remove explicit deref of AbiAlign for most methods
Much of the compiler calls functions on Align projected from AbiAlign. AbiAlign impls Deref to its inner Align, so we can simplify these away. Also, it will minimize disruption when AbiAlign is removed. For now, preserve usages that might resolve to PartialOrd or PartialEq, as those have odd inference.
This commit is contained in:
parent
c8905eaa66
commit
0c9d0dfe04
40 changed files with 66 additions and 68 deletions
|
|
@ -795,7 +795,7 @@ fn variant_info_for_adt<'tcx>(
|
|||
name,
|
||||
offset: offset.bytes(),
|
||||
size: field_layout.size.bytes(),
|
||||
align: field_layout.align.abi.bytes(),
|
||||
align: field_layout.align.bytes(),
|
||||
type_name: None,
|
||||
}
|
||||
})
|
||||
|
|
@ -804,7 +804,7 @@ fn variant_info_for_adt<'tcx>(
|
|||
VariantInfo {
|
||||
name: n,
|
||||
kind: if layout.is_unsized() { SizeKind::Min } else { SizeKind::Exact },
|
||||
align: layout.align.abi.bytes(),
|
||||
align: layout.align.bytes(),
|
||||
size: if min_size.bytes() == 0 { layout.size.bytes() } else { min_size.bytes() },
|
||||
fields: field_info,
|
||||
}
|
||||
|
|
@ -877,7 +877,7 @@ fn variant_info_for_coroutine<'tcx>(
|
|||
name: *name,
|
||||
offset: offset.bytes(),
|
||||
size: field_layout.size.bytes(),
|
||||
align: field_layout.align.abi.bytes(),
|
||||
align: field_layout.align.bytes(),
|
||||
type_name: None,
|
||||
}
|
||||
})
|
||||
|
|
@ -905,7 +905,7 @@ fn variant_info_for_coroutine<'tcx>(
|
|||
}),
|
||||
offset: offset.bytes(),
|
||||
size: field_layout.size.bytes(),
|
||||
align: field_layout.align.abi.bytes(),
|
||||
align: field_layout.align.bytes(),
|
||||
// Include the type name if there is no field name, or if the name is the
|
||||
// __awaitee placeholder symbol which means a child future being `.await`ed.
|
||||
type_name: (field_name.is_none() || field_name == Some(sym::__awaitee))
|
||||
|
|
@ -946,7 +946,7 @@ fn variant_info_for_coroutine<'tcx>(
|
|||
name: Some(Symbol::intern(&ty::CoroutineArgs::variant_name(variant_idx))),
|
||||
kind: SizeKind::Exact,
|
||||
size: variant_size.bytes(),
|
||||
align: variant_layout.align.abi.bytes(),
|
||||
align: variant_layout.align.bytes(),
|
||||
fields,
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use rustc_middle::ty::layout::{HasTyCtxt, LayoutCx, TyAndLayout};
|
|||
pub(super) fn layout_sanity_check<'tcx>(cx: &LayoutCx<'tcx>, layout: &TyAndLayout<'tcx>) {
|
||||
let tcx = cx.tcx();
|
||||
|
||||
if !layout.size.bytes().is_multiple_of(layout.align.abi.bytes()) {
|
||||
if !layout.size.bytes().is_multiple_of(layout.align.bytes()) {
|
||||
bug!("size is not a multiple of align, in the following layout:\n{layout:#?}");
|
||||
}
|
||||
if layout.size.bytes() >= tcx.data_layout.obj_size_bound() {
|
||||
|
|
@ -300,8 +300,8 @@ pub(super) fn layout_sanity_check<'tcx>(cx: &LayoutCx<'tcx>, layout: &TyAndLayou
|
|||
if variant.align.abi > layout.align.abi {
|
||||
bug!(
|
||||
"Type with alignment {} bytes has variant with alignment {} bytes: {layout:#?}",
|
||||
layout.align.abi.bytes(),
|
||||
variant.align.abi.bytes(),
|
||||
layout.align.bytes(),
|
||||
variant.align.bytes(),
|
||||
)
|
||||
}
|
||||
// Skip empty variants.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue