Skip to content

Commit 8134918

Browse files
committed
don't use NOTE in tests
1 parent 069b661 commit 8134918

36 files changed

+37
-73
lines changed

tests/compile-fail-fullmir/reallocate-change-alloc.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ fn main() {
99
unsafe {
1010
let x = Global.alloc(Layout::from_size_align_unchecked(1, 1)).unwrap();
1111
Global.realloc(x, Layout::from_size_align_unchecked(1, 1), 1).unwrap();
12-
let _z = *(x.as_ptr() as *mut u8); //~ ERROR constant evaluation error
13-
//~^ NOTE dangling pointer was dereferenced
12+
let _z = *(x.as_ptr() as *mut u8); //~ ERROR dangling pointer was dereferenced
1413
}
1514
}

tests/compile-fail/alignment.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ fn main() {
55
let x_ptr: *mut u8 = &mut x[0];
66
let y_ptr = x_ptr as *mut u64;
77
unsafe {
8-
*y_ptr = 42; //~ ERROR constant evaluation error
9-
//~^ NOTE tried to access memory with alignment 1, but alignment
8+
*y_ptr = 42; //~ ERROR tried to access memory with alignment 1, but alignment
109
}
1110
panic!("unreachable in miri");
1211
}

tests/compile-fail/assume.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ fn main() {
55
unsafe {
66
std::intrinsics::assume(x < 10);
77
std::intrinsics::assume(x > 1);
8-
std::intrinsics::assume(x > 42); //~ ERROR constant evaluation error
9-
//~^ NOTE `assume` argument was false
8+
std::intrinsics::assume(x > 42); //~ `assume` argument was false
109
}
1110
}

tests/compile-fail/bitop-beyond-alignment.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,10 @@ fn mk_rec() -> Rec {
2828
fn is_u64_aligned(u: &Tag<u64>) -> bool {
2929
let p: usize = unsafe { mem::transmute(u) };
3030
let u64_align = std::mem::align_of::<u64>();
31-
return (p & (u64_align + 1)) == 0; //~ ERROR constant evaluation error
32-
//~^ NOTE a raw memory access tried to access part of a pointer value as raw bytes
31+
return (p & (u64_align + 1)) == 0; //~ ERROR a raw memory access tried to access part of a pointer value as raw bytes
3332
}
3433

3534
pub fn main() {
3635
let x = mk_rec();
37-
assert!(is_u64_aligned(&x.t)); //~ NOTE inside call to `is_u64_aligned
36+
assert!(is_u64_aligned(&x.t));
3837
}

tests/compile-fail/cast_box_int_to_fn_ptr.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@ fn main() {
77
std::mem::transmute::<&usize, &fn(i32)>(&b)
88
};
99

10-
(*g)(42) //~ ERROR constant evaluation error
11-
//~^ NOTE a memory access tried to interpret some bytes as a pointer
10+
(*g)(42) //~ ERROR a memory access tried to interpret some bytes as a pointer
1211
}

tests/compile-fail/cast_int_to_fn_ptr.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@ fn main() {
66
std::mem::transmute::<usize, fn(i32)>(42)
77
};
88

9-
g(42) //~ ERROR constant evaluation error
10-
//~^ NOTE a memory access tried to interpret some bytes as a pointer
9+
g(42) //~ ERROR a memory access tried to interpret some bytes as a pointer
1110
}

tests/compile-fail/dangling_pointer_deref.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ fn main() {
33
let b = Box::new(42);
44
&*b as *const i32
55
};
6-
let x = unsafe { *p }; //~ ERROR constant evaluation error
7-
//~^ NOTE dangling pointer was dereferenced
6+
let x = unsafe { *p }; //~ ERROR dangling pointer was dereferenced
87
panic!("this should never print: {}", x);
98
}

tests/compile-fail/div-by-zero-2.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@
1111
#![allow(const_err)]
1212

1313
fn main() {
14-
let _n = 1 / 0; //~ ERROR constant evaluation error
15-
//~^ NOTE attempt to divide by zero
14+
let _n = 1 / 0; //~ ERROR attempt to divide by zero
1615
}

tests/compile-fail/execute_memory.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ fn main() {
77
let x = box 42;
88
unsafe {
99
let f = std::mem::transmute::<Box<i32>, fn()>(x);
10-
f() //~ ERROR constant evaluation error
11-
//~^ NOTE tried to treat a memory pointer as a function pointer
10+
f() //~ ERROR tried to treat a memory pointer as a function pointer
1211
}
1312
}

tests/compile-fail/fn_ptr_offset.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,5 @@ fn main() {
1010
let y : *mut u8 = unsafe { mem::transmute(x) };
1111
let y = y.wrapping_offset(1);
1212
let x : fn() = unsafe { mem::transmute(y) };
13-
x(); //~ ERROR constant evaluation error
14-
//~^ NOTE tried to use a function pointer after offsetting it
13+
x(); //~ ERROR tried to use a function pointer after offsetting it
1514
}

tests/compile-fail/modifying_constants.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
fn main() {
33
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
44
let y = unsafe { &mut *(x as *const i32 as *mut i32) };
5-
*y = 42; //~ ERROR constant evaluation error
6-
//~^ NOTE tried to modify constant memory
5+
*y = 42; //~ ERROR tried to modify constant memory
76
assert_eq!(*x, 42);
87
}

tests/compile-fail/never_say_never.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
fn main() {
88
let y = &5;
99
let x: ! = unsafe {
10-
*(y as *const _ as *const !) //~ ERROR constant evaluation error
11-
//~^ NOTE entered unreachable code
10+
*(y as *const _ as *const !) //~ ERROR entered unreachable code
1211
};
1312
f(x)
1413
}

tests/compile-fail/never_transmute_void.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@
88
enum Void {}
99

1010
fn f(v: Void) -> ! {
11-
match v {} //~ ERROR constant evaluation error
12-
//~^ NOTE entered unreachable code
11+
match v {} //~ ERROR entered unreachable code
1312
}
1413

1514
fn main() {
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
fn main() {
22
let v: Vec<u8> = vec![1, 2];
3-
let x = unsafe { *v.as_ptr().wrapping_offset(5) }; //~ ERROR constant evaluation error
4-
//~^ NOTE which has size 2
3+
let x = unsafe { *v.as_ptr().wrapping_offset(5) }; //~ ERROR outside bounds of allocation
54
panic!("this should never print: {}", x);
65
}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
fn main() {
22
let v: Vec<u8> = vec![1, 2];
3-
let x = unsafe { *v.as_ptr().wrapping_offset(5) }; //~ ERROR constant evaluation error
4-
//~^ NOTE outside bounds of allocation
3+
let x = unsafe { *v.as_ptr().wrapping_offset(5) }; //~ ERROR outside bounds of allocation
54
panic!("this should never print: {}", x);
65
}

tests/compile-fail/overflowing-lsh-neg.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,5 @@
1212
#![allow(const_err)]
1313

1414
fn main() {
15-
let _n = 2i64 << -1; //~ ERROR constant evaluation error
16-
//~^ NOTE attempt to shift left with overflow
15+
let _n = 2i64 << -1; //~ ERROR attempt to shift left with overflow
1716
}

tests/compile-fail/overflowing-rsh-2.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,5 @@
1212

1313
fn main() {
1414
// Make sure we catch overflows that would be hidden by first casting the RHS to u32
15-
let _n = 1i64 >> (u32::max_value() as i64 + 1); //~ ERROR constant evaluation error
16-
//~^ NOTE attempt to shift right with overflow
15+
let _n = 1i64 >> (u32::max_value() as i64 + 1); //~ ERROR attempt to shift right with overflow
1716
}

tests/compile-fail/overflowing-rsh.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@
1111
#![allow(exceeding_bitshifts)]
1212

1313
fn main() {
14-
let _n = 1i64 >> 64; //~ ERROR constant evaluation error
15-
//~^ NOTE attempt to shift right with overflow
14+
let _n = 1i64 >> 64; //~ ERROR attempt to shift right with overflow
1615
}

tests/compile-fail/overwriting_part_of_relocation_makes_the_rest_undefined.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ fn main() {
66
// "attempted to interpret some raw bytes as a pointer address" instead of
77
// "attempted to read undefined bytes"
88
}
9-
let x = *p; //~ ERROR constant evaluation error
10-
//~^ NOTE attempted to read undefined bytes
9+
let x = *p; //~ ERROR attempted to read undefined bytes
1110
panic!("this should never print: {}", x);
1211
}

tests/compile-fail/pointer_byte_read_2.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@ fn main() {
33
let y = &x;
44
let z = &y as *const &i32 as *const u8;
55
// the deref fails, because we are reading only a part of the pointer
6-
let _ = unsafe { *z }; //~ ERROR constant evaluation error
7-
//~^ NOTE tried to access part of a pointer value as raw bytes
6+
let _ = unsafe { *z }; //~ ERROR tried to access part of a pointer value as raw bytes
87
}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
fn main() {
22
let x: *const u8 = &1;
33
let y: *const u8 = &2;
4-
if x < y { //~ ERROR constant evaluation error
5-
//~^ NOTE attempted to do invalid arithmetic on pointers
4+
if x < y { //~ ERROR attempted to do invalid arithmetic on pointers
65
unreachable!()
76
}
87
}

tests/compile-fail/ptr_int_cast.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ fn main() {
22
let x = &1;
33
// Casting down to u8 and back up to a pointer loses too much precision; this must not work.
44
let x = x as *const i32;
5-
let x = x as u8; //~ ERROR constant evaluation error
6-
//~^ NOTE a raw memory access tried to access part of a pointer value as raw bytes
5+
let x = x as u8; //~ ERROR a raw memory access tried to access part of a pointer value as raw bytes
76
let x = x as *const i32;
87
let _ = unsafe { *x };
98
}

tests/compile-fail/reading_half_a_pointer.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ fn main() {
2424
// starts 1 byte to the right, so using it would actually be wrong!
2525
let d_alias = &mut w.data as *mut _ as *mut *const u8;
2626
unsafe {
27-
let _x = *d_alias; //~ ERROR constant evaluation error
28-
//~^ NOTE tried to access part of a pointer value as raw bytes
27+
let _x = *d_alias; //~ ERROR tried to access part of a pointer value as raw bytes
2928
}
3029
}

tests/compile-fail/reference_to_packed.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,5 @@ fn main() {
1515
y: 99,
1616
};
1717
let p = unsafe { &foo.x };
18-
let i = *p; //~ ERROR constant evaluation error
19-
//~^ NOTE tried to access memory with alignment 1, but alignment 4 is required
18+
let i = *p; //~ ERROR tried to access memory with alignment 1, but alignment 4 is required
2019
}

tests/compile-fail/static_memory_modification.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ static X: usize = 5;
33
#[allow(mutable_transmutes)]
44
fn main() {
55
unsafe {
6-
*std::mem::transmute::<&usize, &mut usize>(&X) = 6; //~ ERROR constant evaluation error
7-
//~^ NOTE tried to modify constant memory
6+
*std::mem::transmute::<&usize, &mut usize>(&X) = 6; //~ ERROR tried to modify constant memory
87
assert_eq!(X, 6);
98
}
109
}

tests/compile-fail/static_memory_modification2.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use std::mem::transmute;
77
fn main() {
88
unsafe {
99
let s = "this is a test";
10-
transmute::<&[u8], &mut [u8]>(s.as_bytes())[4] = 42; //~ ERROR constant evaluation error
11-
//~^ NOTE tried to modify constant memory
10+
transmute::<&[u8], &mut [u8]>(s.as_bytes())[4] = 42; //~ ERROR tried to modify constant memory
1211
}
1312
}

tests/compile-fail/static_memory_modification3.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use std::mem::transmute;
44
fn main() {
55
unsafe {
66
let bs = b"this is a test";
7-
transmute::<&[u8], &mut [u8]>(bs)[4] = 42; //~ ERROR constant evaluation error
8-
//~^ NOTE tried to modify constant memory
7+
transmute::<&[u8], &mut [u8]>(bs)[4] = 42; //~ ERROR tried to modify constant memory
98
}
109
}

tests/compile-fail/transmute-pair-undef.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,5 @@ fn main() {
1616
assert_eq!(byte, 0);
1717
}
1818
let v = unsafe { *z.offset(first_undef) };
19-
if v == 0 {} //~ ERROR constant evaluation error
20-
//~^ NOTE attempted to read undefined bytes
19+
if v == 0 {} //~ ERROR attempted to read undefined bytes
2120
}

tests/compile-fail/transmute_fat.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,5 @@ fn main() {
1010
let bad = unsafe {
1111
std::mem::transmute::<&[u8], [u8; 8]>(&[1u8])
1212
};
13-
let _ = bad[0] + bad[bad.len()-1]; //~ ERROR constant evaluation error
14-
//~^ NOTE a raw memory access tried to access part of a pointer value as raw bytes
13+
let _ = bad[0] + bad[bad.len()-1]; //~ ERROR a raw memory access tried to access part of a pointer value as raw bytes
1514
}

tests/compile-fail/transmute_fat2.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@ fn main() {
77
let bad = unsafe {
88
std::mem::transmute::<u64, &[u8]>(42)
99
};
10-
bad[0]; //~ ERROR constant evaluation error
11-
//~^ NOTE index out of bounds: the len is 0 but the index is 0
10+
bad[0]; //~ ERROR index out of bounds: the len is 0 but the index is 0
1211
}

tests/compile-fail/unaligned_ptr_cast.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@ fn main() {
22
let x = &2u16;
33
let x = x as *const _ as *const u32;
44
// This must fail because alignment is violated
5-
let _x = unsafe { *x }; //~ ERROR constant evaluation error
6-
//~^ NOTE tried to access memory with alignment 2, but alignment 4 is required
5+
let _x = unsafe { *x }; //~ ERROR tried to access memory with alignment 2, but alignment 4 is required
76
}

tests/compile-fail/unaligned_ptr_cast2.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@ fn main() {
33
let x = x as *const _ as *const *const u8;
44
// This must fail because alignment is violated. Test specifically for loading pointers, which have special code
55
// in miri's memory.
6-
let _x = unsafe { *x }; //~ ERROR constant evaluation error
7-
//~^ NOTE tried to access memory with alignment 2, but alignment
6+
let _x = unsafe { *x }; //~ ERROR tried to access memory with alignment 2, but alignment
87
}

tests/compile-fail/unaligned_ptr_cast_zst.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@ fn main() {
22
let x = &2u16;
33
let x = x as *const _ as *const [u32; 0];
44
// This must fail because alignment is violated. Test specifically for loading ZST.
5-
let _x = unsafe { *x }; //~ ERROR constant evaluation error
6-
//~^ NOTE tried to access memory with alignment 2, but alignment 4 is required
5+
let _x = unsafe { *x }; //~ ERROR tried to access memory with alignment 2, but alignment 4 is required
76
}

tests/compile-fail/undefined_byte_read.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
fn main() {
55
let v: Vec<u8> = Vec::with_capacity(10);
66
let undef = unsafe { *v.get_unchecked(5) };
7-
let x = undef + 1; //~ ERROR: error
8-
//~^ NOTE attempted to read undefined bytes
7+
let x = undef + 1; //~ ERROR attempted to read undefined bytes
98
panic!("this should never print: {}", x);
109
}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
fn main() {
22
let p = 44 as *const i32;
3-
let x = unsafe { *p }; //~ ERROR constant evaluation error
4-
//~^ NOTE a memory access tried to interpret some bytes as a pointer
3+
let x = unsafe { *p }; //~ ERROR a memory access tried to interpret some bytes as a pointer
54
panic!("this should never print: {}", x);
65
}

tests/compile-fail/zst.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
fn main() {
22
let x = &() as *const () as *const i32;
3-
let _ = unsafe { *x }; //~ ERROR constant evaluation error
4-
//~^ NOTE tried to access memory with alignment 1, but alignment 4 is required
3+
let _ = unsafe { *x }; //~ ERROR tried to access memory with alignment 1, but alignment 4 is required
54
}

0 commit comments

Comments
 (0)