Move TyCtxt::mk_x
to Ty::new_x
where applicable
This commit is contained in:
parent
b5b1c0eddc
commit
40de0c2765
@ -665,7 +665,8 @@ pub(crate) fn codegen_drop<'tcx>(
|
||||
|
||||
let arg_value = drop_place.place_ref(
|
||||
fx,
|
||||
fx.layout_of(fx.tcx.mk_ref(
|
||||
fx.layout_of(Ty::new_ref(
|
||||
fx.tcx,
|
||||
fx.tcx.lifetimes.re_erased,
|
||||
TypeAndMut { ty, mutbl: crate::rustc_hir::Mutability::Mut },
|
||||
)),
|
||||
|
@ -746,7 +746,7 @@ fn is_fat_ptr<'tcx>(fx: &FunctionCx<'_, '_, 'tcx>, ty: Ty<'tcx>) -> bool {
|
||||
}
|
||||
Rvalue::ShallowInitBox(ref operand, content_ty) => {
|
||||
let content_ty = fx.monomorphize(content_ty);
|
||||
let box_layout = fx.layout_of(fx.tcx.mk_box(content_ty));
|
||||
let box_layout = fx.layout_of(Ty::new_box(fx.tcx, content_ty));
|
||||
let operand = codegen_operand(fx, operand);
|
||||
let operand = operand.load_scalar(fx);
|
||||
lval.write_cvalue(fx, CValue::by_val(operand, box_layout));
|
||||
@ -887,7 +887,7 @@ pub(crate) fn codegen_place<'tcx>(
|
||||
let ptr = cplace.to_ptr();
|
||||
cplace = CPlace::for_ptr(
|
||||
ptr.offset_i64(fx, elem_layout.size.bytes() as i64 * (from as i64)),
|
||||
fx.layout_of(fx.tcx.mk_array(*elem_ty, to - from)),
|
||||
fx.layout_of(Ty::new_array(fx.tcx, *elem_ty, to - from)),
|
||||
);
|
||||
}
|
||||
ty::Slice(elem_ty) => {
|
||||
|
@ -92,7 +92,7 @@ pub(crate) fn maybe_codegen_checked<'tcx>(
|
||||
match bin_op {
|
||||
BinOp::BitAnd | BinOp::BitOr | BinOp::BitXor => unreachable!(),
|
||||
BinOp::Mul if is_signed => {
|
||||
let out_ty = fx.tcx.mk_tup(&[lhs.layout().ty, fx.tcx.types.bool]);
|
||||
let out_ty = Ty::new_tup(fx.tcx, &[lhs.layout().ty, fx.tcx.types.bool]);
|
||||
let oflow = CPlace::new_stack_slot(fx, fx.layout_of(fx.tcx.types.i32));
|
||||
let lhs = lhs.load_scalar(fx);
|
||||
let rhs = rhs.load_scalar(fx);
|
||||
@ -112,7 +112,7 @@ pub(crate) fn maybe_codegen_checked<'tcx>(
|
||||
Some(CValue::by_val_pair(res, oflow, fx.layout_of(out_ty)))
|
||||
}
|
||||
BinOp::Add | BinOp::Sub | BinOp::Mul => {
|
||||
let out_ty = fx.tcx.mk_tup(&[lhs.layout().ty, fx.tcx.types.bool]);
|
||||
let out_ty = Ty::new_tup(fx.tcx, &[lhs.layout().ty, fx.tcx.types.bool]);
|
||||
let out_place = CPlace::new_stack_slot(fx, fx.layout_of(out_ty));
|
||||
let param_types = vec![
|
||||
AbiParam::special(fx.pointer_type, ArgumentPurpose::StructReturn),
|
||||
|
@ -99,7 +99,7 @@ fn clif_pair_type_from_ty<'tcx>(
|
||||
|
||||
/// Is a pointer to this type a fat ptr?
|
||||
pub(crate) fn has_ptr_meta<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> bool {
|
||||
let ptr_ty = tcx.mk_ptr(TypeAndMut { ty, mutbl: rustc_hir::Mutability::Not });
|
||||
let ptr_ty = Ty::new_ptr(tcx, TypeAndMut { ty, mutbl: rustc_hir::Mutability::Not });
|
||||
match &tcx.layout_of(ParamEnv::reveal_all().and(ptr_ty)).unwrap().abi {
|
||||
Abi::Scalar(_) => false,
|
||||
Abi::ScalarPair(_, _) => true,
|
||||
|
@ -386,7 +386,7 @@ fn llvm_add_sub<'tcx>(
|
||||
// carry0 | carry1 -> carry or borrow respectively
|
||||
let cb_out = fx.bcx.ins().bor(cb0, cb1);
|
||||
|
||||
let layout = fx.layout_of(fx.tcx.mk_tup(&[fx.tcx.types.u8, fx.tcx.types.u64]));
|
||||
let layout = fx.layout_of(Ty::new_tup(fx.tcx, &[fx.tcx.types.u8, fx.tcx.types.u64]));
|
||||
let val = CValue::by_val_pair(cb_out, c, layout);
|
||||
ret.write_cvalue(fx, val);
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ pub(crate) fn codegen_checked_int_binop<'tcx>(
|
||||
_ => bug!("binop {:?} on checked int/uint lhs: {:?} rhs: {:?}", bin_op, in_lhs, in_rhs),
|
||||
};
|
||||
|
||||
let out_layout = fx.layout_of(fx.tcx.mk_tup(&[in_lhs.layout().ty, fx.tcx.types.bool]));
|
||||
let out_layout = fx.layout_of(Ty::new_tup(fx.tcx, &[in_lhs.layout().ty, fx.tcx.types.bool]));
|
||||
CValue::by_val_pair(res, has_overflow, out_layout)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user