move has_repr to layout, handle repr(transparent) properly

This commit is contained in:
Erik Desjardins 2023-06-11 13:43:49 -04:00
parent 65d11b5c65
commit 00b3eca0df
6 changed files with 34 additions and 25 deletions

View file

@ -755,6 +755,7 @@ where
largest_niche: None,
align: tcx.data_layout.i8_align,
size: Size::ZERO,
has_repr_align: false,
})
}
@ -1104,15 +1105,6 @@ where
fn is_unit(this: TyAndLayout<'tcx>) -> bool {
matches!(this.ty.kind(), ty::Tuple(list) if list.len() == 0)
}
fn repr_options(this: TyAndLayout<'tcx>) -> ReprOptions {
match *this.ty.kind() {
ty::Adt(def, ..) => def.repr(),
_ => {
bug!("TyAndLayout::repr_options({:?}): not applicable", this)
}
}
}
}
/// Calculates whether a function's ABI can unwind or not.