summaryrefslogtreecommitdiffstats
path: root/src/test/ui/consts
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/consts')
-rw-r--r--src/test/ui/consts/const-err-late.rs4
-rw-r--r--src/test/ui/consts/const-err-late.stderr34
-rw-r--r--src/test/ui/consts/const-err-multi.rs6
-rw-r--r--src/test/ui/consts/const-err-multi.stderr14
-rw-r--r--src/test/ui/consts/const-eval/const-eval-intrinsic-promotion.stderr2
-rw-r--r--src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr11
-rw-r--r--src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr11
-rw-r--r--src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr30
-rw-r--r--src/test/ui/consts/const-eval/const_panic_track_caller.stderr15
-rw-r--r--src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr6
-rw-r--r--src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.stderr4
-rw-r--r--src/test/ui/consts/const-eval/erroneous-const.rs2
-rw-r--r--src/test/ui/consts/const-eval/erroneous-const.stderr10
-rw-r--r--src/test/ui/consts/const-eval/erroneous-const2.rs2
-rw-r--r--src/test/ui/consts/const-eval/erroneous-const2.stderr6
-rw-r--r--src/test/ui/consts/const-eval/format.rs4
-rw-r--r--src/test/ui/consts/const-eval/format.stderr63
-rw-r--r--src/test/ui/consts/const-eval/heap/alloc_intrinsic_errors.stderr17
-rw-r--r--src/test/ui/consts/const-eval/issue-104390.rs10
-rw-r--r--src/test/ui/consts/const-eval/issue-104390.stderr65
-rw-r--r--src/test/ui/consts/const-eval/issue-44578.rs3
-rw-r--r--src/test/ui/consts/const-eval/issue-44578.stderr28
-rw-r--r--src/test/ui/consts/const-eval/issue-50814-2.rs2
-rw-r--r--src/test/ui/consts/const-eval/issue-50814-2.stderr6
-rw-r--r--src/test/ui/consts/const-eval/issue-50814.rs8
-rw-r--r--src/test/ui/consts/const-eval/issue-50814.stderr8
-rw-r--r--src/test/ui/consts/const-eval/panic-assoc-never-type.rs3
-rw-r--r--src/test/ui/consts/const-eval/panic-assoc-never-type.stderr12
-rw-r--r--src/test/ui/consts/const-eval/promoted_const_fn_fail.stderr2
-rw-r--r--src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.stderr2
-rw-r--r--src/test/ui/consts/const-eval/promoted_raw_ptr_ops.stderr8
-rw-r--r--src/test/ui/consts/const-eval/transmute-const-promotion.stderr2
-rw-r--r--src/test/ui/consts/const-eval/ub-nonnull.32bit.stderr13
-rw-r--r--src/test/ui/consts/const-eval/ub-nonnull.64bit.stderr13
-rw-r--r--src/test/ui/consts/const-eval/ub-nonnull.rs9
-rw-r--r--src/test/ui/consts/const-eval/ub-ref-ptr.32bit.stderr28
-rw-r--r--src/test/ui/consts/const-eval/ub-ref-ptr.64bit.stderr28
-rw-r--r--src/test/ui/consts/const-eval/ub-ref-ptr.rs2
-rw-r--r--src/test/ui/consts/const-eval/ub-wide-ptr.32bit.stderr14
-rw-r--r--src/test/ui/consts/const-eval/ub-wide-ptr.64bit.stderr14
-rw-r--r--src/test/ui/consts/const-eval/ub-wide-ptr.rs6
-rw-r--r--src/test/ui/consts/const-eval/union-const-eval-field.rs1
-rw-r--r--src/test/ui/consts/const-eval/union-const-eval-field.stderr12
-rw-r--r--src/test/ui/consts/const-eval/union_promotion.stderr2
-rw-r--r--src/test/ui/consts/const-eval/unwind-abort.stderr16
-rw-r--r--src/test/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr20
-rw-r--r--src/test/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr20
-rw-r--r--src/test/ui/consts/const-float-bits-reject-conv.rs30
-rw-r--r--src/test/ui/consts/const-float-bits-reject-conv.stderr146
-rw-r--r--src/test/ui/consts/const-int-conversion.stderr14
-rw-r--r--src/test/ui/consts/const-int-overflowing.stderr6
-rw-r--r--src/test/ui/consts/const-int-rotate.stderr4
-rw-r--r--src/test/ui/consts/const-int-sign.stderr4
-rw-r--r--src/test/ui/consts/const-int-wrapping.stderr10
-rw-r--r--src/test/ui/consts/const-integer-bool-ops.rs20
-rw-r--r--src/test/ui/consts/const-integer-bool-ops.stderr45
-rw-r--r--src/test/ui/consts/const-len-underflow-separate-spans.rs2
-rw-r--r--src/test/ui/consts/const-len-underflow-separate-spans.stderr6
-rw-r--r--src/test/ui/consts/const-mut-refs/issue-76510.32bit.stderr10
-rw-r--r--src/test/ui/consts/const-mut-refs/issue-76510.64bit.stderr10
-rw-r--r--src/test/ui/consts/const-mut-refs/issue-76510.rs2
-rw-r--r--src/test/ui/consts/const-mut-refs/mut_ref_in_final.stderr10
-rw-r--r--src/test/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr15
-rw-r--r--src/test/ui/consts/const-ptr-nonnull.stderr4
-rw-r--r--src/test/ui/consts/const-ptr-unique.stderr2
-rw-r--r--src/test/ui/consts/const-tup-index-span.rs2
-rw-r--r--src/test/ui/consts/const-tup-index-span.stderr9
-rw-r--r--src/test/ui/consts/const_in_pattern/accept_structural.rs2
-rw-r--r--src/test/ui/consts/const_in_pattern/reject_non_structural.rs2
-rw-r--r--src/test/ui/consts/const_unsafe_unreachable_ub.stderr21
-rw-r--r--src/test/ui/consts/control-flow/interior-mutability.stderr6
-rw-r--r--src/test/ui/consts/extra-const-ub/detect-extra-ub.rs2
-rw-r--r--src/test/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr27
-rw-r--r--src/test/ui/consts/fn_trait_refs.rs77
-rw-r--r--src/test/ui/consts/invalid-const-in-body.rs6
-rw-r--r--src/test/ui/consts/invalid-const-in-body.stderr8
-rw-r--r--src/test/ui/consts/invalid-inline-const-in-match-arm.rs9
-rw-r--r--src/test/ui/consts/invalid-inline-const-in-match-arm.stderr12
-rw-r--r--src/test/ui/consts/invalid-union.32bit.stderr20
-rw-r--r--src/test/ui/consts/invalid-union.64bit.stderr20
-rw-r--r--src/test/ui/consts/invalid-union.rs3
-rw-r--r--src/test/ui/consts/issue-102117.rs4
-rw-r--r--src/test/ui/consts/issue-102117.stderr24
-rw-r--r--src/test/ui/consts/issue-103790.rs10
-rw-r--r--src/test/ui/consts/issue-103790.stderr65
-rw-r--r--src/test/ui/consts/issue-104609.rs10
-rw-r--r--src/test/ui/consts/issue-104609.stderr9
-rw-r--r--src/test/ui/consts/issue-104768.rs4
-rw-r--r--src/test/ui/consts/issue-104768.stderr12
-rw-r--r--src/test/ui/consts/issue-36163.stderr4
-rw-r--r--src/test/ui/consts/issue-54224.stderr4
-rw-r--r--src/test/ui/consts/issue-54954.rs19
-rw-r--r--src/test/ui/consts/issue-54954.stderr34
-rw-r--r--src/test/ui/consts/issue-56164.rs1
-rw-r--r--src/test/ui/consts/issue-56164.stderr17
-rw-r--r--src/test/ui/consts/issue-66693.rs1
-rw-r--r--src/test/ui/consts/issue-66693.stderr13
-rw-r--r--src/test/ui/consts/issue-miri-1910.stderr26
-rw-r--r--src/test/ui/consts/min_const_fn/promotion.stderr12
-rw-r--r--src/test/ui/consts/miri_unleashed/abi-mismatch.stderr15
-rw-r--r--src/test/ui/consts/miri_unleashed/assoc_const.rs2
-rw-r--r--src/test/ui/consts/miri_unleashed/assoc_const.stderr37
-rw-r--r--src/test/ui/consts/miri_unleashed/assoc_const_2.rs2
-rw-r--r--src/test/ui/consts/miri_unleashed/assoc_const_2.stderr18
-rw-r--r--src/test/ui/consts/miri_unleashed/drop.stderr15
-rw-r--r--src/test/ui/consts/miri_unleashed/tls.stderr4
-rw-r--r--src/test/ui/consts/missing_span_in_backtrace.rs27
-rw-r--r--src/test/ui/consts/missing_span_in_backtrace.stderr28
-rw-r--r--src/test/ui/consts/offset_from_ub.stderr45
-rw-r--r--src/test/ui/consts/offset_ub.stderr180
-rw-r--r--src/test/ui/consts/promote-not.stderr40
-rw-r--r--src/test/ui/consts/promote_const_let.stderr2
-rw-r--r--src/test/ui/consts/promoted-const-drop.stderr4
-rw-r--r--src/test/ui/consts/ptr_comparisons.stderr15
-rw-r--r--src/test/ui/consts/qualif-union.stderr10
-rw-r--r--src/test/ui/consts/recursive.stderr21
-rw-r--r--src/test/ui/consts/uninhabited-const-issue-61744.rs2
-rw-r--r--src/test/ui/consts/uninhabited-const-issue-61744.stderr793
118 files changed, 1942 insertions, 751 deletions
diff --git a/src/test/ui/consts/const-err-late.rs b/src/test/ui/consts/const-err-late.rs
index a20ae7025..d2476e493 100644
--- a/src/test/ui/consts/const-err-late.rs
+++ b/src/test/ui/consts/const-err-late.rs
@@ -16,7 +16,5 @@ impl<T> S<T> {
}
fn main() {
- black_box((S::<i32>::FOO, S::<u32>::FOO));
- //~^ ERROR erroneous constant
- //~| ERROR erroneous constant
+ black_box((S::<i32>::FOO, S::<u32>::FOO)); //~ constant
}
diff --git a/src/test/ui/consts/const-err-late.stderr b/src/test/ui/consts/const-err-late.stderr
index 3a8b10317..c5c668189 100644
--- a/src/test/ui/consts/const-err-late.stderr
+++ b/src/test/ui/consts/const-err-late.stderr
@@ -4,11 +4,17 @@ error[E0080]: evaluation of `S::<i32>::FOO` failed
LL | const FOO: u8 = [5u8][1];
| ^^^^^^^^ index out of bounds: the length is 1 but the index is 1
-error[E0080]: erroneous constant used
+note: erroneous constant used
--> $DIR/const-err-late.rs:19:16
|
LL | black_box((S::<i32>::FOO, S::<u32>::FOO));
- | ^^^^^^^^^^^^^ referenced constant has errors
+ | ^^^^^^^^^^^^^
+
+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
@@ -16,12 +22,30 @@ error[E0080]: evaluation of `S::<u32>::FOO` failed
LL | const FOO: u8 = [5u8][1];
| ^^^^^^^^ index out of bounds: the length is 1 but the index is 1
-error[E0080]: erroneous constant used
+note: erroneous constant used
+ --> $DIR/const-err-late.rs:19:31
+ |
+LL | black_box((S::<i32>::FOO, S::<u32>::FOO));
+ | ^^^^^^^^^^^^^
+
+note: erroneous constant used
+ --> $DIR/const-err-late.rs:19:31
+ |
+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));
+ | ^^^^^^^^^^^^^
+
+note: erroneous constant used
--> $DIR/const-err-late.rs:19:31
|
LL | black_box((S::<i32>::FOO, S::<u32>::FOO));
- | ^^^^^^^^^^^^^ referenced constant has errors
+ | ^^^^^^^^^^^^^
-error: aborting due to 4 previous errors
+error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/const-err-multi.rs b/src/test/ui/consts/const-err-multi.rs
index fb26e8aac..b265bc4c4 100644
--- a/src/test/ui/consts/const-err-multi.rs
+++ b/src/test/ui/consts/const-err-multi.rs
@@ -1,11 +1,11 @@
pub const A: i8 = -i8::MIN;
//~^ ERROR constant
pub const B: i8 = A;
-//~^ ERROR constant
+//~^ constant
pub const C: u8 = A as u8;
-//~^ ERROR constant
+//~^ constant
pub const D: i8 = 50 - A;
-//~^ ERROR constant
+//~^ constant
fn main() {
let _ = (A, B, C, D);
diff --git a/src/test/ui/consts/const-err-multi.stderr b/src/test/ui/consts/const-err-multi.stderr
index fca9e2270..28af8e5eb 100644
--- a/src/test/ui/consts/const-err-multi.stderr
+++ b/src/test/ui/consts/const-err-multi.stderr
@@ -4,24 +4,24 @@ error[E0080]: evaluation of constant value failed
LL | pub const A: i8 = -i8::MIN;
| ^^^^^^^^ attempt to negate `i8::MIN`, which would overflow
-error[E0080]: evaluation of constant value failed
+note: erroneous constant used
--> $DIR/const-err-multi.rs:3:19
|
LL | pub const B: i8 = A;
- | ^ referenced constant has errors
+ | ^
-error[E0080]: evaluation of constant value failed
+note: erroneous constant used
--> $DIR/const-err-multi.rs:5:19
|
LL | pub const C: u8 = A as u8;
- | ^ referenced constant has errors
+ | ^
-error[E0080]: evaluation of constant value failed
+note: erroneous constant used
--> $DIR/const-err-multi.rs:7:24
|
LL | pub const D: i8 = 50 - A;
- | ^ referenced constant has errors
+ | ^
-error: aborting due to 4 previous errors
+error: aborting due to previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/const-eval/const-eval-intrinsic-promotion.stderr b/src/test/ui/consts/const-eval/const-eval-intrinsic-promotion.stderr
index 78143042e..ed6a6ee6e 100644
--- a/src/test/ui/consts/const-eval/const-eval-intrinsic-promotion.stderr
+++ b/src/test/ui/consts/const-eval/const-eval-intrinsic-promotion.stderr
@@ -4,7 +4,7 @@ error[E0716]: temporary value dropped while borrowed
LL | let x: &'static usize =
| -------------- type annotation requires that borrow lasts for `'static`
LL | &std::intrinsics::size_of::<i32>();
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
LL | }
| - temporary value is freed at the end of this statement
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr b/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr
index c685922c4..f19917001 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr
+++ b/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr
@@ -12,15 +12,10 @@ LL | = [0; (i8::MAX + 1u8) as usize];
|
= help: the trait `~const Add<u8>` is not implemented for `i8`
= help: the following other types implement trait `Add<Rhs>`:
- <&'a f32 as Add<f32>>
- <&'a f64 as Add<f64>>
- <&'a i128 as Add<i128>>
- <&'a i16 as Add<i16>>
- <&'a i32 as Add<i32>>
- <&'a i64 as Add<i64>>
<&'a i8 as Add<i8>>
- <&'a isize as Add<isize>>
- and 48 others
+ <&i8 as Add<&i8>>
+ <i8 as Add<&i8>>
+ <i8 as Add>
error: aborting due to 2 previous errors
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr b/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr
index b39607924..1f8e40231 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr
+++ b/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr
@@ -12,15 +12,10 @@ LL | : [u32; (i8::MAX as i8 + 1u8) as usize]
|
= help: the trait `~const Add<u8>` is not implemented for `i8`
= help: the following other types implement trait `Add<Rhs>`:
- <&'a f32 as Add<f32>>
- <&'a f64 as Add<f64>>
- <&'a i128 as Add<i128>>
- <&'a i16 as Add<i16>>
- <&'a i32 as Add<i32>>
- <&'a i64 as Add<i64>>
<&'a i8 as Add<i8>>
- <&'a isize as Add<isize>>
- and 48 others
+ <&i8 as Add<&i8>>
+ <i8 as Add<&i8>>
+ <i8 as Add>
error[E0604]: only `u8` can be cast as `char`, not `i8`
--> $DIR/const-eval-overflow-4b.rs:22:13
diff --git a/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr b/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr
index 3784a3861..0734f479f 100644
--- a/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr
+++ b/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr
@@ -2,25 +2,35 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const_fn_ptr_fail2.rs:9:5
|
LL | x(y)
+ | ^^^^ calling non-const function `double`
+ |
+note: inside `bar`
+ --> $DIR/const_fn_ptr_fail2.rs:9:5
+ |
+LL | x(y)
| ^^^^
- | |
- | calling non-const function `double`
- | inside `bar` at $DIR/const_fn_ptr_fail2.rs:9:5
-...
+note: inside `Y`
+ --> $DIR/const_fn_ptr_fail2.rs:14:18
+ |
LL | const Y: usize = bar(X, 2); // FIXME: should fail to typeck someday
- | --------- inside `Y` at $DIR/const_fn_ptr_fail2.rs:14:18
+ | ^^^^^^^^^
error[E0080]: evaluation of constant value failed
--> $DIR/const_fn_ptr_fail2.rs:9:5
|
LL | x(y)
+ | ^^^^ calling non-const function `double`
+ |
+note: inside `bar`
+ --> $DIR/const_fn_ptr_fail2.rs:9:5
+ |
+LL | x(y)
| ^^^^
- | |
- | calling non-const function `double`
- | inside `bar` at $DIR/const_fn_ptr_fail2.rs:9:5
-...
+note: inside `Z`
+ --> $DIR/const_fn_ptr_fail2.rs:15:18
+ |
LL | const Z: usize = bar(double, 2); // FIXME: should fail to typeck someday
- | -------------- inside `Z` at $DIR/const_fn_ptr_fail2.rs:15:18
+ | ^^^^^^^^^^^^^^
warning: skipping const checks
|
diff --git a/src/test/ui/consts/const-eval/const_panic_track_caller.stderr b/src/test/ui/consts/const-eval/const_panic_track_caller.stderr
index 5c3b412d3..846458176 100644
--- a/src/test/ui/consts/const-eval/const_panic_track_caller.stderr
+++ b/src/test/ui/consts/const-eval/const_panic_track_caller.stderr
@@ -2,13 +2,18 @@ error[E0080]: evaluation of constant value failed
--> $DIR/const_panic_track_caller.rs:15:5
|
LL | b()
+ | ^^^ the evaluated program panicked at 'hey', $DIR/const_panic_track_caller.rs:15:5
+ |
+note: inside `c`
+ --> $DIR/const_panic_track_caller.rs:15:5
+ |
+LL | b()
| ^^^
- | |
- | the evaluated program panicked at 'hey', $DIR/const_panic_track_caller.rs:15:5
- | inside `c` at $DIR/const_panic_track_caller.rs:15:5
-...
+note: inside `X`
+ --> $DIR/const_panic_track_caller.rs:21:16
+ |
LL | const X: u32 = c();
- | --- inside `X` at $DIR/const_panic_track_caller.rs:21:16
+ | ^^^
error: aborting due to previous error
diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr
index 69e3ca716..2e697b219 100644
--- a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr
+++ b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr
@@ -10,7 +10,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/dont_promote_unstable_const_fn.rs:17:28
|
LL | let _: &'static u32 = &foo();
- | ------------ ^^^^^ creates a temporary which is freed while still in use
+ | ------------ ^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
LL | }
@@ -20,7 +20,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/dont_promote_unstable_const_fn.rs:21:28
|
LL | let _: &'static u32 = &meh();
- | ------------ ^^^^^ creates a temporary which is freed while still in use
+ | ------------ ^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -31,7 +31,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/dont_promote_unstable_const_fn.rs:22:26
|
LL | let x: &'static _ = &std::time::Duration::from_millis(42).subsec_millis();
- | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
LL |
diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.stderr b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.stderr
index 129f06151..aa742d784 100644
--- a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.stderr
+++ b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.stderr
@@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:8:28
|
LL | let _: &'static u32 = &foo();
- | ------------ ^^^^^ creates a temporary which is freed while still in use
+ | ------------ ^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
LL | let _x: &'static u32 = &foo();
@@ -13,7 +13,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/dont_promote_unstable_const_fn_cross_crate.rs:9:29
|
LL | let _x: &'static u32 = &foo();
- | ------------ ^^^^^ creates a temporary which is freed while still in use
+ | ------------ ^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
LL | }
diff --git a/src/test/ui/consts/const-eval/erroneous-const.rs b/src/test/ui/consts/const-eval/erroneous-const.rs
index cf11531ba..e0fd057a2 100644
--- a/src/test/ui/consts/const-eval/erroneous-const.rs
+++ b/src/test/ui/consts/const-eval/erroneous-const.rs
@@ -10,7 +10,7 @@ const fn no_codegen<T>() {
if false {
// This bad constant is only used in dead code in a no-codegen function... and yet we still
// must make sure that the build fails.
- let _ = PrintName::<T>::VOID; //~ERROR could not evaluate static initializer
+ let _ = PrintName::<T>::VOID; //~ constant
}
}
diff --git a/src/test/ui/consts/const-eval/erroneous-const.stderr b/src/test/ui/consts/const-eval/erroneous-const.stderr
index 33579135d..03030392a 100644
--- a/src/test/ui/consts/const-eval/erroneous-const.stderr
+++ b/src/test/ui/consts/const-eval/erroneous-const.stderr
@@ -4,18 +4,12 @@ error[E0080]: evaluation of `PrintName::<i32>::VOID` failed
LL | const VOID: () = [()][2];
| ^^^^^^^ index out of bounds: the length is 1 but the index is 2
-error[E0080]: could not evaluate static initializer
+note: erroneous constant used
--> $DIR/erroneous-const.rs:13:17
|
LL | let _ = PrintName::<T>::VOID;
| ^^^^^^^^^^^^^^^^^^^^
- | |
- | referenced constant has errors
- | inside `no_codegen::<i32>` at $DIR/erroneous-const.rs:13:17
-...
-LL | pub static FOO: () = no_codegen::<i32>();
- | ------------------- inside `FOO` at $DIR/erroneous-const.rs:17:22
-error: aborting due to 2 previous errors
+error: aborting due to previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/const-eval/erroneous-const2.rs b/src/test/ui/consts/const-eval/erroneous-const2.rs
index 2fbf7be88..15c0f9107 100644
--- a/src/test/ui/consts/const-eval/erroneous-const2.rs
+++ b/src/test/ui/consts/const-eval/erroneous-const2.rs
@@ -10,7 +10,7 @@ pub static FOO: () = {
if false {
// This bad constant is only used in dead code in a static initializer... and yet we still
// must make sure that the build fails.
- let _ = PrintName::<i32>::VOID; //~ERROR could not evaluate static initializer
+ let _ = PrintName::<i32>::VOID; //~ constant
}
};
diff --git a/src/test/ui/consts/const-eval/erroneous-const2.stderr b/src/test/ui/consts/const-eval/erroneous-const2.stderr
index 630b1cf16..8626f4d78 100644
--- a/src/test/ui/consts/const-eval/erroneous-const2.stderr
+++ b/src/test/ui/consts/const-eval/erroneous-const2.stderr
@@ -4,12 +4,12 @@ error[E0080]: evaluation of `PrintName::<i32>::VOID` failed
LL | const VOID: () = [()][2];
| ^^^^^^^ index out of bounds: the length is 1 but the index is 2
-error[E0080]: could not evaluate static initializer
+note: erroneous constant used
--> $DIR/erroneous-const2.rs:13:17
|
LL | let _ = PrintName::<i32>::VOID;
- | ^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
+ | ^^^^^^^^^^^^^^^^^^^^^^
-error: aborting due to 2 previous errors
+error: aborting due to previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/const-eval/format.rs b/src/test/ui/consts/const-eval/format.rs
index 3eef0d6c3..0d8b7c12d 100644
--- a/src/test/ui/consts/const-eval/format.rs
+++ b/src/test/ui/consts/const-eval/format.rs
@@ -1,8 +1,6 @@
const fn failure() {
panic!("{:?}", 0);
//~^ ERROR cannot call non-const formatting macro in constant functions
- //~| ERROR erroneous constant used
- //~| ERROR erroneous constant used
}
const fn print() {
@@ -10,8 +8,6 @@ const fn print() {
//~^ 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 `_print` in constant functions
- //~| ERROR erroneous constant used
- //~| ERROR erroneous constant used
}
fn main() {}
diff --git a/src/test/ui/consts/const-eval/format.stderr b/src/test/ui/consts/const-eval/format.stderr
index 64c769648..4bf39db58 100644
--- a/src/test/ui/consts/const-eval/format.stderr
+++ b/src/test/ui/consts/const-eval/format.stderr
@@ -8,7 +8,7 @@ LL | panic!("{:?}", 0);
= 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:9:22
+ --> $DIR/format.rs:7:22
|
LL | println!("{:?}", 0);
| ^
@@ -17,7 +17,7 @@ LL | println!("{:?}", 0);
= 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:9:5
+ --> $DIR/format.rs:7:5
|
LL | println!("{:?}", 0);
| ^^^^^^^^^^^^^^^^^^^
@@ -26,7 +26,7 @@ LL | println!("{:?}", 0);
= 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:9:5
+ --> $DIR/format.rs:7:5
|
LL | println!("{:?}", 0);
| ^^^^^^^^^^^^^^^^^^^
@@ -34,35 +34,62 @@ 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 `println` (in Nightly builds, run with -Z macro-backtrace for more info)
-error[E0080]: erroneous constant used
+note: erroneous constant used
--> $DIR/format.rs:2:12
|
LL | panic!("{:?}", 0);
- | ^^^^^^ referenced constant has errors
+ | ^^^^^^
-error[E0080]: erroneous constant used
+note: erroneous constant used
+ --> $DIR/format.rs:2:12
+ |
+LL | panic!("{:?}", 0);
+ | ^^^^^^
+
+note: erroneous constant used
--> $DIR/format.rs:2:20
|
LL | panic!("{:?}", 0);
- | ^ referenced constant has errors
+ | ^
|
- = 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)
+ = 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:2:20
+ |
+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)
-error[E0080]: erroneous constant used
- --> $DIR/format.rs:9:14
+note: erroneous constant used
+ --> $DIR/format.rs:7:14
|
LL | println!("{:?}", 0);
- | ^^^^^^ referenced constant has errors
+ | ^^^^^^
-error[E0080]: erroneous constant used
- --> $DIR/format.rs:9:22
+note: erroneous constant used
+ --> $DIR/format.rs:7:14
|
LL | println!("{:?}", 0);
- | ^ referenced constant has errors
+ | ^^^^^^
+
+note: erroneous constant used
+ --> $DIR/format.rs:7:22
|
- = 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)
+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
+ |
+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 8 previous errors
+error: aborting due to 4 previous errors
-Some errors have detailed explanations: E0015, E0080.
-For more information about an error, try `rustc --explain E0015`.
+For more information about this error, try `rustc --explain E0015`.
diff --git a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_errors.stderr b/src/test/ui/consts/const-eval/heap/alloc_intrinsic_errors.stderr
index 2628a7845..8f3b3d5f7 100644
--- a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_errors.stderr
+++ b/src/test/ui/consts/const-eval/heap/alloc_intrinsic_errors.stderr
@@ -1,14 +1,19 @@
error[E0080]: evaluation of constant value failed
--> $DIR/alloc_intrinsic_errors.rs:9:17
|
-LL | const FOO: i32 = foo();
- | ----- inside `FOO` at $DIR/alloc_intrinsic_errors.rs:6:18
-...
+LL | let _ = intrinsics::const_allocate(4, 3) as *mut i32;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ align has to be a power of 2, `3` is not a power of 2
+ |
+note: inside `foo`
+ --> $DIR/alloc_intrinsic_errors.rs:9:17
+ |
LL | let _ = intrinsics::const_allocate(4, 3) as *mut i32;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | align has to be a power of 2, `3` is not a power of 2
- | inside `foo` at $DIR/alloc_intrinsic_errors.rs:9:17
+note: inside `FOO`
+ --> $DIR/alloc_intrinsic_errors.rs:6:18
+ |
+LL | const FOO: i32 = foo();
+ | ^^^^^
error: aborting due to previous error
diff --git a/src/test/ui/consts/const-eval/issue-104390.rs b/src/test/ui/consts/const-eval/issue-104390.rs
new file mode 100644
index 000000000..602d81824
--- /dev/null
+++ b/src/test/ui/consts/const-eval/issue-104390.rs
@@ -0,0 +1,10 @@
+fn f1() -> impl Sized { & 2E } //~ ERROR expected at least one digit in exponent
+fn f2() -> impl Sized { && 2E } //~ ERROR expected at least one digit in exponent
+fn f3() -> impl Sized { &'a 2E } //~ ERROR expected at least one digit in exponent
+//~^ ERROR borrow expressions cannot be annotated with lifetimes
+fn f4() -> impl Sized { &'static 2E } //~ ERROR expected at least one digit in exponent
+//~^ ERROR borrow expressions cannot be annotated with lifetimes
+fn f5() -> impl Sized { *& 2E } //~ ERROR expected at least one digit in exponent
+fn f6() -> impl Sized { &'_ 2E } //~ ERROR expected at least one digit in exponent
+//~^ ERROR borrow expressions cannot be annotated with lifetimes
+fn main() {}
diff --git a/src/test/ui/consts/const-eval/issue-104390.stderr b/src/test/ui/consts/const-eval/issue-104390.stderr
new file mode 100644
index 000000000..865b9996e
--- /dev/null
+++ b/src/test/ui/consts/const-eval/issue-104390.stderr
@@ -0,0 +1,65 @@
+error: expected at least one digit in exponent
+ --> $DIR/issue-104390.rs:1:27
+ |
+LL | fn f1() -> impl Sized { & 2E }
+ | ^^
+
+error: expected at least one digit in exponent
+ --> $DIR/issue-104390.rs:2:28
+ |
+LL | fn f2() -> impl Sized { && 2E }
+ | ^^
+
+error: expected at least one digit in exponent
+ --> $DIR/issue-104390.rs:3:29
+ |
+LL | fn f3() -> impl Sized { &'a 2E }
+ | ^^
+
+error: expected at least one digit in exponent
+ --> $DIR/issue-104390.rs:5:34
+ |
+LL | fn f4() -> impl Sized { &'static 2E }
+ | ^^
+
+error: expected at least one digit in exponent
+ --> $DIR/issue-104390.rs:7:28
+ |
+LL | fn f5() -> impl Sized { *& 2E }
+ | ^^
+
+error: expected at least one digit in exponent
+ --> $DIR/issue-104390.rs:8:29
+ |
+LL | fn f6() -> impl Sized { &'_ 2E }
+ | ^^
+
+error: borrow expressions cannot be annotated with lifetimes
+ --> $DIR/issue-104390.rs:3:25
+ |
+LL | fn f3() -> impl Sized { &'a 2E }
+ | ^--^^^
+ | |
+ | annotated with lifetime here
+ | help: remove the lifetime annotation
+
+error: borrow expressions cannot be annotated with lifetimes
+ --> $DIR/issue-104390.rs:5:25
+ |
+LL | fn f4() -> impl Sized { &'static 2E }
+ | ^-------^^^
+ | |
+ | annotated with lifetime here
+ | help: remove the lifetime annotation
+
+error: borrow expressions cannot be annotated with lifetimes
+ --> $DIR/issue-104390.rs:8:25
+ |
+LL | fn f6() -> impl Sized { &'_ 2E }
+ | ^--^^^
+ | |
+ | annotated with lifetime here
+ | help: remove the lifetime annotation
+
+error: aborting due to 9 previous errors
+
diff --git a/src/test/ui/consts/const-eval/issue-44578.rs b/src/test/ui/consts/const-eval/issue-44578.rs
index 2dbe1c2bd..e4dcc6230 100644
--- a/src/test/ui/consts/const-eval/issue-44578.rs
+++ b/src/test/ui/consts/const-eval/issue-44578.rs
@@ -23,6 +23,5 @@ impl Foo for u16 {
fn main() {
println!("{}", <Bar<u16, u8> as Foo>::AMT);
- //~^ ERROR evaluation of constant value failed
- //~| ERROR erroneous constant used
+ //~^ constant
}
diff --git a/src/test/ui/consts/const-eval/issue-44578.stderr b/src/test/ui/consts/const-eval/issue-44578.stderr
index 963381b58..0cbf54480 100644
--- a/src/test/ui/consts/const-eval/issue-44578.stderr
+++ b/src/test/ui/consts/const-eval/issue-44578.stderr
@@ -4,20 +4,36 @@ error[E0080]: evaluation of `<Bar<u16, u8> as Foo>::AMT` failed
LL | const AMT: usize = [A::AMT][(A::AMT > B::AMT) as usize];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ index out of bounds: the length is 1 but the index is 1
-error[E0080]: evaluation of constant value failed
+note: erroneous constant used
--> $DIR/issue-44578.rs:25:20
|
LL | println!("{}", <Bar<u16, u8> as Foo>::AMT);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
-error[E0080]: erroneous constant used
+note: erroneous constant used
--> $DIR/issue-44578.rs:25:20
|
LL | println!("{}", <Bar<u16, u8> as Foo>::AMT);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
- = 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)
+ = 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 3 previous errors
+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)
+
+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/src/test/ui/consts/const-eval/issue-50814-2.rs b/src/test/ui/consts/const-eval/issue-50814-2.rs
index 49d1d8ff0..53eb7b149 100644
--- a/src/test/ui/consts/const-eval/issue-50814-2.rs
+++ b/src/test/ui/consts/const-eval/issue-50814-2.rs
@@ -15,7 +15,7 @@ impl<T: C> Foo<T> for A<T> {
}
fn foo<T: C>() -> &'static usize {
- &<A<T> as Foo<T>>::BAR //~ ERROR E0080
+ &<A<T> as Foo<T>>::BAR //~ constant
}
impl C for () {
diff --git a/src/test/ui/consts/const-eval/issue-50814-2.stderr b/src/test/ui/consts/const-eval/issue-50814-2.stderr
index 6604f2b9f..956f7aec9 100644
--- a/src/test/ui/consts/const-eval/issue-50814-2.stderr
+++ b/src/test/ui/consts/const-eval/issue-50814-2.stderr
@@ -4,11 +4,11 @@ error[E0080]: evaluation of `<A<()> as Foo<()>>::BAR` failed
LL | const BAR: usize = [5, 6, 7][T::BOO];
| ^^^^^^^^^^^^^^^^^ index out of bounds: the length is 3 but the index is 42
-error[E0080]: evaluation of `foo::<()>` failed
+note: erroneous constant used
--> $DIR/issue-50814-2.rs:18:6
|
LL | &<A<T> as Foo<T>>::BAR
- | ^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
+ | ^^^^^^^^^^^^^^^^^^^^^
note: the above error was encountered while instantiating `fn foo::<()>`
--> $DIR/issue-50814-2.rs:30:22
@@ -16,6 +16,6 @@ note: the above error was encountered while instantiating `fn foo::<()>`
LL | println!("{:x}", foo::<()>() as *const usize as usize);
| ^^^^^^^^^^^
-error: aborting due to 2 previous errors
+error: aborting due to previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/const-eval/issue-50814.rs b/src/test/ui/consts/const-eval/issue-50814.rs
index 5a587701f..374ed1d93 100644
--- a/src/test/ui/consts/const-eval/issue-50814.rs
+++ b/src/test/ui/consts/const-eval/issue-50814.rs
@@ -9,16 +9,16 @@ impl Unsigned for U8 {
const MAX: u8 = 0xff;
}
-struct Sum<A,B>(A,B);
+struct Sum<A, B>(A, B);
-impl<A: Unsigned, B: Unsigned> Unsigned for Sum<A,B> {
+impl<A: Unsigned, B: Unsigned> Unsigned for Sum<A, B> {
const MAX: u8 = A::MAX + B::MAX;
//~^ ERROR evaluation of `<Sum<U8, U8> as Unsigned>::MAX` failed
}
fn foo<T>(_: T) -> &'static u8 {
- &Sum::<U8,U8>::MAX
- //~^ ERROR E0080
+ &Sum::<U8, U8>::MAX
+ //~^ constant
}
fn main() {
diff --git a/src/test/ui/consts/const-eval/issue-50814.stderr b/src/test/ui/consts/const-eval/issue-50814.stderr
index 46dd2b89f..05b6271f4 100644
--- a/src/test/ui/consts/const-eval/issue-50814.stderr
+++ b/src/test/ui/consts/const-eval/issue-50814.stderr
@@ -4,11 +4,11 @@ error[E0080]: evaluation of `<Sum<U8, U8> as Unsigned>::MAX` failed
LL | const MAX: u8 = A::MAX + B::MAX;
| ^^^^^^^^^^^^^^^ attempt to compute `u8::MAX + u8::MAX`, which would overflow
-error[E0080]: evaluation of `foo::<i32>` failed
+note: erroneous constant used
--> $DIR/issue-50814.rs:20:6
|
-LL | &Sum::<U8,U8>::MAX
- | ^^^^^^^^^^^^^^^^^ referenced constant has errors
+LL | &Sum::<U8, U8>::MAX
+ | ^^^^^^^^^^^^^^^^^^
note: the above error was encountered while instantiating `fn foo::<i32>`
--> $DIR/issue-50814.rs:25:5
@@ -16,6 +16,6 @@ note: the above error was encountered while instantiating `fn foo::<i32>`
LL | foo(0);
| ^^^^^^
-error: aborting due to 2 previous errors
+error: aborting due to previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/const-eval/panic-assoc-never-type.rs b/src/test/ui/consts/const-eval/panic-assoc-never-type.rs
index d2a840932..28edf5144 100644
--- a/src/test/ui/consts/const-eval/panic-assoc-never-type.rs
+++ b/src/test/ui/consts/const-eval/panic-assoc-never-type.rs
@@ -11,6 +11,5 @@ impl PrintName {
}
fn main() {
- let _ = PrintName::VOID;
- //~^ ERROR erroneous constant used [E0080]
+ let _ = PrintName::VOID; //~ constant
}
diff --git a/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr b/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr
index 4204d302b..7c36a3a42 100644
--- a/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr
+++ b/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr
@@ -6,12 +6,18 @@ LL | const VOID: ! = panic!();
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
-error[E0080]: erroneous constant used
+note: erroneous constant used
--> $DIR/panic-assoc-never-type.rs:14:13
|
LL | let _ = PrintName::VOID;
- | ^^^^^^^^^^^^^^^ referenced constant has errors
+ | ^^^^^^^^^^^^^^^
-error: aborting due to 2 previous errors
+note: erroneous constant used
+ --> $DIR/panic-assoc-never-type.rs:14:13
+ |
+LL | let _ = PrintName::VOID;
+ | ^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/const-eval/promoted_const_fn_fail.stderr b/src/test/ui/consts/const-eval/promoted_const_fn_fail.stderr
index 596fa090d..2d4e7c83d 100644
--- a/src/test/ui/consts/const-eval/promoted_const_fn_fail.stderr
+++ b/src/test/ui/consts/const-eval/promoted_const_fn_fail.stderr
@@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promoted_const_fn_fail.rs:17:27
|
LL | let x: &'static u8 = &(bar() + 1);
- | ----------- ^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ----------- ^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
diff --git a/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.stderr b/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.stderr
index 63dc43a41..9ebae3a18 100644
--- a/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.stderr
+++ b/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.stderr
@@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promoted_const_fn_fail_deny_const_err.rs:18:27
|
LL | let x: &'static u8 = &(bar() + 1);
- | ----------- ^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ----------- ^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
diff --git a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.stderr b/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.stderr
index 8ac60da38..01fcf2ec2 100644
--- a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.stderr
+++ b/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.stderr
@@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promoted_raw_ptr_ops.rs:2:29
|
LL | let x: &'static bool = &(42 as *const i32 == 43 as *const i32);
- | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -13,7 +13,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promoted_raw_ptr_ops.rs:4:30
|
LL | let y: &'static usize = &(&1 as *const i32 as usize + 1);
- | -------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | -------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -24,7 +24,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promoted_raw_ptr_ops.rs:6:28
|
LL | let z: &'static i32 = &(unsafe { *(42 as *const i32) });
- | ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -35,7 +35,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promoted_raw_ptr_ops.rs:8:29
|
LL | let a: &'static bool = &(main as fn() == main as fn());
- | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
LL |
diff --git a/src/test/ui/consts/const-eval/transmute-const-promotion.stderr b/src/test/ui/consts/const-eval/transmute-const-promotion.stderr
index 15b9b56ea..434a957f6 100644
--- a/src/test/ui/consts/const-eval/transmute-const-promotion.stderr
+++ b/src/test/ui/consts/const-eval/transmute-const-promotion.stderr
@@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/transmute-const-promotion.rs:4:37
|
LL | let x: &'static u32 = unsafe { &mem::transmute(3.0f32) };
- | ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
LL |
diff --git a/src/test/ui/consts/const-eval/ub-nonnull.32bit.stderr b/src/test/ui/consts/const-eval/ub-nonnull.32bit.stderr
index dbd05b8f4..b24e0cc37 100644
--- a/src/test/ui/consts/const-eval/ub-nonnull.32bit.stderr
+++ b/src/test/ui/consts/const-eval/ub-nonnull.32bit.stderr
@@ -65,6 +65,17 @@ LL | const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) };
14 00 00 00 │ ....
}
-error: aborting due to 7 previous errors
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-nonnull.rs:50:1
+ |
+LL | const NULL_FAT_PTR: NonNull<dyn Send> = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
+ |
+ = 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: 8, align: 4) {
+ 00 00 00 00 ╾─alloc26─╼ │ ....╾──╼
+ }
+
+error: aborting due to 8 previous errors
For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/const-eval/ub-nonnull.64bit.stderr b/src/test/ui/consts/const-eval/ub-nonnull.64bit.stderr
index 5a1ac09bd..92b8d017c 100644
--- a/src/test/ui/consts/const-eval/ub-nonnull.64bit.stderr
+++ b/src/test/ui/consts/const-eval/ub-nonnull.64bit.stderr
@@ -65,6 +65,17 @@ LL | const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) };
14 00 00 00 │ ....
}
-error: aborting due to 7 previous errors
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-nonnull.rs:50:1
+ |
+LL | const NULL_FAT_PTR: NonNull<dyn Send> = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
+ |
+ = 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: 16, align: 8) {
+ 00 00 00 00 00 00 00 00 ╾───────alloc26───────╼ │ ........╾──────╼
+ }
+
+error: aborting due to 8 previous errors
For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/const-eval/ub-nonnull.rs b/src/test/ui/consts/const-eval/ub-nonnull.rs
index d22a99cd0..490925822 100644
--- a/src/test/ui/consts/const-eval/ub-nonnull.rs
+++ b/src/test/ui/consts/const-eval/ub-nonnull.rs
@@ -1,5 +1,5 @@
// stderr-per-bitwidth
-#![feature(rustc_attrs)]
+#![feature(rustc_attrs, ptr_metadata)]
#![allow(invalid_value)] // make sure we cannot allow away the errors tested here
use std::mem;
@@ -47,4 +47,11 @@ struct RestrictedRange2(u32);
const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) };
//~^ ERROR it is undefined behavior to use this value
+const NULL_FAT_PTR: NonNull<dyn Send> = unsafe {
+//~^ ERROR it is undefined behavior to use this value
+ let x: &dyn Send = &42;
+ let meta = std::ptr::metadata(x);
+ mem::transmute((0_usize, meta))
+};
+
fn main() {}
diff --git a/src/test/ui/consts/const-eval/ub-ref-ptr.32bit.stderr b/src/test/ui/consts/const-eval/ub-ref-ptr.32bit.stderr
index 6f5c028cb..e5b5c7a84 100644
--- a/src/test/ui/consts/const-eval/ub-ref-ptr.32bit.stderr
+++ b/src/test/ui/consts/const-eval/ub-ref-ptr.32bit.stderr
@@ -60,14 +60,14 @@ LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
= 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
-error[E0080]: evaluation of constant value failed
+note: erroneous constant used
--> $DIR/ub-ref-ptr.rs:34:38
|
LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0080]: evaluation of constant value failed
- --> $DIR/ub-ref-ptr.rs:38:86
+ --> $DIR/ub-ref-ptr.rs:37:86
|
LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) };
| ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -75,14 +75,14 @@ LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[us
= 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
-error[E0080]: evaluation of constant value failed
- --> $DIR/ub-ref-ptr.rs:38:85
+note: erroneous constant used
+ --> $DIR/ub-ref-ptr.rs:37:85
|
LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) };
- | ^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
+ | ^^^^^^^^^^^^^^^^^^^^^
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-ref-ptr.rs:42:1
+ --> $DIR/ub-ref-ptr.rs:40:1
|
LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (address 0x539 is unallocated)
@@ -93,7 +93,7 @@ LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-ref-ptr.rs:45:1
+ --> $DIR/ub-ref-ptr.rs:43:1
|
LL | const USIZE_AS_BOX: Box<u8> = unsafe { mem::transmute(1337usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (address 0x539 is unallocated)
@@ -104,13 +104,13 @@ LL | const USIZE_AS_BOX: Box<u8> = unsafe { mem::transmute(1337usize) };
}
error[E0080]: evaluation of constant value failed
- --> $DIR/ub-ref-ptr.rs:48:41
+ --> $DIR/ub-ref-ptr.rs:46:41
|
LL | const UNINIT_PTR: *const i32 = unsafe { MaybeUninit { uninit: () }.init };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-ref-ptr.rs:52:1
+ --> $DIR/ub-ref-ptr.rs:50:1
|
LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a function pointer
@@ -121,13 +121,13 @@ LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) };
}
error[E0080]: evaluation of constant value failed
- --> $DIR/ub-ref-ptr.rs:54:38
+ --> $DIR/ub-ref-ptr.rs:52:38
|
LL | const UNINIT_FN_PTR: fn() = unsafe { MaybeUninit { uninit: () }.init };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-ref-ptr.rs:57:1
+ --> $DIR/ub-ref-ptr.rs:55:1
|
LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0xd[noalloc], but expected a function pointer
@@ -138,7 +138,7 @@ LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-ref-ptr.rs:59:1
+ --> $DIR/ub-ref-ptr.rs:57:1
|
LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
| ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered alloc41, but expected a function pointer
@@ -148,6 +148,6 @@ LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
╾─alloc41─╼ │ ╾──╼
}
-error: aborting due to 16 previous errors
+error: aborting due to 14 previous errors
For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/const-eval/ub-ref-ptr.64bit.stderr b/src/test/ui/consts/const-eval/ub-ref-ptr.64bit.stderr
index 5ffb710d4..607366cab 100644
--- a/src/test/ui/consts/const-eval/ub-ref-ptr.64bit.stderr
+++ b/src/test/ui/consts/const-eval/ub-ref-ptr.64bit.stderr
@@ -60,14 +60,14 @@ LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
= 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
-error[E0080]: evaluation of constant value failed
+note: erroneous constant used
--> $DIR/ub-ref-ptr.rs:34:38
|
LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0080]: evaluation of constant value failed
- --> $DIR/ub-ref-ptr.rs:38:86
+ --> $DIR/ub-ref-ptr.rs:37:86
|
LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) };
| ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -75,14 +75,14 @@ LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[us
= 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
-error[E0080]: evaluation of constant value failed
- --> $DIR/ub-ref-ptr.rs:38:85
+note: erroneous constant used
+ --> $DIR/ub-ref-ptr.rs:37:85
|
LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) };
- | ^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
+ | ^^^^^^^^^^^^^^^^^^^^^
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-ref-ptr.rs:42:1
+ --> $DIR/ub-ref-ptr.rs:40:1
|
LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (address 0x539 is unallocated)
@@ -93,7 +93,7 @@ LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-ref-ptr.rs:45:1
+ --> $DIR/ub-ref-ptr.rs:43:1
|
LL | const USIZE_AS_BOX: Box<u8> = unsafe { mem::transmute(1337usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (address 0x539 is unallocated)
@@ -104,13 +104,13 @@ LL | const USIZE_AS_BOX: Box<u8> = unsafe { mem::transmute(1337usize) };
}
error[E0080]: evaluation of constant value failed
- --> $DIR/ub-ref-ptr.rs:48:41
+ --> $DIR/ub-ref-ptr.rs:46:41
|
LL | const UNINIT_PTR: *const i32 = unsafe { MaybeUninit { uninit: () }.init };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-ref-ptr.rs:52:1
+ --> $DIR/ub-ref-ptr.rs:50:1
|
LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a function pointer
@@ -121,13 +121,13 @@ LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) };
}
error[E0080]: evaluation of constant value failed
- --> $DIR/ub-ref-ptr.rs:54:38
+ --> $DIR/ub-ref-ptr.rs:52:38
|
LL | const UNINIT_FN_PTR: fn() = unsafe { MaybeUninit { uninit: () }.init };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-ref-ptr.rs:57:1
+ --> $DIR/ub-ref-ptr.rs:55:1
|
LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0xd[noalloc], but expected a function pointer
@@ -138,7 +138,7 @@ LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-ref-ptr.rs:59:1
+ --> $DIR/ub-ref-ptr.rs:57:1
|
LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
| ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered alloc41, but expected a function pointer
@@ -148,6 +148,6 @@ LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
╾───────alloc41───────╼ │ ╾──────╼
}
-error: aborting due to 16 previous errors
+error: aborting due to 14 previous errors
For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/const-eval/ub-ref-ptr.rs b/src/test/ui/consts/const-eval/ub-ref-ptr.rs
index 92049d4c1..a1c812390 100644
--- a/src/test/ui/consts/const-eval/ub-ref-ptr.rs
+++ b/src/test/ui/consts/const-eval/ub-ref-ptr.rs
@@ -33,11 +33,9 @@ const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) };
const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
//~^ ERROR evaluation of constant value failed
-//~| ERROR evaluation of constant value failed
const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) };
//~^ ERROR evaluation of constant value failed
-//~| ERROR evaluation of constant value failed
const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };
//~^ ERROR it is undefined behavior to use this value
diff --git a/src/test/ui/consts/const-eval/ub-wide-ptr.32bit.stderr b/src/test/ui/consts/const-eval/ub-wide-ptr.32bit.stderr
index c8b46608d..9994c2e5a 100644
--- a/src/test/ui/consts/const-eval/ub-wide-ptr.32bit.stderr
+++ b/src/test/ui/consts/const-eval/ub-wide-ptr.32bit.stderr
@@ -139,11 +139,11 @@ LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
╾─allocN─╼ │ ╾──╼
}
-error[E0080]: evaluation of constant value failed
+note: erroneous constant used
--> $DIR/ub-wide-ptr.rs:83:40
|
LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-wide-ptr.rs:90:1
@@ -156,11 +156,11 @@ LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3
╾allocN─╼ │ ╾──╼
}
-error[E0080]: evaluation of constant value failed
+note: erroneous constant used
--> $DIR/ub-wide-ptr.rs:90:42
|
LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-wide-ptr.rs:94:1
@@ -173,11 +173,11 @@ LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::tran
╾allocN─╼ │ ╾──╼
}
-error[E0080]: evaluation of constant value failed
+note: erroneous constant used
--> $DIR/ub-wide-ptr.rs:94:42
|
LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0080]: evaluation of constant value failed
--> $DIR/ub-wide-ptr.rs:102:1
@@ -292,6 +292,6 @@ error[E0080]: could not evaluate static initializer
LL | mem::transmute::<_, &dyn Trait>((&92u8, &3u64))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable
-error: aborting due to 32 previous errors
+error: aborting due to 29 previous errors
For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/const-eval/ub-wide-ptr.64bit.stderr b/src/test/ui/consts/const-eval/ub-wide-ptr.64bit.stderr
index 70574d2dc..06a377d9f 100644
--- a/src/test/ui/consts/const-eval/ub-wide-ptr.64bit.stderr
+++ b/src/test/ui/consts/const-eval/ub-wide-ptr.64bit.stderr
@@ -139,11 +139,11 @@ LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
╾───────allocN───────╼ │ ╾──────╼
}
-error[E0080]: evaluation of constant value failed
+note: erroneous constant used
--> $DIR/ub-wide-ptr.rs:83:40
|
LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-wide-ptr.rs:90:1
@@ -156,11 +156,11 @@ LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3
╾──────allocN───────╼ │ ╾──────╼
}
-error[E0080]: evaluation of constant value failed
+note: erroneous constant used
--> $DIR/ub-wide-ptr.rs:90:42
|
LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-wide-ptr.rs:94:1
@@ -173,11 +173,11 @@ LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::tran
╾──────allocN───────╼ │ ╾──────╼
}
-error[E0080]: evaluation of constant value failed
+note: erroneous constant used
--> $DIR/ub-wide-ptr.rs:94:42
|
LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0080]: evaluation of constant value failed
--> $DIR/ub-wide-ptr.rs:102:1
@@ -292,6 +292,6 @@ error[E0080]: could not evaluate static initializer
LL | mem::transmute::<_, &dyn Trait>((&92u8, &3u64))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable
-error: aborting due to 32 previous errors
+error: aborting due to 29 previous errors
For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/const-eval/ub-wide-ptr.rs b/src/test/ui/consts/const-eval/ub-wide-ptr.rs
index 65f6f0235..2894ef831 100644
--- a/src/test/ui/consts/const-eval/ub-wide-ptr.rs
+++ b/src/test/ui/consts/const-eval/ub-wide-ptr.rs
@@ -82,18 +82,18 @@ const SLICE_LENGTH_PTR_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, &3)) };
// bad data *inside* the slice
const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
//~^ ERROR it is undefined behavior to use this value
-//~| ERROR evaluation of constant value failed
+//~| constant
// good MySliceBool
const MYSLICE_GOOD: &MySliceBool = &MySlice(true, [false]);
// bad: sized field is not okay
const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]);
//~^ ERROR it is undefined behavior to use this value
-//~| ERROR evaluation of constant value failed
+//~| constant
// bad: unsized part is not okay
const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]);
//~^ ERROR it is undefined behavior to use this value
-//~| ERROR evaluation of constant value failed
+//~| constant
// # raw slice
const RAW_SLICE_VALID: *const [u8] = unsafe { mem::transmute((&42u8, 1usize)) }; // ok
diff --git a/src/test/ui/consts/const-eval/union-const-eval-field.rs b/src/test/ui/consts/const-eval/union-const-eval-field.rs
index d88bf2a84..a94fcbbfa 100644
--- a/src/test/ui/consts/const-eval/union-const-eval-field.rs
+++ b/src/test/ui/consts/const-eval/union-const-eval-field.rs
@@ -29,7 +29,6 @@ const fn read_field3() -> Field3 {
//~^ ERROR evaluation of constant value failed
//~| uninitialized
FIELD3
- //~^ ERROR erroneous constant used [E0080]
}
fn main() {
diff --git a/src/test/ui/consts/const-eval/union-const-eval-field.stderr b/src/test/ui/consts/const-eval/union-const-eval-field.stderr
index 00964489e..9899c56c0 100644
--- a/src/test/ui/consts/const-eval/union-const-eval-field.stderr
+++ b/src/test/ui/consts/const-eval/union-const-eval-field.stderr
@@ -4,12 +4,18 @@ error[E0080]: evaluation of constant value failed
LL | const FIELD3: Field3 = unsafe { UNION.field3 };
| ^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
-error[E0080]: erroneous constant used
+note: erroneous constant used
--> $DIR/union-const-eval-field.rs:31:5
|
LL | FIELD3
- | ^^^^^^ referenced constant has errors
+ | ^^^^^^
-error: aborting due to 2 previous errors
+note: erroneous constant used
+ --> $DIR/union-const-eval-field.rs:31:5
+ |
+LL | FIELD3
+ | ^^^^^^
+
+error: aborting due to previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/const-eval/union_promotion.stderr b/src/test/ui/consts/const-eval/union_promotion.stderr
index 70808c520..42f17de20 100644
--- a/src/test/ui/consts/const-eval/union_promotion.stderr
+++ b/src/test/ui/consts/const-eval/union_promotion.stderr
@@ -7,7 +7,7 @@ LL | let x: &'static bool = &unsafe {
| | type annotation requires that borrow lasts for `'static`
LL | | Foo { a: &1 }.b == Foo { a: &2 }.b
LL | | };
- | |_____^ creates a temporary which is freed while still in use
+ | |_____^ creates a temporary value which is freed while still in use
LL | }
| - temporary value is freed at the end of this statement
diff --git a/src/test/ui/consts/const-eval/unwind-abort.stderr b/src/test/ui/consts/const-eval/unwind-abort.stderr
index 99178ae8c..759ce15ab 100644
--- a/src/test/ui/consts/const-eval/unwind-abort.stderr
+++ b/src/test/ui/consts/const-eval/unwind-abort.stderr
@@ -2,14 +2,18 @@ error[E0080]: evaluation of constant value failed
--> $DIR/unwind-abort.rs:4:5
|
LL | panic!()
+ | ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/unwind-abort.rs:4:5
+ |
+note: inside `foo`
+ --> $DIR/unwind-abort.rs:4:5
+ |
+LL | panic!()
| ^^^^^^^^
- | |
- | the evaluated program panicked at 'explicit panic', $DIR/unwind-abort.rs:4:5
- | inside `foo` at $SRC_DIR/std/src/panic.rs:LL:COL
-...
-LL | const _: () = foo();
- | ----- inside `_` at $DIR/unwind-abort.rs:7:15
+note: inside `_`
+ --> $DIR/unwind-abort.rs:7:15
|
+LL | const _: () = foo();
+ | ^^^^^
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to previous error
diff --git a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr
index 63639729a..9710bf476 100644
--- a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr
+++ b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr
@@ -14,13 +14,18 @@ error[E0080]: evaluation of constant value failed
--> $DIR/validate_uninhabited_zsts.rs:4:14
|
LL | unsafe { std::mem::transmute(()) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
+ |
+note: inside `foo`
+ --> $DIR/validate_uninhabited_zsts.rs:4:14
+ |
+LL | unsafe { std::mem::transmute(()) }
| ^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | transmuting to uninhabited type
- | inside `foo` at $DIR/validate_uninhabited_zsts.rs:4:14
-...
+note: inside `FOO`
+ --> $DIR/validate_uninhabited_zsts.rs:19:33
+ |
LL | const FOO: [empty::Empty; 3] = [foo(); 3];
- | ----- inside `FOO` at $DIR/validate_uninhabited_zsts.rs:19:33
+ | ^^^^^
error[E0080]: it is undefined behavior to use this value
--> $DIR/validate_uninhabited_zsts.rs:21:1
@@ -40,6 +45,11 @@ LL | const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3];
| this code causes undefined behavior when executed
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
|
+note: in this struct field
+ --> $DIR/validate_uninhabited_zsts.rs:16:22
+ |
+LL | pub struct Empty(Void);
+ | ^^^^
note: enums with no inhabited variants have no valid value
--> $DIR/validate_uninhabited_zsts.rs:13:5
|
diff --git a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr
index 63639729a..9710bf476 100644
--- a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr
+++ b/src/test/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr
@@ -14,13 +14,18 @@ error[E0080]: evaluation of constant value failed
--> $DIR/validate_uninhabited_zsts.rs:4:14
|
LL | unsafe { std::mem::transmute(()) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
+ |
+note: inside `foo`
+ --> $DIR/validate_uninhabited_zsts.rs:4:14
+ |
+LL | unsafe { std::mem::transmute(()) }
| ^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | transmuting to uninhabited type
- | inside `foo` at $DIR/validate_uninhabited_zsts.rs:4:14
-...
+note: inside `FOO`
+ --> $DIR/validate_uninhabited_zsts.rs:19:33
+ |
LL | const FOO: [empty::Empty; 3] = [foo(); 3];
- | ----- inside `FOO` at $DIR/validate_uninhabited_zsts.rs:19:33
+ | ^^^^^
error[E0080]: it is undefined behavior to use this value
--> $DIR/validate_uninhabited_zsts.rs:21:1
@@ -40,6 +45,11 @@ LL | const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3];
| this code causes undefined behavior when executed
| help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
|
+note: in this struct field
+ --> $DIR/validate_uninhabited_zsts.rs:16:22
+ |
+LL | pub struct Empty(Void);
+ | ^^^^
note: enums with no inhabited variants have no valid value
--> $DIR/validate_uninhabited_zsts.rs:13:5
|
diff --git a/src/test/ui/consts/const-float-bits-reject-conv.rs b/src/test/ui/consts/const-float-bits-reject-conv.rs
index 5bf54fdbb..c77e99abb 100644
--- a/src/test/ui/consts/const-float-bits-reject-conv.rs
+++ b/src/test/ui/consts/const-float-bits-reject-conv.rs
@@ -1,4 +1,5 @@
// compile-flags: -Zmir-opt-level=0
+// error-pattern: cannot use f32::to_bits on a NaN
#![feature(const_float_bits_conv)]
#![feature(const_float_classify)]
@@ -25,22 +26,21 @@ fn f32() {
// 0xA is 0b1010; 0x5 is 0b0101 -- so these two together clobbers all the mantissa bits
// ...actually, let's just check that these break. :D
const MASKED_NAN1: u32 = f32::NAN.to_bits() ^ 0x002A_AAAA;
+ //~^ inside
const MASKED_NAN2: u32 = f32::NAN.to_bits() ^ 0x0055_5555;
+ //~^ inside
+
+ // The rest of the code is dead because the constants already fail to evaluate.
const_assert!(f32::from_bits(MASKED_NAN1).is_nan());
- //~^ ERROR evaluation of constant value failed
const_assert!(f32::from_bits(MASKED_NAN1).is_nan());
- //~^ ERROR evaluation of constant value failed
// LLVM does not guarantee that loads and stores of NaNs preserve their exact bit pattern.
// In practice, this seems to only cause a problem on x86, since the most widely used calling
// convention mandates that floating point values are returned on the x87 FPU stack. See #73328.
- if !cfg!(target_arch = "x86") {
- const_assert!(f32::from_bits(MASKED_NAN1).to_bits(), MASKED_NAN1);
- //~^ ERROR evaluation of constant value failed
- const_assert!(f32::from_bits(MASKED_NAN2).to_bits(), MASKED_NAN2);
- //~^ ERROR evaluation of constant value failed
- }
+ // However, during CTFE we still preserve bit patterns (though that is not a guarantee).
+ const_assert!(f32::from_bits(MASKED_NAN1).to_bits(), MASKED_NAN1);
+ const_assert!(f32::from_bits(MASKED_NAN2).to_bits(), MASKED_NAN2);
}
fn f64() {
@@ -48,20 +48,18 @@ fn f64() {
// 0xA is 0b1010; 0x5 is 0b0101 -- so these two together clobbers all the mantissa bits
// ...actually, let's just check that these break. :D
const MASKED_NAN1: u64 = f64::NAN.to_bits() ^ 0x000A_AAAA_AAAA_AAAA;
+ //~^ inside
const MASKED_NAN2: u64 = f64::NAN.to_bits() ^ 0x0005_5555_5555_5555;
+ //~^ inside
+
+ // The rest of the code is dead because the constants already fail to evaluate.
const_assert!(f64::from_bits(MASKED_NAN1).is_nan());
- //~^ ERROR evaluation of constant value failed
const_assert!(f64::from_bits(MASKED_NAN1).is_nan());
- //~^ ERROR evaluation of constant value failed
// See comment above.
- if !cfg!(target_arch = "x86") {
- const_assert!(f64::from_bits(MASKED_NAN1).to_bits(), MASKED_NAN1);
- //~^ ERROR evaluation of constant value failed
- const_assert!(f64::from_bits(MASKED_NAN2).to_bits(), MASKED_NAN2);
- //~^ ERROR evaluation of constant value failed
- }
+ const_assert!(f64::from_bits(MASKED_NAN1).to_bits(), MASKED_NAN1);
+ const_assert!(f64::from_bits(MASKED_NAN2).to_bits(), MASKED_NAN2);
}
fn main() {
diff --git a/src/test/ui/consts/const-float-bits-reject-conv.stderr b/src/test/ui/consts/const-float-bits-reject-conv.stderr
index b3575f641..195a087ff 100644
--- a/src/test/ui/consts/const-float-bits-reject-conv.stderr
+++ b/src/test/ui/consts/const-float-bits-reject-conv.stderr
@@ -2,126 +2,142 @@ error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/num/f32.rs:LL:COL
|
LL | panic!("const-eval error: cannot use f32::to_bits on a NaN")
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'const-eval error: cannot use f32::to_bits on a NaN', $SRC_DIR/core/src/num/f32.rs:LL:COL
+ |
+note: inside `core::f32::<impl f32>::to_bits::ct_f32_to_u32`
+ --> $SRC_DIR/core/src/num/f32.rs:LL:COL
+ |
+LL | panic!("const-eval error: cannot use f32::to_bits on a NaN")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | the evaluated program panicked at 'const-eval error: cannot use f32::to_bits on a NaN', $SRC_DIR/core/src/num/f32.rs:LL:COL
- | inside `core::f32::<impl f32>::to_bits::ct_f32_to_u32` at $SRC_DIR/core/src/panic.rs:LL:COL
-...
-LL | unsafe { intrinsics::const_eval_select((self,), ct_f32_to_u32, rt_f32_to_u32) }
- | -------------------------------------------------------------------- inside `core::f32::<impl f32>::to_bits` at $SRC_DIR/core/src/num/f32.rs:LL:COL
+note: inside `core::f32::<impl f32>::to_bits`
+ --> $SRC_DIR/core/src/num/f32.rs:LL:COL
|
- ::: $DIR/const-float-bits-reject-conv.rs:27:30
+LL | unsafe { intrinsics::const_eval_select((self,), ct_f32_to_u32, rt_f32_to_u32) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: inside `f32::MASKED_NAN1`
+ --> $DIR/const-float-bits-reject-conv.rs:28:30
|
LL | const MASKED_NAN1: u32 = f32::NAN.to_bits() ^ 0x002A_AAAA;
- | ------------------ inside `f32::MASKED_NAN1` at $DIR/const-float-bits-reject-conv.rs:27:30
- |
+ | ^^^^^^^^^^^^^^^^^^
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/num/f32.rs:LL:COL
|
LL | panic!("const-eval error: cannot use f32::to_bits on a NaN")
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'const-eval error: cannot use f32::to_bits on a NaN', $SRC_DIR/core/src/num/f32.rs:LL:COL
+ |
+note: inside `core::f32::<impl f32>::to_bits::ct_f32_to_u32`
+ --> $SRC_DIR/core/src/num/f32.rs:LL:COL
+ |
+LL | panic!("const-eval error: cannot use f32::to_bits on a NaN")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | the evaluated program panicked at 'const-eval error: cannot use f32::to_bits on a NaN', $SRC_DIR/core/src/num/f32.rs:LL:COL
- | inside `core::f32::<impl f32>::to_bits::ct_f32_to_u32` at $SRC_DIR/core/src/panic.rs:LL:COL
-...
-LL | unsafe { intrinsics::const_eval_select((self,), ct_f32_to_u32, rt_f32_to_u32) }
- | -------------------------------------------------------------------- inside `core::f32::<impl f32>::to_bits` at $SRC_DIR/core/src/num/f32.rs:LL:COL
+note: inside `core::f32::<impl f32>::to_bits`
+ --> $SRC_DIR/core/src/num/f32.rs:LL:COL
|
- ::: $DIR/const-float-bits-reject-conv.rs:28:30
+LL | unsafe { intrinsics::const_eval_select((self,), ct_f32_to_u32, rt_f32_to_u32) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: inside `f32::MASKED_NAN2`
+ --> $DIR/const-float-bits-reject-conv.rs:30:30
|
LL | const MASKED_NAN2: u32 = f32::NAN.to_bits() ^ 0x0055_5555;
- | ------------------ inside `f32::MASKED_NAN2` at $DIR/const-float-bits-reject-conv.rs:28:30
- |
+ | ^^^^^^^^^^^^^^^^^^
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
-error[E0080]: evaluation of constant value failed
- --> $DIR/const-float-bits-reject-conv.rs:30:34
+note: erroneous constant used
+ --> $DIR/const-float-bits-reject-conv.rs:35:34
|
LL | const_assert!(f32::from_bits(MASKED_NAN1).is_nan());
- | ^^^^^^^^^^^ referenced constant has errors
+ | ^^^^^^^^^^^
-error[E0080]: evaluation of constant value failed
- --> $DIR/const-float-bits-reject-conv.rs:32:34
+note: erroneous constant used
+ --> $DIR/const-float-bits-reject-conv.rs:36:34
|
LL | const_assert!(f32::from_bits(MASKED_NAN1).is_nan());
- | ^^^^^^^^^^^ referenced constant has errors
+ | ^^^^^^^^^^^
-error[E0080]: evaluation of constant value failed
- --> $DIR/const-float-bits-reject-conv.rs:39:38
+note: erroneous constant used
+ --> $DIR/const-float-bits-reject-conv.rs:42:34
|
-LL | const_assert!(f32::from_bits(MASKED_NAN1).to_bits(), MASKED_NAN1);
- | ^^^^^^^^^^^ referenced constant has errors
+LL | const_assert!(f32::from_bits(MASKED_NAN1).to_bits(), MASKED_NAN1);
+ | ^^^^^^^^^^^
-error[E0080]: evaluation of constant value failed
- --> $DIR/const-float-bits-reject-conv.rs:41:38
+note: erroneous constant used
+ --> $DIR/const-float-bits-reject-conv.rs:43:34
|
-LL | const_assert!(f32::from_bits(MASKED_NAN2).to_bits(), MASKED_NAN2);
- | ^^^^^^^^^^^ referenced constant has errors
+LL | const_assert!(f32::from_bits(MASKED_NAN2).to_bits(), MASKED_NAN2);
+ | ^^^^^^^^^^^
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/num/f64.rs:LL:COL
|
LL | panic!("const-eval error: cannot use f64::to_bits on a NaN")
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'const-eval error: cannot use f64::to_bits on a NaN', $SRC_DIR/core/src/num/f64.rs:LL:COL
+ |
+note: inside `core::f64::<impl f64>::to_bits::ct_f64_to_u64`
+ --> $SRC_DIR/core/src/num/f64.rs:LL:COL
+ |
+LL | panic!("const-eval error: cannot use f64::to_bits on a NaN")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | the evaluated program panicked at 'const-eval error: cannot use f64::to_bits on a NaN', $SRC_DIR/core/src/num/f64.rs:LL:COL
- | inside `core::f64::<impl f64>::to_bits::ct_f64_to_u64` at $SRC_DIR/core/src/panic.rs:LL:COL
-...
-LL | unsafe { intrinsics::const_eval_select((self,), ct_f64_to_u64, rt_f64_to_u64) }
- | -------------------------------------------------------------------- inside `core::f64::<impl f64>::to_bits` at $SRC_DIR/core/src/num/f64.rs:LL:COL
+note: inside `core::f64::<impl f64>::to_bits`
+ --> $SRC_DIR/core/src/num/f64.rs:LL:COL
|
- ::: $DIR/const-float-bits-reject-conv.rs:50:30
+LL | unsafe { intrinsics::const_eval_select((self,), ct_f64_to_u64, rt_f64_to_u64) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: inside `f64::MASKED_NAN1`
+ --> $DIR/const-float-bits-reject-conv.rs:50:30
|
LL | const MASKED_NAN1: u64 = f64::NAN.to_bits() ^ 0x000A_AAAA_AAAA_AAAA;
- | ------------------ inside `f64::MASKED_NAN1` at $DIR/const-float-bits-reject-conv.rs:50:30
- |
+ | ^^^^^^^^^^^^^^^^^^
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/num/f64.rs:LL:COL
|
LL | panic!("const-eval error: cannot use f64::to_bits on a NaN")
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'const-eval error: cannot use f64::to_bits on a NaN', $SRC_DIR/core/src/num/f64.rs:LL:COL
+ |
+note: inside `core::f64::<impl f64>::to_bits::ct_f64_to_u64`
+ --> $SRC_DIR/core/src/num/f64.rs:LL:COL
+ |
+LL | panic!("const-eval error: cannot use f64::to_bits on a NaN")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | the evaluated program panicked at 'const-eval error: cannot use f64::to_bits on a NaN', $SRC_DIR/core/src/num/f64.rs:LL:COL
- | inside `core::f64::<impl f64>::to_bits::ct_f64_to_u64` at $SRC_DIR/core/src/panic.rs:LL:COL
-...
-LL | unsafe { intrinsics::const_eval_select((self,), ct_f64_to_u64, rt_f64_to_u64) }
- | -------------------------------------------------------------------- inside `core::f64::<impl f64>::to_bits` at $SRC_DIR/core/src/num/f64.rs:LL:COL
+note: inside `core::f64::<impl f64>::to_bits`
+ --> $SRC_DIR/core/src/num/f64.rs:LL:COL
|
- ::: $DIR/const-float-bits-reject-conv.rs:51:30
+LL | unsafe { intrinsics::const_eval_select((self,), ct_f64_to_u64, rt_f64_to_u64) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: inside `f64::MASKED_NAN2`
+ --> $DIR/const-float-bits-reject-conv.rs:52:30
|
LL | const MASKED_NAN2: u64 = f64::NAN.to_bits() ^ 0x0005_5555_5555_5555;
- | ------------------ inside `f64::MASKED_NAN2` at $DIR/const-float-bits-reject-conv.rs:51:30
- |
+ | ^^^^^^^^^^^^^^^^^^
= note: this error originates in the macro `$crate::panic::panic_2021` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
-error[E0080]: evaluation of constant value failed
- --> $DIR/const-float-bits-reject-conv.rs:53:34
+note: erroneous constant used
+ --> $DIR/const-float-bits-reject-conv.rs:57:34
|
LL | const_assert!(f64::from_bits(MASKED_NAN1).is_nan());
- | ^^^^^^^^^^^ referenced constant has errors
+ | ^^^^^^^^^^^
-error[E0080]: evaluation of constant value failed
- --> $DIR/const-float-bits-reject-conv.rs:55:34
+note: erroneous constant used
+ --> $DIR/const-float-bits-reject-conv.rs:58:34
|
LL | const_assert!(f64::from_bits(MASKED_NAN1).is_nan());
- | ^^^^^^^^^^^ referenced constant has errors
+ | ^^^^^^^^^^^
-error[E0080]: evaluation of constant value failed
- --> $DIR/const-float-bits-reject-conv.rs:60:38
+note: erroneous constant used
+ --> $DIR/const-float-bits-reject-conv.rs:61:34
|
-LL | const_assert!(f64::from_bits(MASKED_NAN1).to_bits(), MASKED_NAN1);
- | ^^^^^^^^^^^ referenced constant has errors
+LL | const_assert!(f64::from_bits(MASKED_NAN1).to_bits(), MASKED_NAN1);
+ | ^^^^^^^^^^^
-error[E0080]: evaluation of constant value failed
- --> $DIR/const-float-bits-reject-conv.rs:62:38
+note: erroneous constant used
+ --> $DIR/const-float-bits-reject-conv.rs:62:34
|
-LL | const_assert!(f64::from_bits(MASKED_NAN2).to_bits(), MASKED_NAN2);
- | ^^^^^^^^^^^ referenced constant has errors
+LL | const_assert!(f64::from_bits(MASKED_NAN2).to_bits(), MASKED_NAN2);
+ | ^^^^^^^^^^^
-error: aborting due to 12 previous errors
+error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/const-int-conversion.stderr b/src/test/ui/consts/const-int-conversion.stderr
index 61162a792..5dd757e3f 100644
--- a/src/test/ui/consts/const-int-conversion.stderr
+++ b/src/test/ui/consts/const-int-conversion.stderr
@@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-conversion.rs:2:28
|
LL | let x: &'static i32 = &(5_i32.reverse_bits());
- | ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -13,7 +13,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-conversion.rs:4:28
|
LL | let y: &'static i32 = &(i32::from_be_bytes([0x12, 0x34, 0x56, 0x78]));
- | ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -24,7 +24,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-conversion.rs:6:28
|
LL | let z: &'static i32 = &(i32::from_le_bytes([0x12, 0x34, 0x56, 0x78]));
- | ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -35,7 +35,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-conversion.rs:8:28
|
LL | let a: &'static i32 = &(i32::from_be(i32::from_ne_bytes([0x80, 0, 0, 0])));
- | ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ------------ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -46,7 +46,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-conversion.rs:10:29
|
LL | let b: &'static [u8] = &(0x12_34_56_78_i32.to_be_bytes());
- | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -57,7 +57,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-conversion.rs:12:29
|
LL | let c: &'static [u8] = &(0x12_34_56_78_i32.to_le_bytes());
- | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -68,7 +68,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-conversion.rs:14:29
|
LL | let d: &'static [u8] = &(i32::MIN.to_be().to_ne_bytes());
- | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
LL |
diff --git a/src/test/ui/consts/const-int-overflowing.stderr b/src/test/ui/consts/const-int-overflowing.stderr
index 56c7f7f09..7d3689e6e 100644
--- a/src/test/ui/consts/const-int-overflowing.stderr
+++ b/src/test/ui/consts/const-int-overflowing.stderr
@@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-overflowing.rs:2:36
|
LL | let x: &'static (i32, bool) = &(5_i32.overflowing_add(3));
- | -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -13,7 +13,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-overflowing.rs:4:36
|
LL | let y: &'static (i32, bool) = &(5_i32.overflowing_sub(3));
- | -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -24,7 +24,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-overflowing.rs:6:36
|
LL | let z: &'static (i32, bool) = &(5_i32.overflowing_mul(3));
- | -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | -------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
LL |
diff --git a/src/test/ui/consts/const-int-rotate.stderr b/src/test/ui/consts/const-int-rotate.stderr
index ed265804b..039da1c31 100644
--- a/src/test/ui/consts/const-int-rotate.stderr
+++ b/src/test/ui/consts/const-int-rotate.stderr
@@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-rotate.rs:2:28
|
LL | let x: &'static i32 = &(5_i32.rotate_left(3));
- | ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ------------ ^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -13,7 +13,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-rotate.rs:4:28
|
LL | let y: &'static i32 = &(5_i32.rotate_right(3));
- | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
LL |
diff --git a/src/test/ui/consts/const-int-sign.stderr b/src/test/ui/consts/const-int-sign.stderr
index 5f8fd4141..fc23d9d2b 100644
--- a/src/test/ui/consts/const-int-sign.stderr
+++ b/src/test/ui/consts/const-int-sign.stderr
@@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-sign.rs:2:29
|
LL | let x: &'static bool = &(5_i32.is_negative());
- | ------------- ^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ------------- ^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -13,7 +13,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-sign.rs:4:29
|
LL | let y: &'static bool = &(5_i32.is_positive());
- | ------------- ^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ------------- ^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
LL |
diff --git a/src/test/ui/consts/const-int-wrapping.stderr b/src/test/ui/consts/const-int-wrapping.stderr
index 5174b7265..1342fadc4 100644
--- a/src/test/ui/consts/const-int-wrapping.stderr
+++ b/src/test/ui/consts/const-int-wrapping.stderr
@@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-wrapping.rs:2:28
|
LL | let x: &'static i32 = &(5_i32.wrapping_add(3));
- | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -13,7 +13,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-wrapping.rs:4:28
|
LL | let y: &'static i32 = &(5_i32.wrapping_sub(3));
- | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -24,7 +24,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-wrapping.rs:6:28
|
LL | let z: &'static i32 = &(5_i32.wrapping_mul(3));
- | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -35,7 +35,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-wrapping.rs:8:28
|
LL | let a: &'static i32 = &(5_i32.wrapping_shl(3));
- | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -46,7 +46,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/const-int-wrapping.rs:10:28
|
LL | let b: &'static i32 = &(5_i32.wrapping_shr(3));
- | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
LL |
diff --git a/src/test/ui/consts/const-integer-bool-ops.rs b/src/test/ui/consts/const-integer-bool-ops.rs
index 6924956bd..4110ae3e4 100644
--- a/src/test/ui/consts/const-integer-bool-ops.rs
+++ b/src/test/ui/consts/const-integer-bool-ops.rs
@@ -6,7 +6,7 @@ const X: usize = 42 && 39;
//~| ERROR mismatched types
//~| expected `usize`, found `bool`
const ARR: [i32; X] = [99; 34];
-//~^ ERROR evaluation of constant value failed
+//~^ constant
const X1: usize = 42 || 39;
//~^ ERROR mismatched types
@@ -16,7 +16,7 @@ const X1: usize = 42 || 39;
//~| ERROR mismatched types
//~| expected `usize`, found `bool`
const ARR1: [i32; X1] = [99; 47];
-//~^ ERROR evaluation of constant value failed
+//~^ constant
const X2: usize = -42 || -39;
//~^ ERROR mismatched types
@@ -26,7 +26,7 @@ const X2: usize = -42 || -39;
//~| ERROR mismatched types
//~| expected `usize`, found `bool`
const ARR2: [i32; X2] = [99; 18446744073709551607];
-//~^ ERROR evaluation of constant value failed
+//~^ constant
const X3: usize = -42 && -39;
//~^ ERROR mismatched types
@@ -36,43 +36,43 @@ const X3: usize = -42 && -39;
//~| ERROR mismatched types
//~| expected `usize`, found `bool`
const ARR3: [i32; X3] = [99; 6];
-//~^ ERROR evaluation of constant value failed
+//~^ constant
const Y: usize = 42.0 == 42.0;
//~^ ERROR mismatched types
//~| expected `usize`, found `bool`
const ARRR: [i32; Y] = [99; 1];
-//~^ ERROR evaluation of constant value failed
+//~^ constant
const Y1: usize = 42.0 >= 42.0;
//~^ ERROR mismatched types
//~| expected `usize`, found `bool`
const ARRR1: [i32; Y1] = [99; 1];
-//~^ ERROR evaluation of constant value failed
+//~^ constant
const Y2: usize = 42.0 <= 42.0;
//~^ ERROR mismatched types
//~| expected `usize`, found `bool`
const ARRR2: [i32; Y2] = [99; 1];
-//~^ ERROR evaluation of constant value failed
+//~^ constant
const Y3: usize = 42.0 > 42.0;
//~^ ERROR mismatched types
//~| expected `usize`, found `bool`
const ARRR3: [i32; Y3] = [99; 0];
-//~^ ERROR evaluation of constant value failed
+//~^ constant
const Y4: usize = 42.0 < 42.0;
//~^ ERROR mismatched types
//~| expected `usize`, found `bool`
const ARRR4: [i32; Y4] = [99; 0];
-//~^ ERROR evaluation of constant value failed
+//~^ constant
const Y5: usize = 42.0 != 42.0;
//~^ ERROR mismatched types
//~| expected `usize`, found `bool`
const ARRR5: [i32; Y5] = [99; 0];
-//~^ ERROR evaluation of constant value failed
+//~^ constant
fn main() {
let _ = ARR;
diff --git a/src/test/ui/consts/const-integer-bool-ops.stderr b/src/test/ui/consts/const-integer-bool-ops.stderr
index 9001fefd1..b5c3b22fd 100644
--- a/src/test/ui/consts/const-integer-bool-ops.stderr
+++ b/src/test/ui/consts/const-integer-bool-ops.stderr
@@ -16,11 +16,11 @@ error[E0308]: mismatched types
LL | const X: usize = 42 && 39;
| ^^^^^^^^ expected `usize`, found `bool`
-error[E0080]: evaluation of constant value failed
+note: erroneous constant used
--> $DIR/const-integer-bool-ops.rs:8:18
|
LL | const ARR: [i32; X] = [99; 34];
- | ^ referenced constant has errors
+ | ^
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:11:19
@@ -40,11 +40,11 @@ error[E0308]: mismatched types
LL | const X1: usize = 42 || 39;
| ^^^^^^^^ expected `usize`, found `bool`
-error[E0080]: evaluation of constant value failed
+note: erroneous constant used
--> $DIR/const-integer-bool-ops.rs:18:19
|
LL | const ARR1: [i32; X1] = [99; 47];
- | ^^ referenced constant has errors
+ | ^^
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:21:19
@@ -64,11 +64,11 @@ error[E0308]: mismatched types
LL | const X2: usize = -42 || -39;
| ^^^^^^^^^^ expected `usize`, found `bool`
-error[E0080]: evaluation of constant value failed
+note: erroneous constant used
--> $DIR/const-integer-bool-ops.rs:28:19
|
LL | const ARR2: [i32; X2] = [99; 18446744073709551607];
- | ^^ referenced constant has errors
+ | ^^
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:31:19
@@ -88,11 +88,11 @@ error[E0308]: mismatched types
LL | const X3: usize = -42 && -39;
| ^^^^^^^^^^ expected `usize`, found `bool`
-error[E0080]: evaluation of constant value failed
+note: erroneous constant used
--> $DIR/const-integer-bool-ops.rs:38:19
|
LL | const ARR3: [i32; X3] = [99; 6];
- | ^^ referenced constant has errors
+ | ^^
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:41:18
@@ -100,11 +100,11 @@ error[E0308]: mismatched types
LL | const Y: usize = 42.0 == 42.0;
| ^^^^^^^^^^^^ expected `usize`, found `bool`
-error[E0080]: evaluation of constant value failed
+note: erroneous constant used
--> $DIR/const-integer-bool-ops.rs:44:19
|
LL | const ARRR: [i32; Y] = [99; 1];
- | ^ referenced constant has errors
+ | ^
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:47:19
@@ -112,11 +112,11 @@ error[E0308]: mismatched types
LL | const Y1: usize = 42.0 >= 42.0;
| ^^^^^^^^^^^^ expected `usize`, found `bool`
-error[E0080]: evaluation of constant value failed
+note: erroneous constant used
--> $DIR/const-integer-bool-ops.rs:50:20
|
LL | const ARRR1: [i32; Y1] = [99; 1];
- | ^^ referenced constant has errors
+ | ^^
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:53:19
@@ -124,11 +124,11 @@ error[E0308]: mismatched types
LL | const Y2: usize = 42.0 <= 42.0;
| ^^^^^^^^^^^^ expected `usize`, found `bool`
-error[E0080]: evaluation of constant value failed
+note: erroneous constant used
--> $DIR/const-integer-bool-ops.rs:56:20
|
LL | const ARRR2: [i32; Y2] = [99; 1];
- | ^^ referenced constant has errors
+ | ^^
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:59:19
@@ -136,11 +136,11 @@ error[E0308]: mismatched types
LL | const Y3: usize = 42.0 > 42.0;
| ^^^^^^^^^^^ expected `usize`, found `bool`
-error[E0080]: evaluation of constant value failed
+note: erroneous constant used
--> $DIR/const-integer-bool-ops.rs:62:20
|
LL | const ARRR3: [i32; Y3] = [99; 0];
- | ^^ referenced constant has errors
+ | ^^
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:65:19
@@ -148,11 +148,11 @@ error[E0308]: mismatched types
LL | const Y4: usize = 42.0 < 42.0;
| ^^^^^^^^^^^ expected `usize`, found `bool`
-error[E0080]: evaluation of constant value failed
+note: erroneous constant used
--> $DIR/const-integer-bool-ops.rs:68:20
|
LL | const ARRR4: [i32; Y4] = [99; 0];
- | ^^ referenced constant has errors
+ | ^^
error[E0308]: mismatched types
--> $DIR/const-integer-bool-ops.rs:71:19
@@ -160,13 +160,12 @@ error[E0308]: mismatched types
LL | const Y5: usize = 42.0 != 42.0;
| ^^^^^^^^^^^^ expected `usize`, found `bool`
-error[E0080]: evaluation of constant value failed
+note: erroneous constant used
--> $DIR/const-integer-bool-ops.rs:74:20
|
LL | const ARRR5: [i32; Y5] = [99; 0];
- | ^^ referenced constant has errors
+ | ^^
-error: aborting due to 28 previous errors
+error: aborting due to 18 previous errors
-Some errors have detailed explanations: E0080, E0308.
-For more information about an error, try `rustc --explain E0080`.
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/consts/const-len-underflow-separate-spans.rs b/src/test/ui/consts/const-len-underflow-separate-spans.rs
index 478761aef..4544c8876 100644
--- a/src/test/ui/consts/const-len-underflow-separate-spans.rs
+++ b/src/test/ui/consts/const-len-underflow-separate-spans.rs
@@ -9,5 +9,5 @@ const LEN: usize = ONE - TWO;
fn main() {
let a: [i8; LEN] = unimplemented!();
-//~^ ERROR E0080
+//~^ constant
}
diff --git a/src/test/ui/consts/const-len-underflow-separate-spans.stderr b/src/test/ui/consts/const-len-underflow-separate-spans.stderr
index 1416e695e..269553631 100644
--- a/src/test/ui/consts/const-len-underflow-separate-spans.stderr
+++ b/src/test/ui/consts/const-len-underflow-separate-spans.stderr
@@ -4,12 +4,12 @@ error[E0080]: evaluation of constant value failed
LL | const LEN: usize = ONE - TWO;
| ^^^^^^^^^ attempt to compute `1_usize - 2_usize`, which would overflow
-error[E0080]: evaluation of constant value failed
+note: erroneous constant used
--> $DIR/const-len-underflow-separate-spans.rs:11:17
|
LL | let a: [i8; LEN] = unimplemented!();
- | ^^^ referenced constant has errors
+ | ^^^
-error: aborting due to 2 previous errors
+error: aborting due to previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/const-mut-refs/issue-76510.32bit.stderr b/src/test/ui/consts/const-mut-refs/issue-76510.32bit.stderr
index 0f420ae1b..109d15a8e 100644
--- a/src/test/ui/consts/const-mut-refs/issue-76510.32bit.stderr
+++ b/src/test/ui/consts/const-mut-refs/issue-76510.32bit.stderr
@@ -19,13 +19,13 @@ error[E0596]: cannot borrow data in a `&` reference as mutable
LL | const S: &'static mut str = &mut " hello ";
| ^^^^^^^^^^^^^^ cannot borrow as mutable
-error[E0080]: evaluation of constant value failed
+note: erroneous constant used
--> $DIR/issue-76510.rs:11:70
|
LL | let s = transmute::<(*const u8, usize), &ManuallyDrop<str>>((S.as_ptr(), 3));
- | ^ referenced constant has errors
+ | ^
-error: aborting due to 4 previous errors
+error: aborting due to 3 previous errors
-Some errors have detailed explanations: E0080, E0596, E0658, E0764.
-For more information about an error, try `rustc --explain E0080`.
+Some errors have detailed explanations: E0596, E0658, E0764.
+For more information about an error, try `rustc --explain E0596`.
diff --git a/src/test/ui/consts/const-mut-refs/issue-76510.64bit.stderr b/src/test/ui/consts/const-mut-refs/issue-76510.64bit.stderr
index 0f420ae1b..109d15a8e 100644
--- a/src/test/ui/consts/const-mut-refs/issue-76510.64bit.stderr
+++ b/src/test/ui/consts/const-mut-refs/issue-76510.64bit.stderr
@@ -19,13 +19,13 @@ error[E0596]: cannot borrow data in a `&` reference as mutable
LL | const S: &'static mut str = &mut " hello ";
| ^^^^^^^^^^^^^^ cannot borrow as mutable
-error[E0080]: evaluation of constant value failed
+note: erroneous constant used
--> $DIR/issue-76510.rs:11:70
|
LL | let s = transmute::<(*const u8, usize), &ManuallyDrop<str>>((S.as_ptr(), 3));
- | ^ referenced constant has errors
+ | ^
-error: aborting due to 4 previous errors
+error: aborting due to 3 previous errors
-Some errors have detailed explanations: E0080, E0596, E0658, E0764.
-For more information about an error, try `rustc --explain E0080`.
+Some errors have detailed explanations: E0596, E0658, E0764.
+For more information about an error, try `rustc --explain E0596`.
diff --git a/src/test/ui/consts/const-mut-refs/issue-76510.rs b/src/test/ui/consts/const-mut-refs/issue-76510.rs
index 08cf64ee3..b853e2737 100644
--- a/src/test/ui/consts/const-mut-refs/issue-76510.rs
+++ b/src/test/ui/consts/const-mut-refs/issue-76510.rs
@@ -9,7 +9,7 @@ const S: &'static mut str = &mut " hello ";
const fn trigger() -> [(); unsafe {
let s = transmute::<(*const u8, usize), &ManuallyDrop<str>>((S.as_ptr(), 3));
- //~^ ERROR evaluation of constant value failed
+ //~^ constant
0
}] {
[(); 0]
diff --git a/src/test/ui/consts/const-mut-refs/mut_ref_in_final.stderr b/src/test/ui/consts/const-mut-refs/mut_ref_in_final.stderr
index 3a9ce79f1..78c58b5ab 100644
--- a/src/test/ui/consts/const-mut-refs/mut_ref_in_final.stderr
+++ b/src/test/ui/consts/const-mut-refs/mut_ref_in_final.stderr
@@ -11,7 +11,7 @@ LL | const B3: Option<&mut i32> = Some(&mut 42);
| ----------^^-
| | | |
| | | temporary value is freed at the end of this statement
- | | creates a temporary which is freed while still in use
+ | | creates a temporary value which is freed while still in use
| using this value as a constant requires that borrow lasts for `'static`
error[E0716]: temporary value dropped while borrowed
@@ -21,7 +21,7 @@ LL | const B4: Option<&mut i32> = helper(&mut 42);
| ------------^^-
| | | |
| | | temporary value is freed at the end of this statement
- | | creates a temporary which is freed while still in use
+ | | creates a temporary value which is freed while still in use
| using this value as a constant requires that borrow lasts for `'static`
error[E0716]: temporary value dropped while borrowed
@@ -31,7 +31,7 @@ LL | const FOO: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42));
| -------------------------------^^--
| | | |
| | | temporary value is freed at the end of this statement
- | | creates a temporary which is freed while still in use
+ | | creates a temporary value which is freed while still in use
| using this value as a constant requires that borrow lasts for `'static`
error[E0716]: temporary value dropped while borrowed
@@ -41,7 +41,7 @@ LL | static FOO2: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42));
| -------------------------------^^--
| | | |
| | | temporary value is freed at the end of this statement
- | | creates a temporary which is freed while still in use
+ | | creates a temporary value which is freed while still in use
| using this value as a static requires that borrow lasts for `'static`
error[E0716]: temporary value dropped while borrowed
@@ -51,7 +51,7 @@ LL | static mut FOO3: NotAMutex<&mut i32> = NotAMutex(UnsafeCell::new(&mut 42));
| -------------------------------^^--
| | | |
| | | temporary value is freed at the end of this statement
- | | creates a temporary which is freed while still in use
+ | | creates a temporary value which is freed while still in use
| using this value as a static requires that borrow lasts for `'static`
error: aborting due to 6 previous errors
diff --git a/src/test/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr b/src/test/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr
index 234e55e3a..6e110dbdd 100644
--- a/src/test/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr
+++ b/src/test/ui/consts/const-mut-refs/mut_ref_in_final_dynamic_check.stderr
@@ -2,13 +2,18 @@ error[E0080]: evaluation of constant value failed
--> $DIR/mut_ref_in_final_dynamic_check.rs:13:10
|
LL | Some(&mut *(42 as *mut i32))
+ | ^^^^^^^^^^^^^^^^^^^^^^ dereferencing pointer failed: 0x2a[noalloc] is a dangling pointer (it has no provenance)
+ |
+note: inside `helper`
+ --> $DIR/mut_ref_in_final_dynamic_check.rs:13:10
+ |
+LL | Some(&mut *(42 as *mut i32))
| ^^^^^^^^^^^^^^^^^^^^^^
- | |
- | dereferencing pointer failed: 0x2a[noalloc] is a dangling pointer (it has no provenance)
- | inside `helper` at $DIR/mut_ref_in_final_dynamic_check.rs:13:10
-...
+note: inside `A`
+ --> $DIR/mut_ref_in_final_dynamic_check.rs:18:29
+ |
LL | const A: Option<&mut i32> = helper();
- | -------- inside `A` at $DIR/mut_ref_in_final_dynamic_check.rs:18:29
+ | ^^^^^^^^
error: encountered dangling pointer in final constant
--> $DIR/mut_ref_in_final_dynamic_check.rs:25:1
diff --git a/src/test/ui/consts/const-ptr-nonnull.stderr b/src/test/ui/consts/const-ptr-nonnull.stderr
index 26946fb99..dbcb0c860 100644
--- a/src/test/ui/consts/const-ptr-nonnull.stderr
+++ b/src/test/ui/consts/const-ptr-nonnull.stderr
@@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/const-ptr-nonnull.rs:4:37
|
LL | let x: &'static NonNull<u32> = &(NonNull::dangling());
- | --------------------- ^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | --------------------- ^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -13,7 +13,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/const-ptr-nonnull.rs:9:37
|
LL | let x: &'static NonNull<u32> = &(non_null.cast());
- | --------------------- ^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | --------------------- ^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
LL |
diff --git a/src/test/ui/consts/const-ptr-unique.stderr b/src/test/ui/consts/const-ptr-unique.stderr
index 3644cf4ce..83448c3e8 100644
--- a/src/test/ui/consts/const-ptr-unique.stderr
+++ b/src/test/ui/consts/const-ptr-unique.stderr
@@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/const-ptr-unique.rs:8:33
|
LL | let x: &'static *mut u32 = &(unique.as_ptr());
- | ----------------- ^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ----------------- ^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
LL |
diff --git a/src/test/ui/consts/const-tup-index-span.rs b/src/test/ui/consts/const-tup-index-span.rs
index 763263c6a..778a21224 100644
--- a/src/test/ui/consts/const-tup-index-span.rs
+++ b/src/test/ui/consts/const-tup-index-span.rs
@@ -4,7 +4,7 @@ const TUP: (usize,) = 5usize << 64;
//~^ ERROR mismatched types
//~| expected tuple, found `usize`
const ARR: [i32; TUP.0] = [];
-//~^ ERROR evaluation of constant value failed
+//~^ constant
fn main() {
}
diff --git a/src/test/ui/consts/const-tup-index-span.stderr b/src/test/ui/consts/const-tup-index-span.stderr
index b178e05e2..ad8468056 100644
--- a/src/test/ui/consts/const-tup-index-span.stderr
+++ b/src/test/ui/consts/const-tup-index-span.stderr
@@ -11,13 +11,12 @@ help: use a trailing comma to create a tuple with one element
LL | const TUP: (usize,) = (5usize << 64,);
| + ++
-error[E0080]: evaluation of constant value failed
+note: erroneous constant used
--> $DIR/const-tup-index-span.rs:6:18
|
LL | const ARR: [i32; TUP.0] = [];
- | ^^^ referenced constant has errors
+ | ^^^
-error: aborting due to 2 previous errors
+error: aborting due to previous error
-Some errors have detailed explanations: E0080, E0308.
-For more information about an error, try `rustc --explain E0080`.
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/consts/const_in_pattern/accept_structural.rs b/src/test/ui/consts/const_in_pattern/accept_structural.rs
index 5093fe539..1f56f581c 100644
--- a/src/test/ui/consts/const_in_pattern/accept_structural.rs
+++ b/src/test/ui/consts/const_in_pattern/accept_structural.rs
@@ -45,7 +45,7 @@ fn main() {
const TUPLE: (OND, OND) = (None, None);
match (None, None) { TUPLE => dbg!(TUPLE), _ => panic!("whoops"), };
- const TYPE_ASCRIPTION: OND = None: OND;
+ const TYPE_ASCRIPTION: OND = type_ascribe!(None, OND);
match None { TYPE_ASCRIPTION => dbg!(TYPE_ASCRIPTION), _ => panic!("whoops"), };
const ARRAY: [OND; 2] = [None, None];
diff --git a/src/test/ui/consts/const_in_pattern/reject_non_structural.rs b/src/test/ui/consts/const_in_pattern/reject_non_structural.rs
index 7a8169bec..75fde0d92 100644
--- a/src/test/ui/consts/const_in_pattern/reject_non_structural.rs
+++ b/src/test/ui/consts/const_in_pattern/reject_non_structural.rs
@@ -53,7 +53,7 @@ fn main() {
match (None, Some(NoDerive)) { TUPLE => dbg!(TUPLE), _ => panic!("whoops"), };
//~^ ERROR must be annotated with `#[derive(PartialEq, Eq)]`
- const TYPE_ASCRIPTION: OND = Some(NoDerive): OND;
+ 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)]`
diff --git a/src/test/ui/consts/const_unsafe_unreachable_ub.stderr b/src/test/ui/consts/const_unsafe_unreachable_ub.stderr
index f6de3699f..cbc7cac93 100644
--- a/src/test/ui/consts/const_unsafe_unreachable_ub.stderr
+++ b/src/test/ui/consts/const_unsafe_unreachable_ub.stderr
@@ -2,18 +2,23 @@ error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/hint.rs:LL:COL
|
LL | intrinsics::unreachable()
- | ^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | entering unreachable code
- | inside `unreachable_unchecked` at $SRC_DIR/core/src/hint.rs:LL:COL
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ entering unreachable code
+ |
+note: inside `unreachable_unchecked`
+ --> $SRC_DIR/core/src/hint.rs:LL:COL
|
- ::: $DIR/const_unsafe_unreachable_ub.rs:6:18
+LL | intrinsics::unreachable()
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+note: inside `foo`
+ --> $DIR/const_unsafe_unreachable_ub.rs:6:18
|
LL | false => std::hint::unreachable_unchecked(),
- | ---------------------------------- inside `foo` at $DIR/const_unsafe_unreachable_ub.rs:6:18
-...
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: inside `BAR`
+ --> $DIR/const_unsafe_unreachable_ub.rs:10:28
+ |
LL | const BAR: bool = unsafe { foo(false) };
- | ---------- inside `BAR` at $DIR/const_unsafe_unreachable_ub.rs:10:28
+ | ^^^^^^^^^^
error: aborting due to previous error
diff --git a/src/test/ui/consts/control-flow/interior-mutability.stderr b/src/test/ui/consts/control-flow/interior-mutability.stderr
index 4f9c7d34c..db2ffb91b 100644
--- a/src/test/ui/consts/control-flow/interior-mutability.stderr
+++ b/src/test/ui/consts/control-flow/interior-mutability.stderr
@@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/interior-mutability.rs:40:26
|
LL | let x: &'static _ = &X;
- | ---------- ^ creates a temporary which is freed while still in use
+ | ---------- ^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -13,7 +13,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/interior-mutability.rs:41:26
|
LL | let y: &'static _ = &Y;
- | ---------- ^ creates a temporary which is freed while still in use
+ | ---------- ^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
LL | let z: &'static _ = &Z;
@@ -24,7 +24,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/interior-mutability.rs:42:26
|
LL | let z: &'static _ = &Z;
- | ---------- ^ creates a temporary which is freed while still in use
+ | ---------- ^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
LL | }
diff --git a/src/test/ui/consts/extra-const-ub/detect-extra-ub.rs b/src/test/ui/consts/extra-const-ub/detect-extra-ub.rs
index 159cdf257..9c239c8a1 100644
--- a/src/test/ui/consts/extra-const-ub/detect-extra-ub.rs
+++ b/src/test/ui/consts/extra-const-ub/detect-extra-ub.rs
@@ -29,7 +29,7 @@ const UNALIGNED_PTR: () = unsafe {
};
const UNALIGNED_READ: () = {
- INNER; //[with_flag]~ERROR evaluation of constant value failed
+ INNER; //[with_flag]~ constant
// There is an error here but its span is in the standard library so we cannot match it...
// so we have this in a *nested* const, such that the *outer* const fails to use it.
const INNER: () = unsafe {
diff --git a/src/test/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr b/src/test/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr
index 3e1195822..2603a7358 100644
--- a/src/test/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr
+++ b/src/test/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr
@@ -32,27 +32,30 @@ error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | accessing memory with alignment 1, but alignment 4 is required
- | inside `std::ptr::read::<u32>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ accessing memory with alignment 1, but alignment 4 is required
|
- ::: $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+note: inside `std::ptr::read::<u32>`
+ --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
-LL | unsafe { read(self) }
- | ---------- inside `ptr::const_ptr::<impl *const u32>::read` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: inside `ptr::const_ptr::<impl *const u32>::read`
+ --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
- ::: $DIR/detect-extra-ub.rs:38:9
+LL | unsafe { read(self) }
+ | ^^^^^^^^^^
+note: inside `INNER`
+ --> $DIR/detect-extra-ub.rs:38:9
|
LL | ptr.read();
- | ---------- inside `INNER` at $DIR/detect-extra-ub.rs:38:9
+ | ^^^^^^^^^^
-error[E0080]: evaluation of constant value failed
+note: erroneous constant used
--> $DIR/detect-extra-ub.rs:32:5
|
LL | INNER;
- | ^^^^^ referenced constant has errors
+ | ^^^^^
-error: aborting due to 6 previous errors
+error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/fn_trait_refs.rs b/src/test/ui/consts/fn_trait_refs.rs
new file mode 100644
index 000000000..b50749297
--- /dev/null
+++ b/src/test/ui/consts/fn_trait_refs.rs
@@ -0,0 +1,77 @@
+// check-pass
+
+#![feature(const_fn_trait_ref_impls)]
+#![feature(fn_traits)]
+#![feature(unboxed_closures)]
+#![feature(const_trait_impl)]
+#![feature(const_mut_refs)]
+#![feature(const_cmp)]
+#![feature(const_refs_to_cell)]
+
+use std::marker::Destruct;
+
+const fn tester_fn<T>(f: T) -> T::Output
+where
+ T: ~const Fn<()> + ~const Destruct,
+{
+ f()
+}
+
+const fn tester_fn_mut<T>(mut f: T) -> T::Output
+where
+ T: ~const FnMut<()> + ~const Destruct,
+{
+ f()
+}
+
+const fn tester_fn_once<T>(f: T) -> T::Output
+where
+ T: ~const FnOnce<()>,
+{
+ f()
+}
+
+const fn test_fn<T>(mut f: T) -> (T::Output, T::Output, T::Output)
+where
+ T: ~const Fn<()> + ~const Destruct,
+{
+ (
+ // impl<A: Tuple, F: ~const Fn + ?Sized> const Fn<A> for &F
+ tester_fn(&f),
+ // impl<A: Tuple, F: ~const Fn + ?Sized> const FnMut<A> for &F
+ tester_fn_mut(&f),
+ // impl<A: Tuple, F: ~const Fn + ?Sized> const FnOnce<A> for &F
+ tester_fn_once(&f),
+ )
+}
+
+const fn test_fn_mut<T>(mut f: T) -> (T::Output, T::Output)
+where
+ T: ~const FnMut<()> + ~const Destruct,
+{
+ (
+ // impl<A: Tuple, F: ~const FnMut + ?Sized> const FnMut<A> for &mut F
+ tester_fn_mut(&mut f),
+ // impl<A: Tuple, F: ~const FnMut + ?Sized> const FnOnce<A> for &mut F
+ tester_fn_once(&mut f),
+ )
+}
+const fn test(i: i32) -> i32 {
+ i + 1
+}
+
+fn main() {
+ const fn one() -> i32 {
+ 1
+ };
+ const fn two() -> i32 {
+ 2
+ };
+ const _: () = {
+ let test_one = test_fn(one);
+ assert!(test_one == (1, 1, 1));
+
+ let test_two = test_fn_mut(two);
+ assert!(test_two == (2, 2));
+ };
+}
diff --git a/src/test/ui/consts/invalid-const-in-body.rs b/src/test/ui/consts/invalid-const-in-body.rs
new file mode 100644
index 000000000..f0fa3bb7b
--- /dev/null
+++ b/src/test/ui/consts/invalid-const-in-body.rs
@@ -0,0 +1,6 @@
+fn f() -> impl Sized {
+ 2.0E
+ //~^ ERROR expected at least one digit in exponent
+}
+
+fn main() {}
diff --git a/src/test/ui/consts/invalid-const-in-body.stderr b/src/test/ui/consts/invalid-const-in-body.stderr
new file mode 100644
index 000000000..3be658359
--- /dev/null
+++ b/src/test/ui/consts/invalid-const-in-body.stderr
@@ -0,0 +1,8 @@
+error: expected at least one digit in exponent
+ --> $DIR/invalid-const-in-body.rs:2:5
+ |
+LL | 2.0E
+ | ^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/consts/invalid-inline-const-in-match-arm.rs b/src/test/ui/consts/invalid-inline-const-in-match-arm.rs
new file mode 100644
index 000000000..4d2d8fb13
--- /dev/null
+++ b/src/test/ui/consts/invalid-inline-const-in-match-arm.rs
@@ -0,0 +1,9 @@
+#![allow(incomplete_features)]
+#![feature(inline_const_pat)]
+
+fn main() {
+ match () {
+ const { (|| {})() } => {}
+ //~^ ERROR cannot call non-const closure in constants
+ }
+}
diff --git a/src/test/ui/consts/invalid-inline-const-in-match-arm.stderr b/src/test/ui/consts/invalid-inline-const-in-match-arm.stderr
new file mode 100644
index 000000000..ab594c921
--- /dev/null
+++ b/src/test/ui/consts/invalid-inline-const-in-match-arm.stderr
@@ -0,0 +1,12 @@
+error[E0015]: cannot call non-const closure in constants
+ --> $DIR/invalid-inline-const-in-match-arm.rs:6:17
+ |
+LL | const { (|| {})() } => {}
+ | ^^^^^^^^^
+ |
+ = note: closures need an RFC before allowed to be called in constants
+ = note: calls in constants are limited to constant functions, tuple structs and tuple variants
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0015`.
diff --git a/src/test/ui/consts/invalid-union.32bit.stderr b/src/test/ui/consts/invalid-union.32bit.stderr
index bad07989e..4758ea4ae 100644
--- a/src/test/ui/consts/invalid-union.32bit.stderr
+++ b/src/test/ui/consts/invalid-union.32bit.stderr
@@ -9,12 +9,24 @@ LL | fn main() {
╾─alloc7──╼ │ ╾──╼
}
-error[E0080]: erroneous constant used
- --> $DIR/invalid-union.rs:42:25
+note: erroneous constant used
+ --> $DIR/invalid-union.rs:43:25
|
LL | let _: &'static _ = &C;
- | ^^ referenced constant has errors
+ | ^^
-error: aborting due to 2 previous errors
+note: erroneous constant used
+ --> $DIR/invalid-union.rs:43:25
+ |
+LL | let _: &'static _ = &C;
+ | ^^
+
+note: erroneous constant used
+ --> $DIR/invalid-union.rs:43:25
+ |
+LL | let _: &'static _ = &C;
+ | ^^
+
+error: aborting due to previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/invalid-union.64bit.stderr b/src/test/ui/consts/invalid-union.64bit.stderr
index a209f0038..22b85d20c 100644
--- a/src/test/ui/consts/invalid-union.64bit.stderr
+++ b/src/test/ui/consts/invalid-union.64bit.stderr
@@ -9,12 +9,24 @@ LL | fn main() {
╾───────alloc7────────╼ │ ╾──────╼
}
-error[E0080]: erroneous constant used
- --> $DIR/invalid-union.rs:42:25
+note: erroneous constant used
+ --> $DIR/invalid-union.rs:43:25
|
LL | let _: &'static _ = &C;
- | ^^ referenced constant has errors
+ | ^^
-error: aborting due to 2 previous errors
+note: erroneous constant used
+ --> $DIR/invalid-union.rs:43:25
+ |
+LL | let _: &'static _ = &C;
+ | ^^
+
+note: erroneous constant used
+ --> $DIR/invalid-union.rs:43:25
+ |
+LL | let _: &'static _ = &C;
+ | ^^
+
+error: aborting due to previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/invalid-union.rs b/src/test/ui/consts/invalid-union.rs
index 435d26d6e..28706b4a9 100644
--- a/src/test/ui/consts/invalid-union.rs
+++ b/src/test/ui/consts/invalid-union.rs
@@ -39,5 +39,6 @@ const C: S = {
};
fn main() { //~ ERROR it is undefined behavior to use this value
- let _: &'static _ = &C; //~ ERROR erroneous constant used
+ // FIXME the span here is wrong, sould be pointing at the line below, not above.
+ let _: &'static _ = &C;
}
diff --git a/src/test/ui/consts/issue-102117.rs b/src/test/ui/consts/issue-102117.rs
index b77342c41..3ed90aed2 100644
--- a/src/test/ui/consts/issue-102117.rs
+++ b/src/test/ui/consts/issue-102117.rs
@@ -14,11 +14,11 @@ pub struct VTable {
impl VTable {
pub fn new<T>() -> &'static Self {
const {
- //~^ ERROR the parameter type `T` may not live long enough
- //~| ERROR the parameter type `T` may not live long enough
&VTable {
layout: Layout::new::<T>(),
type_id: TypeId::of::<T>(),
+ //~^ ERROR the parameter type `T` may not live long enough
+ //~| ERROR the parameter type `T` may not live long enough
drop_in_place: unsafe {
transmute::<unsafe fn(*mut T), unsafe fn(*mut ())>(drop_in_place::<T>)
},
diff --git a/src/test/ui/consts/issue-102117.stderr b/src/test/ui/consts/issue-102117.stderr
index eb4b329bd..f42bcf90f 100644
--- a/src/test/ui/consts/issue-102117.stderr
+++ b/src/test/ui/consts/issue-102117.stderr
@@ -1,14 +1,8 @@
error[E0310]: the parameter type `T` may not live long enough
- --> $DIR/issue-102117.rs:16:9
+ --> $DIR/issue-102117.rs:19:26
|
-LL | / const {
-LL | |
-LL | |
-LL | | &VTable {
-... |
-LL | | }
-LL | | }
- | |_________^ ...so that the type `T` will meet its required lifetime bounds
+LL | type_id: TypeId::of::<T>(),
+ | ^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound...
|
@@ -16,16 +10,10 @@ LL | pub fn new<T: 'static>() -> &'static Self {
| +++++++++
error[E0310]: the parameter type `T` may not live long enough
- --> $DIR/issue-102117.rs:16:9
+ --> $DIR/issue-102117.rs:19:26
|
-LL | / const {
-LL | |
-LL | |
-LL | | &VTable {
-... |
-LL | | }
-LL | | }
- | |_________^ ...so that the type `T` will meet its required lifetime bounds
+LL | type_id: TypeId::of::<T>(),
+ | ^^^^^^^^^^^^^^^^^ ...so that the type `T` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound...
|
diff --git a/src/test/ui/consts/issue-103790.rs b/src/test/ui/consts/issue-103790.rs
new file mode 100644
index 000000000..ea3cac605
--- /dev/null
+++ b/src/test/ui/consts/issue-103790.rs
@@ -0,0 +1,10 @@
+#![feature(generic_const_exprs)]
+#![allow(incomplete_features)]
+
+struct S<const S: (), const S: S = { S }>;
+//~^ ERROR the name `S` is already used for a generic parameter in this item's generic parameters
+//~| ERROR missing generics for struct `S`
+//~| ERROR cycle detected when computing type of `S::S`
+//~| ERROR cycle detected when computing type of `S`
+
+fn main() {}
diff --git a/src/test/ui/consts/issue-103790.stderr b/src/test/ui/consts/issue-103790.stderr
new file mode 100644
index 000000000..41b0816dc
--- /dev/null
+++ b/src/test/ui/consts/issue-103790.stderr
@@ -0,0 +1,65 @@
+error[E0403]: the name `S` is already used for a generic parameter in this item's generic parameters
+ --> $DIR/issue-103790.rs:4:29
+ |
+LL | struct S<const S: (), const S: S = { S }>;
+ | - ^ already used
+ | |
+ | first use of `S`
+
+error[E0107]: missing generics for struct `S`
+ --> $DIR/issue-103790.rs:4:32
+ |
+LL | struct S<const S: (), const S: S = { S }>;
+ | ^ expected at least 1 generic argument
+ |
+note: struct defined here, with at least 1 generic parameter: `S`
+ --> $DIR/issue-103790.rs:4:8
+ |
+LL | struct S<const S: (), const S: S = { S }>;
+ | ^ -----------
+help: add missing generic argument
+ |
+LL | struct S<const S: (), const S: S<S> = { S }>;
+ | ~~~~
+
+error[E0391]: cycle detected when computing type of `S::S`
+ --> $DIR/issue-103790.rs:4:32
+ |
+LL | struct S<const S: (), const S: S = { S }>;
+ | ^
+ |
+ = note: ...which immediately requires computing type of `S::S` again
+note: cycle used when computing type of `S`
+ --> $DIR/issue-103790.rs:4:1
+ |
+LL | struct S<const S: (), const S: S = { S }>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0391]: cycle detected when computing type of `S`
+ --> $DIR/issue-103790.rs:4:1
+ |
+LL | struct S<const S: (), const S: S = { S }>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: ...which requires computing type of `S::S`...
+ --> $DIR/issue-103790.rs:4:32
+ |
+LL | struct S<const S: (), const S: S = { S }>;
+ | ^
+ = note: ...which again requires computing type of `S`, completing the cycle
+note: cycle used when collecting item types in top-level module
+ --> $DIR/issue-103790.rs:1:1
+ |
+LL | / #![feature(generic_const_exprs)]
+LL | | #![allow(incomplete_features)]
+LL | |
+LL | | struct S<const S: (), const S: S = { S }>;
+... |
+LL | |
+LL | | fn main() {}
+ | |____________^
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0107, E0391, E0403.
+For more information about an error, try `rustc --explain E0107`.
diff --git a/src/test/ui/consts/issue-104609.rs b/src/test/ui/consts/issue-104609.rs
new file mode 100644
index 000000000..01fd1c48c
--- /dev/null
+++ b/src/test/ui/consts/issue-104609.rs
@@ -0,0 +1,10 @@
+fn foo() {
+ oops;
+ //~^ ERROR: cannot find value `oops` in this scope
+}
+
+unsafe fn bar() {
+ std::mem::transmute::<_, *mut _>(1_u8);
+}
+
+fn main() {}
diff --git a/src/test/ui/consts/issue-104609.stderr b/src/test/ui/consts/issue-104609.stderr
new file mode 100644
index 000000000..00360c44d
--- /dev/null
+++ b/src/test/ui/consts/issue-104609.stderr
@@ -0,0 +1,9 @@
+error[E0425]: cannot find value `oops` in this scope
+ --> $DIR/issue-104609.rs:2:5
+ |
+LL | oops;
+ | ^^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/src/test/ui/consts/issue-104768.rs b/src/test/ui/consts/issue-104768.rs
new file mode 100644
index 000000000..3192daafa
--- /dev/null
+++ b/src/test/ui/consts/issue-104768.rs
@@ -0,0 +1,4 @@
+const A: &_ = 0_u32;
+//~^ ERROR: the placeholder `_` is not allowed within types on item signatures for constants
+
+fn main() {}
diff --git a/src/test/ui/consts/issue-104768.stderr b/src/test/ui/consts/issue-104768.stderr
new file mode 100644
index 000000000..55b2b6f04
--- /dev/null
+++ b/src/test/ui/consts/issue-104768.stderr
@@ -0,0 +1,12 @@
+error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants
+ --> $DIR/issue-104768.rs:1:10
+ |
+LL | const A: &_ = 0_u32;
+ | ^^
+ | |
+ | not allowed in type signatures
+ | help: replace with the correct type: `u32`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0121`.
diff --git a/src/test/ui/consts/issue-36163.stderr b/src/test/ui/consts/issue-36163.stderr
index 9ac6c984c..7137c0538 100644
--- a/src/test/ui/consts/issue-36163.stderr
+++ b/src/test/ui/consts/issue-36163.stderr
@@ -5,10 +5,10 @@ LL | B = A,
| ^
|
note: ...which requires const-evaluating + checking `A`...
- --> $DIR/issue-36163.rs:1:1
+ --> $DIR/issue-36163.rs:1:18
|
LL | const A: isize = Foo::B as isize;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^
= note: ...which again requires const-evaluating + checking `Foo::B::{constant#0}`, completing the cycle
note: cycle used when simplifying constant for the type system `Foo::B::{constant#0}`
--> $DIR/issue-36163.rs:4:9
diff --git a/src/test/ui/consts/issue-54224.stderr b/src/test/ui/consts/issue-54224.stderr
index 8dcb4daca..55fe55759 100644
--- a/src/test/ui/consts/issue-54224.stderr
+++ b/src/test/ui/consts/issue-54224.stderr
@@ -5,7 +5,7 @@ LL | const FOO: Option<&[[u8; 3]]> = Some(&[*b"foo"]);
| ------^^^^^^^^^-
| | | |
| | | temporary value is freed at the end of this statement
- | | creates a temporary which is freed while still in use
+ | | creates a temporary value which is freed while still in use
| using this value as a constant requires that borrow lasts for `'static`
error[E0716]: temporary value dropped while borrowed
@@ -15,7 +15,7 @@ LL | pub const Z: Cow<'static, [ [u8; 3] ]> = Cow::Borrowed(&[*b"ABC"]);
| ---------------^^^^^^^^^-
| | | |
| | | temporary value is freed at the end of this statement
- | | creates a temporary which is freed while still in use
+ | | creates a temporary value which is freed while still in use
| using this value as a constant requires that borrow lasts for `'static`
error: aborting due to 2 previous errors
diff --git a/src/test/ui/consts/issue-54954.rs b/src/test/ui/consts/issue-54954.rs
new file mode 100644
index 000000000..520bf508f
--- /dev/null
+++ b/src/test/ui/consts/issue-54954.rs
@@ -0,0 +1,19 @@
+const ARR_LEN: usize = Tt::const_val::<[i8; 123]>();
+//~^ ERROR E0790
+
+trait Tt {
+ const fn const_val<T: Sized>() -> usize {
+ //~^ ERROR functions in traits cannot be declared const
+ core::mem::size_of::<T>()
+ }
+}
+
+fn f(z: [f32; ARR_LEN]) -> [f32; ARR_LEN] {
+ //~^ constant
+ //~| constant
+ z
+}
+
+fn main() {
+ let _ = f([1f32; ARR_LEN]);
+}
diff --git a/src/test/ui/consts/issue-54954.stderr b/src/test/ui/consts/issue-54954.stderr
new file mode 100644
index 000000000..850558287
--- /dev/null
+++ b/src/test/ui/consts/issue-54954.stderr
@@ -0,0 +1,34 @@
+error[E0379]: functions in traits cannot be declared const
+ --> $DIR/issue-54954.rs:5:5
+ |
+LL | const fn const_val<T: Sized>() -> usize {
+ | ^^^^^ functions in traits cannot be const
+
+error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type
+ --> $DIR/issue-54954.rs:1:24
+ |
+LL | const ARR_LEN: usize = Tt::const_val::<[i8; 123]>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot call associated function of trait
+...
+LL | / const fn const_val<T: Sized>() -> usize {
+LL | |
+LL | | core::mem::size_of::<T>()
+LL | | }
+ | |_____- `Tt::const_val` defined here
+
+note: erroneous constant used
+ --> $DIR/issue-54954.rs:11:15
+ |
+LL | fn f(z: [f32; ARR_LEN]) -> [f32; ARR_LEN] {
+ | ^^^^^^^
+
+note: erroneous constant used
+ --> $DIR/issue-54954.rs:11:34
+ |
+LL | fn f(z: [f32; ARR_LEN]) -> [f32; ARR_LEN] {
+ | ^^^^^^^
+
+error: aborting due to 2 previous errors
+
+Some errors have detailed explanations: E0379, E0790.
+For more information about an error, try `rustc --explain E0379`.
diff --git a/src/test/ui/consts/issue-56164.rs b/src/test/ui/consts/issue-56164.rs
index df3e3bf90..22c257d0b 100644
--- a/src/test/ui/consts/issue-56164.rs
+++ b/src/test/ui/consts/issue-56164.rs
@@ -1,6 +1,5 @@
const fn foo() { (||{})() }
//~^ ERROR cannot call non-const closure
-//~| ERROR erroneous constant used
const fn bad(input: fn()) {
input()
diff --git a/src/test/ui/consts/issue-56164.stderr b/src/test/ui/consts/issue-56164.stderr
index c5b2c57fb..2579b3e78 100644
--- a/src/test/ui/consts/issue-56164.stderr
+++ b/src/test/ui/consts/issue-56164.stderr
@@ -8,18 +8,23 @@ LL | const fn foo() { (||{})() }
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
error: function pointer calls are not allowed in constant functions
- --> $DIR/issue-56164.rs:6:5
+ --> $DIR/issue-56164.rs:5:5
|
LL | input()
| ^^^^^^^
-error[E0080]: erroneous constant used
+note: erroneous constant used
--> $DIR/issue-56164.rs:1:18
|
LL | const fn foo() { (||{})() }
- | ^^^^^^ referenced constant has errors
+ | ^^^^^^
-error: aborting due to 3 previous errors
+note: erroneous constant used
+ --> $DIR/issue-56164.rs:1:18
+ |
+LL | const fn foo() { (||{})() }
+ | ^^^^^^
+
+error: aborting due to 2 previous errors
-Some errors have detailed explanations: E0015, E0080.
-For more information about an error, try `rustc --explain E0015`.
+For more information about this error, try `rustc --explain E0015`.
diff --git a/src/test/ui/consts/issue-66693.rs b/src/test/ui/consts/issue-66693.rs
index 1ff250be1..df45d01ec 100644
--- a/src/test/ui/consts/issue-66693.rs
+++ b/src/test/ui/consts/issue-66693.rs
@@ -10,7 +10,6 @@ static _FOO: () = panic!(true);
const fn _foo() {
panic!(&1);
//~^ ERROR: argument to `panic!()` in a const context must have type `&str`
- //~| ERROR: erroneous constant used
}
// ensure that conforming panics don't cause an error
diff --git a/src/test/ui/consts/issue-66693.stderr b/src/test/ui/consts/issue-66693.stderr
index 911374f50..e9a3fced6 100644
--- a/src/test/ui/consts/issue-66693.stderr
+++ b/src/test/ui/consts/issue-66693.stderr
@@ -22,12 +22,17 @@ LL | panic!(&1);
|
= note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
-error[E0080]: erroneous constant used
+note: erroneous constant used
--> $DIR/issue-66693.rs:11:12
|
LL | panic!(&1);
- | ^^ referenced constant has errors
+ | ^^
-error: aborting due to 4 previous errors
+note: erroneous constant used
+ --> $DIR/issue-66693.rs:11:12
+ |
+LL | panic!(&1);
+ | ^^
+
+error: aborting due to 3 previous errors
-For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/issue-miri-1910.stderr b/src/test/ui/consts/issue-miri-1910.stderr
index 3872e3d4f..1f82e1777 100644
--- a/src/test/ui/consts/issue-miri-1910.stderr
+++ b/src/test/ui/consts/issue-miri-1910.stderr
@@ -2,23 +2,25 @@ error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1);
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | unable to copy parts of a pointer from memory at ALLOC
- | inside `std::ptr::read::<u8>` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to copy parts of a pointer from memory at ALLOC
|
- ::: $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ = 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
+note: inside `std::ptr::read::<u8>`
+ --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
-LL | unsafe { read(self) }
- | ---------- inside `ptr::const_ptr::<impl *const u8>::read` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+LL | copy_nonoverlapping(src, tmp.as_mut_ptr(), 1);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: inside `ptr::const_ptr::<impl *const u8>::read`
+ --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
- ::: $DIR/issue-miri-1910.rs:8:5
+LL | unsafe { read(self) }
+ | ^^^^^^^^^^
+note: inside `C`
+ --> $DIR/issue-miri-1910.rs:8:5
|
LL | (&foo as *const _ as *const u8).add(one_and_a_half_pointers).read();
- | ------------------------------------------------------------------- inside `C` at $DIR/issue-miri-1910.rs:8:5
- |
- = 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
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
diff --git a/src/test/ui/consts/min_const_fn/promotion.stderr b/src/test/ui/consts/min_const_fn/promotion.stderr
index 550423c2d..0b8dc0ce0 100644
--- a/src/test/ui/consts/min_const_fn/promotion.stderr
+++ b/src/test/ui/consts/min_const_fn/promotion.stderr
@@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promotion.rs:11:27
|
LL | let x: &'static () = &foo1();
- | ----------- ^^^^^^ creates a temporary which is freed while still in use
+ | ----------- ^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -13,7 +13,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promotion.rs:12:28
|
LL | let y: &'static i32 = &foo2(42);
- | ------------ ^^^^^^^^ creates a temporary which is freed while still in use
+ | ------------ ^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -24,7 +24,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promotion.rs:13:28
|
LL | let z: &'static i32 = &foo3();
- | ------------ ^^^^^^ creates a temporary which is freed while still in use
+ | ------------ ^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -35,7 +35,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promotion.rs:14:34
|
LL | let a: &'static Cell<i32> = &foo4();
- | ------------------ ^^^^^^ creates a temporary which is freed while still in use
+ | ------------------ ^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -46,7 +46,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promotion.rs:15:42
|
LL | let a: &'static Option<Cell<i32>> = &foo5();
- | -------------------------- ^^^^^^ creates a temporary which is freed while still in use
+ | -------------------------- ^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
LL | let a: &'static Option<Cell<i32>> = &foo6();
@@ -57,7 +57,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promotion.rs:16:42
|
LL | let a: &'static Option<Cell<i32>> = &foo6();
- | -------------------------- ^^^^^^ creates a temporary which is freed while still in use
+ | -------------------------- ^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
LL | }
diff --git a/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr b/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr
index 840d698eb..cf3fd88d0 100644
--- a/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr
+++ b/src/test/ui/consts/miri_unleashed/abi-mismatch.stderr
@@ -2,13 +2,18 @@ error[E0080]: could not evaluate static initializer
--> $DIR/abi-mismatch.rs:9:5
|
LL | my_fn();
+ | ^^^^^^^ calling a function with calling convention C using calling convention Rust
+ |
+note: inside `call_rust_fn`
+ --> $DIR/abi-mismatch.rs:9:5
+ |
+LL | my_fn();
| ^^^^^^^
- | |
- | calling a function with calling convention C using calling convention Rust
- | inside `call_rust_fn` at $DIR/abi-mismatch.rs:9:5
-...
+note: inside `VAL`
+ --> $DIR/abi-mismatch.rs:15:18
+ |
LL | static VAL: () = call_rust_fn(unsafe { std::mem::transmute(c_fn as extern "C" fn()) });
- | --------------------------------------------------------------------- inside `VAL` at $DIR/abi-mismatch.rs:15:18
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: skipping const checks
|
diff --git a/src/test/ui/consts/miri_unleashed/assoc_const.rs b/src/test/ui/consts/miri_unleashed/assoc_const.rs
index 76ed667a5..7bb0c1b77 100644
--- a/src/test/ui/consts/miri_unleashed/assoc_const.rs
+++ b/src/test/ui/consts/miri_unleashed/assoc_const.rs
@@ -26,5 +26,5 @@ fn main() {
// this is fine, but would have been forbidden by the static checks on `F`
let x = <() as Bar<u32, ()>>::F;
// this test only causes errors due to the line below, so post-monomorphization
- let y = <String as Bar<Vec<u32>, String>>::F; //~ ERROR erroneous constant
+ let y = <String as Bar<Vec<u32>, String>>::F; //~ constant
}
diff --git a/src/test/ui/consts/miri_unleashed/assoc_const.stderr b/src/test/ui/consts/miri_unleashed/assoc_const.stderr
index 519bd0748..b26f121db 100644
--- a/src/test/ui/consts/miri_unleashed/assoc_const.stderr
+++ b/src/test/ui/consts/miri_unleashed/assoc_const.stderr
@@ -2,22 +2,41 @@ error[E0080]: evaluation of `<std::string::String as Bar<std::vec::Vec<u32>, std
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
LL | pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling non-const function `<Vec<u32> as Drop>::drop`
+ |
+note: inside `std::ptr::drop_in_place::<Vec<u32>> - shim(Some(Vec<u32>))`
+ --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+ |
+LL | pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | calling non-const function `<Vec<u32> as Drop>::drop`
- | inside `std::ptr::drop_in_place::<Vec<u32>> - shim(Some(Vec<u32>))` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
- | inside `std::ptr::drop_in_place::<(Vec<u32>, u32)> - shim(Some((Vec<u32>, u32)))` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+note: inside `std::ptr::drop_in_place::<(Vec<u32>, u32)> - shim(Some((Vec<u32>, u32)))`
+ --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
- ::: $DIR/assoc_const.rs:12:31
+LL | pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: inside `<String as Bar<Vec<u32>, String>>::F`
+ --> $DIR/assoc_const.rs:12:31
|
LL | const F: u32 = (U::X, 42).1;
- | - inside `<String as Bar<Vec<u32>, String>>::F` at $DIR/assoc_const.rs:12:31
+ | ^
+
+note: erroneous constant used
+ --> $DIR/assoc_const.rs:29:13
+ |
+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;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error[E0080]: erroneous constant used
+note: erroneous constant used
--> $DIR/assoc_const.rs:29:13
|
LL | let y = <String as Bar<Vec<u32>, String>>::F;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
warning: skipping const checks
|
@@ -27,6 +46,6 @@ help: skipping check that does not even have a feature gate
LL | const F: u32 = (U::X, 42).1;
| ^^^^^^^^^^
-error: aborting due to 2 previous errors; 1 warning emitted
+error: aborting due to previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/miri_unleashed/assoc_const_2.rs b/src/test/ui/consts/miri_unleashed/assoc_const_2.rs
index 8377141ea..aad5b3460 100644
--- a/src/test/ui/consts/miri_unleashed/assoc_const_2.rs
+++ b/src/test/ui/consts/miri_unleashed/assoc_const_2.rs
@@ -24,5 +24,5 @@ impl Bar<String> for String {}
fn main() {
let x = <() as Bar<()>>::F;
// this test only causes errors due to the line below, so post-monomorphization
- let y = <String as Bar<String>>::F; //~ ERROR erroneous constant
+ let y = <String as Bar<String>>::F; //~ constant
}
diff --git a/src/test/ui/consts/miri_unleashed/assoc_const_2.stderr b/src/test/ui/consts/miri_unleashed/assoc_const_2.stderr
index 2bf753c2b..fc4b18056 100644
--- a/src/test/ui/consts/miri_unleashed/assoc_const_2.stderr
+++ b/src/test/ui/consts/miri_unleashed/assoc_const_2.stderr
@@ -4,12 +4,24 @@ error[E0080]: evaluation of `<std::string::String as Bar<std::string::String>>::
LL | const F: u32 = 100 / U::X;
| ^^^^^^^^^^ attempt to divide `100_u32` by zero
-error[E0080]: erroneous constant used
+note: erroneous constant used
--> $DIR/assoc_const_2.rs:27:13
|
LL | let y = <String as Bar<String>>::F;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ referenced constant has errors
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: aborting due to 2 previous errors
+note: erroneous constant used
+ --> $DIR/assoc_const_2.rs:27:13
+ |
+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/src/test/ui/consts/miri_unleashed/drop.stderr b/src/test/ui/consts/miri_unleashed/drop.stderr
index a3a502723..e2e2f16d5 100644
--- a/src/test/ui/consts/miri_unleashed/drop.stderr
+++ b/src/test/ui/consts/miri_unleashed/drop.stderr
@@ -2,15 +2,18 @@ error[E0080]: could not evaluate static initializer
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
LL | pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | calling non-const function `<Vec<i32> as Drop>::drop`
- | inside `std::ptr::drop_in_place::<Vec<i32>> - shim(Some(Vec<i32>))` at $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling non-const function `<Vec<i32> as Drop>::drop`
+ |
+note: inside `std::ptr::drop_in_place::<Vec<i32>> - shim(Some(Vec<i32>))`
+ --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
|
- ::: $DIR/drop.rs:17:1
+LL | pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: inside `TEST_BAD`
+ --> $DIR/drop.rs:17:1
|
LL | };
- | - inside `TEST_BAD` at $DIR/drop.rs:17:1
+ | ^
warning: skipping const checks
|
diff --git a/src/test/ui/consts/miri_unleashed/tls.stderr b/src/test/ui/consts/miri_unleashed/tls.stderr
index 436c51123..7aaeadd04 100644
--- a/src/test/ui/consts/miri_unleashed/tls.stderr
+++ b/src/test/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:6 ~ tls[78b0]::A))
+ | ^ cannot access thread local static (DefId(0:4 ~ tls[78b0]::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:6 ~ tls[78b0]::A))
+ | ^ cannot access thread local static (DefId(0:4 ~ tls[78b0]::A))
warning: skipping const checks
|
diff --git a/src/test/ui/consts/missing_span_in_backtrace.rs b/src/test/ui/consts/missing_span_in_backtrace.rs
new file mode 100644
index 000000000..c4930b73a
--- /dev/null
+++ b/src/test/ui/consts/missing_span_in_backtrace.rs
@@ -0,0 +1,27 @@
+// compile-flags: -Z simulate-remapped-rust-src-base=/rustc/FAKE_PREFIX -Z translate-remapped-path-to-local-path=no -Z ui-testing=no
+// normalize-stderr-test "alloc[0-9]+" -> "ALLOC_ID"
+
+#![feature(const_swap)]
+#![feature(const_mut_refs)]
+use std::{
+ mem::{self, MaybeUninit},
+ ptr,
+};
+
+const X: () = {
+ let mut ptr1 = &1;
+ let mut ptr2 = &2;
+
+ // Swap them, bytewise.
+ unsafe {
+ ptr::swap_nonoverlapping(
+ &mut ptr1 as *mut _ as *mut MaybeUninit<u8>,
+ &mut ptr2 as *mut _ as *mut MaybeUninit<u8>,
+ mem::size_of::<&i32>(),
+ );
+ }
+};
+
+fn main() {
+ X
+}
diff --git a/src/test/ui/consts/missing_span_in_backtrace.stderr b/src/test/ui/consts/missing_span_in_backtrace.stderr
new file mode 100644
index 000000000..e6d3d5199
--- /dev/null
+++ b/src/test/ui/consts/missing_span_in_backtrace.stderr
@@ -0,0 +1,28 @@
+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_ID
+ |
+ = 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
+note: inside `std::ptr::read::<MaybeUninit<MaybeUninit<u8>>>`
+ --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+note: inside `mem::swap_simple::<MaybeUninit<MaybeUninit<u8>>>`
+ --> $SRC_DIR/core/src/mem/mod.rs:LL:COL
+note: inside `ptr::swap_nonoverlapping_simple_untyped::<MaybeUninit<u8>>`
+ --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+note: inside `swap_nonoverlapping::<MaybeUninit<u8>>`
+ --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+note: inside `X`
+ --> $DIR/missing_span_in_backtrace.rs:17:9
+ |
+17 | / ptr::swap_nonoverlapping(
+18 | | &mut ptr1 as *mut _ as *mut MaybeUninit<u8>,
+19 | | &mut ptr2 as *mut _ as *mut MaybeUninit<u8>,
+20 | | mem::size_of::<&i32>(),
+21 | | );
+ | |_________^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/offset_from_ub.stderr b/src/test/ui/consts/offset_from_ub.stderr
index 62a087d94..9578d90ea 100644
--- a/src/test/ui/consts/offset_from_ub.stderr
+++ b/src/test/ui/consts/offset_from_ub.stderr
@@ -8,15 +8,18 @@ error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
LL | unsafe { intrinsics::ptr_offset_from(self, origin) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | `ptr_offset_from` called on pointers into different allocations
- | inside `ptr::const_ptr::<impl *const u8>::offset_from` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `ptr_offset_from` called on pointers into different allocations
+ |
+note: inside `ptr::const_ptr::<impl *const u8>::offset_from`
+ --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
- ::: $DIR/offset_from_ub.rs:24:14
+LL | unsafe { intrinsics::ptr_offset_from(self, origin) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: inside `NOT_PTR`
+ --> $DIR/offset_from_ub.rs:24:14
|
LL | unsafe { (42 as *const u8).offset_from(&5u8) as usize }
- | ----------------------------------- inside `NOT_PTR` at $DIR/offset_from_ub.rs:24:14
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0080]: evaluation of constant value failed
--> $DIR/offset_from_ub.rs:31:14
@@ -88,29 +91,35 @@ error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
LL | unsafe { intrinsics::ptr_offset_from(self, origin) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | out-of-bounds offset_from: null pointer is a dangling pointer (it has no provenance)
- | inside `ptr::const_ptr::<impl *const u8>::offset_from` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: null pointer is a dangling pointer (it has no provenance)
|
- ::: $DIR/offset_from_ub.rs:115:14
+note: inside `ptr::const_ptr::<impl *const u8>::offset_from`
+ --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ |
+LL | unsafe { intrinsics::ptr_offset_from(self, origin) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: inside `OFFSET_VERY_FAR1`
+ --> $DIR/offset_from_ub.rs:115:14
|
LL | unsafe { ptr2.offset_from(ptr1) }
- | ---------------------- inside `OFFSET_VERY_FAR1` at $DIR/offset_from_ub.rs:115:14
+ | ^^^^^^^^^^^^^^^^^^^^^^
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
LL | unsafe { intrinsics::ptr_offset_from(self, origin) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | out-of-bounds offset_from: null pointer is a dangling pointer (it has no provenance)
- | inside `ptr::const_ptr::<impl *const u8>::offset_from` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds offset_from: null pointer is a dangling pointer (it has no provenance)
|
- ::: $DIR/offset_from_ub.rs:121:14
+note: inside `ptr::const_ptr::<impl *const u8>::offset_from`
+ --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ |
+LL | unsafe { intrinsics::ptr_offset_from(self, origin) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: inside `OFFSET_VERY_FAR2`
+ --> $DIR/offset_from_ub.rs:121:14
|
LL | unsafe { ptr1.offset_from(ptr2.wrapping_offset(1)) }
- | ----------------------------------------- inside `OFFSET_VERY_FAR2` at $DIR/offset_from_ub.rs:121:14
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 15 previous errors
diff --git a/src/test/ui/consts/offset_ub.stderr b/src/test/ui/consts/offset_ub.stderr
index 5a792bba5..7938f70a2 100644
--- a/src/test/ui/consts/offset_ub.stderr
+++ b/src/test/ui/consts/offset_ub.stderr
@@ -2,169 +2,205 @@ error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
LL | unsafe { intrinsics::offset(self, count) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | overflowing in-bounds pointer arithmetic
- | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing in-bounds pointer arithmetic
+ |
+note: inside `ptr::const_ptr::<impl *const u8>::offset`
+ --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
- ::: $DIR/offset_ub.rs:7:46
+LL | unsafe { intrinsics::offset(self, count) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: inside `BEFORE_START`
+ --> $DIR/offset_ub.rs:7:46
|
LL | pub const BEFORE_START: *const u8 = unsafe { (&0u8 as *const u8).offset(-1) };
- | ------------------------------ inside `BEFORE_START` at $DIR/offset_ub.rs:7:46
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
LL | unsafe { intrinsics::offset(self, count) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | out-of-bounds pointer arithmetic: allocN has size 1, so pointer to 2 bytes starting at offset 0 is out-of-bounds
- | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: allocN has size 1, so pointer to 2 bytes starting at offset 0 is out-of-bounds
|
- ::: $DIR/offset_ub.rs:8:43
+note: inside `ptr::const_ptr::<impl *const u8>::offset`
+ --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ |
+LL | unsafe { intrinsics::offset(self, count) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: inside `AFTER_END`
+ --> $DIR/offset_ub.rs:8:43
|
LL | pub const AFTER_END: *const u8 = unsafe { (&0u8 as *const u8).offset(2) };
- | ----------------------------- inside `AFTER_END` at $DIR/offset_ub.rs:8:43
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
LL | unsafe { intrinsics::offset(self, count) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | out-of-bounds pointer arithmetic: allocN has size 100, so pointer to 101 bytes starting at offset 0 is out-of-bounds
- | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: allocN has size 100, so pointer to 101 bytes starting at offset 0 is out-of-bounds
|
- ::: $DIR/offset_ub.rs:9:45
+note: inside `ptr::const_ptr::<impl *const u8>::offset`
+ --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ |
+LL | unsafe { intrinsics::offset(self, count) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: inside `AFTER_ARRAY`
+ --> $DIR/offset_ub.rs:9:45
|
LL | pub const AFTER_ARRAY: *const u8 = unsafe { [0u8; 100].as_ptr().offset(101) };
- | ------------------------------- inside `AFTER_ARRAY` at $DIR/offset_ub.rs:9:45
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
LL | unsafe { intrinsics::offset(self, count) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | overflowing in-bounds pointer arithmetic
- | inside `ptr::const_ptr::<impl *const u16>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing in-bounds pointer arithmetic
+ |
+note: inside `ptr::const_ptr::<impl *const u16>::offset`
+ --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
- ::: $DIR/offset_ub.rs:11:43
+LL | unsafe { intrinsics::offset(self, count) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: inside `OVERFLOW`
+ --> $DIR/offset_ub.rs:11:43
|
LL | pub const OVERFLOW: *const u16 = unsafe { [0u16; 1].as_ptr().offset(isize::MAX) };
- | ------------------------------------- inside `OVERFLOW` at $DIR/offset_ub.rs:11:43
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
LL | unsafe { intrinsics::offset(self, count) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | overflowing in-bounds pointer arithmetic
- | inside `ptr::const_ptr::<impl *const u16>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing in-bounds pointer arithmetic
|
- ::: $DIR/offset_ub.rs:12:44
+note: inside `ptr::const_ptr::<impl *const u16>::offset`
+ --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ |
+LL | unsafe { intrinsics::offset(self, count) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: inside `UNDERFLOW`
+ --> $DIR/offset_ub.rs:12:44
|
LL | pub const UNDERFLOW: *const u16 = unsafe { [0u16; 1].as_ptr().offset(isize::MIN) };
- | ------------------------------------- inside `UNDERFLOW` at $DIR/offset_ub.rs:12:44
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
LL | unsafe { intrinsics::offset(self, count) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | overflowing in-bounds pointer arithmetic
- | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing in-bounds pointer arithmetic
|
- ::: $DIR/offset_ub.rs:13:56
+note: inside `ptr::const_ptr::<impl *const u8>::offset`
+ --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ |
+LL | unsafe { intrinsics::offset(self, count) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: inside `OVERFLOW_ADDRESS_SPACE`
+ --> $DIR/offset_ub.rs:13:56
|
LL | pub const OVERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (usize::MAX as *const u8).offset(2) };
- | ----------------------------------- inside `OVERFLOW_ADDRESS_SPACE` at $DIR/offset_ub.rs:13:56
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
LL | unsafe { intrinsics::offset(self, count) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | overflowing in-bounds pointer arithmetic
- | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ overflowing in-bounds pointer arithmetic
+ |
+note: inside `ptr::const_ptr::<impl *const u8>::offset`
+ --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
- ::: $DIR/offset_ub.rs:14:57
+LL | unsafe { intrinsics::offset(self, count) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: inside `UNDERFLOW_ADDRESS_SPACE`
+ --> $DIR/offset_ub.rs:14:57
|
LL | pub const UNDERFLOW_ADDRESS_SPACE: *const u8 = unsafe { (1 as *const u8).offset(-2) };
- | --------------------------- inside `UNDERFLOW_ADDRESS_SPACE` at $DIR/offset_ub.rs:14:57
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
LL | unsafe { intrinsics::offset(self, count) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | out-of-bounds pointer arithmetic: allocN has size 1, so pointer to 2 bytes starting at offset -4 is out-of-bounds
- | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: allocN has size 1, so pointer to 2 bytes starting at offset -4 is out-of-bounds
|
- ::: $DIR/offset_ub.rs:15:49
+note: inside `ptr::const_ptr::<impl *const u8>::offset`
+ --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ |
+LL | unsafe { intrinsics::offset(self, count) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: inside `NEGATIVE_OFFSET`
+ --> $DIR/offset_ub.rs:15:49
|
LL | pub const NEGATIVE_OFFSET: *const u8 = unsafe { [0u8; 1].as_ptr().wrapping_offset(-2).offset(-2) };
- | ------------------------------------------------ inside `NEGATIVE_OFFSET` at $DIR/offset_ub.rs:15:49
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
LL | unsafe { intrinsics::offset(self, count) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | out-of-bounds pointer arithmetic: allocN has size 0, so pointer to 1 byte starting at offset 0 is out-of-bounds
- | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: allocN has size 0, so pointer to 1 byte starting at offset 0 is out-of-bounds
|
- ::: $DIR/offset_ub.rs:17:50
+note: inside `ptr::const_ptr::<impl *const u8>::offset`
+ --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ |
+LL | unsafe { intrinsics::offset(self, count) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: inside `ZERO_SIZED_ALLOC`
+ --> $DIR/offset_ub.rs:17:50
|
LL | pub const ZERO_SIZED_ALLOC: *const u8 = unsafe { [0u8; 0].as_ptr().offset(1) };
- | --------------------------- inside `ZERO_SIZED_ALLOC` at $DIR/offset_ub.rs:17:50
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
|
LL | unsafe { intrinsics::offset(self, count) as *mut T }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | out-of-bounds pointer arithmetic: 0x1[noalloc] is a dangling pointer (it has no provenance)
- | inside `ptr::mut_ptr::<impl *mut u8>::offset` at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: 0x1[noalloc] is a dangling pointer (it has no provenance)
+ |
+note: inside `ptr::mut_ptr::<impl *mut u8>::offset`
+ --> $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL
|
- ::: $DIR/offset_ub.rs:18:42
+LL | unsafe { intrinsics::offset(self, count) as *mut T }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: inside `DANGLING`
+ --> $DIR/offset_ub.rs:18:42
|
LL | pub const DANGLING: *const u8 = unsafe { ptr::NonNull::<u8>::dangling().as_ptr().offset(4) };
- | ------------------------------------------------- inside `DANGLING` at $DIR/offset_ub.rs:18:42
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
LL | unsafe { intrinsics::offset(self, count) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | out-of-bounds pointer arithmetic: null pointer is a dangling pointer (it has no provenance)
- | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: null pointer is a dangling pointer (it has no provenance)
|
- ::: $DIR/offset_ub.rs:21:50
+note: inside `ptr::const_ptr::<impl *const u8>::offset`
+ --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ |
+LL | unsafe { intrinsics::offset(self, count) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: inside `NULL_OFFSET_ZERO`
+ --> $DIR/offset_ub.rs:21:50
|
LL | pub const NULL_OFFSET_ZERO: *const u8 = unsafe { ptr::null::<u8>().offset(0) };
- | --------------------------- inside `NULL_OFFSET_ZERO` at $DIR/offset_ub.rs:21:50
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
LL | unsafe { intrinsics::offset(self, count) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | out-of-bounds pointer arithmetic: 0x7f..f[noalloc] is a dangling pointer (it has no provenance)
- | inside `ptr::const_ptr::<impl *const u8>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: 0x7f..f[noalloc] is a dangling pointer (it has no provenance)
|
- ::: $DIR/offset_ub.rs:24:47
+note: inside `ptr::const_ptr::<impl *const u8>::offset`
+ --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ |
+LL | unsafe { intrinsics::offset(self, count) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: inside `UNDERFLOW_ABS`
+ --> $DIR/offset_ub.rs:24:47
|
LL | pub const UNDERFLOW_ABS: *const u8 = unsafe { (usize::MAX as *const u8).offset(isize::MIN) };
- | -------------------------------------------- inside `UNDERFLOW_ABS` at $DIR/offset_ub.rs:24:47
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 12 previous errors
diff --git a/src/test/ui/consts/promote-not.stderr b/src/test/ui/consts/promote-not.stderr
index 0d0b0f9c6..b93358e8d 100644
--- a/src/test/ui/consts/promote-not.stderr
+++ b/src/test/ui/consts/promote-not.stderr
@@ -5,14 +5,14 @@ LL | static mut TEST1: Option<&mut [i32]> = Some(&mut [1, 2, 3]);
| ----------^^^^^^^^^-
| | | |
| | | temporary value is freed at the end of this statement
- | | creates a temporary which is freed while still in use
+ | | creates a temporary value which is freed while still in use
| using this value as a static requires that borrow lasts for `'static`
error[E0716]: temporary value dropped while borrowed
--> $DIR/promote-not.rs:11:18
|
LL | let x = &mut [1,2,3];
- | ^^^^^^^ creates a temporary which is freed while still in use
+ | ^^^^^^^ creates a temporary value which is freed while still in use
LL | x
| - using this value as a static requires that borrow lasts for `'static`
LL | };
@@ -22,7 +22,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promote-not.rs:20:32
|
LL | let _x: &'static () = &foo();
- | ----------- ^^^^^ creates a temporary which is freed while still in use
+ | ----------- ^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
LL | }
@@ -32,7 +32,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promote-not.rs:28:29
|
LL | let _x: &'static i32 = &unsafe { U { x: 0 }.x };
- | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
LL | }
@@ -42,7 +42,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promote-not.rs:33:29
|
LL | let _x: &'static i32 = &unsafe { U { x: 0 }.x };
- | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ------------ ^^^^^^^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
LL | };
@@ -52,7 +52,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promote-not.rs:39:29
|
LL | let _val: &'static _ = &(Cell::new(1), 2).1;
- | ---------- ^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ---------- ^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
LL | };
@@ -62,7 +62,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promote-not.rs:46:29
|
LL | let _val: &'static _ = &(Cell::new(1), 2).0;
- | ---------- ^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ---------- ^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -73,7 +73,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promote-not.rs:47:29
|
LL | let _val: &'static _ = &(Cell::new(1), 2).1;
- | ---------- ^^^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ---------- ^^^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -84,7 +84,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promote-not.rs:50:29
|
LL | let _val: &'static _ = &(1/0);
- | ---------- ^^^^^ creates a temporary which is freed while still in use
+ | ---------- ^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -95,7 +95,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promote-not.rs:51:29
|
LL | let _val: &'static _ = &(1/(1-1));
- | ---------- ^^^^^^^^^ creates a temporary which is freed while still in use
+ | ---------- ^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -106,7 +106,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promote-not.rs:52:29
|
LL | let _val: &'static _ = &(1%0);
- | ---------- ^^^^^ creates a temporary which is freed while still in use
+ | ---------- ^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -117,7 +117,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promote-not.rs:53:29
|
LL | let _val: &'static _ = &(1%(1-1));
- | ---------- ^^^^^^^^^ creates a temporary which is freed while still in use
+ | ---------- ^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -128,7 +128,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promote-not.rs:54:29
|
LL | let _val: &'static _ = &([1,2,3][4]+1);
- | ---------- ^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ---------- ^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -139,7 +139,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promote-not.rs:57:29
|
LL | let _val: &'static _ = &TEST_DROP;
- | ---------- ^^^^^^^^^ creates a temporary which is freed while still in use
+ | ---------- ^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -150,7 +150,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promote-not.rs:59:29
|
LL | let _val: &'static _ = &&TEST_DROP;
- | ---------- ^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ---------- ^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -161,7 +161,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promote-not.rs:59:30
|
LL | let _val: &'static _ = &&TEST_DROP;
- | ---------- ^^^^^^^^^ creates a temporary which is freed while still in use
+ | ---------- ^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -172,7 +172,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promote-not.rs:62:29
|
LL | let _val: &'static _ = &(&TEST_DROP,);
- | ---------- ^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ---------- ^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -183,7 +183,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promote-not.rs:62:31
|
LL | let _val: &'static _ = &(&TEST_DROP,);
- | ---------- ^^^^^^^^^ creates a temporary which is freed while still in use
+ | ---------- ^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -194,7 +194,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promote-not.rs:65:29
|
LL | let _val: &'static _ = &[&TEST_DROP; 1];
- | ---------- ^^^^^^^^^^^^^^^ creates a temporary which is freed while still in use
+ | ---------- ^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -207,7 +207,7 @@ error[E0716]: temporary value dropped while borrowed
LL | let _val: &'static _ = &[&TEST_DROP; 1];
| ---------- ^^^^^^^^^ - temporary value is freed at the end of this statement
| | |
- | | creates a temporary which is freed while still in use
+ | | creates a temporary value which is freed while still in use
| type annotation requires that borrow lasts for `'static`
error: aborting due to 20 previous errors
diff --git a/src/test/ui/consts/promote_const_let.stderr b/src/test/ui/consts/promote_const_let.stderr
index c47d297c9..975a235a6 100644
--- a/src/test/ui/consts/promote_const_let.stderr
+++ b/src/test/ui/consts/promote_const_let.stderr
@@ -19,7 +19,7 @@ LL | let x: &'static u32 = &{
LL | | let y = 42;
LL | | y
LL | | };
- | |_____^ creates a temporary which is freed while still in use
+ | |_____^ creates a temporary value which is freed while still in use
LL | }
| - temporary value is freed at the end of this statement
diff --git a/src/test/ui/consts/promoted-const-drop.stderr b/src/test/ui/consts/promoted-const-drop.stderr
index 184ba0ea3..480283417 100644
--- a/src/test/ui/consts/promoted-const-drop.stderr
+++ b/src/test/ui/consts/promoted-const-drop.stderr
@@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promoted-const-drop.rs:13:26
|
LL | let _: &'static A = &A();
- | ---------- ^^^ creates a temporary which is freed while still in use
+ | ---------- ^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
LL | let _: &'static [A] = &[C];
@@ -13,7 +13,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/promoted-const-drop.rs:14:28
|
LL | let _: &'static [A] = &[C];
- | ------------ ^^^ creates a temporary which is freed while still in use
+ | ------------ ^^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
LL | }
diff --git a/src/test/ui/consts/ptr_comparisons.stderr b/src/test/ui/consts/ptr_comparisons.stderr
index b71964b92..274753ef1 100644
--- a/src/test/ui/consts/ptr_comparisons.stderr
+++ b/src/test/ui/consts/ptr_comparisons.stderr
@@ -2,15 +2,18 @@ error[E0080]: evaluation of constant value failed
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
LL | unsafe { intrinsics::offset(self, count) }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- | |
- | out-of-bounds pointer arithmetic: alloc3 has size $WORD, so pointer to $TWO_WORDS bytes starting at offset 0 is out-of-bounds
- | inside `ptr::const_ptr::<impl *const usize>::offset` at $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer arithmetic: alloc3 has size $WORD, so pointer to $TWO_WORDS bytes starting at offset 0 is out-of-bounds
+ |
+note: inside `ptr::const_ptr::<impl *const usize>::offset`
+ --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
|
- ::: $DIR/ptr_comparisons.rs:50:34
+LL | unsafe { intrinsics::offset(self, count) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: inside `_`
+ --> $DIR/ptr_comparisons.rs:50:34
|
LL | const _: *const usize = unsafe { (FOO as *const usize).offset(2) };
- | ------------------------------- inside `_` at $DIR/ptr_comparisons.rs:50:34
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0080]: evaluation of constant value failed
--> $DIR/ptr_comparisons.rs:53:33
diff --git a/src/test/ui/consts/qualif-union.stderr b/src/test/ui/consts/qualif-union.stderr
index 8ec68ada0..d847cf88f 100644
--- a/src/test/ui/consts/qualif-union.stderr
+++ b/src/test/ui/consts/qualif-union.stderr
@@ -2,7 +2,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/qualif-union.rs:28:26
|
LL | let _: &'static _ = &C1;
- | ---------- ^^ creates a temporary which is freed while still in use
+ | ---------- ^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -13,7 +13,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/qualif-union.rs:29:26
|
LL | let _: &'static _ = &C2;
- | ---------- ^^ creates a temporary which is freed while still in use
+ | ---------- ^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -24,7 +24,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/qualif-union.rs:30:26
|
LL | let _: &'static _ = &C3;
- | ---------- ^^ creates a temporary which is freed while still in use
+ | ---------- ^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
...
@@ -35,7 +35,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/qualif-union.rs:31:26
|
LL | let _: &'static _ = &C4;
- | ---------- ^^ creates a temporary which is freed while still in use
+ | ---------- ^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
LL | let _: &'static _ = &C5;
@@ -46,7 +46,7 @@ error[E0716]: temporary value dropped while borrowed
--> $DIR/qualif-union.rs:32:26
|
LL | let _: &'static _ = &C5;
- | ---------- ^^ creates a temporary which is freed while still in use
+ | ---------- ^^ creates a temporary value which is freed while still in use
| |
| type annotation requires that borrow lasts for `'static`
LL | }
diff --git a/src/test/ui/consts/recursive.stderr b/src/test/ui/consts/recursive.stderr
index 14fa3da7a..60ce64d2a 100644
--- a/src/test/ui/consts/recursive.stderr
+++ b/src/test/ui/consts/recursive.stderr
@@ -13,14 +13,23 @@ error[E0080]: evaluation of constant value failed
--> $DIR/recursive.rs:4:5
|
LL | f(x);
+ | ^^^^ reached the configured maximum number of stack frames
+ |
+note: inside `f::<i32>`
+ --> $DIR/recursive.rs:4:5
+ |
+LL | f(x);
| ^^^^
- | |
- | reached the configured maximum number of stack frames
- | inside `f::<i32>` at $DIR/recursive.rs:4:5
- | [... 126 additional calls inside `f::<i32>` at $DIR/recursive.rs:4:5 ...]
-...
+note: [... 126 additional calls inside `f::<i32>` ...]
+ --> $DIR/recursive.rs:4:5
+ |
+LL | f(x);
+ | ^^^^
+note: inside `X`
+ --> $DIR/recursive.rs:8:15
+ |
LL | const X: () = f(1);
- | ---- inside `X` at $DIR/recursive.rs:8:15
+ | ^^^^
error: aborting due to previous error; 1 warning emitted
diff --git a/src/test/ui/consts/uninhabited-const-issue-61744.rs b/src/test/ui/consts/uninhabited-const-issue-61744.rs
index a07c39882..ca6449cce 100644
--- a/src/test/ui/consts/uninhabited-const-issue-61744.rs
+++ b/src/test/ui/consts/uninhabited-const-issue-61744.rs
@@ -15,5 +15,5 @@ trait Const {
impl<T> Const for T {}
pub fn main() -> () {
- dbg!(i32::CONSTANT); //~ ERROR erroneous constant used
+ dbg!(i32::CONSTANT); //~ constant
}
diff --git a/src/test/ui/consts/uninhabited-const-issue-61744.stderr b/src/test/ui/consts/uninhabited-const-issue-61744.stderr
index 9c7cc8861..3a94e1931 100644
--- a/src/test/ui/consts/uninhabited-const-issue-61744.stderr
+++ b/src/test/ui/consts/uninhabited-const-issue-61744.stderr
@@ -2,150 +2,667 @@ error[E0080]: evaluation of `<i32 as Const>::CONSTANT` failed
--> $DIR/uninhabited-const-issue-61744.rs:4:5
|
LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^ reached the configured maximum number of stack frames
+ |
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
| ^^^^^^^^^^^^^^^^^^
- | |
- | reached the configured maximum number of stack frames
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<!>` at $DIR/uninhabited-const-issue-61744.rs:4:5
- | inside `fake_type::<i32>` at $DIR/uninhabited-const-issue-61744.rs:4:5
-...
-LL | fake_type()
- | -----------
- | |
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
- | inside `hint_unreachable` at $DIR/uninhabited-const-issue-61744.rs:8:5
-...
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<!>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `hint_unreachable`
+ --> $DIR/uninhabited-const-issue-61744.rs:8:5
+ |
+LL | fake_type()
+ | ^^^^^^^^^^^
+note: inside `fake_type::<i32>`
+ --> $DIR/uninhabited-const-issue-61744.rs:4:5
+ |
+LL | hint_unreachable()
+ | ^^^^^^^^^^^^^^^^^^
+note: inside `<i32 as Const>::CONSTANT`
+ --> $DIR/uninhabited-const-issue-61744.rs:12:36
+ |
LL | const CONSTANT: i32 = unsafe { fake_type() };
- | ----------- inside `<i32 as Const>::CONSTANT` at $DIR/uninhabited-const-issue-61744.rs:12:36
+ | ^^^^^^^^^^^
+
+note: erroneous constant used
+ --> $DIR/uninhabited-const-issue-61744.rs:18:10
+ |
+LL | dbg!(i32::CONSTANT);
+ | ^^^^^^^^^^^^^
+
+note: erroneous constant used
+ --> $DIR/uninhabited-const-issue-61744.rs:18:10
+ |
+LL | dbg!(i32::CONSTANT);
+ | ^^^^^^^^^^^^^
-error[E0080]: erroneous constant used
+note: erroneous constant used
--> $DIR/uninhabited-const-issue-61744.rs:18:10
|
LL | dbg!(i32::CONSTANT);
- | ^^^^^^^^^^^^^ referenced constant has errors
+ | ^^^^^^^^^^^^^
-error: aborting due to 2 previous errors
+error: aborting due to previous error
For more information about this error, try `rustc --explain E0080`.