Skip to content

Commit 1118d94

Browse files
committed
Auto merge of #2335 - RalfJung:rustup, r=RalfJung
rustup
2 parents 35399c6 + f3f4baf commit 1118d94

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+69
-64
lines changed

rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4045ce641a9eede71cc12031a2cd71692b273890
1+
41ad4d9b2dbb895666337d162eda52619a6056db

src/machine.rs

+5
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,11 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> {
541541
ecx.machine.enforce_abi
542542
}
543543

544+
#[inline(always)]
545+
fn check_binop_checks_overflow(ecx: &MiriEvalContext<'mir, 'tcx>) -> bool {
546+
ecx.tcx.sess.overflow_checks()
547+
}
548+
544549
#[inline(always)]
545550
fn find_mir_or_eval_fn(
546551
ecx: &mut MiriEvalContext<'mir, 'tcx>,

tests/fail/backtrace/bad-backtrace-ptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ extern "Rust" {
44

55
fn main() {
66
unsafe {
7-
miri_resolve_frame(std::ptr::null_mut(), 0); //~ ERROR null pointer is not a valid pointer for this operation
7+
miri_resolve_frame(std::ptr::null_mut(), 0); //~ ERROR null pointer is a dangling pointer
88
}
99
}

tests/fail/backtrace/bad-backtrace-ptr.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: null pointer is not a valid pointer for this operation
1+
error: Undefined Behavior: out-of-bounds pointer use: null pointer is a dangling pointer (it has no provenance)
22
--> $DIR/bad-backtrace-ptr.rs:LL:CC
33
|
44
LL | miri_resolve_frame(std::ptr::null_mut(), 0);
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ null pointer is not a valid pointer for this operation
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer use: null pointer is a dangling pointer (it has no provenance)
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

tests/fail/dangling_pointers/deref-invalid-ptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33

44
fn main() {
55
let x = 16usize as *const u32;
6-
let _y = unsafe { &*x as *const u32 }; //~ ERROR is not a valid pointer
6+
let _y = unsafe { &*x as *const u32 }; //~ ERROR is a dangling pointer
77
}

tests/fail/dangling_pointers/deref-invalid-ptr.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: dereferencing pointer failed: 0x10 is not a valid pointer
1+
error: Undefined Behavior: dereferencing pointer failed: 0x10[noalloc] is a dangling pointer (it has no provenance)
22
--> $DIR/deref-invalid-ptr.rs:LL:CC
33
|
44
LL | let _y = unsafe { &*x as *const u32 };
5-
| ^^^ dereferencing pointer failed: 0x10 is not a valid pointer
5+
| ^^^ dereferencing pointer failed: 0x10[noalloc] is a dangling pointer (it has no provenance)
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#[allow(deref_nullptr)]
22
fn main() {
3-
let x: i32 = unsafe { *std::ptr::null() }; //~ ERROR null pointer is not a valid pointer
3+
let x: i32 = unsafe { *std::ptr::null() }; //~ ERROR null pointer is a dangling pointer
44
panic!("this should never print: {}", x);
55
}

tests/fail/dangling_pointers/null_pointer_deref.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: dereferencing pointer failed: null pointer is not a valid pointer
1+
error: Undefined Behavior: dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance)
22
--> $DIR/null_pointer_deref.rs:LL:CC
33
|
44
LL | let x: i32 = unsafe { *std::ptr::null() };
5-
| ^^^^^^^^^^^^^^^^^ dereferencing pointer failed: null pointer is not a valid pointer
5+
| ^^^^^^^^^^^^^^^^^ dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance)
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

tests/fail/dangling_pointers/null_pointer_deref_zst.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

44
#[allow(deref_nullptr)]
55
fn main() {
6-
let x: () = unsafe { *std::ptr::null() }; //~ ERROR dereferencing pointer failed: null pointer is not a valid pointer
6+
let x: () = unsafe { *std::ptr::null() }; //~ ERROR dereferencing pointer failed: null pointer is a dangling pointer
77
panic!("this should never print: {:?}", x);
88
}

tests/fail/dangling_pointers/null_pointer_deref_zst.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: dereferencing pointer failed: null pointer is not a valid pointer
1+
error: Undefined Behavior: dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance)
22
--> $DIR/null_pointer_deref_zst.rs:LL:CC
33
|
44
LL | let x: () = unsafe { *std::ptr::null() };
5-
| ^^^^^^^^^^^^^^^^^ dereferencing pointer failed: null pointer is not a valid pointer
5+
| ^^^^^^^^^^^^^^^^^ dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance)
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#[allow(deref_nullptr)]
22
fn main() {
3-
unsafe { *std::ptr::null_mut() = 0i32 }; //~ ERROR null pointer is not a valid pointer
3+
unsafe { *std::ptr::null_mut() = 0i32 }; //~ ERROR null pointer is a dangling pointer
44
}

tests/fail/dangling_pointers/null_pointer_write.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: dereferencing pointer failed: null pointer is not a valid pointer
1+
error: Undefined Behavior: dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance)
22
--> $DIR/null_pointer_write.rs:LL:CC
33
|
44
LL | unsafe { *std::ptr::null_mut() = 0i32 };
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereferencing pointer failed: null pointer is not a valid pointer
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance)
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

tests/fail/dangling_pointers/null_pointer_write_zst.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Some optimizations remove ZST accesses, thus masking this UB.
22
// compile-flags: -Zmir-opt-level=0
3-
// error-pattern: memory access failed: null pointer is not a valid pointer
3+
// error-pattern: memory access failed: null pointer is a dangling pointer
44

55
#[allow(deref_nullptr)]
66
fn main() {

tests/fail/dangling_pointers/null_pointer_write_zst.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: memory access failed: null pointer is not a valid pointer
1+
error: Undefined Behavior: memory access failed: null pointer is a dangling pointer (it has no provenance)
22
--> RUSTLIB/core/src/ptr/mod.rs:LL:CC
33
|
44
LL | copy_nonoverlapping(&src as *const T, dst, 1);
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: null pointer is not a valid pointer
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: null pointer is a dangling pointer (it has no provenance)
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

tests/fail/dangling_pointers/storage_dead_dangling.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fn fill(v: &mut i32) {
1010
}
1111

1212
fn evil() {
13-
unsafe { &mut *(LEAK as *mut i32) }; //~ ERROR is not a valid pointer
13+
unsafe { &mut *(LEAK as *mut i32) }; //~ ERROR is a dangling pointer
1414
}
1515

1616
fn main() {

tests/fail/dangling_pointers/storage_dead_dangling.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: dereferencing pointer failed: $HEX is not a valid pointer
1+
error: Undefined Behavior: dereferencing pointer failed: $HEX[noalloc] is a dangling pointer (it has no provenance)
22
--> $DIR/storage_dead_dangling.rs:LL:CC
33
|
44
LL | unsafe { &mut *(LEAK as *mut i32) };
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^ dereferencing pointer failed: $HEX is not a valid pointer
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^ dereferencing pointer failed: $HEX[noalloc] is a dangling pointer (it has no provenance)
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

tests/fail/dangling_pointers/wild_pointer_deref.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
fn main() {
44
let p = 44 as *const i32;
5-
let x = unsafe { *p }; //~ ERROR is not a valid pointer
5+
let x = unsafe { *p }; //~ ERROR is a dangling pointer
66
panic!("this should never print: {}", x);
77
}

tests/fail/dangling_pointers/wild_pointer_deref.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: dereferencing pointer failed: 0x2c is not a valid pointer
1+
error: Undefined Behavior: dereferencing pointer failed: 0x2c[noalloc] is a dangling pointer (it has no provenance)
22
--> $DIR/wild_pointer_deref.rs:LL:CC
33
|
44
LL | let x = unsafe { *p };
5-
| ^^ dereferencing pointer failed: 0x2c is not a valid pointer
5+
| ^^ dereferencing pointer failed: 0x2c[noalloc] is a dangling pointer (it has no provenance)
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

tests/fail/function_pointers/cast_int_to_fn_ptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
fn main() {
55
let g = unsafe { std::mem::transmute::<usize, fn(i32)>(42) };
66

7-
g(42) //~ ERROR not a valid pointer
7+
g(42) //~ ERROR is a dangling pointer
88
}

tests/fail/function_pointers/cast_int_to_fn_ptr.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: 0x2a is not a valid pointer
1+
error: Undefined Behavior: out-of-bounds pointer use: 0x2a[noalloc] is a dangling pointer (it has no provenance)
22
--> $DIR/cast_int_to_fn_ptr.rs:LL:CC
33
|
44
LL | g(42)
5-
| ^^^^^ 0x2a is not a valid pointer
5+
| ^^^^^ out-of-bounds pointer use: 0x2a[noalloc] is a dangling pointer (it has no provenance)
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

tests/fail/intrinsics/copy_null.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ fn main() {
1010
let ptr = &mut data[0] as *mut u16;
1111
// Even copying 0 elements from NULL should error.
1212
unsafe {
13-
copy_nonoverlapping(std::ptr::null(), ptr, 0); //~ ERROR: memory access failed: null pointer is not a valid pointer
13+
copy_nonoverlapping(std::ptr::null(), ptr, 0); //~ ERROR: memory access failed: null pointer is a dangling pointer
1414
}
1515
}

tests/fail/intrinsics/copy_null.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: memory access failed: null pointer is not a valid pointer
1+
error: Undefined Behavior: memory access failed: null pointer is a dangling pointer (it has no provenance)
22
--> $DIR/copy_null.rs:LL:CC
33
|
44
LL | copy_nonoverlapping(std::ptr::null(), ptr, 0);
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: null pointer is not a valid pointer
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: null pointer is a dangling pointer (it has no provenance)
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

tests/fail/intrinsics/out_of_bounds_ptr_1.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: pointer arithmetic failed: ALLOC has size 4, so pointer to 5 bytes starting at offset 0 is out-of-bounds
1+
error: Undefined Behavior: out-of-bounds pointer arithmetic: ALLOC has size 4, so pointer to 5 bytes starting at offset 0 is out-of-bounds
22
--> RUSTLIB/core/src/ptr/const_ptr.rs:LL:CC
33
|
44
LL | unsafe { intrinsics::offset(self, count) }
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pointer arithmetic failed: ALLOC has size 4, so pointer to 5 bytes starting at offset 0 is out-of-bounds
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: ALLOC has size 4, so pointer to 5 bytes starting at offset 0 is out-of-bounds
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

tests/fail/intrinsics/out_of_bounds_ptr_3.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: pointer arithmetic failed: ALLOC has size 4, so pointer to 1 byte starting at offset -1 is out-of-bounds
1+
error: Undefined Behavior: out-of-bounds pointer arithmetic: ALLOC has size 4, so pointer to 1 byte starting at offset -1 is out-of-bounds
22
--> RUSTLIB/core/src/ptr/const_ptr.rs:LL:CC
33
|
44
LL | unsafe { intrinsics::offset(self, count) }
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pointer arithmetic failed: ALLOC has size 4, so pointer to 1 byte starting at offset -1 is out-of-bounds
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: ALLOC has size 4, so pointer to 1 byte starting at offset -1 is out-of-bounds
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

tests/fail/intrinsics/ptr_offset_0_plus_0.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// error-pattern: pointer arithmetic failed: null pointer is not a valid pointer
1+
// error-pattern: null pointer is a dangling pointer
22
// compile-flags: -Zmiri-permissive-provenance
33

44
fn main() {

tests/fail/intrinsics/ptr_offset_0_plus_0.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: pointer arithmetic failed: null pointer is not a valid pointer
1+
error: Undefined Behavior: out-of-bounds pointer arithmetic: null pointer is a dangling pointer (it has no provenance)
22
--> RUSTLIB/core/src/ptr/mut_ptr.rs:LL:CC
33
|
44
LL | unsafe { intrinsics::offset(self, count) as *mut T }
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pointer arithmetic failed: null pointer is not a valid pointer
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: null pointer is a dangling pointer (it has no provenance)
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

tests/fail/intrinsics/ptr_offset_int_plus_int.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// error-pattern: is not a valid pointer
1+
// error-pattern: is a dangling pointer
22
// compile-flags: -Zmiri-permissive-provenance
33

44
fn main() {

tests/fail/intrinsics/ptr_offset_int_plus_int.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: pointer arithmetic failed: 0x1 is not a valid pointer
1+
error: Undefined Behavior: out-of-bounds pointer arithmetic: 0x1[noalloc] is a dangling pointer (it has no provenance)
22
--> RUSTLIB/core/src/ptr/mut_ptr.rs:LL:CC
33
|
44
LL | unsafe { intrinsics::offset(self, count) as *mut T }
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pointer arithmetic failed: 0x1 is not a valid pointer
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: 0x1[noalloc] is a dangling pointer (it has no provenance)
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

tests/fail/intrinsics/ptr_offset_int_plus_ptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// error-pattern: is not a valid pointer
1+
// error-pattern: is a dangling pointer
22
// compile-flags: -Zmiri-permissive-provenance
33

44
fn main() {

tests/fail/intrinsics/ptr_offset_int_plus_ptr.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: pointer arithmetic failed: 0x1 is not a valid pointer
1+
error: Undefined Behavior: out-of-bounds pointer arithmetic: 0x1[noalloc] is a dangling pointer (it has no provenance)
22
--> RUSTLIB/core/src/ptr/mut_ptr.rs:LL:CC
33
|
44
LL | unsafe { intrinsics::offset(self, count) as *mut T }
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pointer arithmetic failed: 0x1 is not a valid pointer
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: 0x1[noalloc] is a dangling pointer (it has no provenance)
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

tests/fail/intrinsics/ptr_offset_ptr_plus_0.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: pointer arithmetic failed: ALLOC has size 4, so pointer at offset 32 is out-of-bounds
1+
error: Undefined Behavior: out-of-bounds pointer arithmetic: ALLOC has size 4, so pointer at offset 32 is out-of-bounds
22
--> RUSTLIB/core/src/ptr/mut_ptr.rs:LL:CC
33
|
44
LL | unsafe { intrinsics::offset(self, count) as *mut T }
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pointer arithmetic failed: ALLOC has size 4, so pointer at offset 32 is out-of-bounds
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: ALLOC has size 4, so pointer at offset 32 is out-of-bounds
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

tests/fail/intrinsics/write_bytes_null.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ extern "rust-intrinsic" {
66
}
77

88
fn main() {
9-
unsafe { write_bytes::<u8>(std::ptr::null_mut(), 0, 0) }; //~ ERROR memory access failed: null pointer is not a valid pointer
9+
unsafe { write_bytes::<u8>(std::ptr::null_mut(), 0, 0) }; //~ ERROR memory access failed: null pointer is a dangling pointer
1010
}

tests/fail/intrinsics/write_bytes_null.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: memory access failed: null pointer is not a valid pointer
1+
error: Undefined Behavior: memory access failed: null pointer is a dangling pointer (it has no provenance)
22
--> $DIR/write_bytes_null.rs:LL:CC
33
|
44
LL | unsafe { write_bytes::<u8>(std::ptr::null_mut(), 0, 0) };
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: null pointer is not a valid pointer
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: null pointer is a dangling pointer (it has no provenance)
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

tests/fail/provenance/provenance_transmute.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: dereferencing pointer failed: $HEX is not a valid pointer
1+
error: Undefined Behavior: dereferencing pointer failed: $HEX[noalloc] is a dangling pointer (it has no provenance)
22
--> $DIR/provenance_transmute.rs:LL:CC
33
|
44
LL | let _val = *left_ptr;
5-
| ^^^^^^^^^ dereferencing pointer failed: $HEX is not a valid pointer
5+
| ^^^^^^^^^ dereferencing pointer failed: $HEX[noalloc] is a dangling pointer (it has no provenance)
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

tests/fail/provenance/ptr_int_unexposed.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: Undefined Behavior: dereferencing pointer failed: $HEX is not a valid pointer
1+
error: Undefined Behavior: dereferencing pointer failed: $HEX[noalloc] is a dangling pointer (it has no provenance)
22
--> $DIR/ptr_int_unexposed.rs:LL:CC
33
|
44
LL | assert_eq!(unsafe { *ptr }, 3);
5-
| ^^^^ dereferencing pointer failed: $HEX is not a valid pointer
5+
| ^^^^ dereferencing pointer failed: $HEX[noalloc] is a dangling pointer (it has no provenance)
66
|
77
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
88
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information

tests/fail/provenance/ptr_invalid.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ fn main() {
55
let x = 42;
66
let xptr = &x as *const i32;
77
let xptr_invalid = std::ptr::invalid::<i32>(xptr.expose_addr());
8-
let _val = unsafe { *xptr_invalid }; //~ ERROR is not a valid pointer
8+
let _val = unsafe { *xptr_invalid }; //~ ERROR is a dangling pointer
99
}

0 commit comments

Comments
 (0)