summaryrefslogtreecommitdiffstats
path: root/tests/ui/consts
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:20:39 +0000
commit1376c5a617be5c25655d0d7cb63e3beaa5a6e026 (patch)
tree3bb8d61aee02bc7a15eab3f36e3b921afc2075d0 /tests/ui/consts
parentReleasing progress-linux version 1.69.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.tar.xz
rustc-1376c5a617be5c25655d0d7cb63e3beaa5a6e026.zip
Merging upstream version 1.70.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/consts')
-rw-r--r--tests/ui/consts/const-block-const-bound.stderr38
-rw-r--r--tests/ui/consts/const-blocks/fn-call-in-non-const.stderr3
-rw-r--r--tests/ui/consts/const-blocks/migrate-fail.stderr6
-rw-r--r--tests/ui/consts/const-blocks/nll-fail.stderr6
-rw-r--r--tests/ui/consts/const-err-late.stderr6
-rw-r--r--tests/ui/consts/const-eval/const-eval-overflow-2.rs1
-rw-r--r--tests/ui/consts/const-eval/const-eval-overflow-2.stderr8
-rw-r--r--tests/ui/consts/const-eval/format.rs3
-rw-r--r--tests/ui/consts/const-eval/format.stderr35
-rw-r--r--tests/ui/consts/const-eval/issue-44578.stderr8
-rw-r--r--tests/ui/consts/const-eval/panic-assoc-never-type.rs2
-rw-r--r--tests/ui/consts/const-eval/ref_to_int_match.32bit.stderr10
-rw-r--r--tests/ui/consts/const-eval/ref_to_int_match.64bit.stderr10
-rw-r--r--tests/ui/consts/const-eval/ref_to_int_match.rs1
-rw-r--r--tests/ui/consts/const-eval/transmute-size-mismatch.rs24
-rw-r--r--tests/ui/consts/const-eval/transmute-size-mismatch.stderr37
-rw-r--r--tests/ui/consts/const-eval/ub-enum.32bit.stderr4
-rw-r--r--tests/ui/consts/const-eval/ub-enum.64bit.stderr4
-rw-r--r--tests/ui/consts/const-eval/ub-ref-ptr.stderr24
-rw-r--r--tests/ui/consts/const-eval/ub-slice-get-unchecked.rs9
-rw-r--r--tests/ui/consts/const-eval/ub-slice-get-unchecked.stderr18
-rw-r--r--tests/ui/consts/const-eval/ub-uninhabit.rs4
-rw-r--r--tests/ui/consts/const-eval/ub-uninhabit.stderr18
-rw-r--r--tests/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr11
-rw-r--r--tests/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr11
-rw-r--r--tests/ui/consts/const-eval/validate_uninhabited_zsts.rs2
-rw-r--r--tests/ui/consts/const-fn-error.rs1
-rw-r--r--tests/ui/consts/const-fn-error.stderr19
-rw-r--r--tests/ui/consts/const-for.rs1
-rw-r--r--tests/ui/consts/const-for.stderr18
-rw-r--r--tests/ui/consts/const-match-check.eval1.stderr4
-rw-r--r--tests/ui/consts/const-match-check.eval2.stderr4
-rw-r--r--tests/ui/consts/const-match-check.matchck.stderr16
-rw-r--r--tests/ui/consts/const-pattern-irrefutable.stderr15
-rw-r--r--tests/ui/consts/const_in_pattern/cross-crate-fail.stderr6
-rw-r--r--tests/ui/consts/const_in_pattern/custom-eq-branch-warn.rs2
-rw-r--r--tests/ui/consts/const_in_pattern/custom-eq-branch-warn.stderr2
-rw-r--r--tests/ui/consts/const_in_pattern/incomplete-slice.stderr4
-rw-r--r--tests/ui/consts/const_in_pattern/issue-78057.stderr3
-rw-r--r--tests/ui/consts/const_in_pattern/no-eq-branch-fail.stderr3
-rw-r--r--tests/ui/consts/const_in_pattern/reject_non_partial_eq.stderr3
-rw-r--r--tests/ui/consts/const_in_pattern/reject_non_structural.rs22
-rw-r--r--tests/ui/consts/const_in_pattern/reject_non_structural.stderr52
-rw-r--r--tests/ui/consts/const_in_pattern/warn_corner_cases.stderr6
-rw-r--r--tests/ui/consts/invalid-inline-const-in-match-arm.rs1
-rw-r--r--tests/ui/consts/invalid-inline-const-in-match-arm.stderr19
-rw-r--r--tests/ui/consts/issue-28113.rs1
-rw-r--r--tests/ui/consts/issue-28113.stderr19
-rw-r--r--tests/ui/consts/issue-43105.rs1
-rw-r--r--tests/ui/consts/issue-43105.stderr8
-rw-r--r--tests/ui/consts/issue-56164.rs1
-rw-r--r--tests/ui/consts/issue-56164.stderr21
-rw-r--r--tests/ui/consts/issue-64506.rs3
-rw-r--r--tests/ui/consts/issue-64506.stderr9
-rw-r--r--tests/ui/consts/issue-68542-closure-in-array-len.rs1
-rw-r--r--tests/ui/consts/issue-68542-closure-in-array-len.stderr19
-rw-r--r--tests/ui/consts/issue-73976-polymorphic.rs2
-rw-r--r--tests/ui/consts/issue-73976-polymorphic.stderr16
-rw-r--r--tests/ui/consts/issue-78655.rs1
-rw-r--r--tests/ui/consts/issue-78655.stderr8
-rw-r--r--tests/ui/consts/issue-79137-toogeneric.rs1
-rw-r--r--tests/ui/consts/issue-79137-toogeneric.stderr8
-rw-r--r--tests/ui/consts/issue-miri-1910.stderr2
-rw-r--r--tests/ui/consts/match_ice.stderr3
-rw-r--r--tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr6
-rw-r--r--tests/ui/consts/min_const_fn/min_const_fn_unsafe_bad.rs3
-rw-r--r--tests/ui/consts/min_const_fn/min_const_fn_unsafe_bad.stderr11
-rw-r--r--tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr6
-rw-r--r--tests/ui/consts/miri_unleashed/assoc_const.stderr6
-rw-r--r--tests/ui/consts/miri_unleashed/assoc_const_2.stderr6
-rw-r--r--tests/ui/consts/miri_unleashed/box.rs5
-rw-r--r--tests/ui/consts/miri_unleashed/box.stderr29
-rw-r--r--tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr32
-rw-r--r--tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr32
-rw-r--r--tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs4
-rw-r--r--tests/ui/consts/miri_unleashed/tls.stderr4
-rw-r--r--tests/ui/consts/offset_from_ub.stderr6
-rw-r--r--tests/ui/consts/uninhabited-const-issue-61744.stderr6
78 files changed, 449 insertions, 335 deletions
diff --git a/tests/ui/consts/const-block-const-bound.stderr b/tests/ui/consts/const-block-const-bound.stderr
index b9c4d8866..fef4914fa 100644
--- a/tests/ui/consts/const-block-const-bound.stderr
+++ b/tests/ui/consts/const-block-const-bound.stderr
@@ -1,44 +1,30 @@
error[E0277]: can't drop `UnconstDrop` in const contexts
- --> $DIR/const-block-const-bound.rs:20:11
+ --> $DIR/const-block-const-bound.rs:20:9
|
LL | f(UnconstDrop);
- | - ^^^^^^^^^^^ the trait `~const Destruct` is not implemented for `UnconstDrop`
- | |
- | required by a bound introduced by this call
+ | ^^^^^^^^^^^^^^ the trait `~const Destruct` is not implemented for `UnconstDrop`
|
= note: the trait bound `UnconstDrop: ~const Destruct` is not satisfied
-note: required by a bound in `f`
- --> $DIR/const-block-const-bound.rs:6:15
- |
-LL | const fn f<T: ~const Destruct>(x: T) {}
- | ^^^^^^^^^^^^^^^ required by this bound in `f`
help: consider borrowing here
|
-LL | f(&UnconstDrop);
- | +
-LL | f(&mut UnconstDrop);
- | ++++
+LL | &f(UnconstDrop);
+ | +
+LL | &mut f(UnconstDrop);
+ | ++++
error[E0277]: can't drop `NonDrop` in const contexts
- --> $DIR/const-block-const-bound.rs:22:11
+ --> $DIR/const-block-const-bound.rs:22:9
|
LL | f(NonDrop);
- | - ^^^^^^^ the trait `~const Destruct` is not implemented for `NonDrop`
- | |
- | required by a bound introduced by this call
+ | ^^^^^^^^^^ the trait `~const Destruct` is not implemented for `NonDrop`
|
= note: the trait bound `NonDrop: ~const Destruct` is not satisfied
-note: required by a bound in `f`
- --> $DIR/const-block-const-bound.rs:6:15
- |
-LL | const fn f<T: ~const Destruct>(x: T) {}
- | ^^^^^^^^^^^^^^^ required by this bound in `f`
help: consider borrowing here
|
-LL | f(&NonDrop);
- | +
-LL | f(&mut NonDrop);
- | ++++
+LL | &f(NonDrop);
+ | +
+LL | &mut f(NonDrop);
+ | ++++
error: aborting due to 2 previous errors
diff --git a/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr b/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr
index ee352700c..174103eeb 100644
--- a/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr
+++ b/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr
@@ -10,7 +10,8 @@ LL | let _: [Option<Bar>; 2] = [no_copy(); 2];
= help: create an inline `const` block, see RFC #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information
help: consider annotating `Bar` with `#[derive(Copy)]`
|
-LL | #[derive(Copy)]
+LL + #[derive(Copy)]
+LL | struct Bar;
|
error: aborting due to previous error
diff --git a/tests/ui/consts/const-blocks/migrate-fail.stderr b/tests/ui/consts/const-blocks/migrate-fail.stderr
index 928ffd083..d1896f755 100644
--- a/tests/ui/consts/const-blocks/migrate-fail.stderr
+++ b/tests/ui/consts/const-blocks/migrate-fail.stderr
@@ -8,7 +8,8 @@ LL | let arr: [Option<Bar>; 2] = [x; 2];
= note: the `Copy` trait is required because this value will be copied for each element of the array
help: consider annotating `Bar` with `#[derive(Copy)]`
|
-LL | #[derive(Copy)]
+LL + #[derive(Copy)]
+LL | struct Bar;
|
error[E0277]: the trait bound `Bar: Copy` is not satisfied
@@ -21,7 +22,8 @@ LL | let arr: [Option<Bar>; 2] = [x; 2];
= note: the `Copy` trait is required because this value will be copied for each element of the array
help: consider annotating `Bar` with `#[derive(Copy)]`
|
-LL | #[derive(Copy)]
+LL + #[derive(Copy)]
+LL | struct Bar;
|
error: aborting due to 2 previous errors
diff --git a/tests/ui/consts/const-blocks/nll-fail.stderr b/tests/ui/consts/const-blocks/nll-fail.stderr
index fede00845..807c964a5 100644
--- a/tests/ui/consts/const-blocks/nll-fail.stderr
+++ b/tests/ui/consts/const-blocks/nll-fail.stderr
@@ -8,7 +8,8 @@ LL | let arr: [Option<Bar>; 2] = [x; 2];
= note: the `Copy` trait is required because this value will be copied for each element of the array
help: consider annotating `Bar` with `#[derive(Copy)]`
|
-LL | #[derive(Copy)]
+LL + #[derive(Copy)]
+LL | struct Bar;
|
error[E0277]: the trait bound `Bar: Copy` is not satisfied
@@ -21,7 +22,8 @@ LL | let arr: [Option<Bar>; 2] = [x; 2];
= note: the `Copy` trait is required because this value will be copied for each element of the array
help: consider annotating `Bar` with `#[derive(Copy)]`
|
-LL | #[derive(Copy)]
+LL + #[derive(Copy)]
+LL | struct Bar;
|
error: aborting due to 2 previous errors
diff --git a/tests/ui/consts/const-err-late.stderr b/tests/ui/consts/const-err-late.stderr
index cb0cab244..149d3b523 100644
--- a/tests/ui/consts/const-err-late.stderr
+++ b/tests/ui/consts/const-err-late.stderr
@@ -10,12 +10,6 @@ note: erroneous constant used
LL | black_box((S::<i32>::FOO, S::<u32>::FOO));
| ^^^^^^^^^^^^^
-note: erroneous constant used
- --> $DIR/const-err-late.rs:19:16
- |
-LL | black_box((S::<i32>::FOO, S::<u32>::FOO));
- | ^^^^^^^^^^^^^
-
error[E0080]: evaluation of `S::<u32>::FOO` failed
--> $DIR/const-err-late.rs:13:21
|
diff --git a/tests/ui/consts/const-eval/const-eval-overflow-2.rs b/tests/ui/consts/const-eval/const-eval-overflow-2.rs
index 535d91359..c19a0c443 100644
--- a/tests/ui/consts/const-eval/const-eval-overflow-2.rs
+++ b/tests/ui/consts/const-eval/const-eval-overflow-2.rs
@@ -14,7 +14,6 @@ fn main() {
match -128i8 {
NEG_NEG_128 => println!("A"),
//~^ ERROR could not evaluate constant pattern
- //~| ERROR could not evaluate constant pattern
_ => println!("B"),
}
}
diff --git a/tests/ui/consts/const-eval/const-eval-overflow-2.stderr b/tests/ui/consts/const-eval/const-eval-overflow-2.stderr
index 7b1fe49d4..fc0baf110 100644
--- a/tests/ui/consts/const-eval/const-eval-overflow-2.stderr
+++ b/tests/ui/consts/const-eval/const-eval-overflow-2.stderr
@@ -10,12 +10,6 @@ error: could not evaluate constant pattern
LL | NEG_NEG_128 => println!("A"),
| ^^^^^^^^^^^
-error: could not evaluate constant pattern
- --> $DIR/const-eval-overflow-2.rs:15:9
- |
-LL | NEG_NEG_128 => println!("A"),
- | ^^^^^^^^^^^
-
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/format.rs b/tests/ui/consts/const-eval/format.rs
index 0d8b7c12d..5bdb2bf19 100644
--- a/tests/ui/consts/const-eval/format.rs
+++ b/tests/ui/consts/const-eval/format.rs
@@ -1,12 +1,13 @@
const fn failure() {
panic!("{:?}", 0);
//~^ ERROR cannot call non-const formatting macro in constant functions
+ //~| ERROR cannot call non-const fn `Arguments::<'_>::new_v1` in constant functions
}
const fn print() {
println!("{:?}", 0);
//~^ ERROR cannot call non-const formatting macro in constant functions
- //~| ERROR `Arguments::<'a>::new_v1` is not yet stable as a const fn
+ //~| ERROR cannot call non-const fn `Arguments::<'_>::new_v1` in constant functions
//~| ERROR cannot call non-const fn `_print` in constant functions
}
diff --git a/tests/ui/consts/const-eval/format.stderr b/tests/ui/consts/const-eval/format.stderr
index 4bf39db58..70a1abb0a 100644
--- a/tests/ui/consts/const-eval/format.stderr
+++ b/tests/ui/consts/const-eval/format.stderr
@@ -1,32 +1,41 @@
error[E0015]: cannot call non-const formatting macro in constant functions
- --> $DIR/format.rs:2:20
+ --> $DIR/format.rs:2:13
|
LL | panic!("{:?}", 0);
- | ^
+ | ^^^^
+ |
+ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
+ = note: this error originates in the macro `$crate::const_format_args` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0015]: cannot call non-const fn `Arguments::<'_>::new_v1` in constant functions
+ --> $DIR/format.rs:2:5
+ |
+LL | panic!("{:?}", 0);
+ | ^^^^^^^^^^^^^^^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
= note: this error originates in the macro `$crate::const_format_args` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0015]: cannot call non-const formatting macro in constant functions
- --> $DIR/format.rs:7:22
+ --> $DIR/format.rs:8:15
|
LL | println!("{:?}", 0);
- | ^
+ | ^^^^
|
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: `Arguments::<'a>::new_v1` is not yet stable as a const fn
- --> $DIR/format.rs:7:5
+error[E0015]: cannot call non-const fn `Arguments::<'_>::new_v1` in constant functions
+ --> $DIR/format.rs:8:5
|
LL | println!("{:?}", 0);
| ^^^^^^^^^^^^^^^^^^^
|
- = help: add `#![feature(const_fmt_arguments_new)]` to the crate attributes to enable
+ = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0015]: cannot call non-const fn `_print` in constant functions
- --> $DIR/format.rs:7:5
+ --> $DIR/format.rs:8:5
|
LL | println!("{:?}", 0);
| ^^^^^^^^^^^^^^^^^^^
@@ -63,19 +72,19 @@ LL | panic!("{:?}", 0);
= note: this note originates in the macro `$crate::const_format_args` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
note: erroneous constant used
- --> $DIR/format.rs:7:14
+ --> $DIR/format.rs:8:14
|
LL | println!("{:?}", 0);
| ^^^^^^
note: erroneous constant used
- --> $DIR/format.rs:7:14
+ --> $DIR/format.rs:8:14
|
LL | println!("{:?}", 0);
| ^^^^^^
note: erroneous constant used
- --> $DIR/format.rs:7:22
+ --> $DIR/format.rs:8:22
|
LL | println!("{:?}", 0);
| ^
@@ -83,13 +92,13 @@ LL | println!("{:?}", 0);
= note: this note originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
note: erroneous constant used
- --> $DIR/format.rs:7:22
+ --> $DIR/format.rs:8:22
|
LL | println!("{:?}", 0);
| ^
|
= note: this note originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
-error: aborting due to 4 previous errors
+error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/consts/const-eval/issue-44578.stderr b/tests/ui/consts/const-eval/issue-44578.stderr
index 0cbf54480..f3952809e 100644
--- a/tests/ui/consts/const-eval/issue-44578.stderr
+++ b/tests/ui/consts/const-eval/issue-44578.stderr
@@ -26,14 +26,6 @@ LL | println!("{}", <Bar<u16, u8> as Foo>::AMT);
|
= note: this note originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
-note: erroneous constant used
- --> $DIR/issue-44578.rs:25:20
- |
-LL | println!("{}", <Bar<u16, u8> as Foo>::AMT);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: this note originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
-
error: aborting due to previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/panic-assoc-never-type.rs b/tests/ui/consts/const-eval/panic-assoc-never-type.rs
index 28edf5144..1abe708d1 100644
--- a/tests/ui/consts/const-eval/panic-assoc-never-type.rs
+++ b/tests/ui/consts/const-eval/panic-assoc-never-type.rs
@@ -11,5 +11,5 @@ impl PrintName {
}
fn main() {
- let _ = PrintName::VOID; //~ constant
+ let _ = PrintName::VOID; //~ erroneous constant used
}
diff --git a/tests/ui/consts/const-eval/ref_to_int_match.32bit.stderr b/tests/ui/consts/const-eval/ref_to_int_match.32bit.stderr
index 032ceb246..eaa2d6b27 100644
--- a/tests/ui/consts/const-eval/ref_to_int_match.32bit.stderr
+++ b/tests/ui/consts/const-eval/ref_to_int_match.32bit.stderr
@@ -1,5 +1,5 @@
error[E0080]: evaluation of constant value failed
- --> $DIR/ref_to_int_match.rs:25:27
+ --> $DIR/ref_to_int_match.rs:24:27
|
LL | const BAR: Int = unsafe { Foo { r: &42 }.f };
| ^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -13,12 +13,6 @@ error: could not evaluate constant pattern
LL | 10..=BAR => {},
| ^^^
-error: could not evaluate constant pattern
- --> $DIR/ref_to_int_match.rs:7:14
- |
-LL | 10..=BAR => {},
- | ^^^
-
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/ref_to_int_match.64bit.stderr b/tests/ui/consts/const-eval/ref_to_int_match.64bit.stderr
index 032ceb246..eaa2d6b27 100644
--- a/tests/ui/consts/const-eval/ref_to_int_match.64bit.stderr
+++ b/tests/ui/consts/const-eval/ref_to_int_match.64bit.stderr
@@ -1,5 +1,5 @@
error[E0080]: evaluation of constant value failed
- --> $DIR/ref_to_int_match.rs:25:27
+ --> $DIR/ref_to_int_match.rs:24:27
|
LL | const BAR: Int = unsafe { Foo { r: &42 }.f };
| ^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -13,12 +13,6 @@ error: could not evaluate constant pattern
LL | 10..=BAR => {},
| ^^^
-error: could not evaluate constant pattern
- --> $DIR/ref_to_int_match.rs:7:14
- |
-LL | 10..=BAR => {},
- | ^^^
-
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/ref_to_int_match.rs b/tests/ui/consts/const-eval/ref_to_int_match.rs
index 70c6e7d94..a2dabde25 100644
--- a/tests/ui/consts/const-eval/ref_to_int_match.rs
+++ b/tests/ui/consts/const-eval/ref_to_int_match.rs
@@ -5,7 +5,6 @@ fn main() {
match n {
0..=10 => {},
10..=BAR => {}, //~ ERROR could not evaluate constant pattern
- //~| ERROR could not evaluate constant pattern
_ => {},
}
}
diff --git a/tests/ui/consts/const-eval/transmute-size-mismatch.rs b/tests/ui/consts/const-eval/transmute-size-mismatch.rs
new file mode 100644
index 000000000..2410baea2
--- /dev/null
+++ b/tests/ui/consts/const-eval/transmute-size-mismatch.rs
@@ -0,0 +1,24 @@
+#![feature(core_intrinsics)]
+#![feature(custom_mir)]
+
+// These cases are statically rejected by `mem::transmute`, so we need custom
+// MIR to be able to get to constant evaluation.
+use std::intrinsics::mir::*;
+
+#[custom_mir(dialect = "runtime", phase = "initial")]
+const unsafe fn mir_transmute<T, U>(x: T) -> U {
+ mir!{
+ {
+ RET = CastTransmute(x);
+ //~^ ERROR evaluation of constant value failed
+ //~| ERROR evaluation of constant value failed
+ Return()
+ }
+ }
+}
+
+const FROM_BIGGER: u16 = unsafe { mir_transmute(123_i32) };
+
+const FROM_SMALLER: u32 = unsafe { mir_transmute(123_i16) };
+
+fn main() {}
diff --git a/tests/ui/consts/const-eval/transmute-size-mismatch.stderr b/tests/ui/consts/const-eval/transmute-size-mismatch.stderr
new file mode 100644
index 000000000..e051491d3
--- /dev/null
+++ b/tests/ui/consts/const-eval/transmute-size-mismatch.stderr
@@ -0,0 +1,37 @@
+error[E0080]: evaluation of constant value failed
+ --> $DIR/transmute-size-mismatch.rs:12:13
+ |
+LL | RET = CastTransmute(x);
+ | ^^^^^^^^^^^^^^^^^^^^^^ transmuting from 4-byte type to 2-byte type: `i32` -> `u16`
+ |
+note: inside `mir_transmute::<i32, u16>`
+ --> $DIR/transmute-size-mismatch.rs:12:13
+ |
+LL | RET = CastTransmute(x);
+ | ^^^^^^^^^^^^^^^^^^^^^^
+note: inside `FROM_BIGGER`
+ --> $DIR/transmute-size-mismatch.rs:20:35
+ |
+LL | const FROM_BIGGER: u16 = unsafe { mir_transmute(123_i32) };
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/transmute-size-mismatch.rs:12:13
+ |
+LL | RET = CastTransmute(x);
+ | ^^^^^^^^^^^^^^^^^^^^^^ transmuting from 2-byte type to 4-byte type: `i16` -> `u32`
+ |
+note: inside `mir_transmute::<i16, u32>`
+ --> $DIR/transmute-size-mismatch.rs:12:13
+ |
+LL | RET = CastTransmute(x);
+ | ^^^^^^^^^^^^^^^^^^^^^^
+note: inside `FROM_SMALLER`
+ --> $DIR/transmute-size-mismatch.rs:22:36
+ |
+LL | const FROM_SMALLER: u32 = unsafe { mir_transmute(123_i16) };
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/ub-enum.32bit.stderr b/tests/ui/consts/const-eval/ub-enum.32bit.stderr
index 2d86bd88f..3ad1ac974 100644
--- a/tests/ui/consts/const-eval/ub-enum.32bit.stderr
+++ b/tests/ui/consts/const-eval/ub-enum.32bit.stderr
@@ -108,13 +108,13 @@ error[E0080]: evaluation of constant value failed
--> $DIR/ub-enum.rs:96:77
|
LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) };
- | ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
+ | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Ok)>.0.1: encountered a value of uninhabited type Never
error[E0080]: evaluation of constant value failed
--> $DIR/ub-enum.rs:98:77
|
LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) };
- | ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
+ | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Ok)>.0.1: encountered a value of the never type `!`
error: aborting due to 13 previous errors
diff --git a/tests/ui/consts/const-eval/ub-enum.64bit.stderr b/tests/ui/consts/const-eval/ub-enum.64bit.stderr
index a89d7ec5f..a66706d1a 100644
--- a/tests/ui/consts/const-eval/ub-enum.64bit.stderr
+++ b/tests/ui/consts/const-eval/ub-enum.64bit.stderr
@@ -108,13 +108,13 @@ error[E0080]: evaluation of constant value failed
--> $DIR/ub-enum.rs:96:77
|
LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) };
- | ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
+ | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Ok)>.0.1: encountered a value of uninhabited type Never
error[E0080]: evaluation of constant value failed
--> $DIR/ub-enum.rs:98:77
|
LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) };
- | ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
+ | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Ok)>.0.1: encountered a value of the never type `!`
error: aborting due to 13 previous errors
diff --git a/tests/ui/consts/const-eval/ub-ref-ptr.stderr b/tests/ui/consts/const-eval/ub-ref-ptr.stderr
index 6bd367b64..080568b51 100644
--- a/tests/ui/consts/const-eval/ub-ref-ptr.stderr
+++ b/tests/ui/consts/const-eval/ub-ref-ptr.stderr
@@ -148,11 +148,11 @@ LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
HEX_DUMP
}
-error: accessing memory with alignment 1, but alignment 4 is required
+error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/104616>
+ = note: accessing memory with alignment 1, but alignment 4 is required
+ |
note: inside `std::ptr::read::<u32>`
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
note: inside `ptr::const_ptr::<impl *const u32>::read`
@@ -162,25 +162,7 @@ note: inside `UNALIGNED_READ`
|
LL | ptr.read();
| ^^^^^^^^^^
- = note: `#[deny(invalid_alignment)]` on by default
error: aborting due to 15 previous errors
For more information about this error, try `rustc --explain E0080`.
-Future incompatibility report: Future breakage diagnostic:
-error: accessing memory with alignment 1, but alignment 4 is required
- --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
- |
- = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
- = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/104616>
-note: inside `std::ptr::read::<u32>`
- --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
-note: inside `ptr::const_ptr::<impl *const u32>::read`
- --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
-note: inside `UNALIGNED_READ`
- --> $DIR/ub-ref-ptr.rs:67:5
- |
-LL | ptr.read();
- | ^^^^^^^^^^
- = note: `#[deny(invalid_alignment)]` on by default
-
diff --git a/tests/ui/consts/const-eval/ub-slice-get-unchecked.rs b/tests/ui/consts/const-eval/ub-slice-get-unchecked.rs
new file mode 100644
index 000000000..d9a74b4f3
--- /dev/null
+++ b/tests/ui/consts/const-eval/ub-slice-get-unchecked.rs
@@ -0,0 +1,9 @@
+#![feature(const_slice_index)]
+
+const A: [(); 5] = [(), (), (), (), ()];
+
+// Since the indexing is on a ZST, the addresses are all fine,
+// but we should still catch the bad range.
+const B: &[()] = unsafe { A.get_unchecked(3..1) };
+
+fn main() {}
diff --git a/tests/ui/consts/const-eval/ub-slice-get-unchecked.stderr b/tests/ui/consts/const-eval/ub-slice-get-unchecked.stderr
new file mode 100644
index 000000000..775e475df
--- /dev/null
+++ b/tests/ui/consts/const-eval/ub-slice-get-unchecked.stderr
@@ -0,0 +1,18 @@
+error[E0080]: evaluation of constant value failed
+ --> $SRC_DIR/core/src/slice/index.rs:LL:COL
+ |
+ = note: overflow executing `unchecked_sub`
+ |
+note: inside `<std::ops::Range<usize> as SliceIndex<[()]>>::get_unchecked`
+ --> $SRC_DIR/core/src/slice/index.rs:LL:COL
+note: inside `core::slice::<impl [()]>::get_unchecked::<std::ops::Range<usize>>`
+ --> $SRC_DIR/core/src/slice/mod.rs:LL:COL
+note: inside `B`
+ --> $DIR/ub-slice-get-unchecked.rs:7:27
+ |
+LL | const B: &[()] = unsafe { A.get_unchecked(3..1) };
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/ub-uninhabit.rs b/tests/ui/consts/const-eval/ub-uninhabit.rs
index 4c4ef216d..10edae437 100644
--- a/tests/ui/consts/const-eval/ub-uninhabit.rs
+++ b/tests/ui/consts/const-eval/ub-uninhabit.rs
@@ -14,12 +14,12 @@ union MaybeUninit<T: Copy> {
}
const BAD_BAD_BAD: Bar = unsafe { MaybeUninit { uninit: () }.init };
-//~^ ERROR it is undefined behavior to use this value
+//~^ ERROR evaluation of constant value failed
const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
//~^ ERROR it is undefined behavior to use this value
const BAD_BAD_ARRAY: [Bar; 1] = unsafe { MaybeUninit { uninit: () }.init };
-//~^ ERROR it is undefined behavior to use this value
+//~^ ERROR evaluation of constant value failed
fn main() {}
diff --git a/tests/ui/consts/const-eval/ub-uninhabit.stderr b/tests/ui/consts/const-eval/ub-uninhabit.stderr
index 0ae376d03..733975fc0 100644
--- a/tests/ui/consts/const-eval/ub-uninhabit.stderr
+++ b/tests/ui/consts/const-eval/ub-uninhabit.stderr
@@ -1,11 +1,8 @@
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-uninhabit.rs:16:1
+error[E0080]: evaluation of constant value failed
+ --> $DIR/ub-uninhabit.rs:16:35
|
LL | const BAD_BAD_BAD: Bar = unsafe { MaybeUninit { uninit: () }.init };
- | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a value of uninhabited type Bar
- |
- = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
- = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a value of uninhabited type Bar
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-uninhabit.rs:19:1
@@ -18,14 +15,11 @@ LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
HEX_DUMP
}
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-uninhabit.rs:22:1
+error[E0080]: evaluation of constant value failed
+ --> $DIR/ub-uninhabit.rs:22:42
|
LL | const BAD_BAD_ARRAY: [Bar; 1] = unsafe { MaybeUninit { uninit: () }.init };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0]: encountered a value of uninhabited type Bar
- |
- = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
- = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0]: encountered a value of uninhabited type Bar
error: aborting due to 3 previous errors
diff --git a/tests/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr b/tests/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr
index 69fb1a59d..74bc6317c 100644
--- a/tests/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr
+++ b/tests/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr
@@ -11,7 +11,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/validate_uninhabited_zsts.rs:4:14
|
LL | unsafe { std::mem::transmute(()) }
- | ^^^^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
+ | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a value of the never type `!`
|
note: inside `foo`
--> $DIR/validate_uninhabited_zsts.rs:4:14
@@ -24,14 +24,11 @@ note: inside `FOO`
LL | const FOO: [empty::Empty; 3] = [foo(); 3];
| ^^^^^
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/validate_uninhabited_zsts.rs:21:1
+error[E0080]: evaluation of constant value failed
+ --> $DIR/validate_uninhabited_zsts.rs:21:42
|
LL | const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3];
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0].0: encountered a value of uninhabited type empty::Void
- |
- = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
- = note: the raw bytes of the constant (size: 0, align: 1) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered a value of uninhabited type empty::Void
warning: the type `empty::Empty` does not permit zero-initialization
--> $DIR/validate_uninhabited_zsts.rs:21:42
diff --git a/tests/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr b/tests/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr
index 69fb1a59d..74bc6317c 100644
--- a/tests/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr
+++ b/tests/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr
@@ -11,7 +11,7 @@ error[E0080]: evaluation of constant value failed
--> $DIR/validate_uninhabited_zsts.rs:4:14
|
LL | unsafe { std::mem::transmute(()) }
- | ^^^^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
+ | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a value of the never type `!`
|
note: inside `foo`
--> $DIR/validate_uninhabited_zsts.rs:4:14
@@ -24,14 +24,11 @@ note: inside `FOO`
LL | const FOO: [empty::Empty; 3] = [foo(); 3];
| ^^^^^
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/validate_uninhabited_zsts.rs:21:1
+error[E0080]: evaluation of constant value failed
+ --> $DIR/validate_uninhabited_zsts.rs:21:42
|
LL | const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3];
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0].0: encountered a value of uninhabited type empty::Void
- |
- = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
- = note: the raw bytes of the constant (size: 0, align: 1) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered a value of uninhabited type empty::Void
warning: the type `empty::Empty` does not permit zero-initialization
--> $DIR/validate_uninhabited_zsts.rs:21:42
diff --git a/tests/ui/consts/const-eval/validate_uninhabited_zsts.rs b/tests/ui/consts/const-eval/validate_uninhabited_zsts.rs
index c0b326215..b6783175d 100644
--- a/tests/ui/consts/const-eval/validate_uninhabited_zsts.rs
+++ b/tests/ui/consts/const-eval/validate_uninhabited_zsts.rs
@@ -19,7 +19,7 @@ pub mod empty {
const FOO: [empty::Empty; 3] = [foo(); 3];
const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3];
-//~^ ERROR it is undefined behavior to use this value
+//~^ ERROR evaluation of constant value failed
//~| WARN the type `empty::Empty` does not permit zero-initialization
fn main() {
diff --git a/tests/ui/consts/const-fn-error.rs b/tests/ui/consts/const-fn-error.rs
index 50b7ce1f8..dabbd58db 100644
--- a/tests/ui/consts/const-fn-error.rs
+++ b/tests/ui/consts/const-fn-error.rs
@@ -7,6 +7,7 @@ const fn f(x: usize) -> usize {
//~| ERROR `for` is not allowed in a `const fn`
//~| ERROR mutable references are not allowed in constant functions
//~| ERROR cannot call non-const fn
+ //~| ERROR the trait bound
sum += i;
}
sum
diff --git a/tests/ui/consts/const-fn-error.stderr b/tests/ui/consts/const-fn-error.stderr
index f735b3d53..73d235d6a 100644
--- a/tests/ui/consts/const-fn-error.stderr
+++ b/tests/ui/consts/const-fn-error.stderr
@@ -5,7 +5,7 @@ LL | / for i in 0..x {
LL | |
LL | |
LL | |
-LL | |
+... |
LL | | sum += i;
LL | | }
| |_____^
@@ -33,6 +33,19 @@ LL | for i in 0..x {
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
+error[E0277]: the trait bound `std::ops::Range<usize>: Iterator` is not satisfied
+ --> $DIR/const-fn-error.rs:5:14
+ |
+LL | for i in 0..x {
+ | ^^^^ `std::ops::Range<usize>` is not an iterator
+ |
+ = help: the trait `~const Iterator` is not implemented for `std::ops::Range<usize>`
+note: the trait `Iterator` is implemented for `std::ops::Range<usize>`, but that implementation is not `const`
+ --> $DIR/const-fn-error.rs:5:14
+ |
+LL | for i in 0..x {
+ | ^^^^
+
error[E0015]: cannot call non-const fn `<std::ops::Range<usize> as Iterator>::next` in constant functions
--> $DIR/const-fn-error.rs:5:14
|
@@ -42,7 +55,7 @@ LL | for i in 0..x {
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
-error: aborting due to 4 previous errors
+error: aborting due to 5 previous errors
-Some errors have detailed explanations: E0015, E0658.
+Some errors have detailed explanations: E0015, E0277, E0658.
For more information about an error, try `rustc --explain E0015`.
diff --git a/tests/ui/consts/const-for.rs b/tests/ui/consts/const-for.rs
index 8db248535..ff9c977f7 100644
--- a/tests/ui/consts/const-for.rs
+++ b/tests/ui/consts/const-for.rs
@@ -5,6 +5,7 @@ const _: () = {
for _ in 0..5 {}
//~^ error: cannot call
//~| error: cannot convert
+ //~| error: the trait bound
};
fn main() {}
diff --git a/tests/ui/consts/const-for.stderr b/tests/ui/consts/const-for.stderr
index 3fb9787c0..64f2f603b 100644
--- a/tests/ui/consts/const-for.stderr
+++ b/tests/ui/consts/const-for.stderr
@@ -9,6 +9,19 @@ note: impl defined here, but it is not `const`
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
+error[E0277]: the trait bound `std::ops::Range<i32>: Iterator` is not satisfied
+ --> $DIR/const-for.rs:5:14
+ |
+LL | for _ in 0..5 {}
+ | ^^^^ `std::ops::Range<i32>` is not an iterator
+ |
+ = help: the trait `~const Iterator` is not implemented for `std::ops::Range<i32>`
+note: the trait `Iterator` is implemented for `std::ops::Range<i32>`, but that implementation is not `const`
+ --> $DIR/const-for.rs:5:14
+ |
+LL | for _ in 0..5 {}
+ | ^^^^
+
error[E0015]: cannot call non-const fn `<std::ops::Range<i32> as Iterator>::next` in constants
--> $DIR/const-for.rs:5:14
|
@@ -18,6 +31,7 @@ LL | for _ in 0..5 {}
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
-error: aborting due to 2 previous errors
+error: aborting due to 3 previous errors
-For more information about this error, try `rustc --explain E0015`.
+Some errors have detailed explanations: E0015, E0277.
+For more information about an error, try `rustc --explain E0015`.
diff --git a/tests/ui/consts/const-match-check.eval1.stderr b/tests/ui/consts/const-match-check.eval1.stderr
index 08fcd1dea..27ff5d4cd 100644
--- a/tests/ui/consts/const-match-check.eval1.stderr
+++ b/tests/ui/consts/const-match-check.eval1.stderr
@@ -9,8 +9,8 @@ LL | A = { let 0 = 0; 0 },
= note: the matched value is of type `i32`
help: you might want to use `if let` to ignore the variants that aren't matched
|
-LL | A = { if let 0 = 0 { todo!() } 0 },
- | ++ ~~~~~~~~~~~
+LL | A = { if let 0 = 0 { todo!() }; 0 },
+ | ++ +++++++++++
help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits
|
LL | A = { let _0 = 0; 0 },
diff --git a/tests/ui/consts/const-match-check.eval2.stderr b/tests/ui/consts/const-match-check.eval2.stderr
index 5d86ca4bf..0c74a7b3d 100644
--- a/tests/ui/consts/const-match-check.eval2.stderr
+++ b/tests/ui/consts/const-match-check.eval2.stderr
@@ -9,8 +9,8 @@ LL | let x: [i32; { let 0 = 0; 0 }] = [];
= note: the matched value is of type `i32`
help: you might want to use `if let` to ignore the variants that aren't matched
|
-LL | let x: [i32; { if let 0 = 0 { todo!() } 0 }] = [];
- | ++ ~~~~~~~~~~~
+LL | let x: [i32; { if let 0 = 0 { todo!() }; 0 }] = [];
+ | ++ +++++++++++
help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits
|
LL | let x: [i32; { let _0 = 0; 0 }] = [];
diff --git a/tests/ui/consts/const-match-check.matchck.stderr b/tests/ui/consts/const-match-check.matchck.stderr
index c8f66bb0f..bcca4c2a6 100644
--- a/tests/ui/consts/const-match-check.matchck.stderr
+++ b/tests/ui/consts/const-match-check.matchck.stderr
@@ -9,8 +9,8 @@ LL | const X: i32 = { let 0 = 0; 0 };
= note: the matched value is of type `i32`
help: you might want to use `if let` to ignore the variants that aren't matched
|
-LL | const X: i32 = { if let 0 = 0 { todo!() } 0 };
- | ++ ~~~~~~~~~~~
+LL | const X: i32 = { if let 0 = 0 { todo!() }; 0 };
+ | ++ +++++++++++
help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits
|
LL | const X: i32 = { let _0 = 0; 0 };
@@ -27,8 +27,8 @@ LL | static Y: i32 = { let 0 = 0; 0 };
= note: the matched value is of type `i32`
help: you might want to use `if let` to ignore the variants that aren't matched
|
-LL | static Y: i32 = { if let 0 = 0 { todo!() } 0 };
- | ++ ~~~~~~~~~~~
+LL | static Y: i32 = { if let 0 = 0 { todo!() }; 0 };
+ | ++ +++++++++++
help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits
|
LL | static Y: i32 = { let _0 = 0; 0 };
@@ -45,8 +45,8 @@ LL | const X: i32 = { let 0 = 0; 0 };
= note: the matched value is of type `i32`
help: you might want to use `if let` to ignore the variants that aren't matched
|
-LL | const X: i32 = { if let 0 = 0 { todo!() } 0 };
- | ++ ~~~~~~~~~~~
+LL | const X: i32 = { if let 0 = 0 { todo!() }; 0 };
+ | ++ +++++++++++
help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits
|
LL | const X: i32 = { let _0 = 0; 0 };
@@ -63,8 +63,8 @@ LL | const X: i32 = { let 0 = 0; 0 };
= note: the matched value is of type `i32`
help: you might want to use `if let` to ignore the variants that aren't matched
|
-LL | const X: i32 = { if let 0 = 0 { todo!() } 0 };
- | ++ ~~~~~~~~~~~
+LL | const X: i32 = { if let 0 = 0 { todo!() }; 0 };
+ | ++ +++++++++++
help: alternatively, you could prepend the pattern with an underscore to define a new named variable; identifiers cannot begin with digits
|
LL | const X: i32 = { let _0 = 0; 0 };
diff --git a/tests/ui/consts/const-pattern-irrefutable.stderr b/tests/ui/consts/const-pattern-irrefutable.stderr
index c156ea161..2aed68bdd 100644
--- a/tests/ui/consts/const-pattern-irrefutable.stderr
+++ b/tests/ui/consts/const-pattern-irrefutable.stderr
@@ -1,9 +1,6 @@
error[E0005]: refutable pattern in local binding
--> $DIR/const-pattern-irrefutable.rs:12:9
|
-LL | const a: u8 = 2;
- | ----------- constant defined here
-...
LL | let a = 4;
| ^
| |
@@ -11,14 +8,13 @@ LL | let a = 4;
| missing patterns are not covered because `a` is interpreted as a constant pattern, not a new variable
| help: introduce a variable instead: `a_var`
|
+ = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
+ = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
= note: the matched value is of type `u8`
error[E0005]: refutable pattern in local binding
--> $DIR/const-pattern-irrefutable.rs:17:9
|
-LL | pub const b: u8 = 2;
- | --------------- constant defined here
-...
LL | let c = 4;
| ^
| |
@@ -26,14 +22,13 @@ LL | let c = 4;
| missing patterns are not covered because `c` is interpreted as a constant pattern, not a new variable
| help: introduce a variable instead: `c_var`
|
+ = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
+ = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
= note: the matched value is of type `u8`
error[E0005]: refutable pattern in local binding
--> $DIR/const-pattern-irrefutable.rs:22:9
|
-LL | pub const d: u8 = 2;
- | --------------- constant defined here
-...
LL | let d = 4;
| ^
| |
@@ -41,6 +36,8 @@ LL | let d = 4;
| missing patterns are not covered because `d` is interpreted as a constant pattern, not a new variable
| help: introduce a variable instead: `d_var`
|
+ = note: `let` bindings require an "irrefutable pattern", like a `struct` or an `enum` with only one variant
+ = note: for more information, visit https://doc.rust-lang.org/book/ch18-02-refutability.html
= note: the matched value is of type `u8`
error: aborting due to 3 previous errors
diff --git a/tests/ui/consts/const_in_pattern/cross-crate-fail.stderr b/tests/ui/consts/const_in_pattern/cross-crate-fail.stderr
index a8066a88c..2f6786999 100644
--- a/tests/ui/consts/const_in_pattern/cross-crate-fail.stderr
+++ b/tests/ui/consts/const_in_pattern/cross-crate-fail.stderr
@@ -3,12 +3,18 @@ error: to use a constant of type `CustomEq` in a pattern, `CustomEq` must be ann
|
LL | consts::SOME => panic!(),
| ^^^^^^^^^^^^
+ |
+ = note: the traits must be derived, manual `impl`s are not sufficient
+ = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `CustomEq` in a pattern, `CustomEq` must be annotated with `#[derive(PartialEq, Eq)]`
--> $DIR/cross-crate-fail.rs:20:9
|
LL | <Defaulted as consts::AssocConst>::SOME => panic!(),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: the traits must be derived, manual `impl`s are not sufficient
+ = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: aborting due to 2 previous errors
diff --git a/tests/ui/consts/const_in_pattern/custom-eq-branch-warn.rs b/tests/ui/consts/const_in_pattern/custom-eq-branch-warn.rs
index 856d20417..41de5e7b4 100644
--- a/tests/ui/consts/const_in_pattern/custom-eq-branch-warn.rs
+++ b/tests/ui/consts/const_in_pattern/custom-eq-branch-warn.rs
@@ -28,6 +28,8 @@ fn main() {
match Foo::Qux(CustomEq) {
BAR_BAZ => panic!(),
//~^ WARN must be annotated with `#[derive(PartialEq, Eq)]`
+ //~| NOTE the traits must be derived
+ //~| NOTE StructuralEq.html for details
//~| WARN this was previously accepted
//~| NOTE see issue #73448
//~| NOTE `#[warn(nontrivial_structural_match)]` on by default
diff --git a/tests/ui/consts/const_in_pattern/custom-eq-branch-warn.stderr b/tests/ui/consts/const_in_pattern/custom-eq-branch-warn.stderr
index 223482722..3f19c67d2 100644
--- a/tests/ui/consts/const_in_pattern/custom-eq-branch-warn.stderr
+++ b/tests/ui/consts/const_in_pattern/custom-eq-branch-warn.stderr
@@ -6,6 +6,8 @@ LL | BAR_BAZ => panic!(),
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #73448 <https://github.com/rust-lang/rust/issues/73448>
+ = note: the traits must be derived, manual `impl`s are not sufficient
+ = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
= note: `#[warn(nontrivial_structural_match)]` on by default
warning: 1 warning emitted
diff --git a/tests/ui/consts/const_in_pattern/incomplete-slice.stderr b/tests/ui/consts/const_in_pattern/incomplete-slice.stderr
index ddc576ced..be144a87b 100644
--- a/tests/ui/consts/const_in_pattern/incomplete-slice.stderr
+++ b/tests/ui/consts/const_in_pattern/incomplete-slice.stderr
@@ -6,6 +6,8 @@ LL | E_SL => {}
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
+ = note: the traits must be derived, manual `impl`s are not sufficient
+ = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
= note: `#[warn(indirect_structural_match)]` on by default
error[E0004]: non-exhaustive patterns: `&_` not covered
@@ -17,7 +19,7 @@ LL | match &[][..] {
= note: the matched value is of type `&[E]`
help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
|
-LL ~ E_SL => {}
+LL ~ E_SL => {},
LL + &_ => todo!()
|
diff --git a/tests/ui/consts/const_in_pattern/issue-78057.stderr b/tests/ui/consts/const_in_pattern/issue-78057.stderr
index 35619594f..df155bdb6 100644
--- a/tests/ui/consts/const_in_pattern/issue-78057.stderr
+++ b/tests/ui/consts/const_in_pattern/issue-78057.stderr
@@ -3,6 +3,9 @@ error: to use a constant of type `Opaque` in a pattern, `Opaque` must be annotat
|
LL | FOO => {},
| ^^^
+ |
+ = note: the traits must be derived, manual `impl`s are not sufficient
+ = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: unreachable pattern
--> $DIR/issue-78057.rs:14:9
diff --git a/tests/ui/consts/const_in_pattern/no-eq-branch-fail.stderr b/tests/ui/consts/const_in_pattern/no-eq-branch-fail.stderr
index e505dad69..cced6af49 100644
--- a/tests/ui/consts/const_in_pattern/no-eq-branch-fail.stderr
+++ b/tests/ui/consts/const_in_pattern/no-eq-branch-fail.stderr
@@ -3,6 +3,9 @@ error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated wit
|
LL | BAR_BAZ => panic!(),
| ^^^^^^^
+ |
+ = note: the traits must be derived, manual `impl`s are not sufficient
+ = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: aborting due to previous error
diff --git a/tests/ui/consts/const_in_pattern/reject_non_partial_eq.stderr b/tests/ui/consts/const_in_pattern/reject_non_partial_eq.stderr
index 95cfa4a9e..958bf373c 100644
--- a/tests/ui/consts/const_in_pattern/reject_non_partial_eq.stderr
+++ b/tests/ui/consts/const_in_pattern/reject_non_partial_eq.stderr
@@ -3,6 +3,9 @@ error: to use a constant of type `NoPartialEq` in a pattern, `NoPartialEq` must
|
LL | NO_PARTIAL_EQ_NONE => println!("NO_PARTIAL_EQ_NONE"),
| ^^^^^^^^^^^^^^^^^^
+ |
+ = note: the traits must be derived, manual `impl`s are not sufficient
+ = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: aborting due to previous error
diff --git a/tests/ui/consts/const_in_pattern/reject_non_structural.rs b/tests/ui/consts/const_in_pattern/reject_non_structural.rs
index 75fde0d92..dc6b9a331 100644
--- a/tests/ui/consts/const_in_pattern/reject_non_structural.rs
+++ b/tests/ui/consts/const_in_pattern/reject_non_structural.rs
@@ -39,45 +39,67 @@ fn main() {
const ENUM: Derive<NoDerive> = Derive::Some(NoDerive);
match Derive::Some(NoDerive) { ENUM => dbg!(ENUM), _ => panic!("whoops"), };
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
+ //~| NOTE the traits must be derived
+ //~| NOTE StructuralEq.html for details
const FIELD: OND = TrivialEq(Some(NoDerive)).0;
match Some(NoDerive) { FIELD => dbg!(FIELD), _ => panic!("whoops"), };
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
+ //~| NOTE the traits must be derived
+ //~| NOTE StructuralEq.html for details
const NO_DERIVE_SOME: OND = Some(NoDerive);
const INDIRECT: OND = NO_DERIVE_SOME;
match Some(NoDerive) {INDIRECT => dbg!(INDIRECT), _ => panic!("whoops"), };
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
+ //~| NOTE the traits must be derived
+ //~| NOTE StructuralEq.html for details
const TUPLE: (OND, OND) = (None, Some(NoDerive));
match (None, Some(NoDerive)) { TUPLE => dbg!(TUPLE), _ => panic!("whoops"), };
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
+ //~| NOTE the traits must be derived
+ //~| NOTE StructuralEq.html for details
const TYPE_ASCRIPTION: OND = type_ascribe!(Some(NoDerive), OND);
match Some(NoDerive) { TYPE_ASCRIPTION => dbg!(TYPE_ASCRIPTION), _ => panic!("whoops"), };
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
+ //~| NOTE the traits must be derived
+ //~| NOTE StructuralEq.html for details
const ARRAY: [OND; 2] = [None, Some(NoDerive)];
match [None, Some(NoDerive)] { ARRAY => dbg!(ARRAY), _ => panic!("whoops"), };
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
+ //~| NOTE the traits must be derived
+ //~| NOTE StructuralEq.html for details
const REPEAT: [OND; 2] = [Some(NoDerive); 2];
match [Some(NoDerive); 2] { REPEAT => dbg!(REPEAT), _ => panic!("whoops"), };
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
+ //~| NOTE the traits must be derived
+ //~| NOTE StructuralEq.html for details
//~| ERROR must be annotated with `#[derive(PartialEq, Eq)]`
+ //~| NOTE the traits must be derived
+ //~| NOTE StructuralEq.html for details
trait Trait: Sized { const ASSOC: Option<Self>; }
impl Trait for NoDerive { const ASSOC: Option<NoDerive> = Some(NoDerive); }
match Some(NoDerive) { NoDerive::ASSOC => dbg!(NoDerive::ASSOC), _ => panic!("whoops"), };
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
+ //~| NOTE the traits must be derived
+ //~| NOTE StructuralEq.html for details
const BLOCK: OND = { NoDerive; Some(NoDerive) };
match Some(NoDerive) { BLOCK => dbg!(BLOCK), _ => panic!("whoops"), };
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
+ //~| NOTE the traits must be derived
+ //~| NOTE StructuralEq.html for details
const ADDR_OF: &OND = &Some(NoDerive);
match &Some(NoDerive) { ADDR_OF => dbg!(ADDR_OF), _ => panic!("whoops"), };
//~^ WARN must be annotated with `#[derive(PartialEq, Eq)]`
+ //~| NOTE the traits must be derived
+ //~| NOTE StructuralEq.html for details
//~| WARN previously accepted by the compiler but is being phased out
//~| NOTE for more information, see issue #62411
}
diff --git a/tests/ui/consts/const_in_pattern/reject_non_structural.stderr b/tests/ui/consts/const_in_pattern/reject_non_structural.stderr
index 660198349..b6e439f21 100644
--- a/tests/ui/consts/const_in_pattern/reject_non_structural.stderr
+++ b/tests/ui/consts/const_in_pattern/reject_non_structural.stderr
@@ -3,69 +3,101 @@ error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be ann
|
LL | match Derive::Some(NoDerive) { ENUM => dbg!(ENUM), _ => panic!("whoops"), };
| ^^^^
+ |
+ = note: the traits must be derived, manual `impl`s are not sufficient
+ = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:44:28
+ --> $DIR/reject_non_structural.rs:46:28
|
LL | match Some(NoDerive) { FIELD => dbg!(FIELD), _ => panic!("whoops"), };
| ^^^^^
+ |
+ = note: the traits must be derived, manual `impl`s are not sufficient
+ = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:49:27
+ --> $DIR/reject_non_structural.rs:53:27
|
LL | match Some(NoDerive) {INDIRECT => dbg!(INDIRECT), _ => panic!("whoops"), };
| ^^^^^^^^
+ |
+ = note: the traits must be derived, manual `impl`s are not sufficient
+ = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:53:36
+ --> $DIR/reject_non_structural.rs:59:36
|
LL | match (None, Some(NoDerive)) { TUPLE => dbg!(TUPLE), _ => panic!("whoops"), };
| ^^^^^
+ |
+ = note: the traits must be derived, manual `impl`s are not sufficient
+ = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:57:28
+ --> $DIR/reject_non_structural.rs:65:28
|
LL | match Some(NoDerive) { TYPE_ASCRIPTION => dbg!(TYPE_ASCRIPTION), _ => panic!("whoops"), };
| ^^^^^^^^^^^^^^^
+ |
+ = note: the traits must be derived, manual `impl`s are not sufficient
+ = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:61:36
+ --> $DIR/reject_non_structural.rs:71:36
|
LL | match [None, Some(NoDerive)] { ARRAY => dbg!(ARRAY), _ => panic!("whoops"), };
| ^^^^^
+ |
+ = note: the traits must be derived, manual `impl`s are not sufficient
+ = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:65:33
+ --> $DIR/reject_non_structural.rs:77:33
|
LL | match [Some(NoDerive); 2] { REPEAT => dbg!(REPEAT), _ => panic!("whoops"), };
| ^^^^^^
+ |
+ = note: the traits must be derived, manual `impl`s are not sufficient
+ = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:65:33
+ --> $DIR/reject_non_structural.rs:77:33
|
LL | match [Some(NoDerive); 2] { REPEAT => dbg!(REPEAT), _ => panic!("whoops"), };
| ^^^^^^
+ |
+ = note: the traits must be derived, manual `impl`s are not sufficient
+ = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:71:28
+ --> $DIR/reject_non_structural.rs:87:28
|
LL | match Some(NoDerive) { NoDerive::ASSOC => dbg!(NoDerive::ASSOC), _ => panic!("whoops"), };
| ^^^^^^^^^^^^^^^
+ |
+ = note: the traits must be derived, manual `impl`s are not sufficient
+ = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:75:28
+ --> $DIR/reject_non_structural.rs:93:28
|
LL | match Some(NoDerive) { BLOCK => dbg!(BLOCK), _ => panic!("whoops"), };
| ^^^^^
+ |
+ = note: the traits must be derived, manual `impl`s are not sufficient
+ = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
warning: to use a constant of type `NoDerive` in a pattern, `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
- --> $DIR/reject_non_structural.rs:79:29
+ --> $DIR/reject_non_structural.rs:99:29
|
LL | match &Some(NoDerive) { ADDR_OF => dbg!(ADDR_OF), _ => panic!("whoops"), };
| ^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #62411 <https://github.com/rust-lang/rust/issues/62411>
+ = note: the traits must be derived, manual `impl`s are not sufficient
+ = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
note: the lint level is defined here
--> $DIR/reject_non_structural.rs:12:9
|
diff --git a/tests/ui/consts/const_in_pattern/warn_corner_cases.stderr b/tests/ui/consts/const_in_pattern/warn_corner_cases.stderr
index e957a43a1..8c01d2f65 100644
--- a/tests/ui/consts/const_in_pattern/warn_corner_cases.stderr
+++ b/tests/ui/consts/const_in_pattern/warn_corner_cases.stderr
@@ -6,6 +6,8 @@ LL | match None { Some(_) => panic!("whoops"), INDEX => dbg!(INDEX), };
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #73448 <https://github.com/rust-lang/rust/issues/73448>
+ = note: the traits must be derived, manual `impl`s are not sufficient
+ = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
= note: `#[warn(nontrivial_structural_match)]` on by default
warning: to use a constant of type `NoDerive` in a pattern, the constant's initializer must be trivial or `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
@@ -16,6 +18,8 @@ LL | match None { Some(_) => panic!("whoops"), CALL => dbg!(CALL), };
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #73448 <https://github.com/rust-lang/rust/issues/73448>
+ = note: the traits must be derived, manual `impl`s are not sufficient
+ = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
warning: to use a constant of type `NoDerive` in a pattern, the constant's initializer must be trivial or `NoDerive` must be annotated with `#[derive(PartialEq, Eq)]`
--> $DIR/warn_corner_cases.rs:38:47
@@ -25,6 +29,8 @@ LL | match None { Some(_) => panic!("whoops"), METHOD_CALL => dbg!(METHOD_CA
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #73448 <https://github.com/rust-lang/rust/issues/73448>
+ = note: the traits must be derived, manual `impl`s are not sufficient
+ = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
warning: 3 warnings emitted
diff --git a/tests/ui/consts/invalid-inline-const-in-match-arm.rs b/tests/ui/consts/invalid-inline-const-in-match-arm.rs
index 4d2d8fb13..17acb2d9d 100644
--- a/tests/ui/consts/invalid-inline-const-in-match-arm.rs
+++ b/tests/ui/consts/invalid-inline-const-in-match-arm.rs
@@ -5,5 +5,6 @@ fn main() {
match () {
const { (|| {})() } => {}
//~^ ERROR cannot call non-const closure in constants
+ //~| ERROR the trait bound
}
}
diff --git a/tests/ui/consts/invalid-inline-const-in-match-arm.stderr b/tests/ui/consts/invalid-inline-const-in-match-arm.stderr
index 257ecd7f3..ac174849f 100644
--- a/tests/ui/consts/invalid-inline-const-in-match-arm.stderr
+++ b/tests/ui/consts/invalid-inline-const-in-match-arm.stderr
@@ -1,3 +1,17 @@
+error[E0277]: the trait bound `[closure@$DIR/invalid-inline-const-in-match-arm.rs:6:18: 6:20]: Fn<()>` is not satisfied
+ --> $DIR/invalid-inline-const-in-match-arm.rs:6:17
+ |
+LL | const { (|| {})() } => {}
+ | ^^^^^^^^^ expected an `Fn<()>` closure, found `[closure@$DIR/invalid-inline-const-in-match-arm.rs:6:18: 6:20]`
+ |
+ = help: the trait `~const Fn<()>` is not implemented for closure `[closure@$DIR/invalid-inline-const-in-match-arm.rs:6:18: 6:20]`
+note: the trait `Fn<()>` is implemented for `[closure@$DIR/invalid-inline-const-in-match-arm.rs:6:18: 6:20]`, but that implementation is not `const`
+ --> $DIR/invalid-inline-const-in-match-arm.rs:6:17
+ |
+LL | const { (|| {})() } => {}
+ | ^^^^^^^^^
+ = note: wrap the `[closure@$DIR/invalid-inline-const-in-match-arm.rs:6:18: 6:20]` in a closure with no arguments: `|| { /* code */ }`
+
error[E0015]: cannot call non-const closure in constants
--> $DIR/invalid-inline-const-in-match-arm.rs:6:17
|
@@ -8,6 +22,7 @@ LL | const { (|| {})() } => {}
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
-error: aborting due to previous error
+error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0015`.
+Some errors have detailed explanations: E0015, E0277.
+For more information about an error, try `rustc --explain E0015`.
diff --git a/tests/ui/consts/issue-28113.rs b/tests/ui/consts/issue-28113.rs
index f8131c9f3..e45c009d6 100644
--- a/tests/ui/consts/issue-28113.rs
+++ b/tests/ui/consts/issue-28113.rs
@@ -3,6 +3,7 @@
const X: u8 =
|| -> u8 { 5 }()
//~^ ERROR cannot call non-const closure
+ //~| ERROR the trait bound
;
fn main() {}
diff --git a/tests/ui/consts/issue-28113.stderr b/tests/ui/consts/issue-28113.stderr
index 1294cc99b..e177a3585 100644
--- a/tests/ui/consts/issue-28113.stderr
+++ b/tests/ui/consts/issue-28113.stderr
@@ -1,3 +1,17 @@
+error[E0277]: the trait bound `[closure@$DIR/issue-28113.rs:4:5: 4:13]: Fn<()>` is not satisfied
+ --> $DIR/issue-28113.rs:4:5
+ |
+LL | || -> u8 { 5 }()
+ | ^^^^^^^^^^^^^^^^ expected an `Fn<()>` closure, found `[closure@$DIR/issue-28113.rs:4:5: 4:13]`
+ |
+ = help: the trait `~const Fn<()>` is not implemented for closure `[closure@$DIR/issue-28113.rs:4:5: 4:13]`
+note: the trait `Fn<()>` is implemented for `[closure@$DIR/issue-28113.rs:4:5: 4:13]`, but that implementation is not `const`
+ --> $DIR/issue-28113.rs:4:5
+ |
+LL | || -> u8 { 5 }()
+ | ^^^^^^^^^^^^^^^^
+ = note: wrap the `[closure@$DIR/issue-28113.rs:4:5: 4:13]` in a closure with no arguments: `|| { /* code */ }`
+
error[E0015]: cannot call non-const closure in constants
--> $DIR/issue-28113.rs:4:5
|
@@ -8,6 +22,7 @@ LL | || -> u8 { 5 }()
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
-error: aborting due to previous error
+error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0015`.
+Some errors have detailed explanations: E0015, E0277.
+For more information about an error, try `rustc --explain E0015`.
diff --git a/tests/ui/consts/issue-43105.rs b/tests/ui/consts/issue-43105.rs
index cac12b909..20b78d642 100644
--- a/tests/ui/consts/issue-43105.rs
+++ b/tests/ui/consts/issue-43105.rs
@@ -7,7 +7,6 @@ fn main() {
match 1 {
NUM => unimplemented!(),
//~^ ERROR could not evaluate constant pattern
- //~| ERROR could not evaluate constant pattern
_ => unimplemented!(),
}
}
diff --git a/tests/ui/consts/issue-43105.stderr b/tests/ui/consts/issue-43105.stderr
index 2d1174af7..856a8f0da 100644
--- a/tests/ui/consts/issue-43105.stderr
+++ b/tests/ui/consts/issue-43105.stderr
@@ -12,12 +12,6 @@ error: could not evaluate constant pattern
LL | NUM => unimplemented!(),
| ^^^
-error: could not evaluate constant pattern
- --> $DIR/issue-43105.rs:8:9
- |
-LL | NUM => unimplemented!(),
- | ^^^
-
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/consts/issue-56164.rs b/tests/ui/consts/issue-56164.rs
index 22c257d0b..00875c4b5 100644
--- a/tests/ui/consts/issue-56164.rs
+++ b/tests/ui/consts/issue-56164.rs
@@ -1,5 +1,6 @@
const fn foo() { (||{})() }
//~^ ERROR cannot call non-const closure
+//~| ERROR the trait bound
const fn bad(input: fn()) {
input()
diff --git a/tests/ui/consts/issue-56164.stderr b/tests/ui/consts/issue-56164.stderr
index 845b23d5d..003f84744 100644
--- a/tests/ui/consts/issue-56164.stderr
+++ b/tests/ui/consts/issue-56164.stderr
@@ -1,3 +1,17 @@
+error[E0277]: the trait bound `[closure@$DIR/issue-56164.rs:1:19: 1:21]: Fn<()>` is not satisfied
+ --> $DIR/issue-56164.rs:1:18
+ |
+LL | const fn foo() { (||{})() }
+ | ^^^^^^^^ expected an `Fn<()>` closure, found `[closure@$DIR/issue-56164.rs:1:19: 1:21]`
+ |
+ = help: the trait `~const Fn<()>` is not implemented for closure `[closure@$DIR/issue-56164.rs:1:19: 1:21]`
+note: the trait `Fn<()>` is implemented for `[closure@$DIR/issue-56164.rs:1:19: 1:21]`, but that implementation is not `const`
+ --> $DIR/issue-56164.rs:1:18
+ |
+LL | const fn foo() { (||{})() }
+ | ^^^^^^^^
+ = note: wrap the `[closure@$DIR/issue-56164.rs:1:19: 1:21]` in a closure with no arguments: `|| { /* code */ }`
+
error[E0015]: cannot call non-const closure in constant functions
--> $DIR/issue-56164.rs:1:18
|
@@ -9,7 +23,7 @@ LL | const fn foo() { (||{})() }
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
error: function pointer calls are not allowed in constant functions
- --> $DIR/issue-56164.rs:5:5
+ --> $DIR/issue-56164.rs:6:5
|
LL | input()
| ^^^^^^^
@@ -26,6 +40,7 @@ note: erroneous constant used
LL | const fn foo() { (||{})() }
| ^^^^^^
-error: aborting due to 2 previous errors
+error: aborting due to 3 previous errors
-For more information about this error, try `rustc --explain E0015`.
+Some errors have detailed explanations: E0015, E0277.
+For more information about an error, try `rustc --explain E0015`.
diff --git a/tests/ui/consts/issue-64506.rs b/tests/ui/consts/issue-64506.rs
index db3e85a7b..9275a8a07 100644
--- a/tests/ui/consts/issue-64506.rs
+++ b/tests/ui/consts/issue-64506.rs
@@ -1,4 +1,4 @@
-// check-pass
+// check-fail
#[derive(Copy, Clone)]
pub struct ChildStdin {
@@ -14,6 +14,7 @@ const FOO: () = {
b: (),
}
let x = unsafe { Foo { b: () }.a };
+ //~^ ERROR: evaluation of constant value failed
let x = &x.inner;
};
diff --git a/tests/ui/consts/issue-64506.stderr b/tests/ui/consts/issue-64506.stderr
new file mode 100644
index 000000000..31a5b1df8
--- /dev/null
+++ b/tests/ui/consts/issue-64506.stderr
@@ -0,0 +1,9 @@
+error[E0080]: evaluation of constant value failed
+ --> $DIR/issue-64506.rs:16:22
+ |
+LL | let x = unsafe { Foo { b: () }.a };
+ | ^^^^^^^^^^^^^^^ constructing invalid value at .inner: encountered a value of uninhabited type AnonPipe
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/issue-68542-closure-in-array-len.rs b/tests/ui/consts/issue-68542-closure-in-array-len.rs
index 37958e791..a88e0cc60 100644
--- a/tests/ui/consts/issue-68542-closure-in-array-len.rs
+++ b/tests/ui/consts/issue-68542-closure-in-array-len.rs
@@ -4,6 +4,7 @@
struct Bug {
a: [(); (|| { 0 })()] //~ ERROR cannot call non-const closure
+ //~^ ERROR the trait bound
}
fn main() {}
diff --git a/tests/ui/consts/issue-68542-closure-in-array-len.stderr b/tests/ui/consts/issue-68542-closure-in-array-len.stderr
index d23513ed7..ace62f09d 100644
--- a/tests/ui/consts/issue-68542-closure-in-array-len.stderr
+++ b/tests/ui/consts/issue-68542-closure-in-array-len.stderr
@@ -1,3 +1,17 @@
+error[E0277]: the trait bound `[closure@$DIR/issue-68542-closure-in-array-len.rs:6:14: 6:16]: Fn<()>` is not satisfied
+ --> $DIR/issue-68542-closure-in-array-len.rs:6:13
+ |
+LL | a: [(); (|| { 0 })()]
+ | ^^^^^^^^^^^^ expected an `Fn<()>` closure, found `[closure@$DIR/issue-68542-closure-in-array-len.rs:6:14: 6:16]`
+ |
+ = help: the trait `~const Fn<()>` is not implemented for closure `[closure@$DIR/issue-68542-closure-in-array-len.rs:6:14: 6:16]`
+note: the trait `Fn<()>` is implemented for `[closure@$DIR/issue-68542-closure-in-array-len.rs:6:14: 6:16]`, but that implementation is not `const`
+ --> $DIR/issue-68542-closure-in-array-len.rs:6:13
+ |
+LL | a: [(); (|| { 0 })()]
+ | ^^^^^^^^^^^^
+ = note: wrap the `[closure@$DIR/issue-68542-closure-in-array-len.rs:6:14: 6:16]` in a closure with no arguments: `|| { /* code */ }`
+
error[E0015]: cannot call non-const closure in constants
--> $DIR/issue-68542-closure-in-array-len.rs:6:13
|
@@ -8,6 +22,7 @@ LL | a: [(); (|| { 0 })()]
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
= help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
-error: aborting due to previous error
+error: aborting due to 2 previous errors
-For more information about this error, try `rustc --explain E0015`.
+Some errors have detailed explanations: E0015, E0277.
+For more information about an error, try `rustc --explain E0015`.
diff --git a/tests/ui/consts/issue-73976-polymorphic.rs b/tests/ui/consts/issue-73976-polymorphic.rs
index 787462da9..2c576d1f9 100644
--- a/tests/ui/consts/issue-73976-polymorphic.rs
+++ b/tests/ui/consts/issue-73976-polymorphic.rs
@@ -19,7 +19,6 @@ impl<T: 'static> GetTypeId<T> {
const fn check_type_id<T: 'static>() -> bool {
matches!(GetTypeId::<T>::VALUE, GetTypeId::<T>::VALUE)
//~^ ERROR constant pattern depends on a generic parameter
- //~| ERROR constant pattern depends on a generic parameter
}
pub struct GetTypeNameLen<T>(T);
@@ -31,7 +30,6 @@ impl<T: 'static> GetTypeNameLen<T> {
const fn check_type_name_len<T: 'static>() -> bool {
matches!(GetTypeNameLen::<T>::VALUE, GetTypeNameLen::<T>::VALUE)
//~^ ERROR constant pattern depends on a generic parameter
- //~| ERROR constant pattern depends on a generic parameter
}
fn main() {
diff --git a/tests/ui/consts/issue-73976-polymorphic.stderr b/tests/ui/consts/issue-73976-polymorphic.stderr
index 442ad23f2..97a5fbc57 100644
--- a/tests/ui/consts/issue-73976-polymorphic.stderr
+++ b/tests/ui/consts/issue-73976-polymorphic.stderr
@@ -5,22 +5,10 @@ LL | matches!(GetTypeId::<T>::VALUE, GetTypeId::<T>::VALUE)
| ^^^^^^^^^^^^^^^^^^^^^
error: constant pattern depends on a generic parameter
- --> $DIR/issue-73976-polymorphic.rs:32:42
+ --> $DIR/issue-73976-polymorphic.rs:31:42
|
LL | matches!(GetTypeNameLen::<T>::VALUE, GetTypeNameLen::<T>::VALUE)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: constant pattern depends on a generic parameter
- --> $DIR/issue-73976-polymorphic.rs:20:37
- |
-LL | matches!(GetTypeId::<T>::VALUE, GetTypeId::<T>::VALUE)
- | ^^^^^^^^^^^^^^^^^^^^^
-
-error: constant pattern depends on a generic parameter
- --> $DIR/issue-73976-polymorphic.rs:32:42
- |
-LL | matches!(GetTypeNameLen::<T>::VALUE, GetTypeNameLen::<T>::VALUE)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 4 previous errors
+error: aborting due to 2 previous errors
diff --git a/tests/ui/consts/issue-78655.rs b/tests/ui/consts/issue-78655.rs
index 82d2d7c21..cd95ee32c 100644
--- a/tests/ui/consts/issue-78655.rs
+++ b/tests/ui/consts/issue-78655.rs
@@ -6,5 +6,4 @@ const FOO: *const u32 = {
fn main() {
let FOO = FOO;
//~^ ERROR could not evaluate constant pattern
- //~| ERROR could not evaluate constant pattern
}
diff --git a/tests/ui/consts/issue-78655.stderr b/tests/ui/consts/issue-78655.stderr
index 6b83fa0e5..5a38d023d 100644
--- a/tests/ui/consts/issue-78655.stderr
+++ b/tests/ui/consts/issue-78655.stderr
@@ -17,12 +17,6 @@ error: could not evaluate constant pattern
LL | let FOO = FOO;
| ^^^
-error: could not evaluate constant pattern
- --> $DIR/issue-78655.rs:7:9
- |
-LL | let FOO = FOO;
- | ^^^
-
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0381`.
diff --git a/tests/ui/consts/issue-79137-toogeneric.rs b/tests/ui/consts/issue-79137-toogeneric.rs
index 456035458..a80c9f48d 100644
--- a/tests/ui/consts/issue-79137-toogeneric.rs
+++ b/tests/ui/consts/issue-79137-toogeneric.rs
@@ -11,7 +11,6 @@ impl<T> GetVariantCount<T> {
const fn check_variant_count<T>() -> bool {
matches!(GetVariantCount::<T>::VALUE, GetVariantCount::<T>::VALUE)
//~^ ERROR constant pattern depends on a generic parameter
- //~| ERROR constant pattern depends on a generic parameter
}
fn main() {
diff --git a/tests/ui/consts/issue-79137-toogeneric.stderr b/tests/ui/consts/issue-79137-toogeneric.stderr
index 579e6aa09..efe4fd22e 100644
--- a/tests/ui/consts/issue-79137-toogeneric.stderr
+++ b/tests/ui/consts/issue-79137-toogeneric.stderr
@@ -4,11 +4,5 @@ error: constant pattern depends on a generic parameter
LL | matches!(GetVariantCount::<T>::VALUE, GetVariantCount::<T>::VALUE)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: constant pattern depends on a generic parameter
- --> $DIR/issue-79137-toogeneric.rs:12:43
- |
-LL | matches!(GetVariantCount::<T>::VALUE, GetVariantCount::<T>::VALUE)
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
diff --git a/tests/ui/consts/issue-miri-1910.stderr b/tests/ui/consts/issue-miri-1910.stderr
index 61865b1da..a10eea9de 100644
--- a/tests/ui/consts/issue-miri-1910.stderr
+++ b/tests/ui/consts/issue-miri-1910.stderr
@@ -1,7 +1,7 @@
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
- = note: unable to copy parts of a pointer from memory at ALLOC
+ = note: unable to turn pointer into raw bytes
|
= help: this code performed an operation that depends on the underlying bytes representing a pointer
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
diff --git a/tests/ui/consts/match_ice.stderr b/tests/ui/consts/match_ice.stderr
index 699b4a5e2..342d94ed3 100644
--- a/tests/ui/consts/match_ice.stderr
+++ b/tests/ui/consts/match_ice.stderr
@@ -3,6 +3,9 @@ error: to use a constant of type `S` in a pattern, `S` must be annotated with `#
|
LL | C => {}
| ^
+ |
+ = note: the traits must be derived, manual `impl`s are not sufficient
+ = note: see https://doc.rust-lang.org/stable/std/marker/trait.StructuralEq.html for details
error: aborting due to previous error
diff --git a/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr b/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr
index 778b0e55f..7ec2508ca 100644
--- a/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr
+++ b/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr
@@ -22,11 +22,13 @@ LL | const fn bar3() -> u32 { (5f32 + 6f32) as u32 }
|
help: if it is not part of the public API, make this function unstably const
|
-LL | #[rustc_const_unstable(feature = "...", issue = "...")]
+LL + #[rustc_const_unstable(feature = "...", issue = "...")]
+LL | const fn bar3() -> u32 { (5f32 + 6f32) as u32 }
|
help: otherwise `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks
|
-LL | #[rustc_allow_const_fn_unstable(const_fn_floating_point_arithmetic)]
+LL + #[rustc_allow_const_fn_unstable(const_fn_floating_point_arithmetic)]
+LL | const fn bar3() -> u32 { (5f32 + 6f32) as u32 }
|
error: `foo2_gated` is not yet stable as a const fn
diff --git a/tests/ui/consts/min_const_fn/min_const_fn_unsafe_bad.rs b/tests/ui/consts/min_const_fn/min_const_fn_unsafe_bad.rs
index a6e1788bb..df20ff446 100644
--- a/tests/ui/consts/min_const_fn/min_const_fn_unsafe_bad.rs
+++ b/tests/ui/consts/min_const_fn/min_const_fn_unsafe_bad.rs
@@ -7,4 +7,7 @@ const unsafe fn bad_const_unsafe_deref_raw(x: *mut usize) -> usize { *x }
const unsafe fn bad_const_unsafe_deref_raw_ref(x: *mut usize) -> &'static usize { &*x }
//~^ dereferencing raw mutable pointers in constant functions
+const unsafe fn bad_const_unsafe_deref_raw_underscore(x: *mut usize) { let _ = *x; }
+//~^ dereferencing raw mutable pointers in constant functions
+
fn main() {}
diff --git a/tests/ui/consts/min_const_fn/min_const_fn_unsafe_bad.stderr b/tests/ui/consts/min_const_fn/min_const_fn_unsafe_bad.stderr
index 820b6433f..e68376e7b 100644
--- a/tests/ui/consts/min_const_fn/min_const_fn_unsafe_bad.stderr
+++ b/tests/ui/consts/min_const_fn/min_const_fn_unsafe_bad.stderr
@@ -25,6 +25,15 @@ LL | const unsafe fn bad_const_unsafe_deref_raw_ref(x: *mut usize) -> &'static u
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
-error: aborting due to 3 previous errors
+error[E0658]: dereferencing raw mutable pointers in constant functions is unstable
+ --> $DIR/min_const_fn_unsafe_bad.rs:10:80
+ |
+LL | const unsafe fn bad_const_unsafe_deref_raw_underscore(x: *mut usize) { let _ = *x; }
+ | ^^
+ |
+ = note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
+ = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
+
+error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr b/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr
index 0174cb77f..72c1f175d 100644
--- a/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr
+++ b/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr
@@ -22,11 +22,13 @@ LL | const unsafe fn bar3() -> u32 { (5f32 + 6f32) as u32 }
|
help: if it is not part of the public API, make this function unstably const
|
-LL | #[rustc_const_unstable(feature = "...", issue = "...")]
+LL + #[rustc_const_unstable(feature = "...", issue = "...")]
+LL | const unsafe fn bar3() -> u32 { (5f32 + 6f32) as u32 }
|
help: otherwise `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks
|
-LL | #[rustc_allow_const_fn_unstable(const_fn_floating_point_arithmetic)]
+LL + #[rustc_allow_const_fn_unstable(const_fn_floating_point_arithmetic)]
+LL | const unsafe fn bar3() -> u32 { (5f32 + 6f32) as u32 }
|
error: `foo2_gated` is not yet stable as a const fn
diff --git a/tests/ui/consts/miri_unleashed/assoc_const.stderr b/tests/ui/consts/miri_unleashed/assoc_const.stderr
index e1da43c3a..8e22cb74b 100644
--- a/tests/ui/consts/miri_unleashed/assoc_const.stderr
+++ b/tests/ui/consts/miri_unleashed/assoc_const.stderr
@@ -25,12 +25,6 @@ note: erroneous constant used
LL | let y = <String as Bar<Vec<u32>, String>>::F;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: erroneous constant used
- --> $DIR/assoc_const.rs:29:13
- |
-LL | let y = <String as Bar<Vec<u32>, String>>::F;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
warning: skipping const checks
|
help: skipping check that does not even have a feature gate
diff --git a/tests/ui/consts/miri_unleashed/assoc_const_2.stderr b/tests/ui/consts/miri_unleashed/assoc_const_2.stderr
index fc4b18056..ae7b03fc9 100644
--- a/tests/ui/consts/miri_unleashed/assoc_const_2.stderr
+++ b/tests/ui/consts/miri_unleashed/assoc_const_2.stderr
@@ -16,12 +16,6 @@ note: erroneous constant used
LL | let y = <String as Bar<String>>::F;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: erroneous constant used
- --> $DIR/assoc_const_2.rs:27:13
- |
-LL | let y = <String as Bar<String>>::F;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^
-
error: aborting due to previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/miri_unleashed/box.rs b/tests/ui/consts/miri_unleashed/box.rs
index c2a260aa1..39cddda2b 100644
--- a/tests/ui/consts/miri_unleashed/box.rs
+++ b/tests/ui/consts/miri_unleashed/box.rs
@@ -1,12 +1,11 @@
// compile-flags: -Zunleash-the-miri-inside-of-you
-#![feature(box_syntax)]
use std::mem::ManuallyDrop;
fn main() {}
static TEST_BAD: &mut i32 = {
- &mut *(box 0)
+ &mut *(Box::new(0))
//~^ ERROR could not evaluate static initializer
- //~| NOTE calling non-const function `alloc::alloc::exchange_malloc`
+ //~| NOTE calling non-const function `Box::<i32>::new`
};
diff --git a/tests/ui/consts/miri_unleashed/box.stderr b/tests/ui/consts/miri_unleashed/box.stderr
index bc5d4a257..407f5d8cb 100644
--- a/tests/ui/consts/miri_unleashed/box.stderr
+++ b/tests/ui/consts/miri_unleashed/box.stderr
@@ -1,31 +1,26 @@
error[E0080]: could not evaluate static initializer
- --> $DIR/box.rs:9:11
+ --> $DIR/box.rs:8:11
|
-LL | &mut *(box 0)
- | ^^^^^^^ calling non-const function `alloc::alloc::exchange_malloc`
+LL | &mut *(Box::new(0))
+ | ^^^^^^^^^^^^^ calling non-const function `Box::<i32>::new`
warning: skipping const checks
|
help: skipping check that does not even have a feature gate
- --> $DIR/box.rs:9:11
+ --> $DIR/box.rs:8:11
|
-LL | &mut *(box 0)
- | ^^^^^^^
+LL | &mut *(Box::new(0))
+ | ^^^^^^^^^^^^^
help: skipping check for `const_mut_refs` feature
- --> $DIR/box.rs:9:16
+ --> $DIR/box.rs:8:5
|
-LL | &mut *(box 0)
- | ^
-help: skipping check for `const_mut_refs` feature
- --> $DIR/box.rs:9:5
- |
-LL | &mut *(box 0)
- | ^^^^^^^^^^^^^
+LL | &mut *(Box::new(0))
+ | ^^^^^^^^^^^^^^^^^^^
help: skipping check that does not even have a feature gate
- --> $DIR/box.rs:9:5
+ --> $DIR/box.rs:8:5
|
-LL | &mut *(box 0)
- | ^^^^^^^^^^^^^
+LL | &mut *(Box::new(0))
+ | ^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error; 1 warning emitted
diff --git a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr
index 6df2fe3d0..e3a0d93f0 100644
--- a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr
+++ b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.32bit.stderr
@@ -27,7 +27,7 @@ LL | const U8_MUT: &u8 = {
}
error: could not evaluate constant pattern
- --> $DIR/const_refers_to_static_cross_crate.rs:43:9
+ --> $DIR/const_refers_to_static_cross_crate.rs:42:9
|
LL | U8_MUT => true,
| ^^^^^^
@@ -39,7 +39,7 @@ LL | unsafe { &(*static_cross_crate::ZERO_REF)[0] }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static
error: could not evaluate constant pattern
- --> $DIR/const_refers_to_static_cross_crate.rs:54:9
+ --> $DIR/const_refers_to_static_cross_crate.rs:52:9
|
LL | U8_MUT2 => true,
| ^^^^^^^
@@ -51,31 +51,7 @@ LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None =>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static
error: could not evaluate constant pattern
- --> $DIR/const_refers_to_static_cross_crate.rs:62:9
- |
-LL | U8_MUT3 => true,
- | ^^^^^^^
-
-error: could not evaluate constant pattern
- --> $DIR/const_refers_to_static_cross_crate.rs:34:9
- |
-LL | SLICE_MUT => true,
- | ^^^^^^^^^
-
-error: could not evaluate constant pattern
- --> $DIR/const_refers_to_static_cross_crate.rs:43:9
- |
-LL | U8_MUT => true,
- | ^^^^^^
-
-error: could not evaluate constant pattern
- --> $DIR/const_refers_to_static_cross_crate.rs:54:9
- |
-LL | U8_MUT2 => true,
- | ^^^^^^^
-
-error: could not evaluate constant pattern
- --> $DIR/const_refers_to_static_cross_crate.rs:62:9
+ --> $DIR/const_refers_to_static_cross_crate.rs:59:9
|
LL | U8_MUT3 => true,
| ^^^^^^^
@@ -133,6 +109,6 @@ help: skipping check that does not even have a feature gate
LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: aborting due to 12 previous errors; 1 warning emitted
+error: aborting due to 8 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr
index 8802f3ada..a323e9a05 100644
--- a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr
+++ b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.64bit.stderr
@@ -27,7 +27,7 @@ LL | const U8_MUT: &u8 = {
}
error: could not evaluate constant pattern
- --> $DIR/const_refers_to_static_cross_crate.rs:43:9
+ --> $DIR/const_refers_to_static_cross_crate.rs:42:9
|
LL | U8_MUT => true,
| ^^^^^^
@@ -39,7 +39,7 @@ LL | unsafe { &(*static_cross_crate::ZERO_REF)[0] }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static
error: could not evaluate constant pattern
- --> $DIR/const_refers_to_static_cross_crate.rs:54:9
+ --> $DIR/const_refers_to_static_cross_crate.rs:52:9
|
LL | U8_MUT2 => true,
| ^^^^^^^
@@ -51,31 +51,7 @@ LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None =>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses static
error: could not evaluate constant pattern
- --> $DIR/const_refers_to_static_cross_crate.rs:62:9
- |
-LL | U8_MUT3 => true,
- | ^^^^^^^
-
-error: could not evaluate constant pattern
- --> $DIR/const_refers_to_static_cross_crate.rs:34:9
- |
-LL | SLICE_MUT => true,
- | ^^^^^^^^^
-
-error: could not evaluate constant pattern
- --> $DIR/const_refers_to_static_cross_crate.rs:43:9
- |
-LL | U8_MUT => true,
- | ^^^^^^
-
-error: could not evaluate constant pattern
- --> $DIR/const_refers_to_static_cross_crate.rs:54:9
- |
-LL | U8_MUT2 => true,
- | ^^^^^^^
-
-error: could not evaluate constant pattern
- --> $DIR/const_refers_to_static_cross_crate.rs:62:9
+ --> $DIR/const_refers_to_static_cross_crate.rs:59:9
|
LL | U8_MUT3 => true,
| ^^^^^^^
@@ -133,6 +109,6 @@ help: skipping check that does not even have a feature gate
LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: aborting due to 12 previous errors; 1 warning emitted
+error: aborting due to 8 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs
index bf4f14f4d..bbaa32ddf 100644
--- a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs
+++ b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs
@@ -33,7 +33,6 @@ pub fn test(x: &[u8; 1]) -> bool {
match x {
SLICE_MUT => true,
//~^ ERROR could not evaluate constant pattern
- //~| ERROR could not evaluate constant pattern
&[1..] => false,
}
}
@@ -42,7 +41,6 @@ pub fn test2(x: &u8) -> bool {
match x {
U8_MUT => true,
//~^ ERROR could not evaluate constant pattern
- //~| ERROR could not evaluate constant pattern
&(1..) => false,
}
}
@@ -53,7 +51,6 @@ pub fn test3(x: &u8) -> bool {
match x {
U8_MUT2 => true,
//~^ ERROR could not evaluate constant pattern
- //~| ERROR could not evaluate constant pattern
&(1..) => false,
}
}
@@ -61,7 +58,6 @@ pub fn test4(x: &u8) -> bool {
match x {
U8_MUT3 => true,
//~^ ERROR could not evaluate constant pattern
- //~| ERROR could not evaluate constant pattern
&(1..) => false,
}
}
diff --git a/tests/ui/consts/miri_unleashed/tls.stderr b/tests/ui/consts/miri_unleashed/tls.stderr
index 7aaeadd04..ec24527d6 100644
--- a/tests/ui/consts/miri_unleashed/tls.stderr
+++ b/tests/ui/consts/miri_unleashed/tls.stderr
@@ -2,13 +2,13 @@ error[E0080]: could not evaluate static initializer
--> $DIR/tls.rs:11:25
|
LL | unsafe { let _val = A; }
- | ^ cannot access thread local static (DefId(0:4 ~ tls[78b0]::A))
+ | ^ cannot access thread local static (DefId(0:4 ~ tls[ca29]::A))
error[E0080]: could not evaluate static initializer
--> $DIR/tls.rs:18:26
|
LL | unsafe { let _val = &A; }
- | ^ cannot access thread local static (DefId(0:4 ~ tls[78b0]::A))
+ | ^ cannot access thread local static (DefId(0:4 ~ tls[ca29]::A))
warning: skipping const checks
|
diff --git a/tests/ui/consts/offset_from_ub.stderr b/tests/ui/consts/offset_from_ub.stderr
index fff472968..6530084a5 100644
--- a/tests/ui/consts/offset_from_ub.stderr
+++ b/tests/ui/consts/offset_from_ub.stderr
@@ -39,19 +39,19 @@ error[E0080]: evaluation of constant value failed
--> $DIR/offset_from_ub.rs:53:14
|
LL | unsafe { ptr_offset_from(end_ptr, start_ptr) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc18 has size 4, so pointer to 10 bytes starting at offset 0 is out-of-bounds
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc17 has size 4, so pointer to 10 bytes starting at offset 0 is out-of-bounds
error[E0080]: evaluation of constant value failed
--> $DIR/offset_from_ub.rs:62:14
|
LL | unsafe { ptr_offset_from(start_ptr, end_ptr) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc21 has size 4, so pointer to 10 bytes starting at offset 0 is out-of-bounds
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc20 has size 4, so pointer to 10 bytes starting at offset 0 is out-of-bounds
error[E0080]: evaluation of constant value failed
--> $DIR/offset_from_ub.rs:70:14
|
LL | unsafe { ptr_offset_from(end_ptr, end_ptr) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc24 has size 4, so pointer at offset 10 is out-of-bounds
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: alloc23 has size 4, so pointer at offset 10 is out-of-bounds
error[E0080]: evaluation of constant value failed
--> $DIR/offset_from_ub.rs:79:14
diff --git a/tests/ui/consts/uninhabited-const-issue-61744.stderr b/tests/ui/consts/uninhabited-const-issue-61744.stderr
index 3a94e1931..adefbf336 100644
--- a/tests/ui/consts/uninhabited-const-issue-61744.stderr
+++ b/tests/ui/consts/uninhabited-const-issue-61744.stderr
@@ -657,12 +657,6 @@ note: erroneous constant used
LL | dbg!(i32::CONSTANT);
| ^^^^^^^^^^^^^
-note: erroneous constant used
- --> $DIR/uninhabited-const-issue-61744.rs:18:10
- |
-LL | dbg!(i32::CONSTANT);
- | ^^^^^^^^^^^^^
-
error: aborting due to previous error
For more information about this error, try `rustc --explain E0080`.