error[E0080]: it is undefined behavior to use this value
  --> $DIR/const_refers_to_static2.rs:10:1
   |
LL | / const REF_INTERIOR_MUT: &usize = {
LL | |
LL | |
LL | |     static FOO: AtomicUsize = AtomicUsize::new(0);
LL | |     unsafe { &*(&FOO as *const _ as *const usize) }
LL | | };
   | |__^ type validation failed: encountered a reference pointing to a static variable
   |
   = 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.

error[E0080]: it is undefined behavior to use this value
  --> $DIR/const_refers_to_static2.rs:18:1
   |
LL | / const READ_IMMUT: &usize = {
LL | |
LL | |
LL | |     static FOO: usize = 0;
LL | |     &FOO
LL | | };
   | |__^ type validation failed: encountered a reference pointing to a static variable
   |
   = 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.

warning: skipping const checks
   |
help: skipping check that does not even have a feature gate
  --> $DIR/const_refers_to_static2.rs:14:18
   |
LL |     unsafe { &*(&FOO as *const _ as *const usize) }
   |                  ^^^
help: skipping check for `const_raw_ptr_deref` feature
  --> $DIR/const_refers_to_static2.rs:14:14
   |
LL |     unsafe { &*(&FOO as *const _ as *const usize) }
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: skipping check that does not even have a feature gate
  --> $DIR/const_refers_to_static2.rs:22:6
   |
LL |     &FOO
   |      ^^^

error: aborting due to 2 previous errors; 1 warning emitted

For more information about this error, try `rustc --explain E0080`.
