2021-11-26 14:11:45 +00:00
|
|
|
error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
|
2022-01-19 15:24:49 +00:00
|
|
|
--> $DIR/issue-16538.rs:14:22
|
2021-11-26 14:11:45 +00:00
|
|
|
|
|
|
|
|
LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer
|
|
|
|
|
|
|
|
|
= note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
|
|
|
|
|
2021-05-13 21:36:19 +00:00
|
|
|
error[E0133]: use of extern static is unsafe and requires unsafe function or block
|
2022-01-19 15:24:49 +00:00
|
|
|
--> $DIR/issue-16538.rs:14:30
|
2021-05-13 21:36:19 +00:00
|
|
|
|
|
2021-11-26 14:11:45 +00:00
|
|
|
LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X);
|
|
|
|
| ^^^^ use of extern static
|
2021-05-13 21:36:19 +00:00
|
|
|
|
|
|
|
|
= note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
|
|
|
|
|
2021-12-09 17:10:05 +00:00
|
|
|
error[E0015]: cannot call non-const fn `Y::foo` in statics
|
2022-01-19 15:24:49 +00:00
|
|
|
--> $DIR/issue-16538.rs:14:23
|
2018-07-15 21:11:54 +00:00
|
|
|
|
|
2021-11-26 14:11:45 +00:00
|
|
|
LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2021-12-09 17:10:05 +00:00
|
|
|
|
|
|
|
|
= note: calls in statics are limited to constant functions, tuple structs and tuple variants
|
2022-08-14 22:07:47 +00:00
|
|
|
= note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell
|
2018-07-15 21:11:54 +00:00
|
|
|
|
2019-08-03 17:34:21 +00:00
|
|
|
error: aborting due to 3 previous errors
|
2018-07-15 21:11:54 +00:00
|
|
|
|
2021-11-26 14:11:45 +00:00
|
|
|
Some errors have detailed explanations: E0015, E0133.
|
2018-07-15 21:11:54 +00:00
|
|
|
For more information about an error, try `rustc --explain E0015`.
|