This commit is contained in:
Ralf Jung 2022-07-05 18:16:20 -04:00
parent 35399c6a5d
commit f3f4bafa1b
42 changed files with 69 additions and 64 deletions

View File

@ -1 +1 @@
4045ce641a9eede71cc12031a2cd71692b273890
41ad4d9b2dbb895666337d162eda52619a6056db

View File

@ -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>,

View File

@ -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
}
}

View File

@ -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

View File

@ -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
}

View File

@ -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

View File

@ -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);
}

View File

@ -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

View File

@ -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);
}

View File

@ -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

View File

@ -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
}

View File

@ -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

View File

@ -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() {

View File

@ -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

View File

@ -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() {

View File

@ -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

View File

@ -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);
}

View File

@ -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

View File

@ -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
}

View File

@ -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

View File

@ -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
}
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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() {

View File

@ -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

View File

@ -1,4 +1,4 @@
// error-pattern: is not a valid pointer
// error-pattern: is a dangling pointer
// compile-flags: -Zmiri-permissive-provenance
fn main() {

View File

@ -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

View File

@ -1,4 +1,4 @@
// error-pattern: is not a valid pointer
// error-pattern: is a dangling pointer
// compile-flags: -Zmiri-permissive-provenance
fn main() {

View File

@ -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

View File

@ -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

View File

@ -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
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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
}

View File

@ -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_invalid.rs:LL:CC
|
LL | let _val = unsafe { *xptr_invalid };
| ^^^^^^^^^^^^^ 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

View File

@ -1,5 +1,5 @@
// compile-flags: -Zmiri-strict-provenance
// error-pattern: not a valid pointer
// error-pattern: is a dangling pointer
#![feature(strict_provenance)]
fn main() {

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: pointer arithmetic failed: $HEX is not a valid pointer
error: Undefined Behavior: out-of-bounds pointer arithmetic: $HEX[noalloc] is a dangling pointer (it has no provenance)
--> RUSTLIB/core/src/ptr/const_ptr.rs:LL:CC
|
LL | unsafe { intrinsics::offset(self, count) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pointer arithmetic failed: $HEX is not a valid pointer
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: $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

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: ALLOC has size 2, so pointer to 4 bytes starting at offset 0 is out-of-bounds
error: Undefined Behavior: out-of-bounds pointer use: ALLOC has size 2, so pointer to 4 bytes starting at offset 0 is out-of-bounds
--> RUSTLIB/alloc/src/boxed.rs:LL:CC
|
LL | Box(unsafe { Unique::new_unchecked(raw) }, alloc)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ALLOC has size 2, so pointer to 4 bytes starting at offset 0 is out-of-bounds
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer use: ALLOC has size 2, so pointer to 4 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

View File

@ -1,4 +1,4 @@
// error-pattern: is not a valid pointer
// error-pattern: is a dangling pointer
use std::ptr::NonNull;
fn main() {

View File

@ -1,8 +1,8 @@
error: Undefined Behavior: 0x4 is not a valid pointer
error: Undefined Behavior: out-of-bounds pointer use: 0x4[noalloc] is a dangling pointer (it has no provenance)
--> RUSTLIB/alloc/src/boxed.rs:LL:CC
|
LL | Box(unsafe { Unique::new_unchecked(raw) }, alloc)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 0x4 is not a valid pointer
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer use: 0x4[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