1
Fork 0

Auto merge of #120080 - cuviper:128-align-packed, r=nikic

Pack u128 in the compiler to mitigate new alignment

This is based on #116672, adding a new `#[repr(packed(8))]` wrapper on `u128` to avoid changing any of the compiler's size assertions. This is needed in two places:

* `SwitchTargets`, otherwise its `SmallVec<[u128; 1]>` gets padded up to 32 bytes.
* `LitKind::Int`, so that entire `enum` can stay 24 bytes.
  * This change definitely has far-reaching effects though, since it's public.
This commit is contained in:
bors 2024-01-22 13:08:19 +00:00
commit 3066253050
43 changed files with 173 additions and 86 deletions

View file

@ -2069,7 +2069,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
let mut ret = Vec::new();
for meta in attr.meta_item_list()? {
match meta.lit()?.kind {
LitKind::Int(a, _) => ret.push(a as usize),
LitKind::Int(a, _) => ret.push(a.get() as usize),
_ => panic!("invalid arg index"),
}
}