Show sizes in error output
This commit is contained in:
parent
fef596f6a2
commit
9a204509d2
@ -18,10 +18,12 @@ struct Transparent<T>(T);
|
|||||||
|
|
||||||
struct NoNiche<T>(UnsafeCell<T>);
|
struct NoNiche<T>(UnsafeCell<T>);
|
||||||
|
|
||||||
|
struct Size<const S: usize>;
|
||||||
|
|
||||||
// Overwriting the runtime assertion and making it a compile-time assertion
|
// Overwriting the runtime assertion and making it a compile-time assertion
|
||||||
macro_rules! assert_size {
|
macro_rules! assert_size {
|
||||||
($a:ty, $b:literal) => {{
|
($a:ty, $b:literal) => {{
|
||||||
const _: () = assert!(std::mem::size_of::<$a>() == $b);
|
const _: Size::<$b> = Size::<{std::mem::size_of::<$a>()}>;
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user