Skip to content

Commit 40de0c2

Browse files
committed
Move TyCtxt::mk_x to Ty::new_x where applicable
1 parent b5b1c0e commit 40de0c2

File tree

6 files changed

+9
-8
lines changed

6 files changed

+9
-8
lines changed

src/abi/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,8 @@ pub(crate) fn codegen_drop<'tcx>(
665665

666666
let arg_value = drop_place.place_ref(
667667
fx,
668-
fx.layout_of(fx.tcx.mk_ref(
668+
fx.layout_of(Ty::new_ref(
669+
fx.tcx,
669670
fx.tcx.lifetimes.re_erased,
670671
TypeAndMut { ty, mutbl: crate::rustc_hir::Mutability::Mut },
671672
)),

src/base.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ fn codegen_stmt<'tcx>(
746746
}
747747
Rvalue::ShallowInitBox(ref operand, content_ty) => {
748748
let content_ty = fx.monomorphize(content_ty);
749-
let box_layout = fx.layout_of(fx.tcx.mk_box(content_ty));
749+
let box_layout = fx.layout_of(Ty::new_box(fx.tcx, content_ty));
750750
let operand = codegen_operand(fx, operand);
751751
let operand = operand.load_scalar(fx);
752752
lval.write_cvalue(fx, CValue::by_val(operand, box_layout));
@@ -887,7 +887,7 @@ pub(crate) fn codegen_place<'tcx>(
887887
let ptr = cplace.to_ptr();
888888
cplace = CPlace::for_ptr(
889889
ptr.offset_i64(fx, elem_layout.size.bytes() as i64 * (from as i64)),
890-
fx.layout_of(fx.tcx.mk_array(*elem_ty, to - from)),
890+
fx.layout_of(Ty::new_array(fx.tcx, *elem_ty, to - from)),
891891
);
892892
}
893893
ty::Slice(elem_ty) => {

src/codegen_i128.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ pub(crate) fn maybe_codegen_checked<'tcx>(
9292
match bin_op {
9393
BinOp::BitAnd | BinOp::BitOr | BinOp::BitXor => unreachable!(),
9494
BinOp::Mul if is_signed => {
95-
let out_ty = fx.tcx.mk_tup(&[lhs.layout().ty, fx.tcx.types.bool]);
95+
let out_ty = Ty::new_tup(fx.tcx, &[lhs.layout().ty, fx.tcx.types.bool]);
9696
let oflow = CPlace::new_stack_slot(fx, fx.layout_of(fx.tcx.types.i32));
9797
let lhs = lhs.load_scalar(fx);
9898
let rhs = rhs.load_scalar(fx);
@@ -112,7 +112,7 @@ pub(crate) fn maybe_codegen_checked<'tcx>(
112112
Some(CValue::by_val_pair(res, oflow, fx.layout_of(out_ty)))
113113
}
114114
BinOp::Add | BinOp::Sub | BinOp::Mul => {
115-
let out_ty = fx.tcx.mk_tup(&[lhs.layout().ty, fx.tcx.types.bool]);
115+
let out_ty = Ty::new_tup(fx.tcx, &[lhs.layout().ty, fx.tcx.types.bool]);
116116
let out_place = CPlace::new_stack_slot(fx, fx.layout_of(out_ty));
117117
let param_types = vec![
118118
AbiParam::special(fx.pointer_type, ArgumentPurpose::StructReturn),

src/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ fn clif_pair_type_from_ty<'tcx>(
9999

100100
/// Is a pointer to this type a fat ptr?
101101
pub(crate) fn has_ptr_meta<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> bool {
102-
let ptr_ty = tcx.mk_ptr(TypeAndMut { ty, mutbl: rustc_hir::Mutability::Not });
102+
let ptr_ty = Ty::new_ptr(tcx, TypeAndMut { ty, mutbl: rustc_hir::Mutability::Not });
103103
match &tcx.layout_of(ParamEnv::reveal_all().and(ptr_ty)).unwrap().abi {
104104
Abi::Scalar(_) => false,
105105
Abi::ScalarPair(_, _) => true,

src/intrinsics/llvm_x86.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ fn llvm_add_sub<'tcx>(
386386
// carry0 | carry1 -> carry or borrow respectively
387387
let cb_out = fx.bcx.ins().bor(cb0, cb1);
388388

389-
let layout = fx.layout_of(fx.tcx.mk_tup(&[fx.tcx.types.u8, fx.tcx.types.u64]));
389+
let layout = fx.layout_of(Ty::new_tup(fx.tcx, &[fx.tcx.types.u8, fx.tcx.types.u64]));
390390
let val = CValue::by_val_pair(cb_out, c, layout);
391391
ret.write_cvalue(fx, val);
392392
}

src/num.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ pub(crate) fn codegen_checked_int_binop<'tcx>(
270270
_ => bug!("binop {:?} on checked int/uint lhs: {:?} rhs: {:?}", bin_op, in_lhs, in_rhs),
271271
};
272272

273-
let out_layout = fx.layout_of(fx.tcx.mk_tup(&[in_lhs.layout().ty, fx.tcx.types.bool]));
273+
let out_layout = fx.layout_of(Ty::new_tup(fx.tcx, &[in_lhs.layout().ty, fx.tcx.types.bool]));
274274
CValue::by_val_pair(res, has_overflow, out_layout)
275275
}
276276

0 commit comments

Comments
 (0)