Skip to content

Commit 39d8c4d

Browse files
committed
rustup
1 parent b514667 commit 39d8c4d

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7fe022f5aa32bbbb33c3a58755729d6667a461a9
1+
2fdbf075cf502431ca9fee6616331b32e34f25de
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
//@error-pattern: first pointer has smaller offset than second: 0 < 4
1+
// Preparing for a rustc behavior change that'll happen soon: (FIXME remove this after the next submodule bump succeeded)
2+
//@normalize-stderr-test: "`(ptr_offset_from_unsigned)`" -> "$1"
23
#![feature(ptr_sub_ptr)]
34

45
fn main() {
56
let arr = [0u8; 8];
67
let ptr1 = arr.as_ptr();
78
let ptr2 = ptr1.wrapping_add(4);
8-
let _val = unsafe { ptr1.sub_ptr(ptr2) };
9+
let _val = unsafe { ptr1.sub_ptr(ptr2) }; //~ERROR: first pointer has smaller offset than second: 0 < 4
910
}

tests/fail/intrinsics/ptr_offset_from_unsigned_neg.stderr

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,13 @@
11
error: Undefined Behavior: ptr_offset_from_unsigned called when first pointer has smaller offset than second: 0 < 4
2-
--> RUSTLIB/core/src/ptr/const_ptr.rs:LL:CC
2+
--> $DIR/ptr_offset_from_unsigned_neg.rs:LL:CC
33
|
4-
LL | unsafe { intrinsics::ptr_offset_from_unsigned(self, origin) }
5-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ptr_offset_from_unsigned called when first pointer has smaller offset than second: 0 < 4
4+
LL | let _val = unsafe { ptr1.sub_ptr(ptr2) };
5+
| ^^^^^^^^^^^^^^^^^^ ptr_offset_from_unsigned called when first pointer has smaller offset than second: 0 < 4
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
99
= note: backtrace:
10-
= note: inside `std::ptr::const_ptr::<impl *const u8>::sub_ptr` at RUSTLIB/core/src/ptr/const_ptr.rs:LL:CC
11-
note: inside `main` at $DIR/ptr_offset_from_unsigned_neg.rs:LL:CC
12-
--> $DIR/ptr_offset_from_unsigned_neg.rs:LL:CC
13-
|
14-
LL | let _val = unsafe { ptr1.sub_ptr(ptr2) };
15-
| ^^^^^^^^^^^^^^^^^^
10+
= note: inside `main` at $DIR/ptr_offset_from_unsigned_neg.rs:LL:CC
1611

1712
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
1813

0 commit comments

Comments
 (0)