Rollup merge of #135778 - ferrocene:ja-gh135777, r=workingjubilee

account for `c_enum_min_bits` in `multiple-reprs` UI test

fixes #135777
This commit is contained in:
Matthias Krüger 2025-02-14 16:23:27 +01:00 committed by GitHub
commit 4b13dfd6d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -69,7 +69,7 @@ pub fn main() {
assert_eq!(size_of::<E4>(), 8);
assert_eq!(size_of::<E5>(), align_size(10, align_of::<u32>()));
assert_eq!(size_of::<E6>(), align_size(14, align_of::<u64>()));
assert_eq!(size_of::<E7>(), align_size(6 + size_of::<c_int>(), align_of::<c_int>()));
assert_eq!(size_of::<E7>(), align_size(6 + c_enum_min_size(), align_of::<c_int>()));
assert_eq!(size_of::<p0f_api_query>(), 21);
}
@ -80,3 +80,13 @@ fn align_size(size: usize, align: usize) -> usize {
size
}
}
// this is `TargetOptions.c_enum_min_bits` which is not available as a `cfg` value so we retrieve
// the value at runtime. On most targets this is `sizeof(c_int)` but on `thumb*-none` is 1 byte
fn c_enum_min_size() -> usize {
#[repr(C)]
enum E {
A,
}
size_of::<E>()
}