diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2025-02-14 16:23:27 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-14 16:23:27 +0100 |
| commit | 4b13dfd6d5752053d31127b922464fae5506ab93 (patch) | |
| tree | fd56f38362040fc301a76c07d707abfc48f42d77 | |
| parent | d88ffcdb8bfc6f8b917574c1693eb9764a20eff5 (diff) | |
| parent | a710e1fb28d1a75eb7cb2261321c51cccf1c0bc8 (diff) | |
Rollup merge of #135778 - ferrocene:ja-gh135777, r=workingjubilee
account for `c_enum_min_bits` in `multiple-reprs` UI test fixes #135777
| -rw-r--r-- | tests/ui/structs-enums/multiple-reprs.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/ui/structs-enums/multiple-reprs.rs b/tests/ui/structs-enums/multiple-reprs.rs index 1528db126ae..ce50b62ce47 100644 --- a/tests/ui/structs-enums/multiple-reprs.rs +++ b/tests/ui/structs-enums/multiple-reprs.rs @@ -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>() +} |
