Skip to content

Commit 9a20450

Browse files
committed
Show sizes in error output
1 parent fef596f commit 9a20450

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/test/ui/layout/unsafe-cell-hides-niche.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ struct Transparent<T>(T);
1818

1919
struct NoNiche<T>(UnsafeCell<T>);
2020

21+
struct Size<const S: usize>;
22+
2123
// Overwriting the runtime assertion and making it a compile-time assertion
2224
macro_rules! assert_size {
2325
($a:ty, $b:literal) => {{
24-
const _: () = assert!(std::mem::size_of::<$a>() == $b);
26+
const _: Size::<$b> = Size::<{std::mem::size_of::<$a>()}>;
2527
}};
2628
}
2729

0 commit comments

Comments
 (0)