Add test for issue-28575

This commit is contained in:
Yuki Okushi 2020-04-16 10:09:34 +09:00
parent 9fb3f55211
commit 077a7f741f
No known key found for this signature in database
GPG Key ID: B0986C85C0E2DAA1
2 changed files with 20 additions and 0 deletions

View File

@ -0,0 +1,9 @@
#![feature(intrinsics)]
extern "C" {
pub static FOO: extern "rust-intrinsic" fn();
}
fn main() {
FOO() //~ ERROR: use of extern static is unsafe
}

View File

@ -0,0 +1,11 @@
error[E0133]: use of extern static is unsafe and requires unsafe function or block
--> $DIR/issue-28575.rs:8:5
|
LL | FOO()
| ^^^ use of extern static
|
= note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
error: aborting due to previous error
For more information about this error, try `rustc --explain E0133`.