mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
Add regression test for #72394
This commit is contained in:
parent
119efbcbfb
commit
09619bc459
13
src/test/ui/unsafe/unsafe-unstable-const-fn.rs
Normal file
13
src/test/ui/unsafe/unsafe-unstable-const-fn.rs
Normal 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() {}
|
11
src/test/ui/unsafe/unsafe-unstable-const-fn.stderr
Normal file
11
src/test/ui/unsafe/unsafe-unstable-const-fn.stderr
Normal 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`.
|
Loading…
Reference in New Issue
Block a user