Add regression test for #72394

This commit is contained in:
Dylan MacKenzie 2020-05-20 14:55:38 -07:00
parent 119efbcbfb
commit 09619bc459
2 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,13 @@
#![stable(feature = "foo", since = "1.33.0")]
#![feature(staged_api)]
#![feature(const_compare_raw_pointers)]
#![feature(const_fn)]
#[stable(feature = "foo", since = "1.33.0")]
#[rustc_const_unstable(feature = "const_foo", issue = "none")]
const fn unstable(a: *const i32, b: *const i32) -> bool {
a == b
//~^ pointer operation is unsafe
}
fn main() {}

View File

@ -0,0 +1,11 @@
error[E0133]: pointer operation is unsafe and requires unsafe function or block
--> $DIR/unsafe-unstable-const-fn.rs:9:5
|
LL | a == b
| ^^^^^^ pointer operation
|
= note: operations on pointers in constants
error: aborting due to previous error
For more information about this error, try `rustc --explain E0133`.