1 error[E0080]: it is undefined behavior to use this value
2 --> $DIR/const_refers_to_static2.rs:11:1
4 LL | / const REF_INTERIOR_MUT: &usize = {
8 LL | | static FOO: AtomicUsize = AtomicUsize::new(0);
9 LL | | unsafe { &*(&FOO as *const _ as *const usize) }
11 | |__^ type validation failed: encountered a reference pointing to a static variable
13 = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
14 = note: the raw bytes of the constant (size: 8, align: 8) {
15 ╾───────alloc0────────╼ │ ╾──────╼
18 error[E0080]: it is undefined behavior to use this value
19 --> $DIR/const_refers_to_static2.rs:20:1
21 LL | / const READ_IMMUT: &usize = {
25 LL | | static FOO: usize = 0;
28 | |__^ type validation failed: encountered a reference pointing to a static variable
30 = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
31 = note: the raw bytes of the constant (size: 8, align: 8) {
32 ╾───────alloc1────────╼ │ ╾──────╼
35 warning: skipping const checks
37 help: skipping check that does not even have a feature gate
38 --> $DIR/const_refers_to_static2.rs:16:18
40 LL | unsafe { &*(&FOO as *const _ as *const usize) }
42 help: skipping check for `const_raw_ptr_deref` feature
43 --> $DIR/const_refers_to_static2.rs:16:14
45 LL | unsafe { &*(&FOO as *const _ as *const usize) }
46 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
47 help: skipping check that does not even have a feature gate
48 --> $DIR/const_refers_to_static2.rs:25:6
53 error: aborting due to 2 previous errors; 1 warning emitted
55 For more information about this error, try `rustc --explain E0080`.