]> git.lizzy.rs Git - rust.git/commitdiff
make sure we show error messages even when we cannot show span
authorRalf Jung <post@ralfj.de>
Sun, 15 Jul 2018 09:21:56 +0000 (11:21 +0200)
committerRalf Jung <post@ralfj.de>
Sun, 15 Jul 2018 09:40:57 +0000 (11:40 +0200)
48 files changed:
src/lib.rs
tests/compile-fail-fullmir/reallocate-change-alloc.rs
tests/compile-fail/alignment.rs
tests/compile-fail/assume.rs
tests/compile-fail/bitop-beyond-alignment.rs
tests/compile-fail/cast_box_int_to_fn_ptr.rs
tests/compile-fail/cast_fn_ptr.rs
tests/compile-fail/cast_fn_ptr2.rs
tests/compile-fail/cast_int_to_fn_ptr.rs
tests/compile-fail/ctlz_nonzero.rs
tests/compile-fail/cttz_nonzero.rs
tests/compile-fail/dangling_pointer_deref.rs
tests/compile-fail/deref_fn_ptr.rs
tests/compile-fail/div-by-zero-2.rs
tests/compile-fail/execute_memory.rs
tests/compile-fail/fn_ptr_offset.rs
tests/compile-fail/invalid_bool.rs
tests/compile-fail/invalid_enum_discriminant.rs
tests/compile-fail/match_char.rs
tests/compile-fail/modifying_constants.rs
tests/compile-fail/never_say_never.rs
tests/compile-fail/never_transmute_humans.rs
tests/compile-fail/never_transmute_void.rs
tests/compile-fail/null_pointer_deref.rs
tests/compile-fail/out_of_bounds_read.rs
tests/compile-fail/out_of_bounds_read2.rs
tests/compile-fail/overflowing-lsh-neg.rs
tests/compile-fail/overflowing-rsh-2.rs
tests/compile-fail/overflowing-rsh.rs
tests/compile-fail/overwriting_part_of_relocation_makes_the_rest_undefined.rs
tests/compile-fail/pointer_byte_read_1.rs
tests/compile-fail/pointer_byte_read_2.rs
tests/compile-fail/pointers_to_different_allocations_are_unorderable.rs
tests/compile-fail/ptr_bitops.rs
tests/compile-fail/ptr_int_cast.rs
tests/compile-fail/reading_half_a_pointer.rs
tests/compile-fail/reference_to_packed.rs
tests/compile-fail/static_memory_modification.rs
tests/compile-fail/static_memory_modification2.rs
tests/compile-fail/static_memory_modification3.rs
tests/compile-fail/transmute-pair-undef.rs
tests/compile-fail/transmute_fat.rs
tests/compile-fail/transmute_fat2.rs
tests/compile-fail/unaligned_ptr_cast.rs
tests/compile-fail/unaligned_ptr_cast2.rs
tests/compile-fail/unaligned_ptr_cast_zst.rs
tests/compile-fail/wild_pointer_deref.rs
tests/compile-fail/zst.rs

index 75397262b225a1d0d30b1d0b75e8c6f8d83fbae9..520d696405a1b890783a6f4b4907256d2a662d88 100644 (file)
@@ -274,9 +274,11 @@ pub fn eval_main<'a, 'tcx: 'a>(
                     block.terminator().source_info.span
                 };
 
-                let mut err = struct_error(ecx.tcx.tcx.at(span), "constant evaluation error");
+                let e = e.to_string();
+                let msg = format!("constant evaluation error: {}", e);
+                let mut err = struct_error(ecx.tcx.tcx.at(span), msg.as_str());
                 let (frames, span) = ecx.generate_stacktrace(None);
-                err.span_label(span, e.to_string());
+                err.span_label(span, e);
                 for FrameInfo { span, location, .. } in frames {
                     err.span_note(span, &format!("inside call to `{}`", location));
                 }
index 03040cd178da2009010ad0ae5ef816bd7f849fea..a44ccf4c49cd879650243520effc32bd56bae6c9 100644 (file)
@@ -9,7 +9,7 @@ fn main() {
     unsafe {
         let x = Global.alloc(Layout::from_size_align_unchecked(1, 1)).unwrap();
         let _y = Global.realloc(x, Layout::from_size_align_unchecked(1, 1), 1).unwrap();
-        let _z = *(x.as_ptr() as *mut u8); //~ ERROR constant evaluation error [E0080]
+        let _z = *(x.as_ptr() as *mut u8); //~ ERROR constant evaluation error
         //~^ NOTE dangling pointer was dereferenced
     }
 }
index 9730fe473aa5d2194460977d8022ee5dc0883ee2..71161f5d6da0036360ac4d590f6b11f14d7b486b 100644 (file)
@@ -5,7 +5,7 @@ fn main() {
     let x_ptr: *mut u8 = &mut x[0];
     let y_ptr = x_ptr as *mut u64;
     unsafe {
-        *y_ptr = 42; //~ ERROR constant evaluation error [E0080]
+        *y_ptr = 42; //~ ERROR constant evaluation error
         //~^ NOTE tried to access memory with alignment 1, but alignment
     }
     panic!("unreachable in miri");
index cf0632393ad6d803649f2236b7489d6bc152ac25..d9eec480cd0c613a1df6e309619526d4c37f1afc 100644 (file)
@@ -5,7 +5,7 @@ fn main() {
     unsafe {
         std::intrinsics::assume(x < 10);
         std::intrinsics::assume(x > 1);
-        std::intrinsics::assume(x > 42); //~ ERROR constant evaluation error [E0080]
+        std::intrinsics::assume(x > 42); //~ ERROR constant evaluation error
     //~^ NOTE `assume` argument was false
     }
 }
index 89f5e048a36d9fbe098bd769d6194ea71ba47e00..c8cbc9a9184163361d933f05d563aa72ba30566d 100644 (file)
@@ -28,7 +28,7 @@ fn mk_rec() -> Rec {
 fn is_u64_aligned(u: &Tag<u64>) -> bool {
     let p: usize = unsafe { mem::transmute(u) };
     let u64_align = std::mem::align_of::<u64>();
-    return (p & (u64_align + 1)) == 0; //~ ERROR constant evaluation error [E0080]
+    return (p & (u64_align + 1)) == 0; //~ ERROR constant evaluation error
     //~^ NOTE a raw memory access tried to access part of a pointer value as raw bytes
 }
 
index 39b53da0b75cde1d849468a4bbd3b60b4a4c21de..2a317f579f5e035ca229ef28a9b1213979f2cff4 100644 (file)
@@ -7,6 +7,6 @@ fn main() {
         std::mem::transmute::<&usize, &fn(i32)>(&b)
     };
 
-    (*g)(42) //~ ERROR constant evaluation error [E0080]
+    (*g)(42) //~ ERROR constant evaluation error
     //~^ NOTE a memory access tried to interpret some bytes as a pointer
 }
index 19344b13ba7c9300eda6965e4b88a1939a883691..0a8f5ef752a6d48fe1b555a38e1958dd3c0c7c95 100644 (file)
@@ -5,6 +5,6 @@ fn f() {}
         std::mem::transmute::<fn(), fn(i32)>(f)
     };
 
-    g(42) //~ ERROR constant evaluation error [E0080]
+    g(42) //~ ERROR constant evaluation error
     //~^ NOTE tried to call a function with sig fn() through a function pointer of type fn(i32)
 }
index 23868c0e57db419a06c40fa9b67d684892bb2cd5..cb80521c60eeb8cbc88c9d19622382914b38dd3d 100644 (file)
@@ -5,6 +5,6 @@ fn f(_ : (i32,i32)) {}
         std::mem::transmute::<fn((i32,i32)), fn(i32)>(f)
     };
 
-    g(42) //~ ERROR constant evaluation error [E0080]
+    g(42) //~ ERROR constant evaluation error
     //~^ NOTE tried to call a function with sig fn((i32, i32)) through a function pointer of type fn(i32)
 }
index c7556ae06b93e08b563bced30e7fbf979c3e71b6..29d16e9a4259a7e14d0c35ed3d68701ad4477e78 100644 (file)
@@ -6,6 +6,6 @@ fn main() {
         std::mem::transmute::<usize, fn(i32)>(42)
     };
 
-    g(42) //~ ERROR constant evaluation error [E0080]
+    g(42) //~ ERROR constant evaluation error
     //~^ NOTE a memory access tried to interpret some bytes as a pointer
 }
index d952187eba45647de2b67e310660b9f0fa7604b7..167100903f4db81ce3bde422c31cdd363bcc2065 100644 (file)
@@ -10,7 +10,7 @@ pub fn main() {
     unsafe {
         use rusti::*;
 
-        ctlz_nonzero(0u8); //~ ERROR constant evaluation error [E0080]
+        ctlz_nonzero(0u8); //~ ERROR constant evaluation error
         //~^ NOTE ctlz_nonzero called on 0
     }
 }
index b308484622bc4f30ebe3268fcf8c30c6e16a1ef6..7d9ac5a0212d3c119595ccd5ed6729e92b279c0e 100644 (file)
@@ -10,7 +10,7 @@ pub fn main() {
     unsafe {
         use rusti::*;
 
-        cttz_nonzero(0u8); //~ ERROR constant evaluation error [E0080]
+        cttz_nonzero(0u8); //~ ERROR constant evaluation error
         //~^ NOTE cttz_nonzero called on 0
     }
 }
index d42c1d33b530a79b43842796a37bd75e8490ed8c..434f5c780b46f0c00897109f93c6c71391750b0e 100644 (file)
@@ -3,7 +3,7 @@ fn main() {
         let b = Box::new(42);
         &*b as *const i32
     };
-    let x = unsafe { *p }; //~ ERROR constant evaluation error [E0080]
+    let x = unsafe { *p }; //~ ERROR constant evaluation error
     //~^ NOTE dangling pointer was dereferenced
     panic!("this should never print: {}", x);
 }
index a56df5bce408e81cfaa0bde60280f6411a26a066..fb3aea67e821f50f57c6ef31ce88d84745b6bd28 100644 (file)
@@ -2,7 +2,7 @@ fn f() {}
 
 fn main() {
     let x: i32 = unsafe {
-        *std::mem::transmute::<fn(), *const i32>(f) //~ ERROR constant evaluation error [E0080]
+        *std::mem::transmute::<fn(), *const i32>(f) //~ ERROR constant evaluation error
         //~^ NOTE tried to dereference a function pointer
     };
     panic!("this should never print: {}", x);
index c90ca8d15cceab36cf6ceabd7fa5ab581947c8b8..94145c2cf32f37c7b0d5f8084a56bcca7e731719 100644 (file)
@@ -11,6 +11,6 @@
 #![allow(const_err)]
 
 fn main() {
-    let _n = 1 / 0; //~ ERROR constant evaluation error [E0080]
+    let _n = 1 / 0; //~ ERROR constant evaluation error
     //~^ NOTE attempt to divide by zero
 }
index 014c551df0f13d91ff695cac5c984dbeedb8a85d..bcde13d13ee773b49adf26a226e8b5d2f4cc8cf5 100644 (file)
@@ -7,7 +7,7 @@ fn main() {
     let x = box 42;
     unsafe {
         let f = std::mem::transmute::<Box<i32>, fn()>(x);
-        f() //~ ERROR constant evaluation error [E0080]
+        f() //~ ERROR constant evaluation error
         //~^ NOTE tried to treat a memory pointer as a function pointer
     }
 }
index 20eb6573989c004defcd07c6056cf3a440cbe0d5..0c0590e375bbca9129937d094b49f1a0afa474fe 100644 (file)
@@ -10,6 +10,6 @@ fn main() {
     let y : *mut u8 = unsafe { mem::transmute(x) };
     let y = y.wrapping_offset(1);
     let x : fn() = unsafe { mem::transmute(y) };
-    x(); //~ ERROR constant evaluation error [E0080]
+    x(); //~ ERROR constant evaluation error
     //~^ NOTE tried to use a function pointer after offsetting it
 }
index 07c407966a8fdf52a0c47abdffdadb1d0751569c..1aa5d9bf77bcc603cfebfafb187e9b9eb6456408 100644 (file)
@@ -1,5 +1,5 @@
 fn main() {
     let b = unsafe { std::mem::transmute::<u8, bool>(2) };
-    if b { unreachable!() } else { unreachable!() } //~ ERROR constant evaluation error [E0080]
+    if b { unreachable!() } else { unreachable!() } //~ ERROR constant evaluation error
     //~^ NOTE invalid boolean value read
 }
index 69d7e3e427d4b6fae8816778f64b8e3c62721e2c..760b6563d27cc412b22f9f6c1d821a0626be27dd 100644 (file)
@@ -14,5 +14,5 @@ fn main() {
         Foo::C => {},
         Foo::D => {},
     }
-} //~ ERROR constant evaluation error [E0080]
+} //~ ERROR constant evaluation error
 //~^ NOTE entered unreachable code
index 0d45d70eb781ac7564c209fd3564a61642deca33..52f33b58e6fb6fb907afce1cb043abaad7f0e537 100644 (file)
@@ -2,7 +2,7 @@
 
 fn main() {
     assert!(std::char::from_u32(-1_i32 as u32).is_none());
-    match unsafe { std::mem::transmute::<i32, char>(-1) } { //~ ERROR constant evaluation error [E0080]
+    match unsafe { std::mem::transmute::<i32, char>(-1) } { //~ ERROR constant evaluation error
         //~^ NOTE tried to interpret an invalid 32-bit value as a char: 4294967295
         'a' => {},
         'b' => {},
index 06920fa0acf16647786fc4d82a7047a18d5c18e1..c10657ae75a77646902195e7ca5e655a0ed05a1c 100644 (file)
@@ -1,7 +1,7 @@
 fn main() {
     let x = &1; // the `&1` is promoted to a constant, but it used to be that only the pointer is marked static, not the pointee
     let y = unsafe { &mut *(x as *const i32 as *mut i32) };
-    *y = 42;  //~ ERROR constant evaluation error [E0080]
+    *y = 42;  //~ ERROR constant evaluation error
     //~^ NOTE tried to modify constant memory
     assert_eq!(*x, 42);
 }
index de8815ffd9c4ec2f49560e97981db1c4e4095168..fd76ecbd1503e564eef38733dfa7d3e8ec9cefc0 100644 (file)
@@ -7,7 +7,7 @@
 fn main() {
     let y = &5;
     let x: ! = unsafe {
-        *(y as *const _ as *const !)  //~ ERROR constant evaluation error [E0080]
+        *(y as *const _ as *const !)  //~ ERROR constant evaluation error
         //~^ NOTE entered unreachable code
     };
     f(x)
index 3422d52f9c044c480551f110c05e5700ffb9d87f..7652cdfdd3df55993d4c627972cfceb216c546ec 100644 (file)
@@ -9,7 +9,7 @@
 
 fn main() {
     let x: ! = unsafe {
-        std::mem::transmute::<Human, !>(Human) //~ ERROR constant evaluation error [E0080]
+        std::mem::transmute::<Human, !>(Human) //~ ERROR constant evaluation error
         //^~ NOTE entered unreachable code
     };
     f(x)
index 4f1499483eda24b9534e11211b70f45b5e612537..9329cd365994ea92a89f6f07038d3d8be400bfc4 100644 (file)
@@ -8,7 +8,7 @@
 enum Void {}
 
 fn f(v: Void) -> ! {
-    match v {} //~ ERROR constant evaluation error [E0080]
+    match v {} //~ ERROR constant evaluation error
     //~^ NOTE entered unreachable code
 }
 
index 70df937c4c7c5d9abc9090b47454506c16de78e4..f69308296bc2431d4a75197426015a53f1f4ddef 100644 (file)
@@ -1,5 +1,5 @@
 fn main() {
-    let x: i32 = unsafe { *std::ptr::null() }; //~ ERROR constant evaluation error [E0080]
+    let x: i32 = unsafe { *std::ptr::null() }; //~ ERROR constant evaluation error
     //~^ NOTE invalid use of NULL pointer
     panic!("this should never print: {}", x);
 }
index d8811e7abcd2555b8c0c1ea0138315acb30483f3..3ccdb365feebc737b11d81ba660b7f6edd8c1f92 100644 (file)
@@ -1,6 +1,6 @@
 fn main() {
     let v: Vec<u8> = vec![1, 2];
-    let x = unsafe { *v.as_ptr().wrapping_offset(5) }; //~ ERROR constant evaluation error [E0080]
+    let x = unsafe { *v.as_ptr().wrapping_offset(5) }; //~ ERROR constant evaluation error
     //~^ NOTE which has size 2
     panic!("this should never print: {}", x);
 }
index 54738cf81fbd8bd058587c39c1707c535796dd23..811ba7d4b26cfe37c1018605c8b4f9d83aca9323 100644 (file)
@@ -1,6 +1,6 @@
 fn main() {
     let v: Vec<u8> = vec![1, 2];
-    let x = unsafe { *v.as_ptr().wrapping_offset(5) }; //~ ERROR constant evaluation error [E0080]
+    let x = unsafe { *v.as_ptr().wrapping_offset(5) }; //~ ERROR constant evaluation error
     //~^ NOTE memory access at offset 6, outside bounds of allocation
     panic!("this should never print: {}", x);
 }
index e50e4250364995affbb90817bb6af060075bfb2d..825a82226634910216c007766e454901d8ebb3d7 100644 (file)
@@ -12,6 +12,6 @@
 #![allow(const_err)]
 
 fn main() {
-    let _n = 2i64 << -1; //~ ERROR constant evaluation error [E0080]
+    let _n = 2i64 << -1; //~ ERROR constant evaluation error
     //~^ NOTE attempt to shift left with overflow
 }
index 967c8b020cca099781347a769c233d13f45d4585..cf107a76ae29dba95bab4a82c1d28bc4e34dd053 100644 (file)
@@ -12,6 +12,6 @@
 
 fn main() {
     // Make sure we catch overflows that would be hidden by first casting the RHS to u32
-    let _n = 1i64 >> (u32::max_value() as i64 + 1); //~ ERROR constant evaluation error [E0080]
+    let _n = 1i64 >> (u32::max_value() as i64 + 1); //~ ERROR constant evaluation error
     //~^ NOTE attempt to shift right with overflow
 }
index c291815e2e79ab5f7447433711280b7f1987b66c..ea53d7e730925e94d2e77fc1fbcab3a223421edd 100644 (file)
@@ -11,6 +11,6 @@
 #![allow(exceeding_bitshifts)]
 
 fn main() {
-    let _n = 1i64 >> 64; //~ ERROR constant evaluation error [E0080]
+    let _n = 1i64 >> 64; //~ ERROR constant evaluation error
     //~^ NOTE attempt to shift right with overflow
 }
index fabbef5004d771a718b9dfe9fcd7f54b996ccc46..7c38c05746983d07d72a9b715d55684392f9403b 100644 (file)
@@ -6,7 +6,7 @@ fn main() {
         // "attempted to interpret some raw bytes as a pointer address" instead of
         // "attempted to read undefined bytes"
     }
-    let x = *p; //~ ERROR constant evaluation error [E0080]
+    let x = *p; //~ ERROR constant evaluation error
     //~^ NOTE attempted to read undefined bytes
     panic!("this should never print: {}", x);
 }
index 012af897e83703cb30afacb736e330257dd52dbf..b3aaec759ce026d7bcfa7859a4093a9b14374903 100644 (file)
@@ -3,6 +3,6 @@ fn main() {
     let y = &x;
     let z = &y as *const &i32 as *const usize;
     let ptr_bytes = unsafe { *z }; // the actual deref is fine, because we read the entire pointer at once
-    let _ = ptr_bytes % 432; //~ ERROR constant evaluation error [E0080]
+    let _ = ptr_bytes % 432; //~ ERROR constant evaluation error
     //~^ NOTE tried to access part of a pointer value as raw bytes
 }
index 4d25a36a3c883159452bb064053999770f4a013b..c8a1a2e10f5004fa8200f65b0bd544c29b067089 100644 (file)
@@ -3,6 +3,6 @@ fn main() {
     let y = &x;
     let z = &y as *const &i32 as *const u8;
     // the deref fails, because we are reading only a part of the pointer
-    let _ = unsafe { *z }; //~ ERROR constant evaluation error [E0080]
+    let _ = unsafe { *z }; //~ ERROR constant evaluation error
     //~^ NOTE tried to access part of a pointer value as raw bytes
 }
index 72ae1b123e8a266596c4d368c3459d51b401632f..89cf357e201cff0675f1bb49475202040e48b26e 100644 (file)
@@ -1,7 +1,7 @@
 fn main() {
     let x: *const u8 = &1;
     let y: *const u8 = &2;
-    if x < y { //~ ERROR constant evaluation error [E0080]
+    if x < y { //~ ERROR constant evaluation error
     //~^ NOTE attempted to do invalid arithmetic on pointers
         unreachable!()
     }
index 52bcf24cf6b8fa78e954371b3607efcf6730f0eb..ecd47a186efb14eb62dc530fb754a74a913ca509 100644 (file)
@@ -2,7 +2,7 @@ fn main() {
     let bytes = [0i8, 1, 2, 3, 4, 5, 6, 7, 8, 9];
     let one = bytes.as_ptr().wrapping_offset(1);
     let three = bytes.as_ptr().wrapping_offset(3);
-    let res = (one as usize) | (three as usize); //~ ERROR constant evaluation error [E0080]
+    let res = (one as usize) | (three as usize); //~ ERROR constant evaluation error
     //~^ NOTE a raw memory access tried to access part of a pointer value as raw bytes
     println!("{}", res);
 }
index 56403d619ffadf38ae792b811fa5ad9d96231fd9..11243921bfd48e5f8f615192f071a4e8c1984475 100644 (file)
@@ -2,7 +2,7 @@ fn main() {
     let x = &1;
     // Casting down to u8 and back up to a pointer loses too much precision; this must not work.
     let x = x as *const i32;
-    let x = x as u8; //~ ERROR constant evaluation error [E0080]
+    let x = x as u8; //~ ERROR constant evaluation error
     //~^ NOTE a raw memory access tried to access part of a pointer value as raw bytes
     let x = x as *const i32;
     let _ = unsafe { *x };
index e44f26c4c4cfbb1c849dce1c92fbeb1d1a56463f..3ea693a3f0fbbf63dded626048c7635633942b0b 100644 (file)
@@ -24,7 +24,7 @@ fn main() {
     // starts 1 byte to the right, so using it would actually be wrong!
     let d_alias = &mut w.data as *mut _ as *mut *const u8;
     unsafe {
-        let _x = *d_alias; //~ ERROR constant evaluation error [E0080]
+        let _x = *d_alias; //~ ERROR constant evaluation error
         //~^ NOTE tried to access part of a pointer value as raw bytes
     }
 }
index 16b452ca0e3c9c931e13d733d2160e2aeb5f6d08..946a6b89a777a25e213b0b4f7292ba68cfde4137 100644 (file)
@@ -15,6 +15,6 @@ fn main() {
         y: 99,
     };
     let p = unsafe { &foo.x };
-    let i = *p; //~ ERROR constant evaluation error [E0080]
+    let i = *p; //~ ERROR constant evaluation error
     //~^ NOTE tried to access memory with alignment 1, but alignment 4 is required
 }
index a85ff545ee4239e36552db4e5df696acf8b579fd..e28bcb37fb72d3637c52dadeca3b9ac057388f51 100644 (file)
@@ -4,7 +4,7 @@
 #[allow(mutable_transmutes)]
 fn main() {
     unsafe {
-        *std::mem::transmute::<&usize, &mut usize>(&X) = 6; //~ ERROR constant evaluation error [E0080]
+        *std::mem::transmute::<&usize, &mut usize>(&X) = 6; //~ ERROR constant evaluation error
         //~^ NOTE tried to modify constant memory
         assert_eq!(X, 6);
     }
index 6abe6de1fcf41ddc145cf0120b8546a6bad7562b..2f702f09c8047e736ee5cf10dcd97e03be72567d 100644 (file)
@@ -7,7 +7,7 @@
 fn main() {
     unsafe {
         let s = "this is a test";
-        transmute::<&[u8], &mut [u8]>(s.as_bytes())[4] = 42; //~ ERROR constant evaluation error [E0080]
+        transmute::<&[u8], &mut [u8]>(s.as_bytes())[4] = 42; //~ ERROR constant evaluation error
         //~^ NOTE tried to modify constant memory
     }
 }
index 0891756f0ec6141c99ee28e74fa6360af422ca3e..37d8bfe02ceb2bc8be2d954c65063fad0f7eaa38 100644 (file)
@@ -4,7 +4,7 @@
 fn main() {
     unsafe {
         let bs = b"this is a test";
-        transmute::<&[u8], &mut [u8]>(bs)[4] = 42; //~ ERROR constant evaluation error [E0080]
+        transmute::<&[u8], &mut [u8]>(bs)[4] = 42; //~ ERROR constant evaluation error
         //~^ NOTE tried to modify constant memory
     }
 }
index 6b4fe2273a080fd0aed3e78b6b25646736fa66d8..9509bb60e8b112126f7b820684b7c7bbbc6131a1 100644 (file)
@@ -16,6 +16,6 @@ fn main() {
         assert_eq!(byte, 0);
     }
     let v = unsafe { *z.offset(first_undef) };
-    if v == 0 {} //~ ERROR constant evaluation error [E0080]
+    if v == 0 {} //~ ERROR constant evaluation error
     //~^ NOTE attempted to read undefined bytes
 }
index 81d783807c586aa74fc3868a180a9ac8990562bf..dad5f4df2da3cd467454eca295ec6fee2249ef03 100644 (file)
@@ -10,6 +10,6 @@ fn main() {
     let bad = unsafe {
         std::mem::transmute::<&[u8], u64>(&[1u8])
     };
-    let _ = bad + 1; //~ ERROR constant evaluation error [E0080]
+    let _ = bad + 1; //~ ERROR constant evaluation error
     //~^ NOTE a raw memory access tried to access part of a pointer value as raw bytes
 }
index 96a713305e6bd92406b42db993f8d64b49fbb544..e9e21a84294dc5795d8dc6f776b1e6d87ff8e53a 100644 (file)
@@ -7,6 +7,6 @@ fn main() {
     let bad = unsafe {
         std::mem::transmute::<u64, &[u8]>(42)
     };
-    bad[0]; //~ ERROR constant evaluation error [E0080]
+    bad[0]; //~ ERROR constant evaluation error
     //~^ NOTE index out of bounds: the len is 0 but the index is 0
 }
index cb9523395391fcef46a51240ec6cd85f9c44c831..f91def30d120582de6fa0e69b15d05b2e5586690 100644 (file)
@@ -2,6 +2,6 @@ fn main() {
     let x = &2u16;
     let x = x as *const _ as *const u32;
     // This must fail because alignment is violated
-    let _x = unsafe { *x }; //~ ERROR constant evaluation error [E0080]
+    let _x = unsafe { *x }; //~ ERROR constant evaluation error
     //~^ NOTE tried to access memory with alignment 2, but alignment 4 is required
 }
index dee2bbc9972f7f6b486af5936b7468d304b3376e..f87dab76ba30084d5de534a34c22aafb7582e5f7 100644 (file)
@@ -3,6 +3,6 @@ fn main() {
     let x = x as *const _ as *const *const u8;
     // This must fail because alignment is violated.  Test specifically for loading pointers, which have special code
     // in miri's memory.
-    let _x = unsafe { *x }; //~ ERROR constant evaluation error [E0080]
+    let _x = unsafe { *x }; //~ ERROR constant evaluation error
     //~^ NOTE tried to access memory with alignment 2, but alignment
 }
index eba17ab6c6406b0a4728485492b15b2a95f394bf..45016473c97528e060c20806f27c7d327ffb35e0 100644 (file)
@@ -2,6 +2,6 @@ fn main() {
     let x = &2u16;
     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 constant evaluation error [E0080]
+    let _x = unsafe { *x }; //~ ERROR constant evaluation error
     //~^ NOTE tried to access memory with alignment 2, but alignment 4 is required
 }
index 035d979c5b07eeef54fcf1e23de336182a7604cd..4096cfb93e722cb25859cae874dc5d6396c5b7ae 100644 (file)
@@ -1,6 +1,6 @@
 fn main() {
     let p = 44 as *const i32;
-    let x = unsafe { *p }; //~ ERROR constant evaluation error [E0080]
+    let x = unsafe { *p }; //~ ERROR constant evaluation error
     //~^ NOTE a memory access tried to interpret some bytes as a pointer
     panic!("this should never print: {}", x);
 }
index d6518a48aa828c44612b4a52d5b287dbb5d06ab1..efb2dafd36fc58e5f50df098359e0f9edab855d4 100644 (file)
@@ -1,5 +1,5 @@
 fn main() {
     let x = &() as *const () as *const i32;
-    let _ = unsafe { *x }; //~ ERROR constant evaluation error [E0080]
+    let _ = unsafe { *x }; //~ ERROR constant evaluation error
     //~^ NOTE tried to access memory with alignment 1, but alignment 4 is required
 }