We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 984db78 commit 3f4cf59Copy full SHA for 3f4cf59
src/test/ui/layout/unsafe-cell-hides-niche.rs
@@ -3,7 +3,7 @@
3
// test checks that an `Option<UnsafeCell<NonZeroU32>>` has the same
4
// size in memory as an `Option<UnsafeCell<u32>>` (namely, 8 bytes).
5
6
-// run-pass
+// check-pass
7
8
#![feature(repr_simd)]
9
@@ -19,6 +19,13 @@ struct Transparent<T>(T);
19
20
struct NoNiche<T>(UnsafeCell<T>);
21
22
+// Overwriting the runtime assertion and making it a compile-time assertion
23
+macro_rules! assert_eq {
24
+ ($a:expr, $b:literal) => {{
25
+ const _: () = assert!($a == $b);
26
+ }};
27
+}
28
+
29
fn main() {
30
assert_eq!(size_of::<Option<Wrapper<u32>>>(), 8);
31
assert_eq!(size_of::<Option<Wrapper<N32>>>(), 4); // (✓ niche opt)
0 commit comments