From 1220f393cc7a48001ce9080b3e863b15de260c7e Mon Sep 17 00:00:00 2001
From: Sayantan Chakraborty <142906350+sayantn@users.noreply.github.com>
Date: Mon, 9 Dec 2024 00:41:35 +0530
Subject: [PATCH 01/11] Add the `power8-crypto` target feature

---
 compiler/rustc_codegen_llvm/src/llvm_util.rs | 3 +++
 compiler/rustc_target/src/target_features.rs | 1 +
 tests/ui/check-cfg/target_feature.stderr     | 1 +
 3 files changed, 5 insertions(+)

diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs
index db2b03d9aeda8..07eb89e604136 100644
--- a/compiler/rustc_codegen_llvm/src/llvm_util.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs
@@ -230,6 +230,8 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
         "aarch64"
     } else if sess.target.arch == "sparc64" {
         "sparc"
+    } else if sess.target.arch == "powerpc64" {
+        "powerpc"
     } else {
         &*sess.target.arch
     };
@@ -289,6 +291,7 @@ pub(crate) fn to_llvm_features<'a>(sess: &Session, s: &'a str) -> Option<LLVMFea
         // https://github.com/llvm/llvm-project/blob/llvmorg-18.1.0/llvm/lib/Target/Sparc/MCTargetDesc/SparcELFObjectWriter.cpp#L26
         ("sparc", "v8plus") if get_version().0 == 19 => Some(LLVMFeature::new("v9")),
         ("sparc", "v8plus") if get_version().0 < 19 => None,
+        ("powerpc", "power8-crypto") => Some(LLVMFeature::new("crypto")),
         (_, s) => Some(LLVMFeature::new(s)),
     }
 }
diff --git a/compiler/rustc_target/src/target_features.rs b/compiler/rustc_target/src/target_features.rs
index 67c047dddfcf4..3a1306072658d 100644
--- a/compiler/rustc_target/src/target_features.rs
+++ b/compiler/rustc_target/src/target_features.rs
@@ -412,6 +412,7 @@ const POWERPC_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
     ("partword-atomics", Unstable(sym::powerpc_target_feature), &[]),
     ("power10-vector", Unstable(sym::powerpc_target_feature), &["power9-vector"]),
     ("power8-altivec", Unstable(sym::powerpc_target_feature), &["altivec"]),
+    ("power8-crypto", Unstable(sym::powerpc_target_feature), &["power8-altivec"]),
     ("power8-vector", Unstable(sym::powerpc_target_feature), &["vsx", "power8-altivec"]),
     ("power9-altivec", Unstable(sym::powerpc_target_feature), &["power8-altivec"]),
     ("power9-vector", Unstable(sym::powerpc_target_feature), &["power8-vector", "power9-altivec"]),
diff --git a/tests/ui/check-cfg/target_feature.stderr b/tests/ui/check-cfg/target_feature.stderr
index 2674a97a551e4..3df1545cd4aa0 100644
--- a/tests/ui/check-cfg/target_feature.stderr
+++ b/tests/ui/check-cfg/target_feature.stderr
@@ -153,6 +153,7 @@ LL |     cfg!(target_feature = "_UNEXPECTED_VALUE");
 `popcnt`
 `power10-vector`
 `power8-altivec`
+`power8-crypto`
 `power8-vector`
 `power9-altivec`
 `power9-vector`

From b9afc78585fe1cbda5d6a3aed665338e7381ae79 Mon Sep 17 00:00:00 2001
From: Eric Holk <ericholk@microsoft.com>
Date: Mon, 9 Dec 2024 15:08:30 -0800
Subject: [PATCH 02/11] Remove rustc_const_stable attribute on const NOOP

This was accidentally reintroduced while editing #133089.
---
 library/core/src/task/wake.rs | 1 -
 1 file changed, 1 deletion(-)

diff --git a/library/core/src/task/wake.rs b/library/core/src/task/wake.rs
index 6762ed54e5c9b..bfffcc24a46a2 100644
--- a/library/core/src/task/wake.rs
+++ b/library/core/src/task/wake.rs
@@ -61,7 +61,6 @@ impl RawWaker {
     }
 
     #[stable(feature = "noop_waker", since = "CURRENT_RUSTC_VERSION")]
-    #[rustc_const_stable(feature = "noop_waker", since = "CURRENT_RUSTC_VERSION")]
     const NOOP: RawWaker = {
         const VTABLE: RawWakerVTable = RawWakerVTable::new(
             // Cloning just returns a new no-op raw waker

From 4007fc9a0f2ca14c26a494cf7d5e02c79485b43b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Esteban=20K=C3=BCber?= <esteban@kuber.com.ar>
Date: Mon, 9 Dec 2024 19:34:43 +0000
Subject: [PATCH 03/11] Tweak wording of non-const traits used as const bounds

Use verbose suggestions and add additional labels/notes.

Add more test cases for stable/nightly and feature enabled/disabled.
---
 compiler/rustc_hir_analysis/messages.ftl      |  14 +--
 compiler/rustc_hir_analysis/src/collect.rs    |  16 ++-
 compiler/rustc_hir_analysis/src/errors.rs     |  19 +++-
 .../src/hir_ty_lowering/mod.rs                |  17 +++
 .../const-super-trait-nightly-disabled.stderr |  66 ++++++++++++
 .../const-super-trait-nightly-enabled.stderr  |  45 ++++++++
 .../const-super-trait-stable-disabled.stderr  |  64 +++++++++++
 .../const-super-trait-stable-enabled.stderr   |  54 ++++++++++
 .../const-super-trait.rs                      |  13 +++
 .../const-trait-stable-toolchain/rmake.rs     |  59 ++++++++++
 tests/ui/consts/const-try.stderr              |   4 +-
 tests/ui/consts/fn_trait_refs.stderr          |  65 ++++++++---
 .../consts/rustc-impl-const-stability.stderr  |   2 +-
 .../unstable-const-fn-in-libcore.stderr       |   9 +-
 .../impl-trait/normalize-tait-in-const.stderr |   9 +-
 .../ui/specialization/const_trait_impl.stderr |  27 +++--
 .../call-const-trait-method-pass.stderr       |   2 +-
 .../const-traits/call-generic-in-impl.stderr  |   9 +-
 .../call-generic-method-chain.stderr          |  20 +++-
 .../call-generic-method-dup-bound.stderr      |  20 +++-
 .../call-generic-method-pass.stderr           |  11 +-
 .../const-bounds-non-const-trait.stderr       |  20 +++-
 .../const-closure-parse-not-item.stderr       |  13 ++-
 .../const-closure-trait-method-fail.stderr    |   9 +-
 .../const-closure-trait-method.stderr         |   9 +-
 .../traits/const-traits/const-closures.stderr |  36 +++++--
 .../const-impl-requires-const-trait.stderr    |   9 +-
 .../const_derives/derive-const-gate.stderr    |   2 +-
 .../derive-const-non-const-type.stderr        |   2 +-
 .../const_derives/derive-const-use.stderr     |   8 +-
 .../derive-const-with-params.stderr           |   5 +-
 .../ice-112822-expected-type-for-param.stderr |  13 ++-
 .../effects/spec-effectvar-ice.stderr         |  25 +++--
 .../ice-119717-constant-lifetime.stderr       |   2 +-
 .../ice-123664-unexpected-bound-var.stderr    |   9 +-
 .../ice-126148-failed-to-normalize.stderr     |   4 +-
 .../non-const-op-in-closure-in-const.stderr   |   9 +-
 .../super-traits-fail-2.nn.stderr             |  19 +++-
 .../super-traits-fail-2.ny.stderr             |  31 +++++-
 .../super-traits-fail-3.nnn.stderr            | 102 ++++++++++++++++++
 .../super-traits-fail-3.nny.stderr            | 102 ++++++++++++++++++
 .../super-traits-fail-3.ny.stderr             |  49 ---------
 .../super-traits-fail-3.nyn.stderr            |  53 +++++++++
 .../super-traits-fail-3.nyy.stderr            |  53 +++++++++
 .../const-traits/super-traits-fail-3.rs       |  43 +++++---
 ....stderr => super-traits-fail-3.ynn.stderr} |  48 ++++++---
 .../super-traits-fail-3.yny.stderr            |  70 ++++++++++++
 ....stderr => super-traits-fail-3.yyn.stderr} |  23 ++--
 .../trait-default-body-stability.stderr       |   4 +-
 49 files changed, 1122 insertions(+), 195 deletions(-)
 create mode 100644 tests/run-make/const-trait-stable-toolchain/const-super-trait-nightly-disabled.stderr
 create mode 100644 tests/run-make/const-trait-stable-toolchain/const-super-trait-nightly-enabled.stderr
 create mode 100644 tests/run-make/const-trait-stable-toolchain/const-super-trait-stable-disabled.stderr
 create mode 100644 tests/run-make/const-trait-stable-toolchain/const-super-trait-stable-enabled.stderr
 create mode 100644 tests/run-make/const-trait-stable-toolchain/const-super-trait.rs
 create mode 100644 tests/run-make/const-trait-stable-toolchain/rmake.rs
 create mode 100644 tests/ui/traits/const-traits/super-traits-fail-3.nnn.stderr
 create mode 100644 tests/ui/traits/const-traits/super-traits-fail-3.nny.stderr
 delete mode 100644 tests/ui/traits/const-traits/super-traits-fail-3.ny.stderr
 create mode 100644 tests/ui/traits/const-traits/super-traits-fail-3.nyn.stderr
 create mode 100644 tests/ui/traits/const-traits/super-traits-fail-3.nyy.stderr
 rename tests/ui/traits/const-traits/{super-traits-fail-3.nn.stderr => super-traits-fail-3.ynn.stderr} (51%)
 create mode 100644 tests/ui/traits/const-traits/super-traits-fail-3.yny.stderr
 rename tests/ui/traits/const-traits/{super-traits-fail-3.yn.stderr => super-traits-fail-3.yyn.stderr} (55%)

diff --git a/compiler/rustc_hir_analysis/messages.ftl b/compiler/rustc_hir_analysis/messages.ftl
index 070d63b48b7bd..32498d9c5ab5b 100644
--- a/compiler/rustc_hir_analysis/messages.ftl
+++ b/compiler/rustc_hir_analysis/messages.ftl
@@ -96,12 +96,14 @@ hir_analysis_coercion_between_struct_same_note = expected coercion between the s
 
 hir_analysis_coercion_between_struct_single_note = expected a single field to be coerced, none found
 
-hir_analysis_const_bound_for_non_const_trait =
-    `{$modifier}` can only be applied to `#[const_trait]` traits
-
-hir_analysis_const_impl_for_non_const_trait =
-    const `impl` for trait `{$trait_name}` which is not marked with `#[const_trait]`
-    .suggestion = mark `{$trait_name}` as const
+hir_analysis_const_bound_for_non_const_trait = `{$modifier}` can only be applied to `#[const_trait]` traits
+    .label = can't be applied to `{$trait_name}`
+    .note = `{$trait_name}` can't be used with `{$modifier}` because it isn't annotated with `#[const_trait]`
+    .suggestion = {$suggestion_pre}mark `{$trait_name}` as `#[const_trait]` to allow it to have `const` implementations
+
+hir_analysis_const_impl_for_non_const_trait = const `impl` for trait `{$trait_name}` which is not marked with `#[const_trait]`
+    .label = this trait is not `const`
+    .suggestion = {$suggestion_pre}mark `{$trait_name}` as `#[const_trait]` to allow it to have `const` implementations
     .note = marking a trait with `#[const_trait]` ensures all default method bodies are `const`
     .adding = adding a non-const method body in the future would be a breaking change
 
diff --git a/compiler/rustc_hir_analysis/src/collect.rs b/compiler/rustc_hir_analysis/src/collect.rs
index a4636da3f6213..1bd0585e77134 100644
--- a/compiler/rustc_hir_analysis/src/collect.rs
+++ b/compiler/rustc_hir_analysis/src/collect.rs
@@ -1637,11 +1637,23 @@ fn check_impl_constness(
     }
 
     let trait_name = tcx.item_name(trait_def_id).to_string();
+    let (local_trait_span, suggestion_pre) =
+        match (trait_def_id.is_local(), tcx.sess.is_nightly_build()) {
+            (true, true) => (
+                Some(tcx.def_span(trait_def_id).shrink_to_lo()),
+                if tcx.features().const_trait_impl() {
+                    ""
+                } else {
+                    "enable `#![feature(const_trait_impl)]` in your crate and "
+                },
+            ),
+            (false, _) | (_, false) => (None, ""),
+        };
     Some(tcx.dcx().emit_err(errors::ConstImplForNonConstTrait {
         trait_ref_span: hir_trait_ref.path.span,
         trait_name,
-        local_trait_span:
-            trait_def_id.as_local().map(|_| tcx.def_span(trait_def_id).shrink_to_lo()),
+        local_trait_span,
+        suggestion_pre,
         marking: (),
         adding: (),
     }))
diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs
index 4142dcff226bf..7f62ccc91f09a 100644
--- a/compiler/rustc_hir_analysis/src/errors.rs
+++ b/compiler/rustc_hir_analysis/src/errors.rs
@@ -530,10 +530,16 @@ pub(crate) struct GenericArgsOnOverriddenImpl {
 #[diag(hir_analysis_const_impl_for_non_const_trait)]
 pub(crate) struct ConstImplForNonConstTrait {
     #[primary_span]
+    #[label]
     pub trait_ref_span: Span,
     pub trait_name: String,
-    #[suggestion(applicability = "machine-applicable", code = "#[const_trait]")]
+    #[suggestion(
+        applicability = "machine-applicable",
+        code = "#[const_trait] ",
+        style = "verbose"
+    )]
     pub local_trait_span: Option<Span>,
+    pub suggestion_pre: &'static str,
     #[note]
     pub marking: (),
     #[note(hir_analysis_adding)]
@@ -544,8 +550,19 @@ pub(crate) struct ConstImplForNonConstTrait {
 #[diag(hir_analysis_const_bound_for_non_const_trait)]
 pub(crate) struct ConstBoundForNonConstTrait {
     #[primary_span]
+    #[label]
     pub span: Span,
     pub modifier: &'static str,
+    #[note]
+    pub def_span: Option<Span>,
+    pub suggestion_pre: &'static str,
+    #[suggestion(
+        applicability = "machine-applicable",
+        code = "#[const_trait] ",
+        style = "verbose"
+    )]
+    pub suggestion: Option<Span>,
+    pub trait_name: String,
 }
 
 #[derive(Diagnostic)]
diff --git a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
index 3313339abb313..09e46517cea8b 100644
--- a/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
+++ b/compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs
@@ -737,9 +737,26 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
         if let hir::BoundConstness::Always(span) | hir::BoundConstness::Maybe(span) = constness
             && !self.tcx().is_const_trait(trait_def_id)
         {
+            let (def_span, suggestion, suggestion_pre) =
+                match (trait_def_id.is_local(), self.tcx().sess.is_nightly_build()) {
+                    (true, true) => (
+                        None,
+                        Some(tcx.def_span(trait_def_id).shrink_to_lo()),
+                        if self.tcx().features().const_trait_impl() {
+                            ""
+                        } else {
+                            "enable `#![feature(const_trait_impl)]` in your crate and "
+                        },
+                    ),
+                    (false, _) | (_, false) => (Some(tcx.def_span(trait_def_id)), None, ""),
+                };
             self.dcx().emit_err(crate::errors::ConstBoundForNonConstTrait {
                 span,
                 modifier: constness.as_str(),
+                def_span,
+                trait_name: self.tcx().def_path_str(trait_def_id),
+                suggestion_pre,
+                suggestion,
             });
         }
 
diff --git a/tests/run-make/const-trait-stable-toolchain/const-super-trait-nightly-disabled.stderr b/tests/run-make/const-trait-stable-toolchain/const-super-trait-nightly-disabled.stderr
new file mode 100644
index 0000000000000..596f7c510be52
--- /dev/null
+++ b/tests/run-make/const-trait-stable-toolchain/const-super-trait-nightly-disabled.stderr
@@ -0,0 +1,66 @@
+error: `~const` is not allowed here
+  --> const-super-trait.rs:7:12
+   |
+LL | trait Bar: ~const Foo {}
+   |            ^^^^^^
+   |
+note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds
+  --> const-super-trait.rs:7:1
+   |
+LL | trait Bar: ~const Foo {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0658]: const trait impls are experimental
+  --> const-super-trait.rs:7:12
+   |
+LL | trait Bar: ~const Foo {}
+   |            ^^^^^^
+   |
+   = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
+   = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error[E0658]: const trait impls are experimental
+  --> const-super-trait.rs:9:17
+   |
+LL | const fn foo<T: ~const Bar>(x: &T) {
+   |                 ^^^^^^
+   |
+   = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
+   = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error: `~const` can only be applied to `#[const_trait]` traits
+  --> const-super-trait.rs:7:12
+   |
+LL | trait Bar: ~const Foo {}
+   |            ^^^^^^ can't be applied to `Foo`
+   |
+help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Foo {
+   | ++++++++++++++
+
+error: `~const` can only be applied to `#[const_trait]` traits
+  --> const-super-trait.rs:9:17
+   |
+LL | const fn foo<T: ~const Bar>(x: &T) {
+   |                 ^^^^^^ can't be applied to `Bar`
+   |
+help: enable `#![feature(const_trait_impl)]` in your crate and mark `Bar` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Bar: ~const Foo {}
+   | ++++++++++++++
+
+error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions
+  --> const-super-trait.rs:10:7
+   |
+LL |     x.a();
+   |       ^^^
+   |
+   = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
+
+error: aborting due to 6 previous errors
+
+Some errors have detailed explanations: E0015, E0658.
+For more information about an error, try `rustc --explain E0015`.
diff --git a/tests/run-make/const-trait-stable-toolchain/const-super-trait-nightly-enabled.stderr b/tests/run-make/const-trait-stable-toolchain/const-super-trait-nightly-enabled.stderr
new file mode 100644
index 0000000000000..7235278d1bd78
--- /dev/null
+++ b/tests/run-make/const-trait-stable-toolchain/const-super-trait-nightly-enabled.stderr
@@ -0,0 +1,45 @@
+error: `~const` is not allowed here
+  --> const-super-trait.rs:7:12
+   |
+LL | trait Bar: ~const Foo {}
+   |            ^^^^^^
+   |
+note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds
+  --> const-super-trait.rs:7:1
+   |
+LL | trait Bar: ~const Foo {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: `~const` can only be applied to `#[const_trait]` traits
+  --> const-super-trait.rs:7:12
+   |
+LL | trait Bar: ~const Foo {}
+   |            ^^^^^^ can't be applied to `Foo`
+   |
+help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Foo {
+   | ++++++++++++++
+
+error: `~const` can only be applied to `#[const_trait]` traits
+  --> const-super-trait.rs:9:17
+   |
+LL | const fn foo<T: ~const Bar>(x: &T) {
+   |                 ^^^^^^ can't be applied to `Bar`
+   |
+help: mark `Bar` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Bar: ~const Foo {}
+   | ++++++++++++++
+
+error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions
+  --> const-super-trait.rs:10:7
+   |
+LL |     x.a();
+   |       ^^^
+   |
+   = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/run-make/const-trait-stable-toolchain/const-super-trait-stable-disabled.stderr b/tests/run-make/const-trait-stable-toolchain/const-super-trait-stable-disabled.stderr
new file mode 100644
index 0000000000000..eacdaf5e36909
--- /dev/null
+++ b/tests/run-make/const-trait-stable-toolchain/const-super-trait-stable-disabled.stderr
@@ -0,0 +1,64 @@
+error: `~const` is not allowed here
+ --> const-super-trait.rs:7:12
+  |
+7 | trait Bar: ~const Foo {}
+  |            ^^^^^^
+  |
+note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds
+ --> const-super-trait.rs:7:1
+  |
+7 | trait Bar: ~const Foo {}
+  | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0658]: const trait impls are experimental
+ --> const-super-trait.rs:7:12
+  |
+7 | trait Bar: ~const Foo {}
+  |            ^^^^^^
+  |
+  = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
+
+error[E0658]: const trait impls are experimental
+ --> const-super-trait.rs:9:17
+  |
+9 | const fn foo<T: ~const Bar>(x: &T) {
+  |                 ^^^^^^
+  |
+  = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
+
+error: `~const` can only be applied to `#[const_trait]` traits
+ --> const-super-trait.rs:7:12
+  |
+7 | trait Bar: ~const Foo {}
+  |            ^^^^^^ can't be applied to `Foo`
+  |
+note: `Foo` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+ --> const-super-trait.rs:3:1
+  |
+3 | trait Foo {
+  | ^^^^^^^^^
+
+error: `~const` can only be applied to `#[const_trait]` traits
+ --> const-super-trait.rs:9:17
+  |
+9 | const fn foo<T: ~const Bar>(x: &T) {
+  |                 ^^^^^^ can't be applied to `Bar`
+  |
+note: `Bar` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+ --> const-super-trait.rs:7:1
+  |
+7 | trait Bar: ~const Foo {}
+  | ^^^^^^^^^^^^^^^^^^^^^
+
+error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions
+  --> const-super-trait.rs:10:7
+   |
+10 |     x.a();
+   |       ^^^
+   |
+   = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
+
+error: aborting due to 6 previous errors
+
+Some errors have detailed explanations: E0015, E0658.
+For more information about an error, try `rustc --explain E0015`.
diff --git a/tests/run-make/const-trait-stable-toolchain/const-super-trait-stable-enabled.stderr b/tests/run-make/const-trait-stable-toolchain/const-super-trait-stable-enabled.stderr
new file mode 100644
index 0000000000000..9ddec6e422c06
--- /dev/null
+++ b/tests/run-make/const-trait-stable-toolchain/const-super-trait-stable-enabled.stderr
@@ -0,0 +1,54 @@
+error: `~const` is not allowed here
+ --> const-super-trait.rs:7:12
+  |
+7 | trait Bar: ~const Foo {}
+  |            ^^^^^^
+  |
+note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds
+ --> const-super-trait.rs:7:1
+  |
+7 | trait Bar: ~const Foo {}
+  | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0554]: `#![feature]` may not be used on the NIGHTLY release channel
+ --> const-super-trait.rs:1:30
+  |
+1 | #![cfg_attr(feature_enabled, feature(const_trait_impl))]
+  |                              ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: `~const` can only be applied to `#[const_trait]` traits
+ --> const-super-trait.rs:7:12
+  |
+7 | trait Bar: ~const Foo {}
+  |            ^^^^^^ can't be applied to `Foo`
+  |
+note: `Foo` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+ --> const-super-trait.rs:3:1
+  |
+3 | trait Foo {
+  | ^^^^^^^^^
+
+error: `~const` can only be applied to `#[const_trait]` traits
+ --> const-super-trait.rs:9:17
+  |
+9 | const fn foo<T: ~const Bar>(x: &T) {
+  |                 ^^^^^^ can't be applied to `Bar`
+  |
+note: `Bar` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+ --> const-super-trait.rs:7:1
+  |
+7 | trait Bar: ~const Foo {}
+  | ^^^^^^^^^^^^^^^^^^^^^
+
+error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions
+  --> const-super-trait.rs:10:7
+   |
+10 |     x.a();
+   |       ^^^
+   |
+   = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
+
+error: aborting due to 5 previous errors
+
+Some errors have detailed explanations: E0015, E0554.
+For more information about an error, try `rustc --explain E0015`.
diff --git a/tests/run-make/const-trait-stable-toolchain/const-super-trait.rs b/tests/run-make/const-trait-stable-toolchain/const-super-trait.rs
new file mode 100644
index 0000000000000..b2ee96d79f704
--- /dev/null
+++ b/tests/run-make/const-trait-stable-toolchain/const-super-trait.rs
@@ -0,0 +1,13 @@
+#![cfg_attr(feature_enabled, feature(const_trait_impl))]
+
+trait Foo {
+    fn a(&self);
+}
+
+trait Bar: ~const Foo {}
+
+const fn foo<T: ~const Bar>(x: &T) {
+    x.a();
+}
+
+fn main() {}
diff --git a/tests/run-make/const-trait-stable-toolchain/rmake.rs b/tests/run-make/const-trait-stable-toolchain/rmake.rs
new file mode 100644
index 0000000000000..241de11ed59ca
--- /dev/null
+++ b/tests/run-make/const-trait-stable-toolchain/rmake.rs
@@ -0,0 +1,59 @@
+// Test output of const super trait errors in both stable and nightly.
+// We don't want to provide suggestions on stable that only make sense in nightly.
+
+use run_make_support::{diff, rustc};
+
+fn main() {
+    let out = rustc()
+        .input("const-super-trait.rs")
+        .env("RUSTC_BOOTSTRAP", "-1")
+        .cfg("feature_enabled")
+        .run_fail()
+        .assert_stderr_not_contains(
+            "as `#[const_trait]` to allow it to have `const` implementations",
+        )
+        .stderr_utf8();
+    diff()
+        .expected_file("const-super-trait-stable-enabled.stderr")
+        .normalize(
+            "may not be used on the .* release channel",
+            "may not be used on the NIGHTLY release channel",
+        )
+        .actual_text("(rustc)", &out)
+        .run();
+    let out = rustc()
+        .input("const-super-trait.rs")
+        .cfg("feature_enabled")
+        .ui_testing()
+        .run_fail()
+        .assert_stderr_not_contains("enable `#![feature(const_trait_impl)]` in your crate and mark")
+        .assert_stderr_contains("as `#[const_trait]` to allow it to have `const` implementations")
+        .stderr_utf8();
+    diff()
+        .expected_file("const-super-trait-nightly-enabled.stderr")
+        .actual_text("(rustc)", &out)
+        .run();
+    let out = rustc()
+        .input("const-super-trait.rs")
+        .env("RUSTC_BOOTSTRAP", "-1")
+        .run_fail()
+        .assert_stderr_not_contains("enable `#![feature(const_trait_impl)]` in your crate and mark")
+        .assert_stderr_not_contains(
+            "as `#[const_trait]` to allow it to have `const` implementations",
+        )
+        .stderr_utf8();
+    diff()
+        .expected_file("const-super-trait-stable-disabled.stderr")
+        .actual_text("(rustc)", &out)
+        .run();
+    let out = rustc()
+        .input("const-super-trait.rs")
+        .ui_testing()
+        .run_fail()
+        .assert_stderr_contains("enable `#![feature(const_trait_impl)]` in your crate and mark")
+        .stderr_utf8();
+    diff()
+        .expected_file("const-super-trait-nightly-disabled.stderr")
+        .actual_text("(rustc)", &out)
+        .run();
+}
diff --git a/tests/ui/consts/const-try.stderr b/tests/ui/consts/const-try.stderr
index abb03a74c82a4..4209ca1d52665 100644
--- a/tests/ui/consts/const-try.stderr
+++ b/tests/ui/consts/const-try.stderr
@@ -2,7 +2,7 @@ error: const `impl` for trait `FromResidual` which is not marked with `#[const_t
   --> $DIR/const-try.rs:15:12
    |
 LL | impl const FromResidual<Error> for TryMe {
-   |            ^^^^^^^^^^^^^^^^^^^
+   |            ^^^^^^^^^^^^^^^^^^^ this trait is not `const`
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change
@@ -11,7 +11,7 @@ error: const `impl` for trait `Try` which is not marked with `#[const_trait]`
   --> $DIR/const-try.rs:22:12
    |
 LL | impl const Try for TryMe {
-   |            ^^^
+   |            ^^^ this trait is not `const`
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change
diff --git a/tests/ui/consts/fn_trait_refs.stderr b/tests/ui/consts/fn_trait_refs.stderr
index bb7ff76b1255c..e0dbecff8e587 100644
--- a/tests/ui/consts/fn_trait_refs.stderr
+++ b/tests/ui/consts/fn_trait_refs.stderr
@@ -14,110 +14,145 @@ error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/fn_trait_refs.rs:14:8
    |
 LL |     T: ~const Fn<()> + ~const Destruct,
-   |        ^^^^^^
+   |        ^^^^^^ can't be applied to `Fn`
+   |
+note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/fn_trait_refs.rs:14:8
    |
 LL |     T: ~const Fn<()> + ~const Destruct,
-   |        ^^^^^^
+   |        ^^^^^^ can't be applied to `Fn`
    |
+note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/fn_trait_refs.rs:14:8
    |
 LL |     T: ~const Fn<()> + ~const Destruct,
-   |        ^^^^^^
+   |        ^^^^^^ can't be applied to `Fn`
    |
+note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/fn_trait_refs.rs:21:8
    |
 LL |     T: ~const FnMut<()> + ~const Destruct,
-   |        ^^^^^^
+   |        ^^^^^^ can't be applied to `FnMut`
+   |
+note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/fn_trait_refs.rs:21:8
    |
 LL |     T: ~const FnMut<()> + ~const Destruct,
-   |        ^^^^^^
+   |        ^^^^^^ can't be applied to `FnMut`
    |
+note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/fn_trait_refs.rs:21:8
    |
 LL |     T: ~const FnMut<()> + ~const Destruct,
-   |        ^^^^^^
+   |        ^^^^^^ can't be applied to `FnMut`
    |
+note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/fn_trait_refs.rs:28:8
    |
 LL |     T: ~const FnOnce<()>,
-   |        ^^^^^^
+   |        ^^^^^^ can't be applied to `FnOnce`
+   |
+note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/fn_trait_refs.rs:28:8
    |
 LL |     T: ~const FnOnce<()>,
-   |        ^^^^^^
+   |        ^^^^^^ can't be applied to `FnOnce`
    |
+note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/fn_trait_refs.rs:28:8
    |
 LL |     T: ~const FnOnce<()>,
-   |        ^^^^^^
+   |        ^^^^^^ can't be applied to `FnOnce`
    |
+note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/fn_trait_refs.rs:35:8
    |
 LL |     T: ~const Fn<()> + ~const Destruct,
-   |        ^^^^^^
+   |        ^^^^^^ can't be applied to `Fn`
+   |
+note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/fn_trait_refs.rs:35:8
    |
 LL |     T: ~const Fn<()> + ~const Destruct,
-   |        ^^^^^^
+   |        ^^^^^^ can't be applied to `Fn`
    |
+note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/fn_trait_refs.rs:35:8
    |
 LL |     T: ~const Fn<()> + ~const Destruct,
-   |        ^^^^^^
+   |        ^^^^^^ can't be applied to `Fn`
    |
+note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/fn_trait_refs.rs:49:8
    |
 LL |     T: ~const FnMut<()> + ~const Destruct,
-   |        ^^^^^^
+   |        ^^^^^^ can't be applied to `FnMut`
+   |
+note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/fn_trait_refs.rs:49:8
    |
 LL |     T: ~const FnMut<()> + ~const Destruct,
-   |        ^^^^^^
+   |        ^^^^^^ can't be applied to `FnMut`
    |
+note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/fn_trait_refs.rs:49:8
    |
 LL |     T: ~const FnMut<()> + ~const Destruct,
-   |        ^^^^^^
+   |        ^^^^^^ can't be applied to `FnMut`
    |
+note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0277]: the trait bound `fn() -> i32 {one}: const Destruct` is not satisfied
diff --git a/tests/ui/consts/rustc-impl-const-stability.stderr b/tests/ui/consts/rustc-impl-const-stability.stderr
index 4a58b5c86034e..19c6bb5907f82 100644
--- a/tests/ui/consts/rustc-impl-const-stability.stderr
+++ b/tests/ui/consts/rustc-impl-const-stability.stderr
@@ -2,7 +2,7 @@ error: const `impl` for trait `Default` which is not marked with `#[const_trait]
   --> $DIR/rustc-impl-const-stability.rs:15:12
    |
 LL | impl const Default for Data {
-   |            ^^^^^^^
+   |            ^^^^^^^ this trait is not `const`
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change
diff --git a/tests/ui/consts/unstable-const-fn-in-libcore.stderr b/tests/ui/consts/unstable-const-fn-in-libcore.stderr
index f40c1871e90b9..32693edbfcbda 100644
--- a/tests/ui/consts/unstable-const-fn-in-libcore.stderr
+++ b/tests/ui/consts/unstable-const-fn-in-libcore.stderr
@@ -2,14 +2,19 @@ error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/unstable-const-fn-in-libcore.rs:19:32
    |
 LL |     const fn unwrap_or_else<F: ~const FnOnce() -> T>(self, f: F) -> T {
-   |                                ^^^^^^
+   |                                ^^^^^^ can't be applied to `FnOnce`
+   |
+note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/unstable-const-fn-in-libcore.rs:19:32
    |
 LL |     const fn unwrap_or_else<F: ~const FnOnce() -> T>(self, f: F) -> T {
-   |                                ^^^^^^
+   |                                ^^^^^^ can't be applied to `FnOnce`
    |
+note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0015]: cannot call non-const closure in constant functions
diff --git a/tests/ui/impl-trait/normalize-tait-in-const.stderr b/tests/ui/impl-trait/normalize-tait-in-const.stderr
index 1dd84f10ad862..0f79cefeaecb7 100644
--- a/tests/ui/impl-trait/normalize-tait-in-const.stderr
+++ b/tests/ui/impl-trait/normalize-tait-in-const.stderr
@@ -2,14 +2,19 @@ error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/normalize-tait-in-const.rs:26:35
    |
 LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
-   |                                   ^^^^^^
+   |                                   ^^^^^^ can't be applied to `Fn`
+   |
+note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/normalize-tait-in-const.rs:26:35
    |
 LL | const fn with_positive<F: for<'a> ~const Fn(&'a Alias<'a>) + ~const Destruct>(fun: F) {
-   |                                   ^^^^^^
+   |                                   ^^^^^^ can't be applied to `Fn`
    |
+note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0277]: the trait bound `for<'a, 'b> fn(&'a foo::Alias<'b>) {foo}: const Destruct` is not satisfied
diff --git a/tests/ui/specialization/const_trait_impl.stderr b/tests/ui/specialization/const_trait_impl.stderr
index 607fc06823e42..3e1260ff09c92 100644
--- a/tests/ui/specialization/const_trait_impl.stderr
+++ b/tests/ui/specialization/const_trait_impl.stderr
@@ -2,42 +2,57 @@ error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/const_trait_impl.rs:34:9
    |
 LL | impl<T: ~const Default> const A for T {
-   |         ^^^^^^
+   |         ^^^^^^ can't be applied to `Default`
+   |
+note: `Default` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/default.rs:LL:COL
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/const_trait_impl.rs:40:9
    |
 LL | impl<T: ~const Default + ~const Sup> const A for T {
-   |         ^^^^^^
+   |         ^^^^^^ can't be applied to `Default`
+   |
+note: `Default` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/default.rs:LL:COL
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/const_trait_impl.rs:46:9
    |
 LL | impl<T: ~const Default + ~const Sub> const A for T {
-   |         ^^^^^^
+   |         ^^^^^^ can't be applied to `Default`
+   |
+note: `Default` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/default.rs:LL:COL
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/const_trait_impl.rs:40:9
    |
 LL | impl<T: ~const Default + ~const Sup> const A for T {
-   |         ^^^^^^
+   |         ^^^^^^ can't be applied to `Default`
    |
+note: `Default` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/default.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/const_trait_impl.rs:34:9
    |
 LL | impl<T: ~const Default> const A for T {
-   |         ^^^^^^
+   |         ^^^^^^ can't be applied to `Default`
    |
+note: `Default` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/default.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/const_trait_impl.rs:46:9
    |
 LL | impl<T: ~const Default + ~const Sub> const A for T {
-   |         ^^^^^^
+   |         ^^^^^^ can't be applied to `Default`
    |
+note: `Default` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/default.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error: aborting due to 6 previous errors
diff --git a/tests/ui/traits/const-traits/call-const-trait-method-pass.stderr b/tests/ui/traits/const-traits/call-const-trait-method-pass.stderr
index 1e48a0331cca2..ef494bde98ce3 100644
--- a/tests/ui/traits/const-traits/call-const-trait-method-pass.stderr
+++ b/tests/ui/traits/const-traits/call-const-trait-method-pass.stderr
@@ -2,7 +2,7 @@ error: const `impl` for trait `PartialEq` which is not marked with `#[const_trai
   --> $DIR/call-const-trait-method-pass.rs:15:12
    |
 LL | impl const PartialEq for Int {
-   |            ^^^^^^^^^
+   |            ^^^^^^^^^ this trait is not `const`
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change
diff --git a/tests/ui/traits/const-traits/call-generic-in-impl.stderr b/tests/ui/traits/const-traits/call-generic-in-impl.stderr
index 52ee04425b2c7..58d0997f5a341 100644
--- a/tests/ui/traits/const-traits/call-generic-in-impl.stderr
+++ b/tests/ui/traits/const-traits/call-generic-in-impl.stderr
@@ -2,14 +2,19 @@ error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/call-generic-in-impl.rs:10:9
    |
 LL | impl<T: ~const PartialEq> const MyPartialEq for T {
-   |         ^^^^^^
+   |         ^^^^^^ can't be applied to `PartialEq`
+   |
+note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/cmp.rs:LL:COL
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/call-generic-in-impl.rs:10:9
    |
 LL | impl<T: ~const PartialEq> const MyPartialEq for T {
-   |         ^^^^^^
+   |         ^^^^^^ can't be applied to `PartialEq`
    |
+note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/cmp.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0015]: cannot call non-const fn `<T as PartialEq>::eq` in constant functions
diff --git a/tests/ui/traits/const-traits/call-generic-method-chain.stderr b/tests/ui/traits/const-traits/call-generic-method-chain.stderr
index 21fb19daad4aa..d7a2a18649400 100644
--- a/tests/ui/traits/const-traits/call-generic-method-chain.stderr
+++ b/tests/ui/traits/const-traits/call-generic-method-chain.stderr
@@ -2,7 +2,7 @@ error: const `impl` for trait `PartialEq` which is not marked with `#[const_trai
   --> $DIR/call-generic-method-chain.rs:11:12
    |
 LL | impl const PartialEq for S {
-   |            ^^^^^^^^^
+   |            ^^^^^^^^^ this trait is not `const`
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change
@@ -11,28 +11,38 @@ error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/call-generic-method-chain.rs:20:25
    |
 LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
-   |                         ^^^^^^
+   |                         ^^^^^^ can't be applied to `PartialEq`
+   |
+note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/cmp.rs:LL:COL
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/call-generic-method-chain.rs:20:25
    |
 LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
-   |                         ^^^^^^
+   |                         ^^^^^^ can't be applied to `PartialEq`
    |
+note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/cmp.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/call-generic-method-chain.rs:24:33
    |
 LL | const fn equals_self_wrapper<T: ~const PartialEq>(t: &T) -> bool {
-   |                                 ^^^^^^
+   |                                 ^^^^^^ can't be applied to `PartialEq`
+   |
+note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/cmp.rs:LL:COL
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/call-generic-method-chain.rs:24:33
    |
 LL | const fn equals_self_wrapper<T: ~const PartialEq>(t: &T) -> bool {
-   |                                 ^^^^^^
+   |                                 ^^^^^^ can't be applied to `PartialEq`
    |
+note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/cmp.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0015]: cannot call non-const operator in constant functions
diff --git a/tests/ui/traits/const-traits/call-generic-method-dup-bound.stderr b/tests/ui/traits/const-traits/call-generic-method-dup-bound.stderr
index 845949a38bf5a..90465d0a5b2db 100644
--- a/tests/ui/traits/const-traits/call-generic-method-dup-bound.stderr
+++ b/tests/ui/traits/const-traits/call-generic-method-dup-bound.stderr
@@ -2,7 +2,7 @@ error: const `impl` for trait `PartialEq` which is not marked with `#[const_trai
   --> $DIR/call-generic-method-dup-bound.rs:9:12
    |
 LL | impl const PartialEq for S {
-   |            ^^^^^^^^^
+   |            ^^^^^^^^^ this trait is not `const`
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change
@@ -11,28 +11,38 @@ error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/call-generic-method-dup-bound.rs:20:37
    |
 LL | const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool {
-   |                                     ^^^^^^
+   |                                     ^^^^^^ can't be applied to `PartialEq`
+   |
+note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/cmp.rs:LL:COL
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/call-generic-method-dup-bound.rs:20:37
    |
 LL | const fn equals_self<T: PartialEq + ~const PartialEq>(t: &T) -> bool {
-   |                                     ^^^^^^
+   |                                     ^^^^^^ can't be applied to `PartialEq`
    |
+note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/cmp.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/call-generic-method-dup-bound.rs:27:30
    |
 LL | const fn equals_self2<T: A + ~const PartialEq>(t: &T) -> bool {
-   |                              ^^^^^^
+   |                              ^^^^^^ can't be applied to `PartialEq`
+   |
+note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/cmp.rs:LL:COL
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/call-generic-method-dup-bound.rs:27:30
    |
 LL | const fn equals_self2<T: A + ~const PartialEq>(t: &T) -> bool {
-   |                              ^^^^^^
+   |                              ^^^^^^ can't be applied to `PartialEq`
    |
+note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/cmp.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0015]: cannot call non-const operator in constant functions
diff --git a/tests/ui/traits/const-traits/call-generic-method-pass.stderr b/tests/ui/traits/const-traits/call-generic-method-pass.stderr
index 0c0037e36b86d..a7626a4e99d26 100644
--- a/tests/ui/traits/const-traits/call-generic-method-pass.stderr
+++ b/tests/ui/traits/const-traits/call-generic-method-pass.stderr
@@ -2,7 +2,7 @@ error: const `impl` for trait `PartialEq` which is not marked with `#[const_trai
   --> $DIR/call-generic-method-pass.rs:11:12
    |
 LL | impl const PartialEq for S {
-   |            ^^^^^^^^^
+   |            ^^^^^^^^^ this trait is not `const`
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change
@@ -11,14 +11,19 @@ error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/call-generic-method-pass.rs:20:25
    |
 LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
-   |                         ^^^^^^
+   |                         ^^^^^^ can't be applied to `PartialEq`
+   |
+note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/cmp.rs:LL:COL
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/call-generic-method-pass.rs:20:25
    |
 LL | const fn equals_self<T: ~const PartialEq>(t: &T) -> bool {
-   |                         ^^^^^^
+   |                         ^^^^^^ can't be applied to `PartialEq`
    |
+note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/cmp.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0015]: cannot call non-const operator in constant functions
diff --git a/tests/ui/traits/const-traits/const-bounds-non-const-trait.stderr b/tests/ui/traits/const-traits/const-bounds-non-const-trait.stderr
index 2436c97ccf2ca..f97d3a9181e06 100644
--- a/tests/ui/traits/const-traits/const-bounds-non-const-trait.stderr
+++ b/tests/ui/traits/const-traits/const-bounds-non-const-trait.stderr
@@ -2,21 +2,35 @@ error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/const-bounds-non-const-trait.rs:6:21
    |
 LL | const fn perform<T: ~const NonConst>() {}
-   |                     ^^^^^^
+   |                     ^^^^^^ can't be applied to `NonConst`
+   |
+help: mark `NonConst` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait NonConst {}
+   | ++++++++++++++
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/const-bounds-non-const-trait.rs:6:21
    |
 LL | const fn perform<T: ~const NonConst>() {}
-   |                     ^^^^^^
+   |                     ^^^^^^ can't be applied to `NonConst`
    |
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: mark `NonConst` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait NonConst {}
+   | ++++++++++++++
 
 error: `const` can only be applied to `#[const_trait]` traits
   --> $DIR/const-bounds-non-const-trait.rs:10:15
    |
 LL | fn operate<T: const NonConst>() {}
-   |               ^^^^^
+   |               ^^^^^ can't be applied to `NonConst`
+   |
+help: mark `NonConst` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait NonConst {}
+   | ++++++++++++++
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/traits/const-traits/const-closure-parse-not-item.stderr b/tests/ui/traits/const-traits/const-closure-parse-not-item.stderr
index 0970cd5225fba..57afa2257b7d4 100644
--- a/tests/ui/traits/const-traits/const-closure-parse-not-item.stderr
+++ b/tests/ui/traits/const-traits/const-closure-parse-not-item.stderr
@@ -2,22 +2,29 @@ error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/const-closure-parse-not-item.rs:7:25
    |
 LL | const fn test() -> impl ~const Fn() {
-   |                         ^^^^^^
+   |                         ^^^^^^ can't be applied to `Fn`
+   |
+note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/const-closure-parse-not-item.rs:7:25
    |
 LL | const fn test() -> impl ~const Fn() {
-   |                         ^^^^^^
+   |                         ^^^^^^ can't be applied to `Fn`
    |
+note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/const-closure-parse-not-item.rs:7:25
    |
 LL | const fn test() -> impl ~const Fn() {
-   |                         ^^^^^^
+   |                         ^^^^^^ can't be applied to `Fn`
    |
+note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error: aborting due to 3 previous errors
diff --git a/tests/ui/traits/const-traits/const-closure-trait-method-fail.stderr b/tests/ui/traits/const-traits/const-closure-trait-method-fail.stderr
index a76dc3e82af71..2a97846ccb448 100644
--- a/tests/ui/traits/const-traits/const-closure-trait-method-fail.stderr
+++ b/tests/ui/traits/const-traits/const-closure-trait-method-fail.stderr
@@ -2,14 +2,19 @@ error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/const-closure-trait-method-fail.rs:14:32
    |
 LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 {
-   |                                ^^^^^^
+   |                                ^^^^^^ can't be applied to `FnOnce`
+   |
+note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/const-closure-trait-method-fail.rs:14:32
    |
 LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 {
-   |                                ^^^^^^
+   |                                ^^^^^^ can't be applied to `FnOnce`
    |
+note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0015]: cannot call non-const closure in constant functions
diff --git a/tests/ui/traits/const-traits/const-closure-trait-method.stderr b/tests/ui/traits/const-traits/const-closure-trait-method.stderr
index d37ff3d727cea..9c63b7e63a65d 100644
--- a/tests/ui/traits/const-traits/const-closure-trait-method.stderr
+++ b/tests/ui/traits/const-traits/const-closure-trait-method.stderr
@@ -2,14 +2,19 @@ error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/const-closure-trait-method.rs:14:32
    |
 LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 {
-   |                                ^^^^^^
+   |                                ^^^^^^ can't be applied to `FnOnce`
+   |
+note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/const-closure-trait-method.rs:14:32
    |
 LL | const fn need_const_closure<T: ~const FnOnce(()) -> i32>(x: T) -> i32 {
-   |                                ^^^^^^
+   |                                ^^^^^^ can't be applied to `FnOnce`
    |
+note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0015]: cannot call non-const closure in constant functions
diff --git a/tests/ui/traits/const-traits/const-closures.stderr b/tests/ui/traits/const-traits/const-closures.stderr
index 8ceaae16d8e70..92f3ba2082072 100644
--- a/tests/ui/traits/const-traits/const-closures.stderr
+++ b/tests/ui/traits/const-traits/const-closures.stderr
@@ -2,56 +2,76 @@ error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/const-closures.rs:8:12
    |
 LL |         F: ~const FnOnce() -> u8,
-   |            ^^^^^^
+   |            ^^^^^^ can't be applied to `FnOnce`
+   |
+note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/const-closures.rs:9:12
    |
 LL |         F: ~const FnMut() -> u8,
-   |            ^^^^^^
+   |            ^^^^^^ can't be applied to `FnMut`
+   |
+note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/const-closures.rs:10:12
    |
 LL |         F: ~const Fn() -> u8,
-   |            ^^^^^^
+   |            ^^^^^^ can't be applied to `Fn`
+   |
+note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/const-closures.rs:8:12
    |
 LL |         F: ~const FnOnce() -> u8,
-   |            ^^^^^^
+   |            ^^^^^^ can't be applied to `FnOnce`
    |
+note: `FnOnce` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/const-closures.rs:9:12
    |
 LL |         F: ~const FnMut() -> u8,
-   |            ^^^^^^
+   |            ^^^^^^ can't be applied to `FnMut`
    |
+note: `FnMut` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/const-closures.rs:10:12
    |
 LL |         F: ~const Fn() -> u8,
-   |            ^^^^^^
+   |            ^^^^^^ can't be applied to `Fn`
    |
+note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/const-closures.rs:23:20
    |
 LL | const fn answer<F: ~const Fn() -> u8>(f: &F) -> u8 {
-   |                    ^^^^^^
+   |                    ^^^^^^ can't be applied to `Fn`
+   |
+note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/const-closures.rs:23:20
    |
 LL | const fn answer<F: ~const Fn() -> u8>(f: &F) -> u8 {
-   |                    ^^^^^^
+   |                    ^^^^^^ can't be applied to `Fn`
    |
+note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0015]: cannot call non-const closure in constant functions
diff --git a/tests/ui/traits/const-traits/const-impl-requires-const-trait.stderr b/tests/ui/traits/const-traits/const-impl-requires-const-trait.stderr
index bcaae38194959..c728eda069ecb 100644
--- a/tests/ui/traits/const-traits/const-impl-requires-const-trait.stderr
+++ b/tests/ui/traits/const-traits/const-impl-requires-const-trait.stderr
@@ -1,14 +1,15 @@
 error: const `impl` for trait `A` which is not marked with `#[const_trait]`
   --> $DIR/const-impl-requires-const-trait.rs:6:12
    |
-LL | pub trait A {}
-   | - help: mark `A` as const: `#[const_trait]`
-LL |
 LL | impl const A for () {}
-   |            ^
+   |            ^ this trait is not `const`
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change
+help: mark `A` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] pub trait A {}
+   | ++++++++++++++
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/traits/const-traits/const_derives/derive-const-gate.stderr b/tests/ui/traits/const-traits/const_derives/derive-const-gate.stderr
index 95f6f32f21d3c..fae871a4c85ac 100644
--- a/tests/ui/traits/const-traits/const_derives/derive-const-gate.stderr
+++ b/tests/ui/traits/const-traits/const_derives/derive-const-gate.stderr
@@ -11,7 +11,7 @@ error: const `impl` for trait `Default` which is not marked with `#[const_trait]
   --> $DIR/derive-const-gate.rs:1:16
    |
 LL | #[derive_const(Default)]
-   |                ^^^^^^^
+   |                ^^^^^^^ this trait is not `const`
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change
diff --git a/tests/ui/traits/const-traits/const_derives/derive-const-non-const-type.stderr b/tests/ui/traits/const-traits/const_derives/derive-const-non-const-type.stderr
index 9492000a5631e..8a6401afcf19f 100644
--- a/tests/ui/traits/const-traits/const_derives/derive-const-non-const-type.stderr
+++ b/tests/ui/traits/const-traits/const_derives/derive-const-non-const-type.stderr
@@ -2,7 +2,7 @@ error: const `impl` for trait `Default` which is not marked with `#[const_trait]
   --> $DIR/derive-const-non-const-type.rs:10:16
    |
 LL | #[derive_const(Default)]
-   |                ^^^^^^^
+   |                ^^^^^^^ this trait is not `const`
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change
diff --git a/tests/ui/traits/const-traits/const_derives/derive-const-use.stderr b/tests/ui/traits/const-traits/const_derives/derive-const-use.stderr
index 6f4fc90f6363f..3b06f4d801a41 100644
--- a/tests/ui/traits/const-traits/const_derives/derive-const-use.stderr
+++ b/tests/ui/traits/const-traits/const_derives/derive-const-use.stderr
@@ -14,7 +14,7 @@ error: const `impl` for trait `Default` which is not marked with `#[const_trait]
   --> $DIR/derive-const-use.rs:7:12
    |
 LL | impl const Default for A {
-   |            ^^^^^^^
+   |            ^^^^^^^ this trait is not `const`
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change
@@ -23,7 +23,7 @@ error: const `impl` for trait `Default` which is not marked with `#[const_trait]
   --> $DIR/derive-const-use.rs:15:16
    |
 LL | #[derive_const(Default, PartialEq)]
-   |                ^^^^^^^
+   |                ^^^^^^^ this trait is not `const`
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change
@@ -33,7 +33,7 @@ error: const `impl` for trait `PartialEq` which is not marked with `#[const_trai
   --> $DIR/derive-const-use.rs:11:12
    |
 LL | impl const PartialEq for A {
-   |            ^^^^^^^^^
+   |            ^^^^^^^^^ this trait is not `const`
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change
@@ -42,7 +42,7 @@ error: const `impl` for trait `PartialEq` which is not marked with `#[const_trai
   --> $DIR/derive-const-use.rs:15:25
    |
 LL | #[derive_const(Default, PartialEq)]
-   |                         ^^^^^^^^^
+   |                         ^^^^^^^^^ this trait is not `const`
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change
diff --git a/tests/ui/traits/const-traits/const_derives/derive-const-with-params.stderr b/tests/ui/traits/const-traits/const_derives/derive-const-with-params.stderr
index 21cf64f89ea84..6b1405712ef7d 100644
--- a/tests/ui/traits/const-traits/const_derives/derive-const-with-params.stderr
+++ b/tests/ui/traits/const-traits/const_derives/derive-const-with-params.stderr
@@ -2,13 +2,16 @@ error: const `impl` for trait `PartialEq` which is not marked with `#[const_trai
   --> $DIR/derive-const-with-params.rs:7:16
    |
 LL | #[derive_const(PartialEq)]
-   |                ^^^^^^^^^
+   |                ^^^^^^^^^ this trait is not `const`
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change
    = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: `~const` can only be applied to `#[const_trait]` traits
+   |
+note: `PartialEq` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/cmp.rs:LL:COL
 
 error[E0015]: cannot call non-const operator in constant functions
   --> $DIR/derive-const-with-params.rs:8:23
diff --git a/tests/ui/traits/const-traits/effects/ice-112822-expected-type-for-param.stderr b/tests/ui/traits/const-traits/effects/ice-112822-expected-type-for-param.stderr
index 879d966b1f97b..280f8807f5fda 100644
--- a/tests/ui/traits/const-traits/effects/ice-112822-expected-type-for-param.stderr
+++ b/tests/ui/traits/const-traits/effects/ice-112822-expected-type-for-param.stderr
@@ -12,22 +12,29 @@ error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/ice-112822-expected-type-for-param.rs:3:25
    |
 LL | const fn test() -> impl ~const Fn() {
-   |                         ^^^^^^
+   |                         ^^^^^^ can't be applied to `Fn`
+   |
+note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/ice-112822-expected-type-for-param.rs:3:25
    |
 LL | const fn test() -> impl ~const Fn() {
-   |                         ^^^^^^
+   |                         ^^^^^^ can't be applied to `Fn`
    |
+note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/ice-112822-expected-type-for-param.rs:3:25
    |
 LL | const fn test() -> impl ~const Fn() {
-   |                         ^^^^^^
+   |                         ^^^^^^ can't be applied to `Fn`
    |
+note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0015]: cannot call non-const operator in constant functions
diff --git a/tests/ui/traits/const-traits/effects/spec-effectvar-ice.stderr b/tests/ui/traits/const-traits/effects/spec-effectvar-ice.stderr
index 5659102c5e5c4..474d96698d56b 100644
--- a/tests/ui/traits/const-traits/effects/spec-effectvar-ice.stderr
+++ b/tests/ui/traits/const-traits/effects/spec-effectvar-ice.stderr
@@ -1,32 +1,39 @@
 error: const `impl` for trait `Foo` which is not marked with `#[const_trait]`
   --> $DIR/spec-effectvar-ice.rs:10:15
    |
-LL | trait Foo {}
-   | - help: mark `Foo` as const: `#[const_trait]`
-LL |
 LL | impl<T> const Foo for T {}
-   |               ^^^
+   |               ^^^ this trait is not `const`
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change
+help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Foo {}
+   | ++++++++++++++
 
 error: const `impl` for trait `Foo` which is not marked with `#[const_trait]`
   --> $DIR/spec-effectvar-ice.rs:13:15
    |
-LL | trait Foo {}
-   | - help: mark `Foo` as const: `#[const_trait]`
-...
 LL | impl<T> const Foo for T where T: const Specialize {}
-   |               ^^^
+   |               ^^^ this trait is not `const`
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change
+help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Foo {}
+   | ++++++++++++++
 
 error: `const` can only be applied to `#[const_trait]` traits
   --> $DIR/spec-effectvar-ice.rs:13:34
    |
 LL | impl<T> const Foo for T where T: const Specialize {}
-   |                                  ^^^^^
+   |                                  ^^^^^ can't be applied to `Specialize`
+   |
+help: mark `Specialize` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Specialize {}
+   | ++++++++++++++
 
 error: specialization impl does not specialize any associated items
   --> $DIR/spec-effectvar-ice.rs:13:1
diff --git a/tests/ui/traits/const-traits/ice-119717-constant-lifetime.stderr b/tests/ui/traits/const-traits/ice-119717-constant-lifetime.stderr
index 9e22422ad3b94..5af263de28c48 100644
--- a/tests/ui/traits/const-traits/ice-119717-constant-lifetime.stderr
+++ b/tests/ui/traits/const-traits/ice-119717-constant-lifetime.stderr
@@ -2,7 +2,7 @@ error: const `impl` for trait `FromResidual` which is not marked with `#[const_t
   --> $DIR/ice-119717-constant-lifetime.rs:6:15
    |
 LL | impl<T> const FromResidual for T {
-   |               ^^^^^^^^^^^^
+   |               ^^^^^^^^^^^^ this trait is not `const`
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change
diff --git a/tests/ui/traits/const-traits/ice-123664-unexpected-bound-var.stderr b/tests/ui/traits/const-traits/ice-123664-unexpected-bound-var.stderr
index 1178c90fce541..821b257af8807 100644
--- a/tests/ui/traits/const-traits/ice-123664-unexpected-bound-var.stderr
+++ b/tests/ui/traits/const-traits/ice-123664-unexpected-bound-var.stderr
@@ -2,14 +2,19 @@ error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/ice-123664-unexpected-bound-var.rs:4:27
    |
 LL | const fn with_positive<F: ~const Fn()>() {}
-   |                           ^^^^^^
+   |                           ^^^^^^ can't be applied to `Fn`
+   |
+note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/ice-123664-unexpected-bound-var.rs:4:27
    |
 LL | const fn with_positive<F: ~const Fn()>() {}
-   |                           ^^^^^^
+   |                           ^^^^^^ can't be applied to `Fn`
    |
+note: `Fn` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/traits/const-traits/ice-126148-failed-to-normalize.stderr b/tests/ui/traits/const-traits/ice-126148-failed-to-normalize.stderr
index 9bd493e5fdbbf..41f99c2d375e6 100644
--- a/tests/ui/traits/const-traits/ice-126148-failed-to-normalize.stderr
+++ b/tests/ui/traits/const-traits/ice-126148-failed-to-normalize.stderr
@@ -2,7 +2,7 @@ error: const `impl` for trait `FromResidual` which is not marked with `#[const_t
   --> $DIR/ice-126148-failed-to-normalize.rs:8:12
    |
 LL | impl const FromResidual<Error> for TryMe {}
-   |            ^^^^^^^^^^^^^^^^^^^
+   |            ^^^^^^^^^^^^^^^^^^^ this trait is not `const`
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change
@@ -19,7 +19,7 @@ error: const `impl` for trait `Try` which is not marked with `#[const_trait]`
   --> $DIR/ice-126148-failed-to-normalize.rs:12:12
    |
 LL | impl const Try for TryMe {
-   |            ^^^
+   |            ^^^ this trait is not `const`
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change
diff --git a/tests/ui/traits/const-traits/non-const-op-in-closure-in-const.stderr b/tests/ui/traits/const-traits/non-const-op-in-closure-in-const.stderr
index 837effb7ca4cf..4ddb1e8c5a9f9 100644
--- a/tests/ui/traits/const-traits/non-const-op-in-closure-in-const.stderr
+++ b/tests/ui/traits/const-traits/non-const-op-in-closure-in-const.stderr
@@ -2,14 +2,19 @@ error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/non-const-op-in-closure-in-const.rs:10:44
    |
 LL | impl<A, B> const Convert<B> for A where B: ~const From<A> {
-   |                                            ^^^^^^
+   |                                            ^^^^^^ can't be applied to `From`
+   |
+note: `From` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/convert/mod.rs:LL:COL
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/non-const-op-in-closure-in-const.rs:10:44
    |
 LL | impl<A, B> const Convert<B> for A where B: ~const From<A> {
-   |                                            ^^^^^^
+   |                                            ^^^^^^ can't be applied to `From`
    |
+note: `From` can't be used with `~const` because it isn't annotated with `#[const_trait]`
+  --> $SRC_DIR/core/src/convert/mod.rs:LL:COL
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0015]: cannot call non-const fn `<B as From<A>>::from` in constant functions
diff --git a/tests/ui/traits/const-traits/super-traits-fail-2.nn.stderr b/tests/ui/traits/const-traits/super-traits-fail-2.nn.stderr
index e7f54b4c5bdda..51b88cf87022a 100644
--- a/tests/ui/traits/const-traits/super-traits-fail-2.nn.stderr
+++ b/tests/ui/traits/const-traits/super-traits-fail-2.nn.stderr
@@ -14,23 +14,36 @@ error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/super-traits-fail-2.rs:11:12
    |
 LL | trait Bar: ~const Foo {}
-   |            ^^^^^^
+   |            ^^^^^^ can't be applied to `Foo`
+   |
+help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Foo {
+   | ++++++++++++++
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/super-traits-fail-2.rs:11:12
    |
 LL | trait Bar: ~const Foo {}
-   |            ^^^^^^
+   |            ^^^^^^ can't be applied to `Foo`
    |
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Foo {
+   | ++++++++++++++
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/super-traits-fail-2.rs:11:12
    |
 LL | trait Bar: ~const Foo {}
-   |            ^^^^^^
+   |            ^^^^^^ can't be applied to `Foo`
    |
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Foo {
+   | ++++++++++++++
 
 error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions
   --> $DIR/super-traits-fail-2.rs:20:7
diff --git a/tests/ui/traits/const-traits/super-traits-fail-2.ny.stderr b/tests/ui/traits/const-traits/super-traits-fail-2.ny.stderr
index a09fe81f71696..38fb6f05412f4 100644
--- a/tests/ui/traits/const-traits/super-traits-fail-2.ny.stderr
+++ b/tests/ui/traits/const-traits/super-traits-fail-2.ny.stderr
@@ -2,39 +2,60 @@ error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/super-traits-fail-2.rs:11:12
    |
 LL | trait Bar: ~const Foo {}
-   |            ^^^^^^
+   |            ^^^^^^ can't be applied to `Foo`
+   |
+help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Foo {
+   | ++++++++++++++
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/super-traits-fail-2.rs:11:12
    |
 LL | trait Bar: ~const Foo {}
-   |            ^^^^^^
+   |            ^^^^^^ can't be applied to `Foo`
    |
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Foo {
+   | ++++++++++++++
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/super-traits-fail-2.rs:11:12
    |
 LL | trait Bar: ~const Foo {}
-   |            ^^^^^^
+   |            ^^^^^^ can't be applied to `Foo`
    |
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Foo {
+   | ++++++++++++++
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/super-traits-fail-2.rs:11:12
    |
 LL | trait Bar: ~const Foo {}
-   |            ^^^^^^
+   |            ^^^^^^ can't be applied to `Foo`
    |
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Foo {
+   | ++++++++++++++
 
 error: `~const` can only be applied to `#[const_trait]` traits
   --> $DIR/super-traits-fail-2.rs:11:12
    |
 LL | trait Bar: ~const Foo {}
-   |            ^^^^^^
+   |            ^^^^^^ can't be applied to `Foo`
    |
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Foo {
+   | ++++++++++++++
 
 error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions
   --> $DIR/super-traits-fail-2.rs:20:7
diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.nnn.stderr b/tests/ui/traits/const-traits/super-traits-fail-3.nnn.stderr
new file mode 100644
index 0000000000000..fd802fde5bd5a
--- /dev/null
+++ b/tests/ui/traits/const-traits/super-traits-fail-3.nnn.stderr
@@ -0,0 +1,102 @@
+error: `~const` is not allowed here
+  --> $DIR/super-traits-fail-3.rs:23:12
+   |
+LL | trait Bar: ~const Foo {}
+   |            ^^^^^^
+   |
+note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds
+  --> $DIR/super-traits-fail-3.rs:23:1
+   |
+LL | trait Bar: ~const Foo {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0658]: const trait impls are experimental
+  --> $DIR/super-traits-fail-3.rs:23:12
+   |
+LL | trait Bar: ~const Foo {}
+   |            ^^^^^^
+   |
+   = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
+   = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error[E0658]: const trait impls are experimental
+  --> $DIR/super-traits-fail-3.rs:32:17
+   |
+LL | const fn foo<T: ~const Bar>(x: &T) {
+   |                 ^^^^^^
+   |
+   = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
+   = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error: `~const` can only be applied to `#[const_trait]` traits
+  --> $DIR/super-traits-fail-3.rs:23:12
+   |
+LL | trait Bar: ~const Foo {}
+   |            ^^^^^^ can't be applied to `Foo`
+   |
+help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Foo {
+   | ++++++++++++++
+
+error: `~const` can only be applied to `#[const_trait]` traits
+  --> $DIR/super-traits-fail-3.rs:23:12
+   |
+LL | trait Bar: ~const Foo {}
+   |            ^^^^^^ can't be applied to `Foo`
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Foo {
+   | ++++++++++++++
+
+error: `~const` can only be applied to `#[const_trait]` traits
+  --> $DIR/super-traits-fail-3.rs:23:12
+   |
+LL | trait Bar: ~const Foo {}
+   |            ^^^^^^ can't be applied to `Foo`
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Foo {
+   | ++++++++++++++
+
+error: `~const` can only be applied to `#[const_trait]` traits
+  --> $DIR/super-traits-fail-3.rs:32:17
+   |
+LL | const fn foo<T: ~const Bar>(x: &T) {
+   |                 ^^^^^^ can't be applied to `Bar`
+   |
+help: enable `#![feature(const_trait_impl)]` in your crate and mark `Bar` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Bar: ~const Foo {}
+   | ++++++++++++++
+
+error: `~const` can only be applied to `#[const_trait]` traits
+  --> $DIR/super-traits-fail-3.rs:32:17
+   |
+LL | const fn foo<T: ~const Bar>(x: &T) {
+   |                 ^^^^^^ can't be applied to `Bar`
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: enable `#![feature(const_trait_impl)]` in your crate and mark `Bar` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Bar: ~const Foo {}
+   | ++++++++++++++
+
+error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions
+  --> $DIR/super-traits-fail-3.rs:36:7
+   |
+LL |     x.a();
+   |       ^^^
+   |
+   = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
+
+error: aborting due to 9 previous errors
+
+Some errors have detailed explanations: E0015, E0658.
+For more information about an error, try `rustc --explain E0015`.
diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.nny.stderr b/tests/ui/traits/const-traits/super-traits-fail-3.nny.stderr
new file mode 100644
index 0000000000000..fd802fde5bd5a
--- /dev/null
+++ b/tests/ui/traits/const-traits/super-traits-fail-3.nny.stderr
@@ -0,0 +1,102 @@
+error: `~const` is not allowed here
+  --> $DIR/super-traits-fail-3.rs:23:12
+   |
+LL | trait Bar: ~const Foo {}
+   |            ^^^^^^
+   |
+note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds
+  --> $DIR/super-traits-fail-3.rs:23:1
+   |
+LL | trait Bar: ~const Foo {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0658]: const trait impls are experimental
+  --> $DIR/super-traits-fail-3.rs:23:12
+   |
+LL | trait Bar: ~const Foo {}
+   |            ^^^^^^
+   |
+   = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
+   = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error[E0658]: const trait impls are experimental
+  --> $DIR/super-traits-fail-3.rs:32:17
+   |
+LL | const fn foo<T: ~const Bar>(x: &T) {
+   |                 ^^^^^^
+   |
+   = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
+   = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error: `~const` can only be applied to `#[const_trait]` traits
+  --> $DIR/super-traits-fail-3.rs:23:12
+   |
+LL | trait Bar: ~const Foo {}
+   |            ^^^^^^ can't be applied to `Foo`
+   |
+help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Foo {
+   | ++++++++++++++
+
+error: `~const` can only be applied to `#[const_trait]` traits
+  --> $DIR/super-traits-fail-3.rs:23:12
+   |
+LL | trait Bar: ~const Foo {}
+   |            ^^^^^^ can't be applied to `Foo`
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Foo {
+   | ++++++++++++++
+
+error: `~const` can only be applied to `#[const_trait]` traits
+  --> $DIR/super-traits-fail-3.rs:23:12
+   |
+LL | trait Bar: ~const Foo {}
+   |            ^^^^^^ can't be applied to `Foo`
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Foo {
+   | ++++++++++++++
+
+error: `~const` can only be applied to `#[const_trait]` traits
+  --> $DIR/super-traits-fail-3.rs:32:17
+   |
+LL | const fn foo<T: ~const Bar>(x: &T) {
+   |                 ^^^^^^ can't be applied to `Bar`
+   |
+help: enable `#![feature(const_trait_impl)]` in your crate and mark `Bar` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Bar: ~const Foo {}
+   | ++++++++++++++
+
+error: `~const` can only be applied to `#[const_trait]` traits
+  --> $DIR/super-traits-fail-3.rs:32:17
+   |
+LL | const fn foo<T: ~const Bar>(x: &T) {
+   |                 ^^^^^^ can't be applied to `Bar`
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: enable `#![feature(const_trait_impl)]` in your crate and mark `Bar` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Bar: ~const Foo {}
+   | ++++++++++++++
+
+error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions
+  --> $DIR/super-traits-fail-3.rs:36:7
+   |
+LL |     x.a();
+   |       ^^^
+   |
+   = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
+
+error: aborting due to 9 previous errors
+
+Some errors have detailed explanations: E0015, E0658.
+For more information about an error, try `rustc --explain E0015`.
diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.ny.stderr b/tests/ui/traits/const-traits/super-traits-fail-3.ny.stderr
deleted file mode 100644
index a880c2a22061f..0000000000000
--- a/tests/ui/traits/const-traits/super-traits-fail-3.ny.stderr
+++ /dev/null
@@ -1,49 +0,0 @@
-error: `~const` can only be applied to `#[const_trait]` traits
-  --> $DIR/super-traits-fail-3.rs:13:12
-   |
-LL | trait Bar: ~const Foo {}
-   |            ^^^^^^
-
-error: `~const` can only be applied to `#[const_trait]` traits
-  --> $DIR/super-traits-fail-3.rs:13:12
-   |
-LL | trait Bar: ~const Foo {}
-   |            ^^^^^^
-   |
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-
-error: `~const` can only be applied to `#[const_trait]` traits
-  --> $DIR/super-traits-fail-3.rs:13:12
-   |
-LL | trait Bar: ~const Foo {}
-   |            ^^^^^^
-   |
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-
-error: `~const` can only be applied to `#[const_trait]` traits
-  --> $DIR/super-traits-fail-3.rs:13:12
-   |
-LL | trait Bar: ~const Foo {}
-   |            ^^^^^^
-   |
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-
-error: `~const` can only be applied to `#[const_trait]` traits
-  --> $DIR/super-traits-fail-3.rs:13:12
-   |
-LL | trait Bar: ~const Foo {}
-   |            ^^^^^^
-   |
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-
-error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions
-  --> $DIR/super-traits-fail-3.rs:24:7
-   |
-LL |     x.a();
-   |       ^^^
-   |
-   = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-
-error: aborting due to 6 previous errors
-
-For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.nyn.stderr b/tests/ui/traits/const-traits/super-traits-fail-3.nyn.stderr
new file mode 100644
index 0000000000000..8abda1c8f8afe
--- /dev/null
+++ b/tests/ui/traits/const-traits/super-traits-fail-3.nyn.stderr
@@ -0,0 +1,53 @@
+error[E0658]: const trait impls are experimental
+  --> $DIR/super-traits-fail-3.rs:23:12
+   |
+LL | trait Bar: ~const Foo {}
+   |            ^^^^^^
+   |
+   = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
+   = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error[E0658]: const trait impls are experimental
+  --> $DIR/super-traits-fail-3.rs:32:17
+   |
+LL | const fn foo<T: ~const Bar>(x: &T) {
+   |                 ^^^^^^
+   |
+   = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
+   = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error[E0658]: `const_trait` is a temporary placeholder for marking a trait that is suitable for `const` `impls` and all default bodies as `const`, which may be removed or renamed in the future.
+  --> $DIR/super-traits-fail-3.rs:15:37
+   |
+LL | #[cfg_attr(any(yyy, yyn, nyy, nyn), const_trait)]
+   |                                     ^^^^^^^^^^^
+   |
+   = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
+   = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error[E0658]: `const_trait` is a temporary placeholder for marking a trait that is suitable for `const` `impls` and all default bodies as `const`, which may be removed or renamed in the future.
+  --> $DIR/super-traits-fail-3.rs:21:37
+   |
+LL | #[cfg_attr(any(yyy, yny, nyy, nyn), const_trait)]
+   |                                     ^^^^^^^^^^^
+   |
+   = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
+   = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error[E0658]: cannot call conditionally-const method `<T as Foo>::a` in constant functions
+  --> $DIR/super-traits-fail-3.rs:36:5
+   |
+LL |     x.a();
+   |     ^^^^^
+   |
+   = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
+   = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.nyy.stderr b/tests/ui/traits/const-traits/super-traits-fail-3.nyy.stderr
new file mode 100644
index 0000000000000..8abda1c8f8afe
--- /dev/null
+++ b/tests/ui/traits/const-traits/super-traits-fail-3.nyy.stderr
@@ -0,0 +1,53 @@
+error[E0658]: const trait impls are experimental
+  --> $DIR/super-traits-fail-3.rs:23:12
+   |
+LL | trait Bar: ~const Foo {}
+   |            ^^^^^^
+   |
+   = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
+   = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error[E0658]: const trait impls are experimental
+  --> $DIR/super-traits-fail-3.rs:32:17
+   |
+LL | const fn foo<T: ~const Bar>(x: &T) {
+   |                 ^^^^^^
+   |
+   = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
+   = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error[E0658]: `const_trait` is a temporary placeholder for marking a trait that is suitable for `const` `impls` and all default bodies as `const`, which may be removed or renamed in the future.
+  --> $DIR/super-traits-fail-3.rs:15:37
+   |
+LL | #[cfg_attr(any(yyy, yyn, nyy, nyn), const_trait)]
+   |                                     ^^^^^^^^^^^
+   |
+   = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
+   = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error[E0658]: `const_trait` is a temporary placeholder for marking a trait that is suitable for `const` `impls` and all default bodies as `const`, which may be removed or renamed in the future.
+  --> $DIR/super-traits-fail-3.rs:21:37
+   |
+LL | #[cfg_attr(any(yyy, yny, nyy, nyn), const_trait)]
+   |                                     ^^^^^^^^^^^
+   |
+   = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
+   = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error[E0658]: cannot call conditionally-const method `<T as Foo>::a` in constant functions
+  --> $DIR/super-traits-fail-3.rs:36:5
+   |
+LL |     x.a();
+   |     ^^^^^
+   |
+   = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
+   = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.rs b/tests/ui/traits/const-traits/super-traits-fail-3.rs
index bd95ae8d96a9d..aa27554e7f895 100644
--- a/tests/ui/traits/const-traits/super-traits-fail-3.rs
+++ b/tests/ui/traits/const-traits/super-traits-fail-3.rs
@@ -1,29 +1,42 @@
 //@ compile-flags: -Znext-solver
-#![feature(const_trait_impl)]
+#![cfg_attr(any(yyy, yyn, yny, ynn), feature(const_trait_impl))]
 
-//@ revisions: yy yn ny nn
-//@[yy] check-pass
+//@ revisions: yyy yyn yny ynn nyy nyn nny nnn
+//@[yyy] check-pass
+/// yyy: feature enabled, Foo is const, Bar is const
+/// yyn: feature enabled, Foo is const, Bar is not const
+/// yny: feature enabled, Foo is not const, Bar is const
+/// ynn: feature enabled, Foo is not const, Bar is not const
+/// nyy: feature not enabled, Foo is const, Bar is const
+/// nyn: feature not enabled, Foo is const, Bar is not const
+/// nny: feature not enabled, Foo is not const, Bar is const
+/// nnn: feature not enabled, Foo is not const, Bar is not const
 
-#[cfg_attr(any(yy, yn), const_trait)]
+#[cfg_attr(any(yyy, yyn, nyy, nyn), const_trait)]
+//[nyy,nyn]~^ ERROR: `const_trait` is a temporary placeholder for marking a trait that is suitable for `const` `impls` and all default bodies as `const`, which may be removed or renamed in the future
 trait Foo {
     fn a(&self);
 }
 
-#[cfg_attr(any(yy, ny), const_trait)]
+#[cfg_attr(any(yyy, yny, nyy, nyn), const_trait)]
+//[nyy,nyn]~^ ERROR: `const_trait` is a temporary placeholder for marking a trait that is suitable for `const` `impls` and all default bodies as `const`, which may be removed or renamed in the future
 trait Bar: ~const Foo {}
-//[ny,nn]~^ ERROR: `~const` can only be applied to `#[const_trait]`
-//[ny,nn]~| ERROR: `~const` can only be applied to `#[const_trait]`
-//[ny,nn]~| ERROR: `~const` can only be applied to `#[const_trait]`
-//[ny]~| ERROR: `~const` can only be applied to `#[const_trait]`
-//[ny]~| ERROR: `~const` can only be applied to `#[const_trait]`
-//[yn,nn]~^^^^^^ ERROR: `~const` is not allowed here
+//[yny,ynn,nny,nnn]~^ ERROR: `~const` can only be applied to `#[const_trait]`
+//[yny,ynn,nny,nnn]~| ERROR: `~const` can only be applied to `#[const_trait]`
+//[yny,ynn,nny,nnn]~| ERROR: `~const` can only be applied to `#[const_trait]`
+//[yny]~^^^^ ERROR: `~const` can only be applied to `#[const_trait]`
+//[yny]~| ERROR: `~const` can only be applied to `#[const_trait]`
+//[yyn,ynn,nny,nnn]~^^^^^^ ERROR: `~const` is not allowed here
+//[nyy,nyn,nny,nnn]~^^^^^^^ ERROR: const trait impls are experimental
 
 const fn foo<T: ~const Bar>(x: &T) {
-    //[yn,nn]~^ ERROR: `~const` can only be applied to `#[const_trait]`
-    //[yn,nn]~| ERROR: `~const` can only be applied to `#[const_trait]`
+    //[yyn,ynn,nny,nnn]~^ ERROR: `~const` can only be applied to `#[const_trait]`
+    //[yyn,ynn,nny,nnn]~| ERROR: `~const` can only be applied to `#[const_trait]`
+    //[nyy,nyn,nny,nnn]~^^^ ERROR: const trait impls are experimental
     x.a();
-    //[yn]~^ ERROR: the trait bound `T: ~const Foo` is not satisfied
-    //[nn,ny]~^^ ERROR: cannot call non-const fn `<T as Foo>::a` in constant functions
+    //[yyn]~^ ERROR: the trait bound `T: ~const Foo` is not satisfied
+    //[ynn,yny,nny,nnn]~^^ ERROR: cannot call non-const fn `<T as Foo>::a` in constant functions
+    //[nyy,nyn]~^^^ ERROR: cannot call conditionally-const method `<T as Foo>::a` in constant functions
 }
 
 fn main() {}
diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.nn.stderr b/tests/ui/traits/const-traits/super-traits-fail-3.ynn.stderr
similarity index 51%
rename from tests/ui/traits/const-traits/super-traits-fail-3.nn.stderr
rename to tests/ui/traits/const-traits/super-traits-fail-3.ynn.stderr
index 599b8c826f7ae..16424696eeb51 100644
--- a/tests/ui/traits/const-traits/super-traits-fail-3.nn.stderr
+++ b/tests/ui/traits/const-traits/super-traits-fail-3.ynn.stderr
@@ -1,53 +1,75 @@
 error: `~const` is not allowed here
-  --> $DIR/super-traits-fail-3.rs:13:12
+  --> $DIR/super-traits-fail-3.rs:23:12
    |
 LL | trait Bar: ~const Foo {}
    |            ^^^^^^
    |
 note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds
-  --> $DIR/super-traits-fail-3.rs:13:1
+  --> $DIR/super-traits-fail-3.rs:23:1
    |
 LL | trait Bar: ~const Foo {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: `~const` can only be applied to `#[const_trait]` traits
-  --> $DIR/super-traits-fail-3.rs:13:12
+  --> $DIR/super-traits-fail-3.rs:23:12
    |
 LL | trait Bar: ~const Foo {}
-   |            ^^^^^^
+   |            ^^^^^^ can't be applied to `Foo`
+   |
+help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Foo {
+   | ++++++++++++++
 
 error: `~const` can only be applied to `#[const_trait]` traits
-  --> $DIR/super-traits-fail-3.rs:13:12
+  --> $DIR/super-traits-fail-3.rs:23:12
    |
 LL | trait Bar: ~const Foo {}
-   |            ^^^^^^
+   |            ^^^^^^ can't be applied to `Foo`
    |
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Foo {
+   | ++++++++++++++
 
 error: `~const` can only be applied to `#[const_trait]` traits
-  --> $DIR/super-traits-fail-3.rs:13:12
+  --> $DIR/super-traits-fail-3.rs:23:12
    |
 LL | trait Bar: ~const Foo {}
-   |            ^^^^^^
+   |            ^^^^^^ can't be applied to `Foo`
    |
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Foo {
+   | ++++++++++++++
 
 error: `~const` can only be applied to `#[const_trait]` traits
-  --> $DIR/super-traits-fail-3.rs:21:17
+  --> $DIR/super-traits-fail-3.rs:32:17
    |
 LL | const fn foo<T: ~const Bar>(x: &T) {
-   |                 ^^^^^^
+   |                 ^^^^^^ can't be applied to `Bar`
+   |
+help: mark `Bar` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Bar: ~const Foo {}
+   | ++++++++++++++
 
 error: `~const` can only be applied to `#[const_trait]` traits
-  --> $DIR/super-traits-fail-3.rs:21:17
+  --> $DIR/super-traits-fail-3.rs:32:17
    |
 LL | const fn foo<T: ~const Bar>(x: &T) {
-   |                 ^^^^^^
+   |                 ^^^^^^ can't be applied to `Bar`
    |
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: mark `Bar` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Bar: ~const Foo {}
+   | ++++++++++++++
 
 error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions
-  --> $DIR/super-traits-fail-3.rs:24:7
+  --> $DIR/super-traits-fail-3.rs:36:7
    |
 LL |     x.a();
    |       ^^^
diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.yny.stderr b/tests/ui/traits/const-traits/super-traits-fail-3.yny.stderr
new file mode 100644
index 0000000000000..c81544c4bf5b7
--- /dev/null
+++ b/tests/ui/traits/const-traits/super-traits-fail-3.yny.stderr
@@ -0,0 +1,70 @@
+error: `~const` can only be applied to `#[const_trait]` traits
+  --> $DIR/super-traits-fail-3.rs:23:12
+   |
+LL | trait Bar: ~const Foo {}
+   |            ^^^^^^ can't be applied to `Foo`
+   |
+help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Foo {
+   | ++++++++++++++
+
+error: `~const` can only be applied to `#[const_trait]` traits
+  --> $DIR/super-traits-fail-3.rs:23:12
+   |
+LL | trait Bar: ~const Foo {}
+   |            ^^^^^^ can't be applied to `Foo`
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Foo {
+   | ++++++++++++++
+
+error: `~const` can only be applied to `#[const_trait]` traits
+  --> $DIR/super-traits-fail-3.rs:23:12
+   |
+LL | trait Bar: ~const Foo {}
+   |            ^^^^^^ can't be applied to `Foo`
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Foo {
+   | ++++++++++++++
+
+error: `~const` can only be applied to `#[const_trait]` traits
+  --> $DIR/super-traits-fail-3.rs:23:12
+   |
+LL | trait Bar: ~const Foo {}
+   |            ^^^^^^ can't be applied to `Foo`
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Foo {
+   | ++++++++++++++
+
+error: `~const` can only be applied to `#[const_trait]` traits
+  --> $DIR/super-traits-fail-3.rs:23:12
+   |
+LL | trait Bar: ~const Foo {}
+   |            ^^^^^^ can't be applied to `Foo`
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Foo {
+   | ++++++++++++++
+
+error[E0015]: cannot call non-const fn `<T as Foo>::a` in constant functions
+  --> $DIR/super-traits-fail-3.rs:36:7
+   |
+LL |     x.a();
+   |       ^^^
+   |
+   = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/traits/const-traits/super-traits-fail-3.yn.stderr b/tests/ui/traits/const-traits/super-traits-fail-3.yyn.stderr
similarity index 55%
rename from tests/ui/traits/const-traits/super-traits-fail-3.yn.stderr
rename to tests/ui/traits/const-traits/super-traits-fail-3.yyn.stderr
index ecee348222d1f..3270611dace2e 100644
--- a/tests/ui/traits/const-traits/super-traits-fail-3.yn.stderr
+++ b/tests/ui/traits/const-traits/super-traits-fail-3.yyn.stderr
@@ -1,31 +1,40 @@
 error: `~const` is not allowed here
-  --> $DIR/super-traits-fail-3.rs:13:12
+  --> $DIR/super-traits-fail-3.rs:23:12
    |
 LL | trait Bar: ~const Foo {}
    |            ^^^^^^
    |
 note: this trait is not a `#[const_trait]`, so it cannot have `~const` trait bounds
-  --> $DIR/super-traits-fail-3.rs:13:1
+  --> $DIR/super-traits-fail-3.rs:23:1
    |
 LL | trait Bar: ~const Foo {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: `~const` can only be applied to `#[const_trait]` traits
-  --> $DIR/super-traits-fail-3.rs:21:17
+  --> $DIR/super-traits-fail-3.rs:32:17
    |
 LL | const fn foo<T: ~const Bar>(x: &T) {
-   |                 ^^^^^^
+   |                 ^^^^^^ can't be applied to `Bar`
+   |
+help: mark `Bar` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Bar: ~const Foo {}
+   | ++++++++++++++
 
 error: `~const` can only be applied to `#[const_trait]` traits
-  --> $DIR/super-traits-fail-3.rs:21:17
+  --> $DIR/super-traits-fail-3.rs:32:17
    |
 LL | const fn foo<T: ~const Bar>(x: &T) {
-   |                 ^^^^^^
+   |                 ^^^^^^ can't be applied to `Bar`
    |
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: mark `Bar` as `#[const_trait]` to allow it to have `const` implementations
+   |
+LL | #[const_trait] trait Bar: ~const Foo {}
+   | ++++++++++++++
 
 error[E0277]: the trait bound `T: ~const Foo` is not satisfied
-  --> $DIR/super-traits-fail-3.rs:24:7
+  --> $DIR/super-traits-fail-3.rs:36:7
    |
 LL |     x.a();
    |       ^
diff --git a/tests/ui/traits/const-traits/trait-default-body-stability.stderr b/tests/ui/traits/const-traits/trait-default-body-stability.stderr
index b471cb81c3b8d..77b81211e8152 100644
--- a/tests/ui/traits/const-traits/trait-default-body-stability.stderr
+++ b/tests/ui/traits/const-traits/trait-default-body-stability.stderr
@@ -2,7 +2,7 @@ error: const `impl` for trait `Try` which is not marked with `#[const_trait]`
   --> $DIR/trait-default-body-stability.rs:19:12
    |
 LL | impl const Try for T {
-   |            ^^^
+   |            ^^^ this trait is not `const`
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change
@@ -11,7 +11,7 @@ error: const `impl` for trait `FromResidual` which is not marked with `#[const_t
   --> $DIR/trait-default-body-stability.rs:34:12
    |
 LL | impl const FromResidual for T {
-   |            ^^^^^^^^^^^^
+   |            ^^^^^^^^^^^^ this trait is not `const`
    |
    = note: marking a trait with `#[const_trait]` ensures all default method bodies are `const`
    = note: adding a non-const method body in the future would be a breaking change

From 6e2e9f676c03128e3c988c393904e3e6181b938b Mon Sep 17 00:00:00 2001
From: Michael Goulet <michael@errs.io>
Date: Tue, 10 Dec 2024 01:08:03 +0000
Subject: [PATCH 04/11] Don't ICE when encountering never in pattern

---
 compiler/rustc_hir_typeck/src/expr.rs         |  6 +++++-
 tests/ui/never_type/never-in-range-pat.rs     | 16 ++++++++++++++++
 tests/ui/never_type/never-in-range-pat.stderr | 11 +++++++++++
 3 files changed, 32 insertions(+), 1 deletion(-)
 create mode 100644 tests/ui/never_type/never-in-range-pat.rs
 create mode 100644 tests/ui/never_type/never-in-range-pat.stderr

diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs
index 04c06169d3309..1676337ab484b 100644
--- a/compiler/rustc_hir_typeck/src/expr.rs
+++ b/compiler/rustc_hir_typeck/src/expr.rs
@@ -402,6 +402,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
             })
             | hir::Node::ImplItem(hir::ImplItem { kind: hir::ImplItemKind::Const(..), .. }) => true,
 
+            hir::Node::Pat(_) => {
+                self.dcx().span_delayed_bug(expr.span, "place expr not allowed in pattern");
+                true
+            }
+
             // These nodes do not have direct sub-exprs.
             hir::Node::Param(_)
             | hir::Node::Item(_)
@@ -414,7 +419,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
             | hir::Node::Ty(_)
             | hir::Node::AssocItemConstraint(_)
             | hir::Node::TraitRef(_)
-            | hir::Node::Pat(_)
             | hir::Node::PatField(_)
             | hir::Node::LetStmt(_)
             | hir::Node::Synthetic
diff --git a/tests/ui/never_type/never-in-range-pat.rs b/tests/ui/never_type/never-in-range-pat.rs
new file mode 100644
index 0000000000000..ae2d76c172ea0
--- /dev/null
+++ b/tests/ui/never_type/never-in-range-pat.rs
@@ -0,0 +1,16 @@
+// Regression test for <https://github.com/rust-lang/rust/issues/133947>.
+
+// Make sure we don't ICE when there's `!` in a range pattern.
+//
+// This shouldn't be allowed anyways, but we only deny it during MIR
+// building, so make sure we handle it semi-gracefully during typeck.
+
+#![feature(never_type)]
+
+fn main() {
+    let x: !;
+    match 1 {
+        0..x => {}
+        //~^ ERROR only `char` and numeric types are allowed in range patterns
+    }
+}
diff --git a/tests/ui/never_type/never-in-range-pat.stderr b/tests/ui/never_type/never-in-range-pat.stderr
new file mode 100644
index 0000000000000..c78be5350e0f0
--- /dev/null
+++ b/tests/ui/never_type/never-in-range-pat.stderr
@@ -0,0 +1,11 @@
+error[E0029]: only `char` and numeric types are allowed in range patterns
+  --> $DIR/never-in-range-pat.rs:13:12
+   |
+LL |         0..x => {}
+   |         -  ^ this is of type `!` but it should be `char` or numeric
+   |         |
+   |         this is of type `{integer}`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0029`.

From b30d9ebf2627efa37278e00b6ef714340cf224a6 Mon Sep 17 00:00:00 2001
From: Oli Scherer <github333195615777966@oli-obk.de>
Date: Mon, 9 Dec 2024 09:51:55 +0000
Subject: [PATCH 05/11] Add regression tests

---
 tests/ui/asm/generic_const_simd_vec_len.rs    | 18 +++++++++++++++++
 .../ui/asm/generic_const_simd_vec_len.stderr  | 10 ++++++++++
 tests/ui/asm/named_const_simd_vec_len.rs      | 20 +++++++++++++++++++
 tests/ui/asm/named_const_simd_vec_len.stderr  | 10 ++++++++++
 4 files changed, 58 insertions(+)
 create mode 100644 tests/ui/asm/generic_const_simd_vec_len.rs
 create mode 100644 tests/ui/asm/generic_const_simd_vec_len.stderr
 create mode 100644 tests/ui/asm/named_const_simd_vec_len.rs
 create mode 100644 tests/ui/asm/named_const_simd_vec_len.stderr

diff --git a/tests/ui/asm/generic_const_simd_vec_len.rs b/tests/ui/asm/generic_const_simd_vec_len.rs
new file mode 100644
index 0000000000000..4ef839e381674
--- /dev/null
+++ b/tests/ui/asm/generic_const_simd_vec_len.rs
@@ -0,0 +1,18 @@
+//! This is a regression test to ensure that we emit a diagnostic pointing to the
+//! reason the type was rejected in inline assembly.
+
+#![feature(repr_simd)]
+
+#[repr(simd)]
+#[derive(Copy, Clone)]
+pub struct Foo<const C: usize>([u8; C]);
+
+pub unsafe fn foo<const C: usize>(a: Foo<C>) {
+    std::arch::asm!(
+        "movaps {src}, {src}",
+        src = in(xmm_reg) a,
+        //~^ ERROR: cannot use value of type `Foo<C>` for inline assembly
+    );
+}
+
+fn main() {}
diff --git a/tests/ui/asm/generic_const_simd_vec_len.stderr b/tests/ui/asm/generic_const_simd_vec_len.stderr
new file mode 100644
index 0000000000000..d0044d144adcb
--- /dev/null
+++ b/tests/ui/asm/generic_const_simd_vec_len.stderr
@@ -0,0 +1,10 @@
+error: cannot use value of type `Foo<C>` for inline assembly
+  --> $DIR/generic_const_simd_vec_len.rs:13:27
+   |
+LL |         src = in(xmm_reg) a,
+   |                           ^
+   |
+   = note: only integers, floats, SIMD vectors, pointers and function pointers can be used as arguments for inline assembly
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/asm/named_const_simd_vec_len.rs b/tests/ui/asm/named_const_simd_vec_len.rs
new file mode 100644
index 0000000000000..124f5357290ea
--- /dev/null
+++ b/tests/ui/asm/named_const_simd_vec_len.rs
@@ -0,0 +1,20 @@
+//! This is a regression test to ensure that we evaluate
+//! SIMD vector length constants instead of assuming they are literals.
+
+#![feature(repr_simd)]
+
+const C: usize = 16;
+
+#[repr(simd)]
+#[derive(Copy, Clone)]
+pub struct Foo([u8; C]);
+
+pub unsafe fn foo(a: Foo) {
+    std::arch::asm!(
+        "movaps {src}, {src}",
+        src = in(xmm_reg) a,
+        //~^ ERROR: cannot use value of type `Foo` for inline assembly
+    );
+}
+
+fn main() {}
diff --git a/tests/ui/asm/named_const_simd_vec_len.stderr b/tests/ui/asm/named_const_simd_vec_len.stderr
new file mode 100644
index 0000000000000..fb3e6b1738c51
--- /dev/null
+++ b/tests/ui/asm/named_const_simd_vec_len.stderr
@@ -0,0 +1,10 @@
+error: cannot use value of type `Foo` for inline assembly
+  --> $DIR/named_const_simd_vec_len.rs:15:27
+   |
+LL |         src = in(xmm_reg) a,
+   |                           ^
+   |
+   = note: only integers, floats, SIMD vectors, pointers and function pointers can be used as arguments for inline assembly
+
+error: aborting due to 1 previous error
+

From 0ab6ddd488296fe75da3ceaa1001200ea2e19879 Mon Sep 17 00:00:00 2001
From: Oli Scherer <github333195615777966@oli-obk.de>
Date: Mon, 9 Dec 2024 10:06:51 +0000
Subject: [PATCH 06/11] Evaluate constants in SIMD vec lengths before rejecting
 them

---
 compiler/rustc_hir_analysis/src/check/intrinsicck.rs |  1 +
 tests/ui/asm/named_const_simd_vec_len.rs             |  3 ++-
 tests/ui/asm/named_const_simd_vec_len.stderr         | 10 ----------
 3 files changed, 3 insertions(+), 11 deletions(-)
 delete mode 100644 tests/ui/asm/named_const_simd_vec_len.stderr

diff --git a/compiler/rustc_hir_analysis/src/check/intrinsicck.rs b/compiler/rustc_hir_analysis/src/check/intrinsicck.rs
index df4da03f0f59d..c4762b1235867 100644
--- a/compiler/rustc_hir_analysis/src/check/intrinsicck.rs
+++ b/compiler/rustc_hir_analysis/src/check/intrinsicck.rs
@@ -83,6 +83,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
 
                 let (size, ty) = match elem_ty.kind() {
                     ty::Array(ty, len) => {
+                        let len = self.tcx.normalize_erasing_regions(self.typing_env, *len);
                         if let Some(len) = len.try_to_target_usize(self.tcx) {
                             (len, *ty)
                         } else {
diff --git a/tests/ui/asm/named_const_simd_vec_len.rs b/tests/ui/asm/named_const_simd_vec_len.rs
index 124f5357290ea..c7e01de6be15b 100644
--- a/tests/ui/asm/named_const_simd_vec_len.rs
+++ b/tests/ui/asm/named_const_simd_vec_len.rs
@@ -1,6 +1,8 @@
 //! This is a regression test to ensure that we evaluate
 //! SIMD vector length constants instead of assuming they are literals.
 
+//@check-pass
+
 #![feature(repr_simd)]
 
 const C: usize = 16;
@@ -13,7 +15,6 @@ pub unsafe fn foo(a: Foo) {
     std::arch::asm!(
         "movaps {src}, {src}",
         src = in(xmm_reg) a,
-        //~^ ERROR: cannot use value of type `Foo` for inline assembly
     );
 }
 
diff --git a/tests/ui/asm/named_const_simd_vec_len.stderr b/tests/ui/asm/named_const_simd_vec_len.stderr
deleted file mode 100644
index fb3e6b1738c51..0000000000000
--- a/tests/ui/asm/named_const_simd_vec_len.stderr
+++ /dev/null
@@ -1,10 +0,0 @@
-error: cannot use value of type `Foo` for inline assembly
-  --> $DIR/named_const_simd_vec_len.rs:15:27
-   |
-LL |         src = in(xmm_reg) a,
-   |                           ^
-   |
-   = note: only integers, floats, SIMD vectors, pointers and function pointers can be used as arguments for inline assembly
-
-error: aborting due to 1 previous error
-

From c7088b2b95da9fd92df760428a219826edfda490 Mon Sep 17 00:00:00 2001
From: Oli Scherer <github333195615777966@oli-obk.de>
Date: Mon, 9 Dec 2024 10:37:47 +0000
Subject: [PATCH 07/11] Clarify why a type is rejected for asm!

---
 .../src/check/intrinsicck.rs                  | 117 +++++++++++-------
 tests/ui/asm/generic_const_simd_vec_len.rs    |   5 +-
 .../ui/asm/generic_const_simd_vec_len.stderr  |  12 +-
 3 files changed, 85 insertions(+), 49 deletions(-)

diff --git a/compiler/rustc_hir_analysis/src/check/intrinsicck.rs b/compiler/rustc_hir_analysis/src/check/intrinsicck.rs
index c4762b1235867..90e93bdbb5075 100644
--- a/compiler/rustc_hir_analysis/src/check/intrinsicck.rs
+++ b/compiler/rustc_hir_analysis/src/check/intrinsicck.rs
@@ -3,6 +3,7 @@ use std::assert_matches::debug_assert_matches;
 use rustc_abi::FieldIdx;
 use rustc_ast::InlineAsmTemplatePiece;
 use rustc_data_structures::fx::FxIndexSet;
+use rustc_hir::def_id::DefId;
 use rustc_hir::{self as hir, LangItem};
 use rustc_middle::bug;
 use rustc_middle::ty::{self, FloatTy, IntTy, Ty, TyCtxt, TypeVisitableExt, UintTy};
@@ -21,6 +22,12 @@ pub struct InlineAsmCtxt<'a, 'tcx> {
     get_operand_ty: Box<dyn Fn(&'tcx hir::Expr<'tcx>) -> Ty<'tcx> + 'a>,
 }
 
+enum NonAsmTypeReason<'tcx> {
+    UnevaluatedSIMDArrayLength(DefId, ty::Const<'tcx>),
+    Invalid(Ty<'tcx>),
+    InvalidElement(DefId, Ty<'tcx>),
+}
+
 impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
     pub fn new_global_asm(tcx: TyCtxt<'tcx>) -> Self {
         InlineAsmCtxt {
@@ -56,7 +63,7 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
         false
     }
 
-    fn get_asm_ty(&self, ty: Ty<'tcx>) -> Option<InlineAsmType> {
+    fn get_asm_ty(&self, ty: Ty<'tcx>) -> Result<InlineAsmType, NonAsmTypeReason<'tcx>> {
         let asm_ty_isize = match self.tcx.sess.target.pointer_width {
             16 => InlineAsmType::I16,
             32 => InlineAsmType::I32,
@@ -65,21 +72,22 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
         };
 
         match *ty.kind() {
-            ty::Int(IntTy::I8) | ty::Uint(UintTy::U8) => Some(InlineAsmType::I8),
-            ty::Int(IntTy::I16) | ty::Uint(UintTy::U16) => Some(InlineAsmType::I16),
-            ty::Int(IntTy::I32) | ty::Uint(UintTy::U32) => Some(InlineAsmType::I32),
-            ty::Int(IntTy::I64) | ty::Uint(UintTy::U64) => Some(InlineAsmType::I64),
-            ty::Int(IntTy::I128) | ty::Uint(UintTy::U128) => Some(InlineAsmType::I128),
-            ty::Int(IntTy::Isize) | ty::Uint(UintTy::Usize) => Some(asm_ty_isize),
-            ty::Float(FloatTy::F16) => Some(InlineAsmType::F16),
-            ty::Float(FloatTy::F32) => Some(InlineAsmType::F32),
-            ty::Float(FloatTy::F64) => Some(InlineAsmType::F64),
-            ty::Float(FloatTy::F128) => Some(InlineAsmType::F128),
-            ty::FnPtr(..) => Some(asm_ty_isize),
-            ty::RawPtr(ty, _) if self.is_thin_ptr_ty(ty) => Some(asm_ty_isize),
+            ty::Int(IntTy::I8) | ty::Uint(UintTy::U8) => Ok(InlineAsmType::I8),
+            ty::Int(IntTy::I16) | ty::Uint(UintTy::U16) => Ok(InlineAsmType::I16),
+            ty::Int(IntTy::I32) | ty::Uint(UintTy::U32) => Ok(InlineAsmType::I32),
+            ty::Int(IntTy::I64) | ty::Uint(UintTy::U64) => Ok(InlineAsmType::I64),
+            ty::Int(IntTy::I128) | ty::Uint(UintTy::U128) => Ok(InlineAsmType::I128),
+            ty::Int(IntTy::Isize) | ty::Uint(UintTy::Usize) => Ok(asm_ty_isize),
+            ty::Float(FloatTy::F16) => Ok(InlineAsmType::F16),
+            ty::Float(FloatTy::F32) => Ok(InlineAsmType::F32),
+            ty::Float(FloatTy::F64) => Ok(InlineAsmType::F64),
+            ty::Float(FloatTy::F128) => Ok(InlineAsmType::F128),
+            ty::FnPtr(..) => Ok(asm_ty_isize),
+            ty::RawPtr(ty, _) if self.is_thin_ptr_ty(ty) => Ok(asm_ty_isize),
             ty::Adt(adt, args) if adt.repr().simd() => {
                 let fields = &adt.non_enum_variant().fields;
-                let elem_ty = fields[FieldIdx::ZERO].ty(self.tcx, args);
+                let field = &fields[FieldIdx::ZERO];
+                let elem_ty = field.ty(self.tcx, args);
 
                 let (size, ty) = match elem_ty.kind() {
                     ty::Array(ty, len) => {
@@ -87,43 +95,39 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
                         if let Some(len) = len.try_to_target_usize(self.tcx) {
                             (len, *ty)
                         } else {
-                            return None;
+                            return Err(NonAsmTypeReason::UnevaluatedSIMDArrayLength(
+                                field.did, len,
+                            ));
                         }
                     }
                     _ => (fields.len() as u64, elem_ty),
                 };
 
                 match ty.kind() {
-                    ty::Int(IntTy::I8) | ty::Uint(UintTy::U8) => Some(InlineAsmType::VecI8(size)),
-                    ty::Int(IntTy::I16) | ty::Uint(UintTy::U16) => {
-                        Some(InlineAsmType::VecI16(size))
-                    }
-                    ty::Int(IntTy::I32) | ty::Uint(UintTy::U32) => {
-                        Some(InlineAsmType::VecI32(size))
-                    }
-                    ty::Int(IntTy::I64) | ty::Uint(UintTy::U64) => {
-                        Some(InlineAsmType::VecI64(size))
-                    }
+                    ty::Int(IntTy::I8) | ty::Uint(UintTy::U8) => Ok(InlineAsmType::VecI8(size)),
+                    ty::Int(IntTy::I16) | ty::Uint(UintTy::U16) => Ok(InlineAsmType::VecI16(size)),
+                    ty::Int(IntTy::I32) | ty::Uint(UintTy::U32) => Ok(InlineAsmType::VecI32(size)),
+                    ty::Int(IntTy::I64) | ty::Uint(UintTy::U64) => Ok(InlineAsmType::VecI64(size)),
                     ty::Int(IntTy::I128) | ty::Uint(UintTy::U128) => {
-                        Some(InlineAsmType::VecI128(size))
+                        Ok(InlineAsmType::VecI128(size))
                     }
                     ty::Int(IntTy::Isize) | ty::Uint(UintTy::Usize) => {
-                        Some(match self.tcx.sess.target.pointer_width {
+                        Ok(match self.tcx.sess.target.pointer_width {
                             16 => InlineAsmType::VecI16(size),
                             32 => InlineAsmType::VecI32(size),
                             64 => InlineAsmType::VecI64(size),
                             width => bug!("unsupported pointer width: {width}"),
                         })
                     }
-                    ty::Float(FloatTy::F16) => Some(InlineAsmType::VecF16(size)),
-                    ty::Float(FloatTy::F32) => Some(InlineAsmType::VecF32(size)),
-                    ty::Float(FloatTy::F64) => Some(InlineAsmType::VecF64(size)),
-                    ty::Float(FloatTy::F128) => Some(InlineAsmType::VecF128(size)),
-                    _ => None,
+                    ty::Float(FloatTy::F16) => Ok(InlineAsmType::VecF16(size)),
+                    ty::Float(FloatTy::F32) => Ok(InlineAsmType::VecF32(size)),
+                    ty::Float(FloatTy::F64) => Ok(InlineAsmType::VecF64(size)),
+                    ty::Float(FloatTy::F128) => Ok(InlineAsmType::VecF128(size)),
+                    _ => Err(NonAsmTypeReason::InvalidElement(field.did, ty)),
                 }
             }
             ty::Infer(_) => bug!("unexpected infer ty in asm operand"),
-            _ => None,
+            _ => Err(NonAsmTypeReason::Invalid(ty)),
         }
     }
 
@@ -164,17 +168,42 @@ impl<'a, 'tcx> InlineAsmCtxt<'a, 'tcx> {
             }
             _ => self.get_asm_ty(ty),
         };
-        let Some(asm_ty) = asm_ty else {
-            let msg = format!("cannot use value of type `{ty}` for inline assembly");
-            self.tcx
-                .dcx()
-                .struct_span_err(expr.span, msg)
-                .with_note(
-                    "only integers, floats, SIMD vectors, pointers and function pointers \
-                     can be used as arguments for inline assembly",
-                )
-                .emit();
-            return None;
+        let asm_ty = match asm_ty {
+            Ok(asm_ty) => asm_ty,
+            Err(reason) => {
+                match reason {
+                    NonAsmTypeReason::UnevaluatedSIMDArrayLength(did, len) => {
+                        let msg = format!("cannot evaluate SIMD vector length `{len}`");
+                        self.tcx
+                            .dcx()
+                            .struct_span_err(self.tcx.def_span(did), msg)
+                            .with_span_note(
+                                expr.span,
+                                "SIMD vector length needs to be known statically for use in `asm!`",
+                            )
+                            .emit();
+                    }
+                    NonAsmTypeReason::Invalid(ty) => {
+                        let msg = format!("cannot use value of type `{ty}` for inline assembly");
+                        self.tcx.dcx().struct_span_err(expr.span, msg).with_note(
+                            "only integers, floats, SIMD vectors, pointers and function pointers \
+                            can be used as arguments for inline assembly",
+                        ).emit();
+                    }
+                    NonAsmTypeReason::InvalidElement(did, ty) => {
+                        let msg = format!(
+                            "cannot use SIMD vector with element type `{ty}` for inline assembly"
+                        );
+                        self.tcx.dcx()
+                        .struct_span_err(self.tcx.def_span(did), msg).with_span_note(
+                            expr.span,
+                            "only integers, floats, SIMD vectors, pointers and function pointers \
+                            can be used as arguments for inline assembly",
+                        ).emit();
+                    }
+                }
+                return None;
+            }
         };
 
         // Check that the type implements Copy. The only case where this can
diff --git a/tests/ui/asm/generic_const_simd_vec_len.rs b/tests/ui/asm/generic_const_simd_vec_len.rs
index 4ef839e381674..fb8c5274ddb82 100644
--- a/tests/ui/asm/generic_const_simd_vec_len.rs
+++ b/tests/ui/asm/generic_const_simd_vec_len.rs
@@ -1,17 +1,20 @@
 //! This is a regression test to ensure that we emit a diagnostic pointing to the
 //! reason the type was rejected in inline assembly.
 
+//@ only-x86_64
+
 #![feature(repr_simd)]
 
 #[repr(simd)]
 #[derive(Copy, Clone)]
 pub struct Foo<const C: usize>([u8; C]);
+//~^ ERROR: cannot evaluate SIMD vector length
 
 pub unsafe fn foo<const C: usize>(a: Foo<C>) {
     std::arch::asm!(
         "movaps {src}, {src}",
         src = in(xmm_reg) a,
-        //~^ ERROR: cannot use value of type `Foo<C>` for inline assembly
+        //~^ NOTE: SIMD vector length needs to be known statically
     );
 }
 
diff --git a/tests/ui/asm/generic_const_simd_vec_len.stderr b/tests/ui/asm/generic_const_simd_vec_len.stderr
index d0044d144adcb..486281b6062d9 100644
--- a/tests/ui/asm/generic_const_simd_vec_len.stderr
+++ b/tests/ui/asm/generic_const_simd_vec_len.stderr
@@ -1,10 +1,14 @@
-error: cannot use value of type `Foo<C>` for inline assembly
-  --> $DIR/generic_const_simd_vec_len.rs:13:27
+error: cannot evaluate SIMD vector length `C`
+  --> $DIR/generic_const_simd_vec_len.rs:10:32
+   |
+LL | pub struct Foo<const C: usize>([u8; C]);
+   |                                ^^^^^^^
+   |
+note: SIMD vector length needs to be known statically for use in `asm!`
+  --> $DIR/generic_const_simd_vec_len.rs:16:27
    |
 LL |         src = in(xmm_reg) a,
    |                           ^
-   |
-   = note: only integers, floats, SIMD vectors, pointers and function pointers can be used as arguments for inline assembly
 
 error: aborting due to 1 previous error
 

From 9a6deba8af18e3d69b6c824a989f8647955fd3a1 Mon Sep 17 00:00:00 2001
From: jyn <github@jyn.dev>
Date: Tue, 10 Dec 2024 04:35:20 -0500
Subject: [PATCH 08/11] run-make: Fix `assert_stderr_not_contains_regex`

It asserted on **stdout**, not stderr.
---
 src/tools/run-make-support/src/command.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/tools/run-make-support/src/command.rs b/src/tools/run-make-support/src/command.rs
index 9e09527d6d08d..e73413085fade 100644
--- a/src/tools/run-make-support/src/command.rs
+++ b/src/tools/run-make-support/src/command.rs
@@ -329,7 +329,7 @@ impl CompletedProcess {
     /// Checks that `stderr` does not contain the regex pattern `unexpected`.
     #[track_caller]
     pub fn assert_stderr_not_contains_regex<S: AsRef<str>>(&self, unexpected: S) -> &Self {
-        assert_not_contains_regex(&self.stdout_utf8(), unexpected);
+        assert_not_contains_regex(&self.stderr_utf8(), unexpected);
         self
     }
 

From a8d11ea20e282c7e63a965df7a30ab840ea049eb Mon Sep 17 00:00:00 2001
From: Ralf Jung <post@ralfj.de>
Date: Tue, 10 Dec 2024 11:29:01 +0100
Subject: [PATCH 09/11] stabilize const_nonnull_new

---
 library/core/src/ptr/non_null.rs | 2 +-
 library/core/src/ptr/unique.rs   | 2 --
 library/core/tests/lib.rs        | 1 -
 3 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/library/core/src/ptr/non_null.rs b/library/core/src/ptr/non_null.rs
index 0ad1cad6914ad..6b601405e1c2a 100644
--- a/library/core/src/ptr/non_null.rs
+++ b/library/core/src/ptr/non_null.rs
@@ -217,7 +217,7 @@ impl<T: ?Sized> NonNull<T> {
     /// }
     /// ```
     #[stable(feature = "nonnull", since = "1.25.0")]
-    #[rustc_const_unstable(feature = "const_nonnull_new", issue = "93235")]
+    #[rustc_const_stable(feature = "const_nonnull_new", since = "CURRENT_RUSTC_VERSION")]
     #[inline]
     pub const fn new(ptr: *mut T) -> Option<Self> {
         if !ptr.is_null() {
diff --git a/library/core/src/ptr/unique.rs b/library/core/src/ptr/unique.rs
index ebdc918a729c7..4810ebe01f9bb 100644
--- a/library/core/src/ptr/unique.rs
+++ b/library/core/src/ptr/unique.rs
@@ -92,8 +92,6 @@ impl<T: ?Sized> Unique<T> {
 
     /// Creates a new `Unique` if `ptr` is non-null.
     #[inline]
-    // rustc_const_unstable attribute can be removed when `const_nonnull_new` is stable
-    #[rustc_const_unstable(feature = "ptr_internals", issue = "none")]
     pub const fn new(ptr: *mut T) -> Option<Self> {
         if let Some(pointer) = NonNull::new(ptr) {
             Some(Unique { pointer, _marker: PhantomData })
diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs
index a4a794691fe38..89b65eefd027e 100644
--- a/library/core/tests/lib.rs
+++ b/library/core/tests/lib.rs
@@ -15,7 +15,6 @@
 #![feature(clone_to_uninit)]
 #![feature(const_black_box)]
 #![feature(const_eval_select)]
-#![feature(const_nonnull_new)]
 #![feature(const_swap)]
 #![feature(const_trait_impl)]
 #![feature(core_intrinsics)]

From 0680155a171d47772302fc4da4cbbfa466378d81 Mon Sep 17 00:00:00 2001
From: Augie Fackler <augie@google.com>
Date: Tue, 10 Dec 2024 04:54:12 -0500
Subject: [PATCH 10/11] rustc_target: ppc64 target string fixes for LLVM 20

LLVM continues to clean these up, and we continue to make this
consistent. This is similar to 9caced7badc337ced7ad89eb614621c39bd996e9,
e9853961452b56997cc127b51308879b9cd09482, and
a10e744fafa7eb3afef9a938097509bf4b225f84.

`@rustbot` label: +llvm-main
---
 compiler/rustc_codegen_llvm/src/context.rs                   | 5 +++++
 compiler/rustc_target/src/spec/targets/powerpc64_ibm_aix.rs  | 2 +-
 .../src/spec/targets/powerpc64_unknown_freebsd.rs            | 2 +-
 .../src/spec/targets/powerpc64_unknown_linux_gnu.rs          | 2 +-
 .../src/spec/targets/powerpc64_unknown_linux_musl.rs         | 2 +-
 .../src/spec/targets/powerpc64_unknown_openbsd.rs            | 2 +-
 .../rustc_target/src/spec/targets/powerpc64_wrs_vxworks.rs   | 2 +-
 .../src/spec/targets/powerpc64le_unknown_freebsd.rs          | 2 +-
 .../src/spec/targets/powerpc64le_unknown_linux_gnu.rs        | 2 +-
 .../src/spec/targets/powerpc64le_unknown_linux_musl.rs       | 2 +-
 10 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs
index 8218126ea29c3..e0506c0c5fd1f 100644
--- a/compiler/rustc_codegen_llvm/src/context.rs
+++ b/compiler/rustc_codegen_llvm/src/context.rs
@@ -159,6 +159,11 @@ pub(crate) unsafe fn create_module<'ll>(
             // See https://github.com/llvm/llvm-project/pull/112084
             target_data_layout = target_data_layout.replace("-i128:128", "");
         }
+        if sess.target.arch.starts_with("powerpc64") {
+            // LLVM 20 updates the powerpc64 layout to correctly align 128 bit integers to 128 bit.
+            // See https://github.com/llvm/llvm-project/pull/118004
+            target_data_layout = target_data_layout.replace("-i128:128", "");
+        }
     }
 
     // Ensure the data-layout values hardcoded remain the defaults.
diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_ibm_aix.rs b/compiler/rustc_target/src/spec/targets/powerpc64_ibm_aix.rs
index 0f361054f7a02..edabbbf5f005b 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc64_ibm_aix.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc64_ibm_aix.rs
@@ -19,7 +19,7 @@ pub(crate) fn target() -> Target {
             std: None, // ?
         },
         pointer_width: 64,
-        data_layout: "E-m:a-Fi64-i64:64-n32:64-S128-v256:256:256-v512:512:512".into(),
+        data_layout: "E-m:a-Fi64-i64:64-i128:128-n32:64-S128-v256:256:256-v512:512:512".into(),
         arch: "powerpc64".into(),
         options: base,
     }
diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_freebsd.rs
index 680b024cb6e60..68a3718035cd9 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_freebsd.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_freebsd.rs
@@ -17,7 +17,7 @@ pub(crate) fn target() -> Target {
             std: Some(true),
         },
         pointer_width: 64,
-        data_layout: "E-m:e-Fn32-i64:64-n32:64".into(),
+        data_layout: "E-m:e-Fn32-i64:64-i128:128-n32:64".into(),
         arch: "powerpc64".into(),
         options: TargetOptions { endian: Endian::Big, mcount: "_mcount".into(), ..base },
     }
diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_gnu.rs
index 5acd9205a8c74..351ffa65eba8e 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_gnu.rs
@@ -17,7 +17,7 @@ pub(crate) fn target() -> Target {
             std: Some(true),
         },
         pointer_width: 64,
-        data_layout: "E-m:e-Fi64-i64:64-n32:64-S128-v256:256:256-v512:512:512".into(),
+        data_layout: "E-m:e-Fi64-i64:64-i128:128-n32:64-S128-v256:256:256-v512:512:512".into(),
         arch: "powerpc64".into(),
         options: TargetOptions { endian: Endian::Big, mcount: "_mcount".into(), ..base },
     }
diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs
index 62c30aebc518e..a964f417799f6 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_linux_musl.rs
@@ -17,7 +17,7 @@ pub(crate) fn target() -> Target {
             std: Some(true),
         },
         pointer_width: 64,
-        data_layout: "E-m:e-Fn32-i64:64-n32:64-S128-v256:256:256-v512:512:512".into(),
+        data_layout: "E-m:e-Fn32-i64:64-i128:128-n32:64-S128-v256:256:256-v512:512:512".into(),
         arch: "powerpc64".into(),
         options: TargetOptions { endian: Endian::Big, mcount: "_mcount".into(), ..base },
     }
diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_openbsd.rs b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_openbsd.rs
index c723847cada73..31fbb14152407 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc64_unknown_openbsd.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc64_unknown_openbsd.rs
@@ -17,7 +17,7 @@ pub(crate) fn target() -> Target {
             std: Some(true),
         },
         pointer_width: 64,
-        data_layout: "E-m:e-Fn32-i64:64-n32:64".into(),
+        data_layout: "E-m:e-Fn32-i64:64-i128:128-n32:64".into(),
         arch: "powerpc64".into(),
         options: TargetOptions { endian: Endian::Big, mcount: "_mcount".into(), ..base },
     }
diff --git a/compiler/rustc_target/src/spec/targets/powerpc64_wrs_vxworks.rs b/compiler/rustc_target/src/spec/targets/powerpc64_wrs_vxworks.rs
index 1d3d9f1b77df8..c37aa8d502ad7 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc64_wrs_vxworks.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc64_wrs_vxworks.rs
@@ -17,7 +17,7 @@ pub(crate) fn target() -> Target {
             std: Some(true),
         },
         pointer_width: 64,
-        data_layout: "E-m:e-Fi64-i64:64-n32:64-S128-v256:256:256-v512:512:512".into(),
+        data_layout: "E-m:e-Fi64-i64:64-i128:128-n32:64-S128-v256:256:256-v512:512:512".into(),
         arch: "powerpc64".into(),
         options: TargetOptions { endian: Endian::Big, ..base },
     }
diff --git a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_freebsd.rs b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_freebsd.rs
index 0c1218bd05939..13885c7326a71 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_freebsd.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_freebsd.rs
@@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {
             std: Some(true),
         },
         pointer_width: 64,
-        data_layout: "e-m:e-Fn32-i64:64-n32:64".into(),
+        data_layout: "e-m:e-Fn32-i64:64-i128:128-n32:64".into(),
         arch: "powerpc64".into(),
         options: TargetOptions { mcount: "_mcount".into(), ..base },
     }
diff --git a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs
index 23913687a1fd8..06ae54063cef4 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_gnu.rs
@@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {
             std: Some(true),
         },
         pointer_width: 64,
-        data_layout: "e-m:e-Fn32-i64:64-n32:64-S128-v256:256:256-v512:512:512".into(),
+        data_layout: "e-m:e-Fn32-i64:64-i128:128-n32:64-S128-v256:256:256-v512:512:512".into(),
         arch: "powerpc64".into(),
         options: TargetOptions { mcount: "_mcount".into(), ..base },
     }
diff --git a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs
index 50946ae4ce66d..04fe5f9af335e 100644
--- a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs
+++ b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs
@@ -16,7 +16,7 @@ pub(crate) fn target() -> Target {
             std: Some(true),
         },
         pointer_width: 64,
-        data_layout: "e-m:e-Fn32-i64:64-n32:64-S128-v256:256:256-v512:512:512".into(),
+        data_layout: "e-m:e-Fn32-i64:64-i128:128-n32:64-S128-v256:256:256-v512:512:512".into(),
         arch: "powerpc64".into(),
         options: TargetOptions { mcount: "_mcount".into(), ..base },
     }

From e1689e6807ed787581154eca8d4eb1e49ad4bc17 Mon Sep 17 00:00:00 2001
From: Oli Scherer <github333195615777966@oli-obk.de>
Date: Tue, 10 Dec 2024 11:19:47 +0000
Subject: [PATCH 11/11] Remove Felix from ping groups and review rotation

---
 triagebot.toml | 2 --
 1 file changed, 2 deletions(-)

diff --git a/triagebot.toml b/triagebot.toml
index 665108cccd38a..6eb4cb50d0deb 100644
--- a/triagebot.toml
+++ b/triagebot.toml
@@ -1014,7 +1014,6 @@ compiler = [
     "@Noratrieb",
     "@oli-obk",
     "@petrochenkov",
-    "@pnkfelix",
     "@SparrowLii",
     "@wesleywiser",
 ]
@@ -1107,7 +1106,6 @@ types = [
 ]
 borrowck = [
     "@davidtwco",
-    "@pnkfelix",
     "@matthewjasper"
 ]
 ast_lowering = [