rust/tests/ui/consts/issue-16538.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
400 B
Rust
Raw Normal View History

// revisions: mir thir
// [thir]compile-flags: -Z thir-unsafeck
mod Y {
2016-02-22 22:33:38 +00:00
pub type X = usize;
2020-09-01 21:12:52 +00:00
extern "C" {
2016-02-22 22:33:38 +00:00
pub static x: *const usize;
}
2016-02-22 22:33:38 +00:00
pub fn foo(value: *const X) -> *const X {
value
}
}
static foo: &Y::X = &*Y::foo(Y::x as *const Y::X);
//~^ ERROR dereference of raw pointer
//~| ERROR E0015
2019-08-03 17:34:21 +00:00
//~| ERROR use of extern static is unsafe and requires
fn main() {}