]> git.lizzy.rs Git - rust.git/commitdiff
Update all tests
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>
Wed, 25 May 2022 16:15:37 +0000 (16:15 +0000)
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>
Wed, 25 May 2022 18:26:33 +0000 (18:26 +0000)
tests/compile-fail/intrinsics/copy_unaligned.rs
tests/compile-fail/stacked_borrows/static_memory_modification.rs
tests/compile-fail/unaligned_pointers/dyn_alignment.rs
tests/compile-fail/unaligned_pointers/intptrcast_alignment_check.rs
tests/compile-fail/unaligned_pointers/reference_to_packed.rs
tests/compile-fail/unaligned_pointers/unaligned_ptr1.rs
tests/compile-fail/unaligned_pointers/unaligned_ptr2.rs
tests/compile-fail/unaligned_pointers/unaligned_ptr_addr_of.rs
tests/compile-fail/unaligned_pointers/unaligned_ptr_zst.rs
tests/compile-fail/validity/dangling_ref1.rs
tests/compile-fail/validity/invalid_char.rs

index 7aff0adc407a2eab7becac7890a8274d17db7639..84f4de93461e7aec452e0edb7f07e2be7313b3c4 100644 (file)
@@ -9,5 +9,5 @@ fn main() {
     let mut data = [0u16; 8];
     let ptr = (&mut data[0] as *mut u16 as *mut u8).wrapping_add(1) as *mut u16;
     // Even copying 0 elements to something unaligned should error
-    unsafe { copy_nonoverlapping(&data[5], ptr, 0); } //~ ERROR accessing memory with alignment ALIGN, but alignment ALIGN is required
+    unsafe { copy_nonoverlapping(&data[5], ptr, 0); } //~ ERROR accessing memory with alignment 1, but alignment 2 is required
 }
index 72e2ed9381240964e6a4c53af39da8abf7141f37..417a03bb0335b55e1eceb9ce3a56ed5b7ded8c52 100644 (file)
@@ -3,6 +3,6 @@
 #[allow(mutable_transmutes)]
 fn main() {
     let _x = unsafe {
-        std::mem::transmute::<&usize, &mut usize>(&X) //~ ERROR writing to ALLOC which is read-only
+        std::mem::transmute::<&usize, &mut usize>(&X) //~ ERROR writing to alloc1 which is read-only
     };
 }
index 9d8829fe1ee0c7276482c8b817add50b9e821228..91d9ec475b1fefca737d72f41752131490f305cb 100644 (file)
@@ -16,6 +16,6 @@ fn main() {
         // Overwrite the data part of `ptr` so it points to `buf`.
         unsafe { (&mut ptr as *mut _ as *mut *const u8).write(&buf as *const _ as *const u8); }
         // Re-borrow that. This should be UB.
-        let _ptr = &*ptr; //~ERROR alignment ALIGN is required
+        let _ptr = &*ptr; //~ERROR alignment 256 is required
     }
 }
index a8d0b5afbb89d3c71a89aa06856645d07da82ee3..9872a493c02a9b6c68c0f1a19fe63e9de576514f 100644 (file)
@@ -12,6 +12,6 @@ fn main() {
     // Manually make sure the pointer is properly aligned.
     let base_addr_aligned = if base_addr % 2 == 0 { base_addr } else { base_addr+1 };
     let u16_ptr = base_addr_aligned as *mut u16;
-    unsafe { *u16_ptr = 2; } //~ERROR memory with alignment ALIGN, but alignment ALIGN is required
+    unsafe { *u16_ptr = 2; } //~ERROR memory with alignment 1, but alignment 2 is required
     println!("{:?}", x);
 }
index 60d2524040a26f1e1a684b0c615792033a3ac810..b376859d22c11ec97f918b1085ae378973c8517d 100644 (file)
@@ -16,6 +16,6 @@ fn main() {
             y: 99,
         };
         let p = &foo.x;
-        let i = *p; //~ERROR alignment ALIGN is required
+        let i = *p; //~ERROR alignment 4 is required
     }
 }
index fe46e7b8addb392356e9b241634315c42903c21d..1d72e5170b7c2d99f770f88f206dfc7af2fbaff9 100644 (file)
@@ -6,6 +6,6 @@ fn main() {
         let x = [2u16, 3, 4]; // Make it big enough so we don't get an out-of-bounds error.
         let x = &x[0] as *const _ as *const u32;
         // This must fail because alignment is violated: the allocation's base is not sufficiently aligned.
-        let _x = unsafe { *x }; //~ERROR memory with alignment ALIGN, but alignment ALIGN is required
+        let _x = unsafe { *x }; //~ERROR memory with alignment 2, but alignment 4 is required
     }
 }
index 1d1e7fad05c94c6a8aa4002fdd93223d3ad172ff..49612e2b8a0964087d7a6f3e1233218fd362fdce 100644 (file)
@@ -8,5 +8,5 @@ fn main() {
     let x = (x.as_ptr() as *const u8).wrapping_offset(3) as *const u32;
     // This must fail because alignment is violated: the offset is not sufficiently aligned.
     // Also make the offset not a power of 2, that used to ICE.
-    let _x = unsafe { *x }; //~ERROR memory with alignment ALIGN, but alignment ALIGN is required
+    let _x = unsafe { *x }; //~ERROR memory with alignment 1, but alignment 4 is required
 }
index d97306b3cb8157eda23e07b16eca52055a475ba1..e33f3c8598f332b1f0f3eb046c02dafeb897b34b 100644 (file)
@@ -8,6 +8,6 @@ fn main() {
         let x = &x[0] as *const _ as *const u32;
         // This must fail because alignment is violated: the allocation's base is not sufficiently aligned.
         // The deref is UB even if we just put the result into a raw pointer.
-        let _x = unsafe { ptr::addr_of!(*x) }; //~ ERROR memory with alignment ALIGN, but alignment ALIGN is required
+        let _x = unsafe { ptr::addr_of!(*x) }; //~ ERROR memory with alignment 2, but alignment 4 is required
     }
 }
index c549688c262e957c5d4a9c00cc7f74b008918b97..27403c11abc7466281a4780642f74e9cbcc6fc4d 100644 (file)
@@ -7,6 +7,6 @@ fn main() {
         let x = i as u8;
         let x = &x as *const _ as *const [u32; 0];
         // This must fail because alignment is violated. Test specifically for loading ZST.
-        let _x = unsafe { *x }; //~ERROR alignment ALIGN is required
+        let _x = unsafe { *x }; //~ERROR alignment 4 is required
     }
 }
index 3243eee06eb671ae65f748c6f4fc148f58164ca0..78425cde4a8aae51fa8b29220193ddc9ae905d4f 100644 (file)
@@ -3,5 +3,5 @@
 use std::mem;
 
 fn main() {
-    let _x: &i32 = unsafe { mem::transmute(16usize) }; //~ ERROR encountered a dangling reference (address $HEX is unallocated)
+    let _x: &i32 = unsafe { mem::transmute(16usize) }; //~ ERROR encountered a dangling reference (address 0x10 is unallocated)
 }
index d9a55f241c00b70ca12d7d8c11bb522bf44467d7..079823f894a86cc9ef7187720a12c4cc133a6dc3 100644 (file)
@@ -1,6 +1,6 @@
 fn main() {
     assert!(std::char::from_u32(-1_i32 as u32).is_none());
-    let _val = match unsafe { std::mem::transmute::<i32, char>(-1) } { //~ ERROR encountered $HEX, but expected a valid unicode scalar value
+    let _val = match unsafe { std::mem::transmute::<i32, char>(-1) } { //~ ERROR encountered 0xffffffff, but expected a valid unicode scalar value
         'a' => {true},
         'b' => {false},
         _ => {true},