about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc_mir/transform/check_consts/validation.rs8
-rw-r--r--src/librustc_session/session.rs48
-rw-r--r--src/test/ui/consts/const-eval/const_fn_ptr.rs6
-rw-r--r--src/test/ui/consts/const-eval/const_fn_ptr.stderr34
-rw-r--r--src/test/ui/consts/const-eval/const_fn_ptr_fail.rs2
-rw-r--r--src/test/ui/consts/const-eval/const_fn_ptr_fail.stderr10
-rw-r--r--src/test/ui/consts/const-eval/const_fn_ptr_fail2.rs2
-rw-r--r--src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr16
-rw-r--r--src/test/ui/consts/const-points-to-static.rs5
-rw-r--r--src/test/ui/consts/const-points-to-static.stderr14
-rw-r--r--src/test/ui/consts/const-prop-read-static-in-const.rs1
-rw-r--r--src/test/ui/consts/const-prop-read-static-in-const.stderr14
-rw-r--r--src/test/ui/consts/miri_unleashed/abi-mismatch.rs4
-rw-r--r--src/test/ui/consts/miri_unleashed/abi-mismatch.stderr39
-rw-r--r--src/test/ui/consts/miri_unleashed/assoc_const.rs2
-rw-r--r--src/test/ui/consts/miri_unleashed/assoc_const.stderr14
-rw-r--r--src/test/ui/consts/miri_unleashed/box.rs2
-rw-r--r--src/test/ui/consts/miri_unleashed/box.stderr33
-rw-r--r--src/test/ui/consts/miri_unleashed/const_refers_to_static.rs3
-rw-r--r--src/test/ui/consts/miri_unleashed/const_refers_to_static.stderr67
-rw-r--r--src/test/ui/consts/miri_unleashed/const_refers_to_static2.rs2
-rw-r--r--src/test/ui/consts/miri_unleashed/const_refers_to_static2.stderr48
-rw-r--r--src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs4
-rw-r--r--src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.stderr127
-rw-r--r--src/test/ui/consts/miri_unleashed/drop.rs2
-rw-r--r--src/test/ui/consts/miri_unleashed/drop.stderr16
-rw-r--r--src/test/ui/consts/miri_unleashed/inline_asm.rs3
-rw-r--r--src/test/ui/consts/miri_unleashed/inline_asm.stderr20
-rw-r--r--src/test/ui/consts/miri_unleashed/mutable_const.rs2
-rw-r--r--src/test/ui/consts/miri_unleashed/mutable_const.stderr41
-rw-r--r--src/test/ui/consts/miri_unleashed/mutable_const2.rs3
-rw-r--r--src/test/ui/consts/miri_unleashed/mutable_const2.stderr6
-rw-r--r--src/test/ui/consts/miri_unleashed/mutable_references.rs6
-rw-r--r--src/test/ui/consts/miri_unleashed/mutable_references.stderr52
-rw-r--r--src/test/ui/consts/miri_unleashed/mutable_references_ice.rs2
-rw-r--r--src/test/ui/consts/miri_unleashed/mutable_references_ice.stderr16
-rw-r--r--src/test/ui/consts/miri_unleashed/non_const_fn.rs2
-rw-r--r--src/test/ui/consts/miri_unleashed/non_const_fn.stderr12
38 files changed, 343 insertions, 345 deletions
diff --git a/src/librustc_mir/transform/check_consts/validation.rs b/src/librustc_mir/transform/check_consts/validation.rs
index 727eb5b333a..5c1c3582d5c 100644
--- a/src/librustc_mir/transform/check_consts/validation.rs
+++ b/src/librustc_mir/transform/check_consts/validation.rs
@@ -253,13 +253,7 @@ impl Validator<'mir, 'tcx> {
         let is_unleashable = O::IS_SUPPORTED_IN_MIRI;
 
         if is_unleashable && self.tcx.sess.opts.debugging_opts.unleash_the_miri_inside_of_you {
-            // Use `def_span` to deduplicate all warnings for the same const.
-            self.tcx.sess.span_warn(self.tcx.def_span(self.def_id), "skipping const checks");
-            if let Some(feature) = O::feature_gate() {
-                // We'd like to use `delay_span_bug` here, but we cannot as that ICEs
-                // before codegen has the chance to emit errors.  So we use a custom system instead.
-                self.tcx.sess.miri_unleashed_feature(feature);
-            }
+            self.tcx.sess.miri_unleashed_feature(span, O::feature_gate());
             return;
         }
 
diff --git a/src/librustc_session/session.rs b/src/librustc_session/session.rs
index 3606a5c451a..922850f9940 100644
--- a/src/librustc_session/session.rs
+++ b/src/librustc_session/session.rs
@@ -27,7 +27,6 @@ use rustc_target::spec::{PanicStrategy, RelocModel, RelroLevel, Target, TargetTr
 
 use std::cell::{self, RefCell};
 use std::env;
-use std::fmt::Write as _;
 use std::io::Write;
 use std::num::NonZeroU32;
 use std::path::PathBuf;
@@ -144,9 +143,11 @@ pub struct Session {
     /// and immediately printing the backtrace to stderr.
     pub ctfe_backtrace: Lock<CtfeBacktrace>,
 
-    /// This tracks whether `-Zunleash-the-miri-inside-of-you` was used to get around a
-    /// feature gate.  If yes, this file must fail to compile.
-    miri_unleashed_features: Lock<FxHashSet<Symbol>>,
+    /// This tracks where `-Zunleash-the-miri-inside-of-you` was used to get around a
+    /// const check, optionally with the relevant feature gate.  We use this to
+    /// warn about unleashing, but with a single diagnostic instead of dozens that
+    /// drown everything else in noise.
+    miri_unleashed_features: Lock<Vec<(Span, Option<Symbol>)>>,
 
     /// Base directory containing the `src/` for the Rust standard library, and
     /// potentially `rustc` as well, if we can can find it. Right now it's always
@@ -195,29 +196,34 @@ impl From<&'static lint::Lint> for DiagnosticMessageId {
 }
 
 impl Session {
-    pub fn miri_unleashed_feature(&self, s: Symbol) {
-        self.miri_unleashed_features.lock().insert(s);
+    pub fn miri_unleashed_feature(&self, span: Span, feature_gate: Option<Symbol>) {
+        self.miri_unleashed_features.lock().push((span, feature_gate));
     }
 
     fn check_miri_unleashed_features(&self) {
-        if !self.has_errors_or_delayed_span_bugs() {
-            let unleashed_features = self.miri_unleashed_features.lock();
-            if !unleashed_features.is_empty() {
-                // Join the strings (itertools has it but libstd does not...)
-                let mut list = String::new();
-                for feature in unleashed_features.iter() {
-                    if !list.is_empty() {
-                        list.push_str(", ");
-                    }
-                    write!(&mut list, "{}", feature).unwrap();
+        let unleashed_features = self.miri_unleashed_features.lock();
+        if !unleashed_features.is_empty() {
+            let mut must_err = false;
+            // Create a diagnostic pointing at where things got unleashed.
+            let mut diag = self.struct_warn("skipping const checks");
+            for &(span, feature_gate) in unleashed_features.iter() {
+                // FIXME: `span_label` doesn't do anything, so we use "help" as a hack.
+                if let Some(feature_gate) = feature_gate {
+                    diag.span_help(span, &format!("skipping check for `{}` feature", feature_gate));
+                    // The unleash flag must *not* be used to just "hack around" feature gates.
+                    must_err = true;
+                } else {
+                    diag.span_help(span, "skipping check that does not even have a feature gate");
                 }
+            }
+            diag.emit();
+            // If we should err, make sure we did.
+            if must_err && !self.has_errors() {
                 // We have skipped a feature gate, and not run into other errors... reject.
-                self.err(&format!(
+                self.err(
                     "`-Zunleash-the-miri-inside-of-you` may not be used to circumvent feature \
-                    gates, except when testing error paths in the CTFE engine.\n\
-                    The following feature flags are missing from this crate: {}",
-                    list,
-                ));
+                     gates, except when testing error paths in the CTFE engine"
+                );
             }
         }
     }
diff --git a/src/test/ui/consts/const-eval/const_fn_ptr.rs b/src/test/ui/consts/const-eval/const_fn_ptr.rs
index 4d9a5838071..045fe9ad11a 100644
--- a/src/test/ui/consts/const-eval/const_fn_ptr.rs
+++ b/src/test/ui/consts/const-eval/const_fn_ptr.rs
@@ -8,15 +8,15 @@ const fn double_const(x: usize) -> usize { x * 2 }
 const X: fn(usize) -> usize = double;
 const X_CONST: fn(usize) -> usize = double_const;
 
-const fn bar(x: usize) -> usize { //~ WARNING skipping const checks
+const fn bar(x: usize) -> usize {
     X(x)
 }
 
-const fn bar_const(x: usize) -> usize { //~ WARNING skipping const checks
+const fn bar_const(x: usize) -> usize {
     X_CONST(x)
 }
 
-const fn foo(x: fn(usize) -> usize, y: usize)  -> usize { //~ WARNING skipping const checks
+const fn foo(x: fn(usize) -> usize, y: usize)  -> usize {
     x(y)
 }
 
diff --git a/src/test/ui/consts/const-eval/const_fn_ptr.stderr b/src/test/ui/consts/const-eval/const_fn_ptr.stderr
index d129954c775..d0ae94079da 100644
--- a/src/test/ui/consts/const-eval/const_fn_ptr.stderr
+++ b/src/test/ui/consts/const-eval/const_fn_ptr.stderr
@@ -1,26 +1,20 @@
 warning: skipping const checks
-  --> $DIR/const_fn_ptr.rs:11:1
    |
-LL | / const fn bar(x: usize) -> usize {
-LL | |     X(x)
-LL | | }
-   | |_^
-
-warning: skipping const checks
-  --> $DIR/const_fn_ptr.rs:15:1
+help: skipping check that does not even have a feature gate
+  --> $DIR/const_fn_ptr.rs:12:5
    |
-LL | / const fn bar_const(x: usize) -> usize {
-LL | |     X_CONST(x)
-LL | | }
-   | |_^
-
-warning: skipping const checks
-  --> $DIR/const_fn_ptr.rs:19:1
+LL |     X(x)
+   |     ^^^^
+help: skipping check that does not even have a feature gate
+  --> $DIR/const_fn_ptr.rs:16:5
+   |
+LL |     X_CONST(x)
+   |     ^^^^^^^^^^
+help: skipping check that does not even have a feature gate
+  --> $DIR/const_fn_ptr.rs:20:5
    |
-LL | / const fn foo(x: fn(usize) -> usize, y: usize)  -> usize {
-LL | |     x(y)
-LL | | }
-   | |_^
+LL |     x(y)
+   |     ^^^^
 
-warning: 3 warnings emitted
+warning: 1 warning emitted
 
diff --git a/src/test/ui/consts/const-eval/const_fn_ptr_fail.rs b/src/test/ui/consts/const-eval/const_fn_ptr_fail.rs
index 23ed003db26..14bd6558e7f 100644
--- a/src/test/ui/consts/const-eval/const_fn_ptr_fail.rs
+++ b/src/test/ui/consts/const-eval/const_fn_ptr_fail.rs
@@ -6,7 +6,7 @@
 fn double(x: usize) -> usize { x * 2 }
 const X: fn(usize) -> usize = double;
 
-const fn bar(x: usize) -> usize { //~ WARNING skipping const checks
+const fn bar(x: usize) -> usize {
     X(x) // FIXME: this should error someday
 }
 
diff --git a/src/test/ui/consts/const-eval/const_fn_ptr_fail.stderr b/src/test/ui/consts/const-eval/const_fn_ptr_fail.stderr
index 232ae750db2..0a7182fd39c 100644
--- a/src/test/ui/consts/const-eval/const_fn_ptr_fail.stderr
+++ b/src/test/ui/consts/const-eval/const_fn_ptr_fail.stderr
@@ -1,10 +1,10 @@
 warning: skipping const checks
-  --> $DIR/const_fn_ptr_fail.rs:9:1
    |
-LL | / const fn bar(x: usize) -> usize {
-LL | |     X(x) // FIXME: this should error someday
-LL | | }
-   | |_^
+help: skipping check that does not even have a feature gate
+  --> $DIR/const_fn_ptr_fail.rs:10:5
+   |
+LL |     X(x) // FIXME: this should error someday
+   |     ^^^^
 
 warning: 1 warning emitted
 
diff --git a/src/test/ui/consts/const-eval/const_fn_ptr_fail2.rs b/src/test/ui/consts/const-eval/const_fn_ptr_fail2.rs
index fb58b0f287d..f67871e6142 100644
--- a/src/test/ui/consts/const-eval/const_fn_ptr_fail2.rs
+++ b/src/test/ui/consts/const-eval/const_fn_ptr_fail2.rs
@@ -9,7 +9,7 @@ fn double(x: usize) -> usize {
 }
 const X: fn(usize) -> usize = double;
 
-const fn bar(x: fn(usize) -> usize, y: usize) -> usize { //~ WARN skipping const checks
+const fn bar(x: fn(usize) -> usize, y: usize) -> usize {
     x(y)
 }
 
diff --git a/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr b/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr
index 28ed7566fdc..90ee2afa315 100644
--- a/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr
+++ b/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr
@@ -1,11 +1,3 @@
-warning: skipping const checks
-  --> $DIR/const_fn_ptr_fail2.rs:12:1
-   |
-LL | / const fn bar(x: fn(usize) -> usize, y: usize) -> usize {
-LL | |     x(y)
-LL | | }
-   | |_^
-
 error[E0080]: evaluation of constant expression failed
   --> $DIR/const_fn_ptr_fail2.rs:20:5
    |
@@ -26,6 +18,14 @@ LL |     assert_eq!(Z, 4);
    |
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
+warning: skipping const checks
+   |
+help: skipping check that does not even have a feature gate
+  --> $DIR/const_fn_ptr_fail2.rs:13:5
+   |
+LL |     x(y)
+   |     ^^^^
+
 error: aborting due to 2 previous errors; 1 warning emitted
 
 For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/const-points-to-static.rs b/src/test/ui/consts/const-points-to-static.rs
index b998b7a97be..7087b6e6a67 100644
--- a/src/test/ui/consts/const-points-to-static.rs
+++ b/src/test/ui/consts/const-points-to-static.rs
@@ -3,8 +3,9 @@
 #![allow(dead_code)]
 
 const TEST: &u8 = &MY_STATIC;
-//~^ skipping const checks
-//~| it is undefined behavior to use this value
+//~^ ERROR it is undefined behavior to use this value
+//~| NOTE  encountered a reference pointing to a static variable
+//~| NOTE
 
 static MY_STATIC: u8 = 4;
 
diff --git a/src/test/ui/consts/const-points-to-static.stderr b/src/test/ui/consts/const-points-to-static.stderr
index b31e3020b83..465537fb3d5 100644
--- a/src/test/ui/consts/const-points-to-static.stderr
+++ b/src/test/ui/consts/const-points-to-static.stderr
@@ -1,9 +1,3 @@
-warning: skipping const checks
-  --> $DIR/const-points-to-static.rs:5:1
-   |
-LL | const TEST: &u8 = &MY_STATIC;
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
 error[E0080]: it is undefined behavior to use this value
   --> $DIR/const-points-to-static.rs:5:1
    |
@@ -12,6 +6,14 @@ LL | const TEST: &u8 = &MY_STATIC;
    |
    = 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-points-to-static.rs:5:20
+   |
+LL | const TEST: &u8 = &MY_STATIC;
+   |                    ^^^^^^^^^
+
 error: aborting due to previous error; 1 warning emitted
 
 For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/const-prop-read-static-in-const.rs b/src/test/ui/consts/const-prop-read-static-in-const.rs
index 14ec064e4ce..13b1b2d1412 100644
--- a/src/test/ui/consts/const-prop-read-static-in-const.rs
+++ b/src/test/ui/consts/const-prop-read-static-in-const.rs
@@ -3,7 +3,6 @@
 #![allow(dead_code)]
 
 const TEST: u8 = MY_STATIC; //~ ERROR any use of this value will cause an error
-//~^ skipping const checks
 
 static MY_STATIC: u8 = 4;
 
diff --git a/src/test/ui/consts/const-prop-read-static-in-const.stderr b/src/test/ui/consts/const-prop-read-static-in-const.stderr
index 953483a8add..7a517d1d7b3 100644
--- a/src/test/ui/consts/const-prop-read-static-in-const.stderr
+++ b/src/test/ui/consts/const-prop-read-static-in-const.stderr
@@ -1,9 +1,3 @@
-warning: skipping const checks
-  --> $DIR/const-prop-read-static-in-const.rs:5:1
-   |
-LL | const TEST: u8 = MY_STATIC;
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
 error: any use of this value will cause an error
   --> $DIR/const-prop-read-static-in-const.rs:5:18
    |
@@ -14,5 +8,13 @@ LL | const TEST: u8 = MY_STATIC;
    |
    = note: `#[deny(const_err)]` on by default
 
+warning: skipping const checks
+   |
+help: skipping check that does not even have a feature gate
+  --> $DIR/const-prop-read-static-in-const.rs:5:18
+   |
+LL | const TEST: u8 = MY_STATIC;
+   |                  ^^^^^^^^^
+
 error: aborting due to previous error; 1 warning emitted
 
diff --git a/src/test/ui/consts/miri_unleashed/abi-mismatch.rs b/src/test/ui/consts/miri_unleashed/abi-mismatch.rs
index 7297e91e697..ae440d4f8f7 100644
--- a/src/test/ui/consts/miri_unleashed/abi-mismatch.rs
+++ b/src/test/ui/consts/miri_unleashed/abi-mismatch.rs
@@ -7,7 +7,6 @@
 const extern "C" fn c_fn() {}
 
 const fn call_rust_fn(my_fn: extern "Rust" fn()) {
-//~^ WARN skipping const checks
     my_fn();
     //~^ ERROR could not evaluate static initializer
     //~| NOTE calling a function with ABI C using caller ABI Rust
@@ -15,7 +14,6 @@ const fn call_rust_fn(my_fn: extern "Rust" fn()) {
 }
 
 static VAL: () = call_rust_fn(unsafe { std::mem::transmute(c_fn as extern "C" fn()) });
-//~^ WARN skipping const checks
-//~| NOTE inside `VAL`
+//~^ NOTE inside `VAL`
 
 fn main() {}
diff --git a/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr b/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr
index 6f9681e3981..d55090c75e6 100644
--- a/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr
+++ b/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr
@@ -1,33 +1,28 @@
-warning: skipping const checks
-  --> $DIR/abi-mismatch.rs:9:1
-   |
-LL | / const fn call_rust_fn(my_fn: extern "Rust" fn()) {
-LL | |
-LL | |     my_fn();
-LL | |
-LL | |
-LL | |
-LL | | }
-   | |_^
-
-warning: skipping const checks
-  --> $DIR/abi-mismatch.rs:17:1
-   |
-LL | static VAL: () = call_rust_fn(unsafe { std::mem::transmute(c_fn as extern "C" fn()) });
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
 error[E0080]: could not evaluate static initializer
-  --> $DIR/abi-mismatch.rs:11:5
+  --> $DIR/abi-mismatch.rs:10:5
    |
 LL |     my_fn();
    |     ^^^^^^^
    |     |
    |     calling a function with ABI C using caller ABI Rust
-   |     inside `call_rust_fn` at $DIR/abi-mismatch.rs:11:5
+   |     inside `call_rust_fn` at $DIR/abi-mismatch.rs:10:5
 ...
 LL | static VAL: () = call_rust_fn(unsafe { std::mem::transmute(c_fn as extern "C" fn()) });
-   |                  --------------------------------------------------------------------- inside `VAL` at $DIR/abi-mismatch.rs:17:18
+   |                  --------------------------------------------------------------------- inside `VAL` at $DIR/abi-mismatch.rs:16:18
+
+warning: skipping const checks
+   |
+help: skipping check that does not even have a feature gate
+  --> $DIR/abi-mismatch.rs:10:5
+   |
+LL |     my_fn();
+   |     ^^^^^^^
+help: skipping check that does not even have a feature gate
+  --> $DIR/abi-mismatch.rs:16:40
+   |
+LL | static VAL: () = call_rust_fn(unsafe { std::mem::transmute(c_fn as extern "C" fn()) });
+   |                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: aborting due to previous error; 2 warnings emitted
+error: aborting due to previous error; 1 warning emitted
 
 For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/miri_unleashed/assoc_const.rs b/src/test/ui/consts/miri_unleashed/assoc_const.rs
index cfbcc959d3b..5f520c2cfdb 100644
--- a/src/test/ui/consts/miri_unleashed/assoc_const.rs
+++ b/src/test/ui/consts/miri_unleashed/assoc_const.rs
@@ -11,7 +11,7 @@ trait Foo<T> {
 }
 
 trait Bar<T, U: Foo<T>> {
-    const F: u32 = (U::X, 42).1; //~ WARN skipping const checks
+    const F: u32 = (U::X, 42).1;
 }
 
 impl Foo<u32> for () {
diff --git a/src/test/ui/consts/miri_unleashed/assoc_const.stderr b/src/test/ui/consts/miri_unleashed/assoc_const.stderr
index 60fec1fb092..193a49bb266 100644
--- a/src/test/ui/consts/miri_unleashed/assoc_const.stderr
+++ b/src/test/ui/consts/miri_unleashed/assoc_const.stderr
@@ -1,15 +1,17 @@
-warning: skipping const checks
-  --> $DIR/assoc_const.rs:14:5
-   |
-LL |     const F: u32 = (U::X, 42).1;
-   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
 error[E0080]: erroneous constant used
   --> $DIR/assoc_const.rs:31:13
    |
 LL |     let y = <String as Bar<Vec<u32>, String>>::F;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
 
+warning: skipping const checks
+   |
+help: skipping check that does not even have a feature gate
+  --> $DIR/assoc_const.rs:14:20
+   |
+LL |     const F: u32 = (U::X, 42).1;
+   |                    ^^^^^^^^^^
+
 error: aborting due to previous error; 1 warning emitted
 
 For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/miri_unleashed/box.rs b/src/test/ui/consts/miri_unleashed/box.rs
index 98dea797b69..133ac7649c8 100644
--- a/src/test/ui/consts/miri_unleashed/box.rs
+++ b/src/test/ui/consts/miri_unleashed/box.rs
@@ -6,7 +6,7 @@ use std::mem::ManuallyDrop;
 
 fn main() {}
 
-static TEST_BAD: &mut i32 = { //~ WARN skipping const checks
+static TEST_BAD: &mut i32 = {
     &mut *(box 0)
     //~^ ERROR could not evaluate static initializer
     //~| NOTE heap allocations
diff --git a/src/test/ui/consts/miri_unleashed/box.stderr b/src/test/ui/consts/miri_unleashed/box.stderr
index cf405d06b82..768b795ca5b 100644
--- a/src/test/ui/consts/miri_unleashed/box.stderr
+++ b/src/test/ui/consts/miri_unleashed/box.stderr
@@ -1,19 +1,32 @@
-warning: skipping const checks
-  --> $DIR/box.rs:9:1
-   |
-LL | / static TEST_BAD: &mut i32 = {
-LL | |     &mut *(box 0)
-LL | |
-LL | |
-LL | | };
-   | |__^
-
 error[E0080]: could not evaluate static initializer
   --> $DIR/box.rs:10:11
    |
 LL |     &mut *(box 0)
    |           ^^^^^^^ "heap allocations via `box` keyword" needs an rfc before being allowed inside constants
 
+warning: skipping const checks
+   |
+help: skipping check that does not even have a feature gate
+  --> $DIR/box.rs:10:11
+   |
+LL |     &mut *(box 0)
+   |           ^^^^^^^
+help: skipping check for `const_mut_refs` feature
+  --> $DIR/box.rs:10:16
+   |
+LL |     &mut *(box 0)
+   |                ^
+help: skipping check for `const_mut_refs` feature
+  --> $DIR/box.rs:10:5
+   |
+LL |     &mut *(box 0)
+   |     ^^^^^^^^^^^^^
+help: skipping check for `const_mut_refs` feature
+  --> $DIR/box.rs:10:5
+   |
+LL |     &mut *(box 0)
+   |     ^^^^^^^^^^^^^
+
 error: aborting due to previous error; 1 warning emitted
 
 For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static.rs b/src/test/ui/consts/miri_unleashed/const_refers_to_static.rs
index 7c8cdaec4a1..a769bfd78d3 100644
--- a/src/test/ui/consts/miri_unleashed/const_refers_to_static.rs
+++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static.rs
@@ -9,20 +9,17 @@ use std::sync::atomic::Ordering;
 // when *using* the const.
 
 const MUTATE_INTERIOR_MUT: usize = {
-//~^ WARN skipping const checks
     static FOO: AtomicUsize = AtomicUsize::new(0);
     FOO.fetch_add(1, Ordering::Relaxed)
 };
 
 const READ_INTERIOR_MUT: usize = {
-//~^ WARN skipping const checks
     static FOO: AtomicUsize = AtomicUsize::new(0);
     unsafe { *(&FOO as *const _ as *const usize) }
 };
 
 static mut MUTABLE: u32 = 0;
 const READ_MUT: u32 = unsafe { MUTABLE };
-//~^ WARN skipping const checks
 
 fn main() {
     MUTATE_INTERIOR_MUT;
diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static.stderr b/src/test/ui/consts/miri_unleashed/const_refers_to_static.stderr
index 7e049647cfd..e5cd86b3d6c 100644
--- a/src/test/ui/consts/miri_unleashed/const_refers_to_static.stderr
+++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static.stderr
@@ -1,47 +1,54 @@
-warning: skipping const checks
-  --> $DIR/const_refers_to_static.rs:11:1
-   |
-LL | / const MUTATE_INTERIOR_MUT: usize = {
-LL | |
-LL | |     static FOO: AtomicUsize = AtomicUsize::new(0);
-LL | |     FOO.fetch_add(1, Ordering::Relaxed)
-LL | | };
-   | |__^
-
-warning: skipping const checks
-  --> $DIR/const_refers_to_static.rs:17:1
-   |
-LL | / const READ_INTERIOR_MUT: usize = {
-LL | |
-LL | |     static FOO: AtomicUsize = AtomicUsize::new(0);
-LL | |     unsafe { *(&FOO as *const _ as *const usize) }
-LL | | };
-   | |__^
-
-warning: skipping const checks
-  --> $DIR/const_refers_to_static.rs:24:1
-   |
-LL | const READ_MUT: u32 = unsafe { MUTABLE };
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
 error[E0080]: erroneous constant used
-  --> $DIR/const_refers_to_static.rs:28:5
+  --> $DIR/const_refers_to_static.rs:25:5
    |
 LL |     MUTATE_INTERIOR_MUT;
    |     ^^^^^^^^^^^^^^^^^^^ referenced constant has errors
 
 error[E0080]: erroneous constant used
-  --> $DIR/const_refers_to_static.rs:30:5
+  --> $DIR/const_refers_to_static.rs:27:5
    |
 LL |     READ_INTERIOR_MUT;
    |     ^^^^^^^^^^^^^^^^^ referenced constant has errors
 
 error[E0080]: erroneous constant used
-  --> $DIR/const_refers_to_static.rs:32:5
+  --> $DIR/const_refers_to_static.rs:29:5
    |
 LL |     READ_MUT;
    |     ^^^^^^^^ referenced constant has errors
 
-error: aborting due to 3 previous errors; 3 warnings emitted
+warning: skipping const checks
+   |
+help: skipping check that does not even have a feature gate
+  --> $DIR/const_refers_to_static.rs:13:5
+   |
+LL |     FOO.fetch_add(1, Ordering::Relaxed)
+   |     ^^^
+help: skipping check that does not even have a feature gate
+  --> $DIR/const_refers_to_static.rs:13:5
+   |
+LL |     FOO.fetch_add(1, Ordering::Relaxed)
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+help: skipping check that does not even have a feature gate
+  --> $DIR/const_refers_to_static.rs:18:17
+   |
+LL |     unsafe { *(&FOO as *const _ as *const usize) }
+   |                 ^^^
+help: skipping check for `const_raw_ptr_deref` feature
+  --> $DIR/const_refers_to_static.rs:18:14
+   |
+LL |     unsafe { *(&FOO as *const _ as *const usize) }
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+help: skipping check that does not even have a feature gate
+  --> $DIR/const_refers_to_static.rs:22:32
+   |
+LL | const READ_MUT: u32 = unsafe { MUTABLE };
+   |                                ^^^^^^^
+help: skipping check that does not even have a feature gate
+  --> $DIR/const_refers_to_static.rs:22:32
+   |
+LL | const READ_MUT: u32 = unsafe { MUTABLE };
+   |                                ^^^^^^^
+
+error: aborting due to 3 previous errors; 1 warning emitted
 
 For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static2.rs b/src/test/ui/consts/miri_unleashed/const_refers_to_static2.rs
index b8eccdb53ea..4e67ff704e6 100644
--- a/src/test/ui/consts/miri_unleashed/const_refers_to_static2.rs
+++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static2.rs
@@ -8,7 +8,6 @@ use std::sync::atomic::Ordering;
 // so they cause an immediate error when *defining* the const.
 
 const REF_INTERIOR_MUT: &usize = { //~ ERROR undefined behavior to use this value
-//~^ WARN skipping const checks
 //~| NOTE encountered a reference pointing to a static variable
 //~| NOTE
     static FOO: AtomicUsize = AtomicUsize::new(0);
@@ -17,7 +16,6 @@ const REF_INTERIOR_MUT: &usize = { //~ ERROR undefined behavior to use this valu
 
 // ok some day perhaps
 const READ_IMMUT: &usize = { //~ ERROR it is undefined behavior to use this value
-//~^ WARN skipping const checks
 //~| NOTE encountered a reference pointing to a static variable
 //~| NOTE
     static FOO: usize = 0;
diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static2.stderr b/src/test/ui/consts/miri_unleashed/const_refers_to_static2.stderr
index bb197884141..2e40b38dac7 100644
--- a/src/test/ui/consts/miri_unleashed/const_refers_to_static2.stderr
+++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static2.stderr
@@ -1,34 +1,9 @@
-warning: skipping const checks
-  --> $DIR/const_refers_to_static2.rs:10:1
-   |
-LL | / const REF_INTERIOR_MUT: &usize = {
-LL | |
-LL | |
-LL | |
-LL | |     static FOO: AtomicUsize = AtomicUsize::new(0);
-LL | |     unsafe { &*(&FOO as *const _ as *const usize) }
-LL | | };
-   | |__^
-
-warning: skipping const checks
-  --> $DIR/const_refers_to_static2.rs:19:1
-   |
-LL | / const READ_IMMUT: &usize = {
-LL | |
-LL | |
-LL | |
-LL | |     static FOO: usize = 0;
-LL | |     &FOO
-LL | | };
-   | |__^
-
 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 | |
 LL | |     static FOO: AtomicUsize = AtomicUsize::new(0);
 LL | |     unsafe { &*(&FOO as *const _ as *const usize) }
 LL | | };
@@ -37,12 +12,11 @@ LL | | };
    = 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:19:1
+  --> $DIR/const_refers_to_static2.rs:18:1
    |
 LL | / const READ_IMMUT: &usize = {
 LL | |
 LL | |
-LL | |
 LL | |     static FOO: usize = 0;
 LL | |     &FOO
 LL | | };
@@ -50,6 +24,24 @@ LL | | };
    |
    = 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: aborting due to 2 previous errors; 2 warnings emitted
+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`.
diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs b/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs
index 81a15afed8b..e159c109bfd 100644
--- a/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs
+++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs
@@ -9,14 +9,12 @@ extern crate static_cross_crate;
 // Sneaky: reference to a mutable static.
 // Allowing this would be a disaster for pattern matching, we could violate exhaustiveness checking!
 const SLICE_MUT: &[u8; 1] = { //~ ERROR undefined behavior to use this value
-//~^ WARN skipping const checks
 //~| NOTE encountered a reference pointing to a static variable
 //~| NOTE
     unsafe { &static_cross_crate::ZERO }
 };
 
 const U8_MUT: &u8 = { //~ ERROR undefined behavior to use this value
-//~^ WARN skipping const checks
 //~| NOTE encountered a reference pointing to a static variable
 //~| NOTE
     unsafe { &static_cross_crate::ZERO[0] }
@@ -25,14 +23,12 @@ const U8_MUT: &u8 = { //~ ERROR undefined behavior to use this value
 // Also test indirection that reads from other static. This causes a const_err.
 #[warn(const_err)] //~ NOTE
 const U8_MUT2: &u8 = { //~ NOTE
-//~^ WARN skipping const checks
     unsafe { &(*static_cross_crate::ZERO_REF)[0] }
     //~^ WARN [const_err]
     //~| NOTE constant accesses static
 };
 #[warn(const_err)] //~ NOTE
 const U8_MUT3: &u8 = { //~ NOTE
-//~^ WARN skipping const checks
     unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
     //~^ WARN [const_err]
     //~| NOTE constant accesses static
diff --git a/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.stderr b/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.stderr
index ffb428506ea..b44ac5633d5 100644
--- a/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.stderr
+++ b/src/test/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.stderr
@@ -1,21 +1,9 @@
-warning: skipping const checks
-  --> $DIR/const_refers_to_static_cross_crate.rs:11:1
-   |
-LL | / const SLICE_MUT: &[u8; 1] = {
-LL | |
-LL | |
-LL | |
-LL | |     unsafe { &static_cross_crate::ZERO }
-LL | | };
-   | |__^
-
 error[E0080]: it is undefined behavior to use this value
   --> $DIR/const_refers_to_static_cross_crate.rs:11:1
    |
 LL | / const SLICE_MUT: &[u8; 1] = {
 LL | |
 LL | |
-LL | |
 LL | |     unsafe { &static_cross_crate::ZERO }
 LL | | };
    | |__^ type validation failed: encountered a reference pointing to a static variable
@@ -23,29 +11,17 @@ LL | | };
    = 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: could not evaluate constant pattern
-  --> $DIR/const_refers_to_static_cross_crate.rs:43:9
+  --> $DIR/const_refers_to_static_cross_crate.rs:39:9
    |
 LL |         SLICE_MUT => true,
    |         ^^^^^^^^^
 
-warning: skipping const checks
-  --> $DIR/const_refers_to_static_cross_crate.rs:18:1
-   |
-LL | / const U8_MUT: &u8 = {
-LL | |
-LL | |
-LL | |
-LL | |     unsafe { &static_cross_crate::ZERO[0] }
-LL | | };
-   | |__^
-
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/const_refers_to_static_cross_crate.rs:18:1
+  --> $DIR/const_refers_to_static_cross_crate.rs:17:1
    |
 LL | / const U8_MUT: &u8 = {
 LL | |
 LL | |
-LL | |
 LL | |     unsafe { &static_cross_crate::ZERO[0] }
 LL | | };
    | |__^ type validation failed: encountered a reference pointing to a static variable
@@ -53,27 +29,15 @@ LL | | };
    = 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: could not evaluate constant pattern
-  --> $DIR/const_refers_to_static_cross_crate.rs:51:9
+  --> $DIR/const_refers_to_static_cross_crate.rs:47:9
    |
 LL |         U8_MUT => true,
    |         ^^^^^^
 
-warning: skipping const checks
-  --> $DIR/const_refers_to_static_cross_crate.rs:27:1
-   |
-LL | / const U8_MUT2: &u8 = {
-LL | |
-LL | |     unsafe { &(*static_cross_crate::ZERO_REF)[0] }
-LL | |
-LL | |
-LL | | };
-   | |__^
-
 warning: any use of this value will cause an error
-  --> $DIR/const_refers_to_static_cross_crate.rs:29:14
+  --> $DIR/const_refers_to_static_cross_crate.rs:26:14
    |
 LL | / const U8_MUT2: &u8 = {
-LL | |
 LL | |     unsafe { &(*static_cross_crate::ZERO_REF)[0] }
    | |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static
 LL | |
@@ -82,33 +46,21 @@ LL | | };
    | |__-
    |
 note: the lint level is defined here
-  --> $DIR/const_refers_to_static_cross_crate.rs:26:8
+  --> $DIR/const_refers_to_static_cross_crate.rs:24:8
    |
 LL | #[warn(const_err)]
    |        ^^^^^^^^^
 
 error: could not evaluate constant pattern
-  --> $DIR/const_refers_to_static_cross_crate.rs:61:9
+  --> $DIR/const_refers_to_static_cross_crate.rs:57:9
    |
 LL |         U8_MUT2 => true,
    |         ^^^^^^^
 
-warning: skipping const checks
-  --> $DIR/const_refers_to_static_cross_crate.rs:34:1
-   |
-LL | / const U8_MUT3: &u8 = {
-LL | |
-LL | |     unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
-LL | |
-LL | |
-LL | | };
-   | |__^
-
 warning: any use of this value will cause an error
-  --> $DIR/const_refers_to_static_cross_crate.rs:36:51
+  --> $DIR/const_refers_to_static_cross_crate.rs:32:51
    |
 LL | / const U8_MUT3: &u8 = {
-LL | |
 LL | |     unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
    | |                                                   ^^^^^^^^^^^ constant accesses static
 LL | |
@@ -117,17 +69,76 @@ LL | | };
    | |__-
    |
 note: the lint level is defined here
-  --> $DIR/const_refers_to_static_cross_crate.rs:33:8
+  --> $DIR/const_refers_to_static_cross_crate.rs:30:8
    |
 LL | #[warn(const_err)]
    |        ^^^^^^^^^
 
 error: could not evaluate constant pattern
-  --> $DIR/const_refers_to_static_cross_crate.rs:68:9
+  --> $DIR/const_refers_to_static_cross_crate.rs:64:9
    |
 LL |         U8_MUT3 => true,
    |         ^^^^^^^
 
-error: aborting due to 6 previous errors; 6 warnings emitted
+warning: skipping const checks
+   |
+help: skipping check that does not even have a feature gate
+  --> $DIR/const_refers_to_static_cross_crate.rs:14:15
+   |
+LL |     unsafe { &static_cross_crate::ZERO }
+   |               ^^^^^^^^^^^^^^^^^^^^^^^^
+help: skipping check that does not even have a feature gate
+  --> $DIR/const_refers_to_static_cross_crate.rs:14:15
+   |
+LL |     unsafe { &static_cross_crate::ZERO }
+   |               ^^^^^^^^^^^^^^^^^^^^^^^^
+help: skipping check that does not even have a feature gate
+  --> $DIR/const_refers_to_static_cross_crate.rs:20:15
+   |
+LL |     unsafe { &static_cross_crate::ZERO[0] }
+   |               ^^^^^^^^^^^^^^^^^^^^^^^^
+help: skipping check that does not even have a feature gate
+  --> $DIR/const_refers_to_static_cross_crate.rs:20:15
+   |
+LL |     unsafe { &static_cross_crate::ZERO[0] }
+   |               ^^^^^^^^^^^^^^^^^^^^^^^^
+help: skipping check that does not even have a feature gate
+  --> $DIR/const_refers_to_static_cross_crate.rs:20:15
+   |
+LL |     unsafe { &static_cross_crate::ZERO[0] }
+   |               ^^^^^^^^^^^^^^^^^^^^^^^^
+help: skipping check that does not even have a feature gate
+  --> $DIR/const_refers_to_static_cross_crate.rs:26:17
+   |
+LL |     unsafe { &(*static_cross_crate::ZERO_REF)[0] }
+   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+help: skipping check that does not even have a feature gate
+  --> $DIR/const_refers_to_static_cross_crate.rs:32:20
+   |
+LL |     unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
+   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+help: skipping check that does not even have a feature gate
+  --> $DIR/const_refers_to_static_cross_crate.rs:32:20
+   |
+LL |     unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
+   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+help: skipping check that does not even have a feature gate
+  --> $DIR/const_refers_to_static_cross_crate.rs:32:20
+   |
+LL |     unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
+   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+help: skipping check for `const_panic` feature
+  --> $DIR/const_refers_to_static_cross_crate.rs:32:77
+   |
+LL |     unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
+   |                                                                             ^^^^^^^^
+help: skipping check that does not even have a feature gate
+  --> $DIR/const_refers_to_static_cross_crate.rs:32:20
+   |
+LL |     unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
+   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 6 previous errors; 3 warnings emitted
 
 For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/miri_unleashed/drop.rs b/src/test/ui/consts/miri_unleashed/drop.rs
index b873b972307..9bd56e81cbf 100644
--- a/src/test/ui/consts/miri_unleashed/drop.rs
+++ b/src/test/ui/consts/miri_unleashed/drop.rs
@@ -13,6 +13,6 @@ static TEST_OK: () = {
 
 // Make sure we catch executing bad drop functions.
 // The actual error is tested by the error-pattern above.
-static TEST_BAD: () = { //~ WARN skipping const checks
+static TEST_BAD: () = {
     let _v: Vec<i32> = Vec::new();
 };
diff --git a/src/test/ui/consts/miri_unleashed/drop.stderr b/src/test/ui/consts/miri_unleashed/drop.stderr
index dfefd7f2d31..34ab5155e22 100644
--- a/src/test/ui/consts/miri_unleashed/drop.stderr
+++ b/src/test/ui/consts/miri_unleashed/drop.stderr
@@ -1,11 +1,3 @@
-warning: skipping const checks
-  --> $DIR/drop.rs:16:1
-   |
-LL | / static TEST_BAD: () = {
-LL | |     let _v: Vec<i32> = Vec::new();
-LL | | };
-   | |__^
-
 error[E0080]: could not evaluate static initializer
   --> $SRC_DIR/libcore/ptr/mod.rs:LL:COL
    |
@@ -24,6 +16,14 @@ LL | | }
 LL |   };
    |   - inside `TEST_BAD` at $DIR/drop.rs:18:1
 
+warning: skipping const checks
+   |
+help: skipping check that does not even have a feature gate
+  --> $DIR/drop.rs:17:9
+   |
+LL |     let _v: Vec<i32> = Vec::new();
+   |         ^^
+
 error: aborting due to previous error; 1 warning emitted
 
 For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/miri_unleashed/inline_asm.rs b/src/test/ui/consts/miri_unleashed/inline_asm.rs
index c8c6553ed39..7b2b1ed4965 100644
--- a/src/test/ui/consts/miri_unleashed/inline_asm.rs
+++ b/src/test/ui/consts/miri_unleashed/inline_asm.rs
@@ -6,9 +6,10 @@
 fn main() {}
 
 // Make sure we catch executing inline assembly.
-static TEST_BAD: () = { //~ WARN skipping const checks
+static TEST_BAD: () = {
     unsafe { llvm_asm!("xor %eax, %eax" ::: "eax"); }
     //~^ ERROR could not evaluate static initializer
     //~| NOTE inline assembly is not supported
     //~| NOTE in this expansion of llvm_asm!
+    //~| NOTE in this expansion of llvm_asm!
 };
diff --git a/src/test/ui/consts/miri_unleashed/inline_asm.stderr b/src/test/ui/consts/miri_unleashed/inline_asm.stderr
index ef11c5b1d1a..0f5ee5de396 100644
--- a/src/test/ui/consts/miri_unleashed/inline_asm.stderr
+++ b/src/test/ui/consts/miri_unleashed/inline_asm.stderr
@@ -1,14 +1,3 @@
-warning: skipping const checks
-  --> $DIR/inline_asm.rs:9:1
-   |
-LL | / static TEST_BAD: () = {
-LL | |     unsafe { llvm_asm!("xor %eax, %eax" ::: "eax"); }
-LL | |
-LL | |
-LL | |
-LL | | };
-   | |__^
-
 error[E0080]: could not evaluate static initializer
   --> $DIR/inline_asm.rs:10:14
    |
@@ -17,6 +6,15 @@ LL |     unsafe { llvm_asm!("xor %eax, %eax" ::: "eax"); }
    |
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
+warning: skipping const checks
+   |
+help: skipping check that does not even have a feature gate
+  --> $DIR/inline_asm.rs:10:14
+   |
+LL |     unsafe { llvm_asm!("xor %eax, %eax" ::: "eax"); }
+   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   = note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
+
 error: aborting due to previous error; 1 warning emitted
 
 For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/miri_unleashed/mutable_const.rs b/src/test/ui/consts/miri_unleashed/mutable_const.rs
index 955ba90674b..5aae34e93d4 100644
--- a/src/test/ui/consts/miri_unleashed/mutable_const.rs
+++ b/src/test/ui/consts/miri_unleashed/mutable_const.rs
@@ -11,10 +11,8 @@ use std::cell::UnsafeCell;
 
 // make sure we do not just intern this as mutable
 const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
-//~^ WARN: skipping const checks
 
 const MUTATING_BEHIND_RAW: () = { //~ NOTE
-//~^ WARN skipping const checks
     // Test that `MUTABLE_BEHIND_RAW` is actually immutable, by doing this at const time.
     unsafe {
         *MUTABLE_BEHIND_RAW = 99 //~ ERROR any use of this value will cause an error
diff --git a/src/test/ui/consts/miri_unleashed/mutable_const.stderr b/src/test/ui/consts/miri_unleashed/mutable_const.stderr
index a1d9e7f1d5f..4772baf9d9a 100644
--- a/src/test/ui/consts/miri_unleashed/mutable_const.stderr
+++ b/src/test/ui/consts/miri_unleashed/mutable_const.stderr
@@ -1,26 +1,7 @@
-warning: skipping const checks
-  --> $DIR/mutable_const.rs:13:1
-   |
-LL | const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-warning: skipping const checks
-  --> $DIR/mutable_const.rs:16:1
-   |
-LL | / const MUTATING_BEHIND_RAW: () = {
-LL | |
-LL | |     // Test that `MUTABLE_BEHIND_RAW` is actually immutable, by doing this at const time.
-LL | |     unsafe {
-...  |
-LL | |     }
-LL | | };
-   | |__^
-
 error: any use of this value will cause an error
-  --> $DIR/mutable_const.rs:20:9
+  --> $DIR/mutable_const.rs:18:9
    |
 LL | / const MUTATING_BEHIND_RAW: () = {
-LL | |
 LL | |     // Test that `MUTABLE_BEHIND_RAW` is actually immutable, by doing this at const time.
 LL | |     unsafe {
 LL | |         *MUTABLE_BEHIND_RAW = 99
@@ -36,5 +17,23 @@ note: the lint level is defined here
 LL | #![deny(const_err)] // The `allow` variant is tested by `mutable_const2`.
    |         ^^^^^^^^^
 
-error: aborting due to previous error; 2 warnings emitted
+warning: skipping const checks
+   |
+help: skipping check that does not even have a feature gate
+  --> $DIR/mutable_const.rs:13:38
+   |
+LL | const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
+   |                                      ^^^^^^^^^^^^^^^^^^^^
+help: skipping check for `const_raw_ptr_deref` feature
+  --> $DIR/mutable_const.rs:18:9
+   |
+LL |         *MUTABLE_BEHIND_RAW = 99
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^
+help: skipping check for `const_mut_refs` feature
+  --> $DIR/mutable_const.rs:18:9
+   |
+LL |         *MUTABLE_BEHIND_RAW = 99
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error; 1 warning emitted
 
diff --git a/src/test/ui/consts/miri_unleashed/mutable_const2.rs b/src/test/ui/consts/miri_unleashed/mutable_const2.rs
index d5a5d06412f..867091af7ba 100644
--- a/src/test/ui/consts/miri_unleashed/mutable_const2.rs
+++ b/src/test/ui/consts/miri_unleashed/mutable_const2.rs
@@ -11,7 +11,6 @@ use std::cell::UnsafeCell;
 
 // make sure we do not just intern this as mutable
 const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
-//~^ WARN: skipping const checks
-//~| ERROR: mutable allocation in constant
+//~^ ERROR: mutable allocation in constant
 
 fn main() {}
diff --git a/src/test/ui/consts/miri_unleashed/mutable_const2.stderr b/src/test/ui/consts/miri_unleashed/mutable_const2.stderr
index 329805a48a3..98a1c8bdd89 100644
--- a/src/test/ui/consts/miri_unleashed/mutable_const2.stderr
+++ b/src/test/ui/consts/miri_unleashed/mutable_const2.stderr
@@ -1,8 +1,10 @@
 warning: skipping const checks
-  --> $DIR/mutable_const2.rs:13:1
+   |
+help: skipping check that does not even have a feature gate
+  --> $DIR/mutable_const2.rs:13:38
    |
 LL | const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |                                      ^^^^^^^^^^^^^^^^^^^^
 
 warning: 1 warning emitted
 
diff --git a/src/test/ui/consts/miri_unleashed/mutable_references.rs b/src/test/ui/consts/miri_unleashed/mutable_references.rs
index ca6b4286dc2..ed2ca86ba2c 100644
--- a/src/test/ui/consts/miri_unleashed/mutable_references.rs
+++ b/src/test/ui/consts/miri_unleashed/mutable_references.rs
@@ -7,18 +7,15 @@ use std::cell::UnsafeCell;
 
 // this is fine because is not possible to mutate through an immutable reference.
 static FOO: &&mut u32 = &&mut 42;
-//~^ WARN skipping const checks
 
 // this is fine because accessing an immutable static `BAR` is equivalent to accessing `*&BAR`
 // which puts the mutable reference behind an immutable one.
 static BAR: &mut () = &mut ();
-//~^ WARN skipping const checks
 
 struct Foo<T>(T);
 
 // this is fine for the same reason as `BAR`.
 static BOO: &mut Foo<()> = &mut Foo(());
-//~^ WARN skipping const checks
 
 struct Meh {
     x: &'static UnsafeCell<i32>,
@@ -26,13 +23,12 @@ struct Meh {
 
 unsafe impl Sync for Meh {}
 
-static MEH: Meh = Meh { //~ WARN skipping const checks
+static MEH: Meh = Meh {
     x: &UnsafeCell::new(42),
 };
 
 // this is fine for the same reason as `BAR`.
 static OH_YES: &mut i32 = &mut 42;
-//~^ WARN skipping const checks
 
 fn main() {
     unsafe {
diff --git a/src/test/ui/consts/miri_unleashed/mutable_references.stderr b/src/test/ui/consts/miri_unleashed/mutable_references.stderr
index 119f1ec3d5d..83c4e0ceba0 100644
--- a/src/test/ui/consts/miri_unleashed/mutable_references.stderr
+++ b/src/test/ui/consts/miri_unleashed/mutable_references.stderr
@@ -1,41 +1,37 @@
-warning: skipping const checks
-  --> $DIR/mutable_references.rs:9:1
+error[E0594]: cannot assign to `*OH_YES`, as `OH_YES` is an immutable static item
+  --> $DIR/mutable_references.rs:37:5
    |
-LL | static FOO: &&mut u32 = &&mut 42;
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL |     *OH_YES = 99;
+   |     ^^^^^^^^^^^^ cannot assign
 
 warning: skipping const checks
-  --> $DIR/mutable_references.rs:14:1
+   |
+help: skipping check for `const_mut_refs` feature
+  --> $DIR/mutable_references.rs:9:26
+   |
+LL | static FOO: &&mut u32 = &&mut 42;
+   |                          ^^^^^^^
+help: skipping check for `const_mut_refs` feature
+  --> $DIR/mutable_references.rs:13:23
    |
 LL | static BAR: &mut () = &mut ();
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-warning: skipping const checks
-  --> $DIR/mutable_references.rs:20:1
+   |                       ^^^^^^^
+help: skipping check for `const_mut_refs` feature
+  --> $DIR/mutable_references.rs:18:28
    |
 LL | static BOO: &mut Foo<()> = &mut Foo(());
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-warning: skipping const checks
-  --> $DIR/mutable_references.rs:29:1
+   |                            ^^^^^^^^^^^^
+help: skipping check that does not even have a feature gate
+  --> $DIR/mutable_references.rs:27:8
    |
-LL | / static MEH: Meh = Meh {
-LL | |     x: &UnsafeCell::new(42),
-LL | | };
-   | |__^
-
-warning: skipping const checks
-  --> $DIR/mutable_references.rs:34:1
+LL |     x: &UnsafeCell::new(42),
+   |        ^^^^^^^^^^^^^^^^^^^^
+help: skipping check for `const_mut_refs` feature
+  --> $DIR/mutable_references.rs:31:27
    |
 LL | static OH_YES: &mut i32 = &mut 42;
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error[E0594]: cannot assign to `*OH_YES`, as `OH_YES` is an immutable static item
-  --> $DIR/mutable_references.rs:41:5
-   |
-LL |     *OH_YES = 99;
-   |     ^^^^^^^^^^^^ cannot assign
+   |                           ^^^^^^^
 
-error: aborting due to previous error; 5 warnings emitted
+error: aborting due to previous error; 1 warning emitted
 
 For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/ui/consts/miri_unleashed/mutable_references_ice.rs b/src/test/ui/consts/miri_unleashed/mutable_references_ice.rs
index 0d2bb021251..7388aad2a9e 100644
--- a/src/test/ui/consts/miri_unleashed/mutable_references_ice.rs
+++ b/src/test/ui/consts/miri_unleashed/mutable_references_ice.rs
@@ -18,7 +18,7 @@ struct Meh {
 unsafe impl Sync for Meh {}
 
 // the following will never be ok!
-const MUH: Meh = Meh { //~ WARN skipping const checks
+const MUH: Meh = Meh {
     x: &UnsafeCell::new(42),
 };
 
diff --git a/src/test/ui/consts/miri_unleashed/mutable_references_ice.stderr b/src/test/ui/consts/miri_unleashed/mutable_references_ice.stderr
index 88da046ea00..7ddf77af4d3 100644
--- a/src/test/ui/consts/miri_unleashed/mutable_references_ice.stderr
+++ b/src/test/ui/consts/miri_unleashed/mutable_references_ice.stderr
@@ -1,11 +1,3 @@
-warning: skipping const checks
-  --> $DIR/mutable_references_ice.rs:21:1
-   |
-LL | / const MUH: Meh = Meh {
-LL | |     x: &UnsafeCell::new(42),
-LL | | };
-   | |__^
-
 thread 'rustc' panicked at 'assertion failed: `(left != right)`
   left: `Const`,
  right: `Const`: UnsafeCells are not allowed behind references in constants. This should have been prevented statically by const qualification. If this were allowed one would be able to change a constant at one use site and other use sites could observe that mutation.', src/librustc_mir/interpret/intern.rs:LL:CC
@@ -21,5 +13,13 @@ note: rustc VERSION running on TARGET
 
 note: compiler flags: FLAGS
 
+warning: skipping const checks
+   |
+help: skipping check that does not even have a feature gate
+  --> $DIR/mutable_references_ice.rs:22:8
+   |
+LL |     x: &UnsafeCell::new(42),
+   |        ^^^^^^^^^^^^^^^^^^^^
+
 warning: 1 warning emitted
 
diff --git a/src/test/ui/consts/miri_unleashed/non_const_fn.rs b/src/test/ui/consts/miri_unleashed/non_const_fn.rs
index b401884139d..70da94df7a2 100644
--- a/src/test/ui/consts/miri_unleashed/non_const_fn.rs
+++ b/src/test/ui/consts/miri_unleashed/non_const_fn.rs
@@ -6,7 +6,7 @@
 
 fn foo() {}
 
-static C: () = foo(); //~ WARN: skipping const checks
+static C: () = foo();
 //~^ ERROR could not evaluate static initializer
 //~| NOTE calling non-const function `foo`
 
diff --git a/src/test/ui/consts/miri_unleashed/non_const_fn.stderr b/src/test/ui/consts/miri_unleashed/non_const_fn.stderr
index 5b607748493..3e9658ad88e 100644
--- a/src/test/ui/consts/miri_unleashed/non_const_fn.stderr
+++ b/src/test/ui/consts/miri_unleashed/non_const_fn.stderr
@@ -1,14 +1,16 @@
-warning: skipping const checks
-  --> $DIR/non_const_fn.rs:9:1
+error[E0080]: could not evaluate static initializer
+  --> $DIR/non_const_fn.rs:9:16
    |
 LL | static C: () = foo();
-   | ^^^^^^^^^^^^^^^^^^^^^
+   |                ^^^^^ calling non-const function `foo`
 
-error[E0080]: could not evaluate static initializer
+warning: skipping const checks
+   |
+help: skipping check that does not even have a feature gate
   --> $DIR/non_const_fn.rs:9:16
    |
 LL | static C: () = foo();
-   |                ^^^^^ calling non-const function `foo`
+   |                ^^^^^
 
 error: aborting due to previous error; 1 warning emitted