about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2022-07-11 10:31:21 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2022-07-11 10:31:21 +0000
commitfef596f6a243d311dc50b50f83f8339e326f1f66 (patch)
treedb16910a8dc90e4a884a00bec08f09e0ed451211
parentaf8536e32ff8840bb41c65a438ccf33568548e02 (diff)
downloadrust-fef596f6a243d311dc50b50f83f8339e326f1f66.tar.gz
rust-fef596f6a243d311dc50b50f83f8339e326f1f66.zip
Rename assertion macro
-rw-r--r--src/test/ui/layout/unsafe-cell-hides-niche.rs54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/test/ui/layout/unsafe-cell-hides-niche.rs b/src/test/ui/layout/unsafe-cell-hides-niche.rs
index f5c1fe1320c..7fb55d8219e 100644
--- a/src/test/ui/layout/unsafe-cell-hides-niche.rs
+++ b/src/test/ui/layout/unsafe-cell-hides-niche.rs
@@ -19,46 +19,46 @@ struct Transparent<T>(T);
 struct NoNiche<T>(UnsafeCell<T>);
 
 // Overwriting the runtime assertion and making it a compile-time assertion
-macro_rules! assert_eq {
+macro_rules! assert_size {
     ($a:ty, $b:literal) => {{
         const _: () = assert!(std::mem::size_of::<$a>() == $b);
     }};
 }
 
 fn main() {
-    assert_eq!(Option<Wrapper<u32>>,     8);
-    assert_eq!(Option<Wrapper<N32>>,     4); // (✓ niche opt)
-    assert_eq!(Option<Transparent<u32>>, 8);
-    assert_eq!(Option<Transparent<N32>>, 4); // (✓ niche opt)
-    assert_eq!(Option<NoNiche<u32>>,     8);
-    assert_eq!(Option<NoNiche<N32>>,     8); // (✗ niche opt)
+    assert_size!(Option<Wrapper<u32>>,     8);
+    assert_size!(Option<Wrapper<N32>>,     4); // (✓ niche opt)
+    assert_size!(Option<Transparent<u32>>, 8);
+    assert_size!(Option<Transparent<N32>>, 4); // (✓ niche opt)
+    assert_size!(Option<NoNiche<u32>>,     8);
+    assert_size!(Option<NoNiche<N32>>,     8); // (✗ niche opt)
 
-    assert_eq!(Option<UnsafeCell<u32>>,  8);
-    assert_eq!(Option<UnsafeCell<N32>>,  8); // (✗ niche opt)
+    assert_size!(Option<UnsafeCell<u32>>,  8);
+    assert_size!(Option<UnsafeCell<N32>>,  8); // (✗ niche opt)
 
-    assert_eq!(       UnsafeCell<&()> , 8);
-    assert_eq!(Option<UnsafeCell<&()>>, 16); // (✗ niche opt)
-    assert_eq!(             Cell<&()> , 8);
-    assert_eq!(Option<      Cell<&()>>, 16); // (✗ niche opt)
-    assert_eq!(          RefCell<&()> , 16);
-    assert_eq!(Option<   RefCell<&()>>, 24); // (✗ niche opt)
-    assert_eq!(           RwLock<&()> , 24);
-    assert_eq!(Option<    RwLock<&()>>, 32); // (✗ niche opt)
-    assert_eq!(            Mutex<&()> , 16);
-    assert_eq!(Option<     Mutex<&()>>, 24); // (✗ niche opt)
+    assert_size!(       UnsafeCell<&()> , 8);
+    assert_size!(Option<UnsafeCell<&()>>, 16); // (✗ niche opt)
+    assert_size!(             Cell<&()> , 8);
+    assert_size!(Option<      Cell<&()>>, 16); // (✗ niche opt)
+    assert_size!(          RefCell<&()> , 16);
+    assert_size!(Option<   RefCell<&()>>, 24); // (✗ niche opt)
+    assert_size!(           RwLock<&()> , 24);
+    assert_size!(Option<    RwLock<&()>>, 32); // (✗ niche opt)
+    assert_size!(            Mutex<&()> , 16);
+    assert_size!(Option<     Mutex<&()>>, 24); // (✗ niche opt)
 
-    assert_eq!(       UnsafeCell<&[i32]> , 16);
-    assert_eq!(Option<UnsafeCell<&[i32]>>, 24); // (✗ niche opt)
-    assert_eq!(       UnsafeCell<(&(), &())> , 16);
-    assert_eq!(Option<UnsafeCell<(&(), &())>>, 24); // (✗ niche opt)
+    assert_size!(       UnsafeCell<&[i32]> , 16);
+    assert_size!(Option<UnsafeCell<&[i32]>>, 24); // (✗ niche opt)
+    assert_size!(       UnsafeCell<(&(), &())> , 16);
+    assert_size!(Option<UnsafeCell<(&(), &())>>, 24); // (✗ niche opt)
 
     trait Trait {}
-    assert_eq!(       UnsafeCell<&dyn Trait> , 16);
-    assert_eq!(Option<UnsafeCell<&dyn Trait>>, 24); // (✗ niche opt)
+    assert_size!(       UnsafeCell<&dyn Trait> , 16);
+    assert_size!(Option<UnsafeCell<&dyn Trait>>, 24); // (✗ niche opt)
 
     #[repr(simd)]
     pub struct Vec4<T>([T; 4]);
 
-    assert_eq!(       UnsafeCell<Vec4<N32>> , 16);
-    assert_eq!(Option<UnsafeCell<Vec4<N32>>>, 32); // (✗ niche opt)
+    assert_size!(       UnsafeCell<Vec4<N32>> , 16);
+    assert_size!(Option<UnsafeCell<Vec4<N32>>>, 32); // (✗ niche opt)
 }