Auto merge of #122972 - beetrees:use-align-type, r=fee1-dead

Use the `Align` type when parsing alignment attributes

Use the `Align` type in `rustc_attr::parse_alignment`, removing the need to call `Align::from_bytes(...).unwrap()` later in the compilation process.
This commit is contained in:
bors 2024-04-01 03:16:45 +00:00
commit defef8658e
12 changed files with 74 additions and 26 deletions

View file

@ -1552,7 +1552,6 @@ impl<'tcx> TyCtxt<'tcx> {
attr::ReprRust => ReprFlags::empty(),
attr::ReprC => ReprFlags::IS_C,
attr::ReprPacked(pack) => {
let pack = Align::from_bytes(pack as u64).unwrap();
min_pack = Some(if let Some(min_pack) = min_pack {
min_pack.min(pack)
} else {
@ -1584,7 +1583,7 @@ impl<'tcx> TyCtxt<'tcx> {
ReprFlags::empty()
}
attr::ReprAlign(align) => {
max_align = max_align.max(Some(Align::from_bytes(align as u64).unwrap()));
max_align = max_align.max(Some(align));
ReprFlags::empty()
}
});