2021-05-16 22:29:54 +00:00
|
|
|
// revisions: mir thir
|
|
|
|
// [thir]compile-flags: -Z thir-unsafeck
|
|
|
|
|
2014-12-23 05:20:31 +00:00
|
|
|
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;
|
2014-12-23 05:20:31 +00:00
|
|
|
}
|
2016-02-22 22:33:38 +00:00
|
|
|
pub fn foo(value: *const X) -> *const X {
|
2014-12-23 05:20:31 +00:00
|
|
|
value
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-26 14:11:45 +00:00
|
|
|
static foo: &Y::X = &*Y::foo(Y::x as *const Y::X);
|
|
|
|
//~^ ERROR dereference of raw pointer
|
2015-05-05 12:47:04 +00:00
|
|
|
//~| ERROR E0015
|
2019-08-03 17:34:21 +00:00
|
|
|
//~| ERROR use of extern static is unsafe and requires
|
2014-12-23 05:20:31 +00:00
|
|
|
|
|
|
|
fn main() {}
|