Skip to content

Commit

Permalink
Auto merge of #1790 - hyd-dev:rustup, r=RalfJung
Browse files Browse the repository at this point in the history
Update pointer error messages

cc rust-lang/rust#85027
  • Loading branch information
bors committed May 8, 2021
2 parents ee8dbbc + 1ab9fd5 commit 38b5f23
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1773f14a24c49356b384e45ebb45643bc9bef2c4
e002ac7e8a1eb04961a722c44b3ffbad575a6caa
2 changes: 1 addition & 1 deletion tests/compile-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(0 as *mut _, 0); //~ ERROR 0x0 is not a valid pointer
miri_resolve_frame(0 as *mut _, 0); //~ ERROR null pointer is not a valid pointer for this operation
}
}
2 changes: 1 addition & 1 deletion tests/compile-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 inbounds test failed: 0x10 is not a valid pointer
let _y = unsafe { &*x as *const u32 }; //~ ERROR 0x10 is not a valid pointer
}
2 changes: 1 addition & 1 deletion tests/compile-fail/dangling_pointers/wild_pointer_deref.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fn main() {
let p = 44 as *const i32;
let x = unsafe { *p }; //~ ERROR inbounds test failed: 0x2c is not a valid pointer
let x = unsafe { *p }; //~ ERROR 0x2c is not a valid pointer
panic!("this should never print: {}", x);
}
2 changes: 1 addition & 1 deletion tests/compile-fail/function_pointers/cast_int_to_fn_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ fn main() {
std::mem::transmute::<usize, fn(i32)>(42)
};

g(42) //~ ERROR inbounds test failed: 0x2a is not a valid pointer
g(42) //~ ERROR 0x2a is not a valid pointer
}
2 changes: 1 addition & 1 deletion tests/compile-fail/intrinsics/ptr_offset_0_plus_0.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// error-pattern: inbounds test failed: 0x0 is not a valid pointer
// error-pattern: pointer arithmetic failed: 0x0 is not a valid pointer

fn main() {
let x = 0 as *mut i32;
Expand Down
2 changes: 1 addition & 1 deletion tests/compile-fail/intrinsics/ptr_offset_int_plus_int.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// error-pattern: inbounds test failed: 0x1 is not a valid pointer
// error-pattern: 0x1 is not a valid pointer

fn main() {
// Can't offset an integer pointer by non-zero offset.
Expand Down
2 changes: 1 addition & 1 deletion tests/compile-fail/intrinsics/ptr_offset_int_plus_ptr.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// error-pattern: inbounds test failed: 0x1 is not a valid pointer
// error-pattern: 0x1 is not a valid pointer

fn main() {
let ptr = Box::into_raw(Box::new(0u32));
Expand Down
2 changes: 1 addition & 1 deletion tests/compile-fail/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 inbounds test failed: 0x0 is not a valid pointer
let x: i32 = unsafe { *std::ptr::null() }; //~ ERROR null pointer is not a valid pointer for this operation
panic!("this should never print: {}", x);
}
2 changes: 1 addition & 1 deletion tests/compile-fail/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 inbounds test failed: 0x0 is not a valid pointer
unsafe { *std::ptr::null_mut() = 0i32 }; //~ ERROR null pointer is not a valid pointer for this operation
}
2 changes: 1 addition & 1 deletion tests/compile-fail/stacked_borrows/issue-miri-1050-2.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// error-pattern: inbounds test failed: 0x4 is not a valid pointer
// error-pattern: 0x4 is not a valid pointer
use std::ptr::NonNull;

fn main() { unsafe {
Expand Down

0 comments on commit 38b5f23

Please sign in to comment.