Auto merge of #113377 - BoxyUwU:move_ty_ctors_to_ty, r=compiler-errors
Move `TyCtxt::mk_x` to `Ty::new_x` where applicable Part of rust-lang/compiler-team#616 turns out there's a lot of places we construct `Ty` this is a ridiculously huge PR :S r? `@oli-obk`
This commit is contained in:
commit
4dd1719b34
165 changed files with 1388 additions and 1187 deletions
|
@ -168,7 +168,7 @@ fn build_pointer_or_reference_di_node<'ll, 'tcx>(
|
|||
// a (fat) pointer. Make sure it is not called for e.g. `Box<T, NonZSTAllocator>`.
|
||||
debug_assert_eq!(
|
||||
cx.size_and_align_of(ptr_type),
|
||||
cx.size_and_align_of(cx.tcx.mk_mut_ptr(pointee_type))
|
||||
cx.size_and_align_of(Ty::new_mut_ptr(cx.tcx, pointee_type))
|
||||
);
|
||||
|
||||
let pointee_type_di_node = type_di_node(cx, pointee_type);
|
||||
|
@ -223,8 +223,11 @@ fn build_pointer_or_reference_di_node<'ll, 'tcx>(
|
|||
// at all and instead emit regular struct debuginfo for it. We just
|
||||
// need to make sure that we don't break existing debuginfo consumers
|
||||
// by doing that (at least not without a warning period).
|
||||
let layout_type =
|
||||
if ptr_type.is_box() { cx.tcx.mk_mut_ptr(pointee_type) } else { ptr_type };
|
||||
let layout_type = if ptr_type.is_box() {
|
||||
Ty::new_mut_ptr(cx.tcx, pointee_type)
|
||||
} else {
|
||||
ptr_type
|
||||
};
|
||||
|
||||
let layout = cx.layout_of(layout_type);
|
||||
let addr_field = layout.field(cx, abi::FAT_PTR_ADDR);
|
||||
|
@ -1298,7 +1301,7 @@ fn build_vtable_type_di_node<'ll, 'tcx>(
|
|||
|
||||
// All function pointers are described as opaque pointers. This could be improved in the future
|
||||
// by describing them as actual function pointers.
|
||||
let void_pointer_ty = tcx.mk_imm_ptr(tcx.types.unit);
|
||||
let void_pointer_ty = Ty::new_imm_ptr(tcx, tcx.types.unit);
|
||||
let void_pointer_type_di_node = type_di_node(cx, void_pointer_ty);
|
||||
let usize_di_node = type_di_node(cx, tcx.types.usize);
|
||||
let (pointer_size, pointer_align) = cx.size_and_align_of(void_pointer_ty);
|
||||
|
|
|
@ -454,7 +454,7 @@ impl<'ll, 'tcx> DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> {
|
|||
ty::Array(ct, _)
|
||||
if (*ct == cx.tcx.types.u8) || cx.layout_of(*ct).is_zst() =>
|
||||
{
|
||||
cx.tcx.mk_imm_ptr(*ct)
|
||||
Ty::new_imm_ptr(cx.tcx, *ct)
|
||||
}
|
||||
_ => t,
|
||||
};
|
||||
|
|
|
@ -82,8 +82,8 @@ pub(crate) fn fat_pointer_kind<'ll, 'tcx>(
|
|||
ty::Foreign(_) => {
|
||||
// Assert that pointers to foreign types really are thin:
|
||||
debug_assert_eq!(
|
||||
cx.size_of(cx.tcx.mk_imm_ptr(pointee_tail_ty)),
|
||||
cx.size_of(cx.tcx.mk_imm_ptr(cx.tcx.types.u8))
|
||||
cx.size_of(Ty::new_imm_ptr(cx.tcx, pointee_tail_ty)),
|
||||
cx.size_of(Ty::new_imm_ptr(cx.tcx, cx.tcx.types.u8))
|
||||
);
|
||||
None
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue