Skip to content

Commit

Permalink
Add regression test for #72394
Browse files Browse the repository at this point in the history
  • Loading branch information
ecstatic-morse committed May 20, 2020
1 parent 119efbc commit 09619bc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/test/ui/unsafe/unsafe-unstable-const-fn.rs
@@ -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() {}
11 changes: 11 additions & 0 deletions src/test/ui/unsafe/unsafe-unstable-const-fn.stderr
@@ -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`.

0 comments on commit 09619bc

Please sign in to comment.