提交 dd3b8e8b 编写于 作者: R Ralf Jung

rustup

上级 c0cbddc7
a86705942c4cfaaee60f2e7308ca2bca703a710f
c11207ec89b856164bba03b8ecfe07b0b234ed21
// 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() {
......
error: Undefined Behavior: ptr_offset_from_unsigned called when first pointer has smaller offset than second: 0 < 4
error: Undefined Behavior: `ptr_offset_from_unsigned` called when first pointer has smaller offset than second: 0 < 4
--> $DIR/ptr_offset_from_unsigned_neg.rs:LL:CC
|
LL | let _val = unsafe { ptr1.sub_ptr(ptr2) };
| ^^^^^^^^^^^^^^^^^^ ptr_offset_from_unsigned called when first pointer has smaller offset than second: 0 < 4
| ^^^^^^^^^^^^^^^^^^ `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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册