rustup
This commit is contained in:
parent
b514667c36
commit
39d8c4de35
@ -1 +1 @@
|
||||
7fe022f5aa32bbbb33c3a58755729d6667a461a9
|
||||
2fdbf075cf502431ca9fee6616331b32e34f25de
|
||||
|
@ -1,9 +1,10 @@
|
||||
//@error-pattern: first pointer has smaller offset than second: 0 < 4
|
||||
// Preparing for a rustc behavior change that'll happen soon: (FIXME remove this after the next submodule bump succeeded)
|
||||
//@normalize-stderr-test: "`(ptr_offset_from_unsigned)`" -> "$1"
|
||||
#![feature(ptr_sub_ptr)]
|
||||
|
||||
fn main() {
|
||||
let arr = [0u8; 8];
|
||||
let ptr1 = arr.as_ptr();
|
||||
let ptr2 = ptr1.wrapping_add(4);
|
||||
let _val = unsafe { ptr1.sub_ptr(ptr2) };
|
||||
let _val = unsafe { ptr1.sub_ptr(ptr2) }; //~ERROR: first pointer has smaller offset than second: 0 < 4
|
||||
}
|
||||
|
@ -1,18 +1,13 @@
|
||||
error: Undefined Behavior: ptr_offset_from_unsigned called when first pointer has smaller offset than second: 0 < 4
|
||||
--> RUSTLIB/core/src/ptr/const_ptr.rs:LL:CC
|
||||
--> $DIR/ptr_offset_from_unsigned_neg.rs:LL:CC
|
||||
|
|
||||
LL | unsafe { intrinsics::ptr_offset_from_unsigned(self, origin) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ptr_offset_from_unsigned called when first pointer has smaller offset than second: 0 < 4
|
||||
LL | let _val = unsafe { ptr1.sub_ptr(ptr2) };
|
||||
| ^^^^^^^^^^^^^^^^^^ ptr_offset_from_unsigned called when first pointer has smaller offset than second: 0 < 4
|
||||
|
|
||||
= 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
|
||||
= note: backtrace:
|
||||
= note: inside `std::ptr::const_ptr::<impl *const u8>::sub_ptr` at RUSTLIB/core/src/ptr/const_ptr.rs:LL:CC
|
||||
note: inside `main` at $DIR/ptr_offset_from_unsigned_neg.rs:LL:CC
|
||||
--> $DIR/ptr_offset_from_unsigned_neg.rs:LL:CC
|
||||
|
|
||||
LL | let _val = unsafe { ptr1.sub_ptr(ptr2) };
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
= note: inside `main` at $DIR/ptr_offset_from_unsigned_neg.rs:LL:CC
|
||||
|
||||
note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user