about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/coercion/coerce-loop-issue-122561.rs12
-rw-r--r--tests/ui/coercion/coerce-loop-issue-122561.stderr73
-rw-r--r--tests/ui/consts/const-fn-error.rs5
-rw-r--r--tests/ui/consts/const-fn-error.stderr27
-rw-r--r--tests/ui/consts/const-for-feature-gate.rs5
-rw-r--r--tests/ui/consts/const-for-feature-gate.stderr22
-rw-r--r--tests/ui/consts/const-for.rs4
-rw-r--r--tests/ui/consts/const-for.stderr7
-rw-r--r--tests/ui/consts/const-try-feature-gate.rs5
-rw-r--r--tests/ui/consts/const-try-feature-gate.stderr23
-rw-r--r--tests/ui/consts/const-try.rs4
-rw-r--r--tests/ui/consts/const-try.stderr4
-rw-r--r--tests/ui/consts/control-flow/loop.rs12
-rw-r--r--tests/ui/consts/control-flow/loop.stderr47
-rw-r--r--tests/ui/consts/control-flow/try.rs6
-rw-r--r--tests/ui/consts/control-flow/try.stderr23
-rw-r--r--tests/ui/consts/try-operator.stderr16
-rw-r--r--tests/ui/issues/issue-50582.rs1
-rw-r--r--tests/ui/issues/issue-50582.stderr15
-rw-r--r--tests/ui/issues/issue-50585.rs1
-rw-r--r--tests/ui/issues/issue-50585.stderr15
-rw-r--r--tests/ui/never_type/issue-52443.rs5
-rw-r--r--tests/ui/never_type/issue-52443.stderr21
-rw-r--r--tests/ui/traits/const-traits/hir-const-check.rs6
-rw-r--r--tests/ui/traits/const-traits/hir-const-check.stderr23
-rw-r--r--tests/ui/traits/const-traits/ice-126148-failed-to-normalize.rs4
-rw-r--r--tests/ui/traits/const-traits/ice-126148-failed-to-normalize.stderr4
-rw-r--r--tests/ui/traits/const-traits/trait-default-body-stability.stderr4
-rw-r--r--tests/ui/traits/default-method/rustc_must_implement_one_of_misuse.stderr22
29 files changed, 105 insertions, 311 deletions
diff --git a/tests/ui/coercion/coerce-loop-issue-122561.rs b/tests/ui/coercion/coerce-loop-issue-122561.rs
index e08884ad6a4..50a2aacc91a 100644
--- a/tests/ui/coercion/coerce-loop-issue-122561.rs
+++ b/tests/ui/coercion/coerce-loop-issue-122561.rs
@@ -39,8 +39,7 @@ fn for_single_line() -> bool { for i in 0.. { return false; } }
 // b. format the suggestion correctly so
 //    that it's readable
 fn for_in_arg(a: &[(); for x in 0..2 {}]) -> bool {
-//~^ ERROR `for` is not allowed in a `const`
-//~| ERROR mismatched types
+    //~^ ERROR mismatched types
     true
 }
 
@@ -84,16 +83,14 @@ fn loop_() -> bool {
 
 const C: i32 = {
     for i in 0.. {
-    //~^ ERROR `for` is not allowed in a `const`
-    //~| ERROR mismatched types
+    //~^ ERROR mismatched types
     }
 };
 
 fn main() {
     let _ = [10; {
         for i in 0..5 {
-        //~^ ERROR `for` is not allowed in a `const`
-        //~| ERROR mismatched types
+        //~^ ERROR mismatched types
         }
     }];
 
@@ -105,6 +102,5 @@ fn main() {
 
 
     let _ = |a: &[(); for x in 0..2 {}]| {};
-    //~^ ERROR `for` is not allowed in a `const`
-    //~| ERROR mismatched types
+    //~^ ERROR mismatched types
 }
diff --git a/tests/ui/coercion/coerce-loop-issue-122561.stderr b/tests/ui/coercion/coerce-loop-issue-122561.stderr
index 0f77fd1364d..90e9f41c291 100644
--- a/tests/ui/coercion/coerce-loop-issue-122561.stderr
+++ b/tests/ui/coercion/coerce-loop-issue-122561.stderr
@@ -1,5 +1,5 @@
 warning: denote infinite loops with `loop { ... }`
-  --> $DIR/coerce-loop-issue-122561.rs:48:5
+  --> $DIR/coerce-loop-issue-122561.rs:47:5
    |
 LL |     while true {
    |     ^^^^^^^^^^ help: use `loop`
@@ -7,57 +7,11 @@ LL |     while true {
    = note: `#[warn(while_true)]` on by default
 
 warning: denote infinite loops with `loop { ... }`
-  --> $DIR/coerce-loop-issue-122561.rs:72:5
+  --> $DIR/coerce-loop-issue-122561.rs:71:5
    |
 LL |     while true {
    |     ^^^^^^^^^^ help: use `loop`
 
-error[E0658]: `for` is not allowed in a `const`
-  --> $DIR/coerce-loop-issue-122561.rs:41:24
-   |
-LL | fn for_in_arg(a: &[(); for x in 0..2 {}]) -> bool {
-   |                        ^^^^^^^^^^^^^^^^
-   |
-   = note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information
-   = help: add `#![feature(const_for)]` 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]: `for` is not allowed in a `const`
-  --> $DIR/coerce-loop-issue-122561.rs:86:5
-   |
-LL | /     for i in 0.. {
-LL | |
-LL | |
-LL | |     }
-   | |_____^
-   |
-   = note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information
-   = help: add `#![feature(const_for)]` 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]: `for` is not allowed in a `const`
-  --> $DIR/coerce-loop-issue-122561.rs:94:9
-   |
-LL | /         for i in 0..5 {
-LL | |
-LL | |
-LL | |         }
-   | |_________^
-   |
-   = note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information
-   = help: add `#![feature(const_for)]` 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]: `for` is not allowed in a `const`
-  --> $DIR/coerce-loop-issue-122561.rs:107:23
-   |
-LL |     let _ = |a: &[(); for x in 0..2 {}]| {};
-   |                       ^^^^^^^^^^^^^^^^
-   |
-   = note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information
-   = help: add `#![feature(const_for)]` 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[E0308]: mismatched types
   --> $DIR/coerce-loop-issue-122561.rs:41:24
    |
@@ -71,11 +25,10 @@ LL | fn for_in_arg(a: &[(); for x in 0..2 {} /* `usize` value */]) -> bool {
    |                                         +++++++++++++++++++
 
 error[E0308]: mismatched types
-  --> $DIR/coerce-loop-issue-122561.rs:86:5
+  --> $DIR/coerce-loop-issue-122561.rs:85:5
    |
 LL | /     for i in 0.. {
 LL | |
-LL | |
 LL | |     }
    | |_____^ expected `i32`, found `()`
    |
@@ -174,7 +127,7 @@ LL | fn for_single_line() -> bool { for i in 0.. { return false; } /* `bool` val
    |                                                               ++++++++++++++++++
 
 error[E0308]: mismatched types
-  --> $DIR/coerce-loop-issue-122561.rs:48:5
+  --> $DIR/coerce-loop-issue-122561.rs:47:5
    |
 LL |   fn while_inifinite() -> bool {
    |                           ---- expected `bool` because of return type
@@ -193,7 +146,7 @@ LL +     /* `bool` value */
    |
 
 error[E0308]: mismatched types
-  --> $DIR/coerce-loop-issue-122561.rs:57:5
+  --> $DIR/coerce-loop-issue-122561.rs:56:5
    |
 LL |   fn while_finite() -> bool {
    |                        ---- expected `bool` because of return type
@@ -213,7 +166,7 @@ LL +     /* `bool` value */
    |
 
 error[E0308]: mismatched types
-  --> $DIR/coerce-loop-issue-122561.rs:65:5
+  --> $DIR/coerce-loop-issue-122561.rs:64:5
    |
 LL |   fn while_zero_times() -> bool {
    |                            ---- expected `bool` because of return type
@@ -231,7 +184,7 @@ LL +     /* `bool` value */
    |
 
 error[E0308]: mismatched types
-  --> $DIR/coerce-loop-issue-122561.rs:72:5
+  --> $DIR/coerce-loop-issue-122561.rs:71:5
    |
 LL |   fn while_never_type() -> ! {
    |                            - expected `!` because of return type
@@ -251,11 +204,10 @@ LL +     /* `loop {}` or `panic!("...")` */
    |
 
 error[E0308]: mismatched types
-  --> $DIR/coerce-loop-issue-122561.rs:94:9
+  --> $DIR/coerce-loop-issue-122561.rs:92:9
    |
 LL | /         for i in 0..5 {
 LL | |
-LL | |
 LL | |         }
    | |_________^ expected `usize`, found `()`
    |
@@ -267,7 +219,7 @@ LL +         /* `usize` value */
    |
 
 error[E0308]: mismatched types
-  --> $DIR/coerce-loop-issue-122561.rs:101:9
+  --> $DIR/coerce-loop-issue-122561.rs:98:9
    |
 LL | /         while false {
 LL | |
@@ -282,7 +234,7 @@ LL +         /* `usize` value */
    |
 
 error[E0308]: mismatched types
-  --> $DIR/coerce-loop-issue-122561.rs:107:23
+  --> $DIR/coerce-loop-issue-122561.rs:104:23
    |
 LL |     let _ = |a: &[(); for x in 0..2 {}]| {};
    |                       ^^^^^^^^^^^^^^^^ expected `usize`, found `()`
@@ -293,7 +245,6 @@ help: consider returning a value here
 LL |     let _ = |a: &[(); for x in 0..2 {} /* `usize` value */]| {};
    |                                        +++++++++++++++++++
 
-error: aborting due to 18 previous errors; 2 warnings emitted
+error: aborting due to 14 previous errors; 2 warnings emitted
 
-Some errors have detailed explanations: E0308, E0658.
-For more information about an error, try `rustc --explain E0308`.
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/consts/const-fn-error.rs b/tests/ui/consts/const-fn-error.rs
index 42061ef0670..b7151782423 100644
--- a/tests/ui/consts/const-fn-error.rs
+++ b/tests/ui/consts/const-fn-error.rs
@@ -3,9 +3,8 @@ const X : usize = 2;
 const fn f(x: usize) -> usize {
     let mut sum = 0;
     for i in 0..x {
-        //~^ ERROR cannot convert
-        //~| ERROR `for` is not allowed in a `const fn`
-        //~| ERROR cannot call non-const fn
+        //~^ ERROR cannot use `for`
+        //~| ERROR cannot use `for`
         sum += i;
     }
     sum
diff --git a/tests/ui/consts/const-fn-error.stderr b/tests/ui/consts/const-fn-error.stderr
index 42a6f2704c9..3d4cf6539c8 100644
--- a/tests/ui/consts/const-fn-error.stderr
+++ b/tests/ui/consts/const-fn-error.stderr
@@ -1,37 +1,20 @@
-error[E0658]: `for` is not allowed in a `const fn`
-  --> $DIR/const-fn-error.rs:5:5
-   |
-LL | /     for i in 0..x {
-LL | |
-LL | |
-LL | |
-LL | |         sum += i;
-LL | |     }
-   | |_____^
-   |
-   = note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information
-   = help: add `#![feature(const_for)]` 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[E0015]: cannot convert `std::ops::Range<usize>` into an iterator in constant functions
+error[E0015]: cannot use `for` loop on `std::ops::Range<usize>` in constant functions
   --> $DIR/const-fn-error.rs:5:14
    |
 LL |     for i in 0..x {
    |              ^^^^
    |
-note: impl defined here, but it is not `const`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
 
-error[E0015]: cannot call non-const fn `<std::ops::Range<usize> as Iterator>::next` in constant functions
+error[E0015]: cannot use `for` loop on `std::ops::Range<usize>` in constant functions
   --> $DIR/const-fn-error.rs:5:14
    |
 LL |     for i in 0..x {
    |              ^^^^
    |
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
 
-Some errors have detailed explanations: E0015, E0658.
-For more information about an error, try `rustc --explain E0015`.
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/consts/const-for-feature-gate.rs b/tests/ui/consts/const-for-feature-gate.rs
index d74178662b3..b643e63c096 100644
--- a/tests/ui/consts/const-for-feature-gate.rs
+++ b/tests/ui/consts/const-for-feature-gate.rs
@@ -2,9 +2,8 @@
 
 const _: () = {
     for _ in 0..5 {}
-    //~^ error: `for` is not allowed in a `const`
-    //~| ERROR: cannot convert
-    //~| ERROR: cannot call
+    //~^ ERROR cannot use `for`
+    //~| ERROR cannot use `for`
 };
 
 fn main() {}
diff --git a/tests/ui/consts/const-for-feature-gate.stderr b/tests/ui/consts/const-for-feature-gate.stderr
index 6e099a3159d..29db5d24ac8 100644
--- a/tests/ui/consts/const-for-feature-gate.stderr
+++ b/tests/ui/consts/const-for-feature-gate.stderr
@@ -1,32 +1,20 @@
-error[E0658]: `for` is not allowed in a `const`
-  --> $DIR/const-for-feature-gate.rs:4:5
-   |
-LL |     for _ in 0..5 {}
-   |     ^^^^^^^^^^^^^^^^
-   |
-   = note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information
-   = help: add `#![feature(const_for)]` 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[E0015]: cannot convert `std::ops::Range<i32>` into an iterator in constants
+error[E0015]: cannot use `for` loop on `std::ops::Range<i32>` in constants
   --> $DIR/const-for-feature-gate.rs:4:14
    |
 LL |     for _ in 0..5 {}
    |              ^^^^
    |
-note: impl defined here, but it is not `const`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
    = note: calls in constants are limited to constant functions, tuple structs and tuple variants
 
-error[E0015]: cannot call non-const fn `<std::ops::Range<i32> as Iterator>::next` in constants
+error[E0015]: cannot use `for` loop on `std::ops::Range<i32>` in constants
   --> $DIR/const-for-feature-gate.rs:4:14
    |
 LL |     for _ in 0..5 {}
    |              ^^^^
    |
    = note: calls in constants are limited to constant functions, tuple structs and tuple variants
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
 
-Some errors have detailed explanations: E0015, E0658.
-For more information about an error, try `rustc --explain E0015`.
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/consts/const-for.rs b/tests/ui/consts/const-for.rs
index 4f8034e73f0..6f7895457c5 100644
--- a/tests/ui/consts/const-for.rs
+++ b/tests/ui/consts/const-for.rs
@@ -2,8 +2,8 @@
 
 const _: () = {
     for _ in 0..5 {}
-    //~^ error: cannot call
-    //~| error: cannot convert
+    //~^ ERROR cannot use `for`
+    //~| ERROR cannot use `for`
 };
 
 fn main() {}
diff --git a/tests/ui/consts/const-for.stderr b/tests/ui/consts/const-for.stderr
index 78336dc93e8..d1308a8dedc 100644
--- a/tests/ui/consts/const-for.stderr
+++ b/tests/ui/consts/const-for.stderr
@@ -1,20 +1,19 @@
-error[E0015]: cannot convert `std::ops::Range<i32>` into an iterator in constants
+error[E0015]: cannot use `for` loop on `std::ops::Range<i32>` in constants
   --> $DIR/const-for.rs:4:14
    |
 LL |     for _ in 0..5 {}
    |              ^^^^
    |
-note: impl defined here, but it is not `const`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
    = note: calls in constants are limited to constant functions, tuple structs and tuple variants
 
-error[E0015]: cannot call non-const fn `<std::ops::Range<i32> as Iterator>::next` in constants
+error[E0015]: cannot use `for` loop on `std::ops::Range<i32>` in constants
   --> $DIR/const-for.rs:4:14
    |
 LL |     for _ in 0..5 {}
    |              ^^^^
    |
    = note: calls in constants are limited to constant functions, tuple structs and tuple variants
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/consts/const-try-feature-gate.rs b/tests/ui/consts/const-try-feature-gate.rs
index 1cc045bf612..09985079e8e 100644
--- a/tests/ui/consts/const-try-feature-gate.rs
+++ b/tests/ui/consts/const-try-feature-gate.rs
@@ -2,9 +2,8 @@
 
 const fn t() -> Option<()> {
     Some(())?;
-    //~^ error: `?` is not allowed in a `const fn`
-    //~| ERROR: cannot convert
-    //~| ERROR: cannot determine
+    //~^ ERROR `?` is not allowed
+    //~| ERROR `?` is not allowed
     None
 }
 
diff --git a/tests/ui/consts/const-try-feature-gate.stderr b/tests/ui/consts/const-try-feature-gate.stderr
index dc1dabc2f4f..0ad19d05b38 100644
--- a/tests/ui/consts/const-try-feature-gate.stderr
+++ b/tests/ui/consts/const-try-feature-gate.stderr
@@ -1,34 +1,19 @@
-error[E0658]: `?` is not allowed in a `const fn`
+error[E0015]: `?` is not allowed on `Option<()>` in constant functions
   --> $DIR/const-try-feature-gate.rs:4:5
    |
 LL |     Some(())?;
    |     ^^^^^^^^^
    |
-   = note: see issue #74935 <https://github.com/rust-lang/rust/issues/74935> for more information
-   = help: add `#![feature(const_try)]` 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[E0015]: `?` cannot determine the branch of `Option<()>` in constant functions
-  --> $DIR/const-try-feature-gate.rs:4:5
-   |
-LL |     Some(())?;
-   |     ^^^^^^^^^
-   |
-note: impl defined here, but it is not `const`
-  --> $SRC_DIR/core/src/option.rs:LL:COL
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
 
-error[E0015]: `?` cannot convert from residual of `Option<()>` in constant functions
+error[E0015]: `?` is not allowed on `Option<()>` in constant functions
   --> $DIR/const-try-feature-gate.rs:4:5
    |
 LL |     Some(())?;
    |     ^^^^^^^^^
    |
-note: impl defined here, but it is not `const`
-  --> $SRC_DIR/core/src/option.rs:LL:COL
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
 
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
 
-Some errors have detailed explanations: E0015, E0658.
-For more information about an error, try `rustc --explain E0015`.
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/consts/const-try.rs b/tests/ui/consts/const-try.rs
index d30b22accef..26aa9230a39 100644
--- a/tests/ui/consts/const-try.rs
+++ b/tests/ui/consts/const-try.rs
@@ -33,8 +33,8 @@ impl const Try for TryMe {
 
 const fn t() -> TryMe {
     TryMe?;
-    //~^ ERROR `?` cannot determine the branch of `TryMe` in constant functions
-    //~| ERROR `?` cannot convert from residual of `TryMe` in constant functions
+    //~^ ERROR `?` is not allowed on
+    //~| ERROR `?` is not allowed on
     TryMe
 }
 
diff --git a/tests/ui/consts/const-try.stderr b/tests/ui/consts/const-try.stderr
index 1f4f814cb93..abb03a74c82 100644
--- a/tests/ui/consts/const-try.stderr
+++ b/tests/ui/consts/const-try.stderr
@@ -16,7 +16,7 @@ LL | impl const Try for TryMe {
    = 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
 
-error[E0015]: `?` cannot determine the branch of `TryMe` in constant functions
+error[E0015]: `?` is not allowed on `TryMe` in constant functions
   --> $DIR/const-try.rs:35:5
    |
 LL |     TryMe?;
@@ -24,7 +24,7 @@ LL |     TryMe?;
    |
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
 
-error[E0015]: `?` cannot convert from residual of `TryMe` in constant functions
+error[E0015]: `?` is not allowed on `TryMe` in constant functions
   --> $DIR/const-try.rs:35:5
    |
 LL |     TryMe?;
diff --git a/tests/ui/consts/control-flow/loop.rs b/tests/ui/consts/control-flow/loop.rs
index f8d9f3ddb9b..b02c31c4c25 100644
--- a/tests/ui/consts/control-flow/loop.rs
+++ b/tests/ui/consts/control-flow/loop.rs
@@ -50,15 +50,15 @@ const _: i32 = {
 const _: i32 = {
     let mut x = 0;
 
-    for i in 0..4 { //~ ERROR `for` is not allowed in a `const`
-        //~^ ERROR: cannot call
-        //~| ERROR: cannot convert
+    for i in 0..4 {
+        //~^ ERROR: cannot use `for`
+        //~| ERROR: cannot use `for`
         x += i;
     }
 
-    for i in 0..4 { //~ ERROR `for` is not allowed in a `const`
-        //~^ ERROR: cannot call
-        //~| ERROR: cannot convert
+    for i in 0..4 {
+        //~^ ERROR: cannot use `for`
+        //~| ERROR: cannot use `for`
         x += i;
     }
 
diff --git a/tests/ui/consts/control-flow/loop.stderr b/tests/ui/consts/control-flow/loop.stderr
index 5e43c70e9df..b91371f9dc2 100644
--- a/tests/ui/consts/control-flow/loop.stderr
+++ b/tests/ui/consts/control-flow/loop.stderr
@@ -1,68 +1,37 @@
-error[E0658]: `for` is not allowed in a `const`
-  --> $DIR/loop.rs:53:5
-   |
-LL | /     for i in 0..4 {
-LL | |
-LL | |
-LL | |         x += i;
-LL | |     }
-   | |_____^
-   |
-   = note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information
-   = help: add `#![feature(const_for)]` 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]: `for` is not allowed in a `const`
-  --> $DIR/loop.rs:59:5
-   |
-LL | /     for i in 0..4 {
-LL | |
-LL | |
-LL | |         x += i;
-LL | |     }
-   | |_____^
-   |
-   = note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information
-   = help: add `#![feature(const_for)]` 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[E0015]: cannot convert `std::ops::Range<i32>` into an iterator in constants
+error[E0015]: cannot use `for` loop on `std::ops::Range<i32>` in constants
   --> $DIR/loop.rs:53:14
    |
 LL |     for i in 0..4 {
    |              ^^^^
    |
-note: impl defined here, but it is not `const`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
    = note: calls in constants are limited to constant functions, tuple structs and tuple variants
 
-error[E0015]: cannot call non-const fn `<std::ops::Range<i32> as Iterator>::next` in constants
+error[E0015]: cannot use `for` loop on `std::ops::Range<i32>` in constants
   --> $DIR/loop.rs:53:14
    |
 LL |     for i in 0..4 {
    |              ^^^^
    |
    = note: calls in constants are limited to constant functions, tuple structs and tuple variants
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
-error[E0015]: cannot convert `std::ops::Range<i32>` into an iterator in constants
+error[E0015]: cannot use `for` loop on `std::ops::Range<i32>` in constants
   --> $DIR/loop.rs:59:14
    |
 LL |     for i in 0..4 {
    |              ^^^^
    |
-note: impl defined here, but it is not `const`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
    = note: calls in constants are limited to constant functions, tuple structs and tuple variants
 
-error[E0015]: cannot call non-const fn `<std::ops::Range<i32> as Iterator>::next` in constants
+error[E0015]: cannot use `for` loop on `std::ops::Range<i32>` in constants
   --> $DIR/loop.rs:59:14
    |
 LL |     for i in 0..4 {
    |              ^^^^
    |
    = note: calls in constants are limited to constant functions, tuple structs and tuple variants
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
-error: aborting due to 6 previous errors
+error: aborting due to 4 previous errors
 
-Some errors have detailed explanations: E0015, E0658.
-For more information about an error, try `rustc --explain E0015`.
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/consts/control-flow/try.rs b/tests/ui/consts/control-flow/try.rs
index 5c6957df405..67083e1a39b 100644
--- a/tests/ui/consts/control-flow/try.rs
+++ b/tests/ui/consts/control-flow/try.rs
@@ -3,9 +3,9 @@
 
 const fn opt() -> Option<i32> {
     let x = Some(2);
-    x?; //~ ERROR `?` is not allowed in a `const fn`
-    //~^ ERROR: cannot convert
-    //~| ERROR: cannot determine
+    x?;
+    //~^ ERROR: `?` is not allowed
+    //~| ERROR: `?` is not allowed
     None
 }
 
diff --git a/tests/ui/consts/control-flow/try.stderr b/tests/ui/consts/control-flow/try.stderr
index 5e2c77318e7..62a3e3ce6bc 100644
--- a/tests/ui/consts/control-flow/try.stderr
+++ b/tests/ui/consts/control-flow/try.stderr
@@ -1,34 +1,19 @@
-error[E0658]: `?` is not allowed in a `const fn`
+error[E0015]: `?` is not allowed on `Option<i32>` in constant functions
   --> $DIR/try.rs:6:5
    |
 LL |     x?;
    |     ^^
    |
-   = note: see issue #74935 <https://github.com/rust-lang/rust/issues/74935> for more information
-   = help: add `#![feature(const_try)]` 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[E0015]: `?` cannot determine the branch of `Option<i32>` in constant functions
-  --> $DIR/try.rs:6:5
-   |
-LL |     x?;
-   |     ^^
-   |
-note: impl defined here, but it is not `const`
-  --> $SRC_DIR/core/src/option.rs:LL:COL
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
 
-error[E0015]: `?` cannot convert from residual of `Option<i32>` in constant functions
+error[E0015]: `?` is not allowed on `Option<i32>` in constant functions
   --> $DIR/try.rs:6:5
    |
 LL |     x?;
    |     ^^
    |
-note: impl defined here, but it is not `const`
-  --> $SRC_DIR/core/src/option.rs:LL:COL
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
 
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
 
-Some errors have detailed explanations: E0015, E0658.
-For more information about an error, try `rustc --explain E0015`.
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/consts/try-operator.stderr b/tests/ui/consts/try-operator.stderr
index 40d96ed3a10..fc37039d260 100644
--- a/tests/ui/consts/try-operator.stderr
+++ b/tests/ui/consts/try-operator.stderr
@@ -4,44 +4,36 @@ error[E0635]: unknown feature `const_convert`
 LL | #![feature(const_convert)]
    |            ^^^^^^^^^^^^^
 
-error[E0015]: `?` cannot determine the branch of `Result<(), ()>` in constant functions
+error[E0015]: `?` is not allowed on `Result<(), ()>` in constant functions
   --> $DIR/try-operator.rs:10:9
    |
 LL |         Err(())?;
    |         ^^^^^^^^
    |
-note: impl defined here, but it is not `const`
-  --> $SRC_DIR/core/src/result.rs:LL:COL
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
 
-error[E0015]: `?` cannot convert from residual of `Result<bool, ()>` in constant functions
+error[E0015]: `?` is not allowed on `Result<bool, ()>` in constant functions
   --> $DIR/try-operator.rs:10:9
    |
 LL |         Err(())?;
    |         ^^^^^^^^
    |
-note: impl defined here, but it is not `const`
-  --> $SRC_DIR/core/src/result.rs:LL:COL
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
 
-error[E0015]: `?` cannot determine the branch of `Option<()>` in constant functions
+error[E0015]: `?` is not allowed on `Option<()>` in constant functions
   --> $DIR/try-operator.rs:18:9
    |
 LL |         None?;
    |         ^^^^^
    |
-note: impl defined here, but it is not `const`
-  --> $SRC_DIR/core/src/option.rs:LL:COL
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
 
-error[E0015]: `?` cannot convert from residual of `Option<()>` in constant functions
+error[E0015]: `?` is not allowed on `Option<()>` in constant functions
   --> $DIR/try-operator.rs:18:9
    |
 LL |         None?;
    |         ^^^^^
    |
-note: impl defined here, but it is not `const`
-  --> $SRC_DIR/core/src/option.rs:LL:COL
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
 
 error: aborting due to 5 previous errors
diff --git a/tests/ui/issues/issue-50582.rs b/tests/ui/issues/issue-50582.rs
index 2d5c9358752..1358e0bde4c 100644
--- a/tests/ui/issues/issue-50582.rs
+++ b/tests/ui/issues/issue-50582.rs
@@ -1,5 +1,4 @@
 fn main() {
     Vec::<[(); 1 + for x in 0..1 {}]>::new();
     //~^ ERROR cannot add
-    //~| ERROR `for` is not allowed in a `const`
 }
diff --git a/tests/ui/issues/issue-50582.stderr b/tests/ui/issues/issue-50582.stderr
index af7a36f62fb..168f5894fb0 100644
--- a/tests/ui/issues/issue-50582.stderr
+++ b/tests/ui/issues/issue-50582.stderr
@@ -1,13 +1,3 @@
-error[E0658]: `for` is not allowed in a `const`
-  --> $DIR/issue-50582.rs:2:20
-   |
-LL |     Vec::<[(); 1 + for x in 0..1 {}]>::new();
-   |                    ^^^^^^^^^^^^^^^^
-   |
-   = note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information
-   = help: add `#![feature(const_for)]` 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[E0277]: cannot add `()` to `{integer}`
   --> $DIR/issue-50582.rs:2:18
    |
@@ -26,7 +16,6 @@ LL |     Vec::<[(); 1 + for x in 0..1 {}]>::new();
              `&f64` implements `Add`
            and 56 others
 
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error
 
-Some errors have detailed explanations: E0277, E0658.
-For more information about an error, try `rustc --explain E0277`.
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/issues/issue-50585.rs b/tests/ui/issues/issue-50585.rs
index a2f11c98d5a..ca2ece8d53b 100644
--- a/tests/ui/issues/issue-50585.rs
+++ b/tests/ui/issues/issue-50585.rs
@@ -1,5 +1,4 @@
 fn main() {
     |y: Vec<[(); for x in 0..2 {}]>| {};
     //~^ ERROR mismatched types
-    //~| ERROR `for` is not allowed in a `const`
 }
diff --git a/tests/ui/issues/issue-50585.stderr b/tests/ui/issues/issue-50585.stderr
index e7f13e63475..7e83ea35fbb 100644
--- a/tests/ui/issues/issue-50585.stderr
+++ b/tests/ui/issues/issue-50585.stderr
@@ -1,13 +1,3 @@
-error[E0658]: `for` is not allowed in a `const`
-  --> $DIR/issue-50585.rs:2:18
-   |
-LL |     |y: Vec<[(); for x in 0..2 {}]>| {};
-   |                  ^^^^^^^^^^^^^^^^
-   |
-   = note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information
-   = help: add `#![feature(const_for)]` 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[E0308]: mismatched types
   --> $DIR/issue-50585.rs:2:18
    |
@@ -20,7 +10,6 @@ help: consider returning a value here
 LL |     |y: Vec<[(); for x in 0..2 {} /* `usize` value */]>| {};
    |                                   +++++++++++++++++++
 
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error
 
-Some errors have detailed explanations: E0308, E0658.
-For more information about an error, try `rustc --explain E0308`.
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/never_type/issue-52443.rs b/tests/ui/never_type/issue-52443.rs
index dcda2b9536a..b112842030e 100644
--- a/tests/ui/never_type/issue-52443.rs
+++ b/tests/ui/never_type/issue-52443.rs
@@ -7,7 +7,6 @@ fn main() {
     //~^ WARN denote infinite loops with
 
     [(); { for _ in 0usize.. {}; 0}];
-    //~^ ERROR `for` is not allowed in a `const`
-    //~| ERROR cannot convert
-    //~| ERROR cannot call
+    //~^ ERROR cannot use `for`
+    //~| ERROR cannot use `for`
 }
diff --git a/tests/ui/never_type/issue-52443.stderr b/tests/ui/never_type/issue-52443.stderr
index 2207ceb5033..1c5a0d65142 100644
--- a/tests/ui/never_type/issue-52443.stderr
+++ b/tests/ui/never_type/issue-52443.stderr
@@ -6,16 +6,6 @@ LL |     [(); {while true {break}; 0}];
    |
    = note: `#[warn(while_true)]` on by default
 
-error[E0658]: `for` is not allowed in a `const`
-  --> $DIR/issue-52443.rs:9:12
-   |
-LL |     [(); { for _ in 0usize.. {}; 0}];
-   |            ^^^^^^^^^^^^^^^^^^^^
-   |
-   = note: see issue #87575 <https://github.com/rust-lang/rust/issues/87575> for more information
-   = help: add `#![feature(const_for)]` 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[E0308]: mismatched types
   --> $DIR/issue-52443.rs:2:10
    |
@@ -41,25 +31,24 @@ help: give the `break` a value of the expected type
 LL |     [(); loop { break 42 }];
    |                       ++
 
-error[E0015]: cannot convert `RangeFrom<usize>` into an iterator in constants
+error[E0015]: cannot use `for` loop on `RangeFrom<usize>` in constants
   --> $DIR/issue-52443.rs:9:21
    |
 LL |     [(); { for _ in 0usize.. {}; 0}];
    |                     ^^^^^^^^
    |
-note: impl defined here, but it is not `const`
-  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
    = note: calls in constants are limited to constant functions, tuple structs and tuple variants
 
-error[E0015]: cannot call non-const fn `<RangeFrom<usize> as Iterator>::next` in constants
+error[E0015]: cannot use `for` loop on `RangeFrom<usize>` in constants
   --> $DIR/issue-52443.rs:9:21
    |
 LL |     [(); { for _ in 0usize.. {}; 0}];
    |                     ^^^^^^^^
    |
    = note: calls in constants are limited to constant functions, tuple structs and tuple variants
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
-error: aborting due to 5 previous errors; 1 warning emitted
+error: aborting due to 4 previous errors; 1 warning emitted
 
-Some errors have detailed explanations: E0015, E0308, E0658.
+Some errors have detailed explanations: E0015, E0308.
 For more information about an error, try `rustc --explain E0015`.
diff --git a/tests/ui/traits/const-traits/hir-const-check.rs b/tests/ui/traits/const-traits/hir-const-check.rs
index ea1783b7c2c..c485fb12184 100644
--- a/tests/ui/traits/const-traits/hir-const-check.rs
+++ b/tests/ui/traits/const-traits/hir-const-check.rs
@@ -11,9 +11,9 @@ pub trait MyTrait {
 
 impl const MyTrait for () {
     fn method(&self) -> Option<()> {
-        Some(())?; //~ ERROR `?` is not allowed in a `const fn`
-        //~^ ERROR `?` cannot determine the branch of `Option<()>` in constant functions
-        //~| ERROR `?` cannot convert from residual of `Option<()>` in constant functions
+        Some(())?;
+        //~^ ERROR `?` is not allowed on
+        //~| ERROR `?` is not allowed on
         None
     }
 }
diff --git a/tests/ui/traits/const-traits/hir-const-check.stderr b/tests/ui/traits/const-traits/hir-const-check.stderr
index ef5dba0dc0e..d66a7ea3144 100644
--- a/tests/ui/traits/const-traits/hir-const-check.stderr
+++ b/tests/ui/traits/const-traits/hir-const-check.stderr
@@ -1,34 +1,19 @@
-error[E0658]: `?` is not allowed in a `const fn`
+error[E0015]: `?` is not allowed on `Option<()>` in constant functions
   --> $DIR/hir-const-check.rs:14:9
    |
 LL |         Some(())?;
    |         ^^^^^^^^^
    |
-   = note: see issue #74935 <https://github.com/rust-lang/rust/issues/74935> for more information
-   = help: add `#![feature(const_try)]` 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[E0015]: `?` cannot determine the branch of `Option<()>` in constant functions
-  --> $DIR/hir-const-check.rs:14:9
-   |
-LL |         Some(())?;
-   |         ^^^^^^^^^
-   |
-note: impl defined here, but it is not `const`
-  --> $SRC_DIR/core/src/option.rs:LL:COL
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
 
-error[E0015]: `?` cannot convert from residual of `Option<()>` in constant functions
+error[E0015]: `?` is not allowed on `Option<()>` in constant functions
   --> $DIR/hir-const-check.rs:14:9
    |
 LL |         Some(())?;
    |         ^^^^^^^^^
    |
-note: impl defined here, but it is not `const`
-  --> $SRC_DIR/core/src/option.rs:LL:COL
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
 
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
 
-Some errors have detailed explanations: E0015, E0658.
-For more information about an error, try `rustc --explain E0015`.
+For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/traits/const-traits/ice-126148-failed-to-normalize.rs b/tests/ui/traits/const-traits/ice-126148-failed-to-normalize.rs
index 9ce81031b27..3473be565c1 100644
--- a/tests/ui/traits/const-traits/ice-126148-failed-to-normalize.rs
+++ b/tests/ui/traits/const-traits/ice-126148-failed-to-normalize.rs
@@ -18,8 +18,8 @@ impl const Try for TryMe {
 
 const fn t() -> TryMe {
     TryMe?;
-    //~^ ERROR `?` cannot determine the branch of `TryMe` in constant functions
-    //~| ERROR `?` cannot convert from residual of `TryMe` in constant functions
+    //~^ ERROR `?` is not allowed on
+    //~| ERROR `?` is not allowed on
     TryMe
 }
 
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 db047bfd94d..9bd493e5fdb 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
@@ -33,7 +33,7 @@ LL | impl const Try for TryMe {
    = help: implement the missing item: `fn from_output(_: <Self as Try>::Output) -> Self { todo!() }`
    = help: implement the missing item: `fn branch(self) -> ControlFlow<<Self as Try>::Residual, <Self as Try>::Output> { todo!() }`
 
-error[E0015]: `?` cannot determine the branch of `TryMe` in constant functions
+error[E0015]: `?` is not allowed on `TryMe` in constant functions
   --> $DIR/ice-126148-failed-to-normalize.rs:20:5
    |
 LL |     TryMe?;
@@ -41,7 +41,7 @@ LL |     TryMe?;
    |
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
 
-error[E0015]: `?` cannot convert from residual of `TryMe` in constant functions
+error[E0015]: `?` is not allowed on `TryMe` in constant functions
   --> $DIR/ice-126148-failed-to-normalize.rs:20:5
    |
 LL |     TryMe?;
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 5806b6d6fd2..b471cb81c3b 100644
--- a/tests/ui/traits/const-traits/trait-default-body-stability.stderr
+++ b/tests/ui/traits/const-traits/trait-default-body-stability.stderr
@@ -16,7 +16,7 @@ LL | impl const FromResidual for T {
    = 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
 
-error[E0015]: `?` cannot determine the branch of `T` in constant functions
+error[E0015]: `?` is not allowed on `T` in constant functions
   --> $DIR/trait-default-body-stability.rs:45:9
    |
 LL |         T?
@@ -24,7 +24,7 @@ LL |         T?
    |
    = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
 
-error[E0015]: `?` cannot convert from residual of `T` in constant functions
+error[E0015]: `?` is not allowed on `T` in constant functions
   --> $DIR/trait-default-body-stability.rs:45:9
    |
 LL |         T?
diff --git a/tests/ui/traits/default-method/rustc_must_implement_one_of_misuse.stderr b/tests/ui/traits/default-method/rustc_must_implement_one_of_misuse.stderr
index 03a4017b3d7..38e692521ca 100644
--- a/tests/ui/traits/default-method/rustc_must_implement_one_of_misuse.stderr
+++ b/tests/ui/traits/default-method/rustc_must_implement_one_of_misuse.stderr
@@ -23,29 +23,29 @@ LL | struct Struct {}
    | ---------------- not a trait
 
 error: function not found in this trait
-  --> $DIR/rustc_must_implement_one_of_misuse.rs:8:34
+  --> $DIR/rustc_must_implement_one_of_misuse.rs:3:31
    |
 LL | #[rustc_must_implement_one_of(a, b)]
-   |                                  ^
-
-error: the `#[rustc_must_implement_one_of]` attribute must be used with at least 2 args
-  --> $DIR/rustc_must_implement_one_of_misuse.rs:14:1
-   |
-LL | #[rustc_must_implement_one_of(a)]
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |                               ^
 
 error: function not found in this trait
-  --> $DIR/rustc_must_implement_one_of_misuse.rs:3:31
+  --> $DIR/rustc_must_implement_one_of_misuse.rs:3:34
    |
 LL | #[rustc_must_implement_one_of(a, b)]
-   |                               ^
+   |                                  ^
 
 error: function not found in this trait
-  --> $DIR/rustc_must_implement_one_of_misuse.rs:3:34
+  --> $DIR/rustc_must_implement_one_of_misuse.rs:8:34
    |
 LL | #[rustc_must_implement_one_of(a, b)]
    |                                  ^
 
+error: the `#[rustc_must_implement_one_of]` attribute must be used with at least 2 args
+  --> $DIR/rustc_must_implement_one_of_misuse.rs:14:1
+   |
+LL | #[rustc_must_implement_one_of(a)]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
 error: not a function
   --> $DIR/rustc_must_implement_one_of_misuse.rs:26:5
    |