fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.4 KiB29 linesraw
1error[E0015]: cannot call non-const fn `Y::foo` in statics
2  --> $DIR/issue-16538.rs:14:23
3   |
4LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X);
5   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^
6   |
7   = note: calls in statics are limited to constant functions, tuple structs and tuple variants
8   = note: consider wrapping this expression in `Lazy::new(|| ...)` from the `once_cell` crate: https://crates.io/crates/once_cell
9
10error[E0133]: use of extern static is unsafe and requires unsafe function or block
11  --> $DIR/issue-16538.rs:14:30
12   |
13LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X);
14   |                              ^^^^ use of extern static
15   |
16   = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
17
18error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
19  --> $DIR/issue-16538.rs:14:21
20   |
21LL | static foo: &Y::X = &*Y::foo(Y::x as *const Y::X);
22   |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer
23   |
24   = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
25
26error: aborting due to 3 previous errors
27
28Some errors have detailed explanations: E0015, E0133.
29For more information about an error, try `rustc --explain E0015`.