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 16:33:38 -06:00
pub type X = usize;
2020-09-01 16:12:52 -05:00
extern "C" {
2016-02-22 16:33:38 -06:00
pub static x: *const usize;
}
2016-02-22 16:33:38 -06: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 12:34:21 -05:00
//~| ERROR use of extern static is unsafe and requires
fn main() {}