Skip to content

Commit

Permalink
Auto merge of #2335 - RalfJung:rustup, r=RalfJung
Browse files Browse the repository at this point in the history
rustup
  • Loading branch information
bors committed Jul 5, 2022
2 parents 35399c6 + f3f4baf commit 1118d94
Show file tree
Hide file tree
Showing 42 changed files with 69 additions and 64 deletions.
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4045ce641a9eede71cc12031a2cd71692b273890
41ad4d9b2dbb895666337d162eda52619a6056db
5 changes: 5 additions & 0 deletions src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,11 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> {
ecx.machine.enforce_abi
}

#[inline(always)]
fn check_binop_checks_overflow(ecx: &MiriEvalContext<'mir, 'tcx>) -> bool {
ecx.tcx.sess.overflow_checks()
}

#[inline(always)]
fn find_mir_or_eval_fn(
ecx: &mut MiriEvalContext<'mir, 'tcx>,
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/backtrace/bad-backtrace-ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ extern "Rust" {

fn main() {
unsafe {
miri_resolve_frame(std::ptr::null_mut(), 0); //~ ERROR null pointer is not a valid pointer for this operation
miri_resolve_frame(std::ptr::null_mut(), 0); //~ ERROR null pointer is a dangling pointer
}
}
4 changes: 2 additions & 2 deletions tests/fail/backtrace/bad-backtrace-ptr.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: null pointer is not a valid pointer for this operation
error: Undefined Behavior: out-of-bounds pointer use: null pointer is a dangling pointer (it has no provenance)
--> $DIR/bad-backtrace-ptr.rs:LL:CC
|
LL | miri_resolve_frame(std::ptr::null_mut(), 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ null pointer is not a valid pointer for this operation
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer use: null pointer is a dangling pointer (it has no provenance)
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/dangling_pointers/deref-invalid-ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

fn main() {
let x = 16usize as *const u32;
let _y = unsafe { &*x as *const u32 }; //~ ERROR is not a valid pointer
let _y = unsafe { &*x as *const u32 }; //~ ERROR is a dangling pointer
}
4 changes: 2 additions & 2 deletions tests/fail/dangling_pointers/deref-invalid-ptr.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: dereferencing pointer failed: 0x10 is not a valid pointer
error: Undefined Behavior: dereferencing pointer failed: 0x10[noalloc] is a dangling pointer (it has no provenance)
--> $DIR/deref-invalid-ptr.rs:LL:CC
|
LL | let _y = unsafe { &*x as *const u32 };
| ^^^ dereferencing pointer failed: 0x10 is not a valid pointer
| ^^^ dereferencing pointer failed: 0x10[noalloc] is a dangling pointer (it has no provenance)
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/dangling_pointers/null_pointer_deref.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[allow(deref_nullptr)]
fn main() {
let x: i32 = unsafe { *std::ptr::null() }; //~ ERROR null pointer is not a valid pointer
let x: i32 = unsafe { *std::ptr::null() }; //~ ERROR null pointer is a dangling pointer
panic!("this should never print: {}", x);
}
4 changes: 2 additions & 2 deletions tests/fail/dangling_pointers/null_pointer_deref.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: dereferencing pointer failed: null pointer is not a valid pointer
error: Undefined Behavior: dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance)
--> $DIR/null_pointer_deref.rs:LL:CC
|
LL | let x: i32 = unsafe { *std::ptr::null() };
| ^^^^^^^^^^^^^^^^^ dereferencing pointer failed: null pointer is not a valid pointer
| ^^^^^^^^^^^^^^^^^ dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance)
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/dangling_pointers/null_pointer_deref_zst.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@

#[allow(deref_nullptr)]
fn main() {
let x: () = unsafe { *std::ptr::null() }; //~ ERROR dereferencing pointer failed: null pointer is not a valid pointer
let x: () = unsafe { *std::ptr::null() }; //~ ERROR dereferencing pointer failed: null pointer is a dangling pointer
panic!("this should never print: {:?}", x);
}
4 changes: 2 additions & 2 deletions tests/fail/dangling_pointers/null_pointer_deref_zst.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: dereferencing pointer failed: null pointer is not a valid pointer
error: Undefined Behavior: dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance)
--> $DIR/null_pointer_deref_zst.rs:LL:CC
|
LL | let x: () = unsafe { *std::ptr::null() };
| ^^^^^^^^^^^^^^^^^ dereferencing pointer failed: null pointer is not a valid pointer
| ^^^^^^^^^^^^^^^^^ dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance)
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/dangling_pointers/null_pointer_write.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#[allow(deref_nullptr)]
fn main() {
unsafe { *std::ptr::null_mut() = 0i32 }; //~ ERROR null pointer is not a valid pointer
unsafe { *std::ptr::null_mut() = 0i32 }; //~ ERROR null pointer is a dangling pointer
}
4 changes: 2 additions & 2 deletions tests/fail/dangling_pointers/null_pointer_write.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: dereferencing pointer failed: null pointer is not a valid pointer
error: Undefined Behavior: dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance)
--> $DIR/null_pointer_write.rs:LL:CC
|
LL | unsafe { *std::ptr::null_mut() = 0i32 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereferencing pointer failed: null pointer is not a valid pointer
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereferencing pointer failed: null pointer is a dangling pointer (it has no provenance)
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/dangling_pointers/null_pointer_write_zst.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Some optimizations remove ZST accesses, thus masking this UB.
// compile-flags: -Zmir-opt-level=0
// error-pattern: memory access failed: null pointer is not a valid pointer
// error-pattern: memory access failed: null pointer is a dangling pointer

#[allow(deref_nullptr)]
fn main() {
Expand Down
4 changes: 2 additions & 2 deletions tests/fail/dangling_pointers/null_pointer_write_zst.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: memory access failed: null pointer is not a valid pointer
error: Undefined Behavior: memory access failed: null pointer is a dangling pointer (it has no provenance)
--> RUSTLIB/core/src/ptr/mod.rs:LL:CC
|
LL | copy_nonoverlapping(&src as *const T, dst, 1);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: null pointer is not a valid pointer
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: null pointer is a dangling pointer (it has no provenance)
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/dangling_pointers/storage_dead_dangling.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn fill(v: &mut i32) {
}

fn evil() {
unsafe { &mut *(LEAK as *mut i32) }; //~ ERROR is not a valid pointer
unsafe { &mut *(LEAK as *mut i32) }; //~ ERROR is a dangling pointer
}

fn main() {
Expand Down
4 changes: 2 additions & 2 deletions tests/fail/dangling_pointers/storage_dead_dangling.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: dereferencing pointer failed: $HEX is not a valid pointer
error: Undefined Behavior: dereferencing pointer failed: $HEX[noalloc] is a dangling pointer (it has no provenance)
--> $DIR/storage_dead_dangling.rs:LL:CC
|
LL | unsafe { &mut *(LEAK as *mut i32) };
| ^^^^^^^^^^^^^^^^^^^^^^^^ dereferencing pointer failed: $HEX is not a valid pointer
| ^^^^^^^^^^^^^^^^^^^^^^^^ dereferencing pointer failed: $HEX[noalloc] is a dangling pointer (it has no provenance)
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/dangling_pointers/wild_pointer_deref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

fn main() {
let p = 44 as *const i32;
let x = unsafe { *p }; //~ ERROR is not a valid pointer
let x = unsafe { *p }; //~ ERROR is a dangling pointer
panic!("this should never print: {}", x);
}
4 changes: 2 additions & 2 deletions tests/fail/dangling_pointers/wild_pointer_deref.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: dereferencing pointer failed: 0x2c is not a valid pointer
error: Undefined Behavior: dereferencing pointer failed: 0x2c[noalloc] is a dangling pointer (it has no provenance)
--> $DIR/wild_pointer_deref.rs:LL:CC
|
LL | let x = unsafe { *p };
| ^^ dereferencing pointer failed: 0x2c is not a valid pointer
| ^^ dereferencing pointer failed: 0x2c[noalloc] is a dangling pointer (it has no provenance)
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/function_pointers/cast_int_to_fn_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
fn main() {
let g = unsafe { std::mem::transmute::<usize, fn(i32)>(42) };

g(42) //~ ERROR not a valid pointer
g(42) //~ ERROR is a dangling pointer
}
4 changes: 2 additions & 2 deletions tests/fail/function_pointers/cast_int_to_fn_ptr.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: 0x2a is not a valid pointer
error: Undefined Behavior: out-of-bounds pointer use: 0x2a[noalloc] is a dangling pointer (it has no provenance)
--> $DIR/cast_int_to_fn_ptr.rs:LL:CC
|
LL | g(42)
| ^^^^^ 0x2a is not a valid pointer
| ^^^^^ out-of-bounds pointer use: 0x2a[noalloc] is a dangling pointer (it has no provenance)
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/intrinsics/copy_null.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ fn main() {
let ptr = &mut data[0] as *mut u16;
// Even copying 0 elements from NULL should error.
unsafe {
copy_nonoverlapping(std::ptr::null(), ptr, 0); //~ ERROR: memory access failed: null pointer is not a valid pointer
copy_nonoverlapping(std::ptr::null(), ptr, 0); //~ ERROR: memory access failed: null pointer is a dangling pointer
}
}
4 changes: 2 additions & 2 deletions tests/fail/intrinsics/copy_null.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: memory access failed: null pointer is not a valid pointer
error: Undefined Behavior: memory access failed: null pointer is a dangling pointer (it has no provenance)
--> $DIR/copy_null.rs:LL:CC
|
LL | copy_nonoverlapping(std::ptr::null(), ptr, 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: null pointer is not a valid pointer
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: null pointer is a dangling pointer (it has no provenance)
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Expand Down
4 changes: 2 additions & 2 deletions tests/fail/intrinsics/out_of_bounds_ptr_1.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: pointer arithmetic failed: ALLOC has size 4, so pointer to 5 bytes starting at offset 0 is out-of-bounds
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
--> RUSTLIB/core/src/ptr/const_ptr.rs:LL:CC
|
LL | unsafe { intrinsics::offset(self, count) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pointer arithmetic failed: ALLOC has size 4, so pointer to 5 bytes starting at offset 0 is out-of-bounds
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: ALLOC has size 4, so pointer to 5 bytes starting at offset 0 is out-of-bounds
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Expand Down
4 changes: 2 additions & 2 deletions tests/fail/intrinsics/out_of_bounds_ptr_3.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: pointer arithmetic failed: ALLOC has size 4, so pointer to 1 byte starting at offset -1 is out-of-bounds
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
--> RUSTLIB/core/src/ptr/const_ptr.rs:LL:CC
|
LL | unsafe { intrinsics::offset(self, count) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pointer arithmetic failed: ALLOC has size 4, so pointer to 1 byte starting at offset -1 is out-of-bounds
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: ALLOC has size 4, so pointer to 1 byte starting at offset -1 is out-of-bounds
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/intrinsics/ptr_offset_0_plus_0.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// error-pattern: pointer arithmetic failed: null pointer is not a valid pointer
// error-pattern: null pointer is a dangling pointer
// compile-flags: -Zmiri-permissive-provenance

fn main() {
Expand Down
4 changes: 2 additions & 2 deletions tests/fail/intrinsics/ptr_offset_0_plus_0.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: pointer arithmetic failed: null pointer is not a valid pointer
error: Undefined Behavior: out-of-bounds pointer arithmetic: null pointer is a dangling pointer (it has no provenance)
--> RUSTLIB/core/src/ptr/mut_ptr.rs:LL:CC
|
LL | unsafe { intrinsics::offset(self, count) as *mut T }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pointer arithmetic failed: null pointer is not a valid pointer
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: null pointer is a dangling pointer (it has no provenance)
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/intrinsics/ptr_offset_int_plus_int.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// error-pattern: is not a valid pointer
// error-pattern: is a dangling pointer
// compile-flags: -Zmiri-permissive-provenance

fn main() {
Expand Down
4 changes: 2 additions & 2 deletions tests/fail/intrinsics/ptr_offset_int_plus_int.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: pointer arithmetic failed: 0x1 is not a valid pointer
error: Undefined Behavior: out-of-bounds pointer arithmetic: 0x1[noalloc] is a dangling pointer (it has no provenance)
--> RUSTLIB/core/src/ptr/mut_ptr.rs:LL:CC
|
LL | unsafe { intrinsics::offset(self, count) as *mut T }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pointer arithmetic failed: 0x1 is not a valid pointer
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: 0x1[noalloc] is a dangling pointer (it has no provenance)
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/intrinsics/ptr_offset_int_plus_ptr.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// error-pattern: is not a valid pointer
// error-pattern: is a dangling pointer
// compile-flags: -Zmiri-permissive-provenance

fn main() {
Expand Down
4 changes: 2 additions & 2 deletions tests/fail/intrinsics/ptr_offset_int_plus_ptr.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: pointer arithmetic failed: 0x1 is not a valid pointer
error: Undefined Behavior: out-of-bounds pointer arithmetic: 0x1[noalloc] is a dangling pointer (it has no provenance)
--> RUSTLIB/core/src/ptr/mut_ptr.rs:LL:CC
|
LL | unsafe { intrinsics::offset(self, count) as *mut T }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pointer arithmetic failed: 0x1 is not a valid pointer
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: 0x1[noalloc] is a dangling pointer (it has no provenance)
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Expand Down
4 changes: 2 additions & 2 deletions tests/fail/intrinsics/ptr_offset_ptr_plus_0.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: pointer arithmetic failed: ALLOC has size 4, so pointer at offset 32 is out-of-bounds
error: Undefined Behavior: out-of-bounds pointer arithmetic: ALLOC has size 4, so pointer at offset 32 is out-of-bounds
--> RUSTLIB/core/src/ptr/mut_ptr.rs:LL:CC
|
LL | unsafe { intrinsics::offset(self, count) as *mut T }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pointer arithmetic failed: ALLOC has size 4, so pointer at offset 32 is out-of-bounds
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: ALLOC has size 4, so pointer at offset 32 is out-of-bounds
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/intrinsics/write_bytes_null.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ extern "rust-intrinsic" {
}

fn main() {
unsafe { write_bytes::<u8>(std::ptr::null_mut(), 0, 0) }; //~ ERROR memory access failed: null pointer is not a valid pointer
unsafe { write_bytes::<u8>(std::ptr::null_mut(), 0, 0) }; //~ ERROR memory access failed: null pointer is a dangling pointer
}
4 changes: 2 additions & 2 deletions tests/fail/intrinsics/write_bytes_null.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: memory access failed: null pointer is not a valid pointer
error: Undefined Behavior: memory access failed: null pointer is a dangling pointer (it has no provenance)
--> $DIR/write_bytes_null.rs:LL:CC
|
LL | unsafe { write_bytes::<u8>(std::ptr::null_mut(), 0, 0) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: null pointer is not a valid pointer
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: null pointer is a dangling pointer (it has no provenance)
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Expand Down
4 changes: 2 additions & 2 deletions tests/fail/provenance/provenance_transmute.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: dereferencing pointer failed: $HEX is not a valid pointer
error: Undefined Behavior: dereferencing pointer failed: $HEX[noalloc] is a dangling pointer (it has no provenance)
--> $DIR/provenance_transmute.rs:LL:CC
|
LL | let _val = *left_ptr;
| ^^^^^^^^^ dereferencing pointer failed: $HEX is not a valid pointer
| ^^^^^^^^^ dereferencing pointer failed: $HEX[noalloc] is a dangling pointer (it has no provenance)
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Expand Down
4 changes: 2 additions & 2 deletions tests/fail/provenance/ptr_int_unexposed.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: dereferencing pointer failed: $HEX is not a valid pointer
error: Undefined Behavior: dereferencing pointer failed: $HEX[noalloc] is a dangling pointer (it has no provenance)
--> $DIR/ptr_int_unexposed.rs:LL:CC
|
LL | assert_eq!(unsafe { *ptr }, 3);
| ^^^^ dereferencing pointer failed: $HEX is not a valid pointer
| ^^^^ dereferencing pointer failed: $HEX[noalloc] is a dangling pointer (it has no provenance)
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Expand Down
2 changes: 1 addition & 1 deletion tests/fail/provenance/ptr_invalid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ fn main() {
let x = 42;
let xptr = &x as *const i32;
let xptr_invalid = std::ptr::invalid::<i32>(xptr.expose_addr());
let _val = unsafe { *xptr_invalid }; //~ ERROR is not a valid pointer
let _val = unsafe { *xptr_invalid }; //~ ERROR is a dangling pointer
}
Loading

0 comments on commit 1118d94

Please sign in to comment.