summaryrefslogtreecommitdiffstats
path: root/tests/ui/consts/const-eval
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:25:56 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:25:56 +0000
commit018c4950b9406055dec02ef0fb52f132e2bb1e2c (patch)
treea835ebdf2088ef88fa681f8fad45f09922c1ae9a /tests/ui/consts/const-eval
parentAdding debian version 1.75.0+dfsg1-5. (diff)
downloadrustc-018c4950b9406055dec02ef0fb52f132e2bb1e2c.tar.xz
rustc-018c4950b9406055dec02ef0fb52f132e2bb1e2c.zip
Merging upstream version 1.76.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/consts/const-eval')
-rw-r--r--tests/ui/consts/const-eval/assign-to-static-within-other-static.stderr2
-rw-r--r--tests/ui/consts/const-eval/conditional_array_execution.stderr2
-rw-r--r--tests/ui/consts/const-eval/const-eval-intrinsic-promotion.stderr2
-rw-r--r--tests/ui/consts/const-eval/const-eval-overflow-3.stderr2
-rw-r--r--tests/ui/consts/const-eval/const-eval-overflow-4.stderr2
-rw-r--r--tests/ui/consts/const-eval/const-eval-span.stderr2
-rw-r--r--tests/ui/consts/const-eval/const_fn_target_feature.stderr2
-rw-r--r--tests/ui/consts/const-eval/const_panic-normalize-tabs-115498.stderr2
-rw-r--r--tests/ui/consts/const-eval/const_panic_stability.e2021.stderr2
-rw-r--r--tests/ui/consts/const-eval/const_panic_track_caller.stderr2
-rw-r--r--tests/ui/consts/const-eval/erroneous-const.stderr2
-rw-r--r--tests/ui/consts/const-eval/erroneous-const2.stderr2
-rw-r--r--tests/ui/consts/const-eval/heap/alloc_intrinsic_errors.stderr2
-rw-r--r--tests/ui/consts/const-eval/heap/alloc_intrinsic_nontransient_fail.stderr2
-rw-r--r--tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.32bit.stderr4
-rw-r--r--tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.64bit.stderr4
-rw-r--r--tests/ui/consts/const-eval/heap/alloc_intrinsic_untyped.stderr2
-rw-r--r--tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.stderr2
-rw-r--r--tests/ui/consts/const-eval/index-out-of-bounds-never-type.stderr2
-rw-r--r--tests/ui/consts/const-eval/index_out_of_bounds.stderr2
-rw-r--r--tests/ui/consts/const-eval/index_out_of_bounds_propagated.stderr2
-rw-r--r--tests/ui/consts/const-eval/infinite_loop.stderr2
-rw-r--r--tests/ui/consts/const-eval/issue-44578.stderr2
-rw-r--r--tests/ui/consts/const-eval/issue-49296.stderr2
-rw-r--r--tests/ui/consts/const-eval/issue-50814-2.mir-opt.stderr2
-rw-r--r--tests/ui/consts/const-eval/issue-50814-2.normal.stderr2
-rw-r--r--tests/ui/consts/const-eval/issue-50814.stderr2
-rw-r--r--tests/ui/consts/const-eval/issue-52475.stderr2
-rw-r--r--tests/ui/consts/const-eval/issue-70723.stderr2
-rw-r--r--tests/ui/consts/const-eval/issue-85155.stderr2
-rw-r--r--tests/ui/consts/const-eval/issue-85907.stderr2
-rw-r--r--tests/ui/consts/const-eval/issue-91827-extern-types-field-offset.rs43
-rw-r--r--tests/ui/consts/const-eval/issue-91827-extern-types-field-offset.stderr9
-rw-r--r--tests/ui/consts/const-eval/issue-91827-extern-types.rs59
-rw-r--r--tests/ui/consts/const-eval/livedrop.stderr2
-rw-r--r--tests/ui/consts/const-eval/match-test-ptr-null.stderr2
-rw-r--r--tests/ui/consts/const-eval/mod-static-with-const-fn.stderr2
-rw-r--r--tests/ui/consts/const-eval/nonnull_as_ref_ub.stderr2
-rw-r--r--tests/ui/consts/const-eval/panic-assoc-never-type.stderr2
-rw-r--r--tests/ui/consts/const-eval/panic-never-type.stderr2
-rw-r--r--tests/ui/consts/const-eval/partial_ptr_overwrite.stderr2
-rw-r--r--tests/ui/consts/const-eval/promoted_const_fn_fail.stderr2
-rw-r--r--tests/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.stderr2
-rw-r--r--tests/ui/consts/const-eval/raw-bytes.32bit.stderr140
-rw-r--r--tests/ui/consts/const-eval/raw-bytes.64bit.stderr140
-rw-r--r--tests/ui/consts/const-eval/raw-bytes.rs16
-rw-r--r--tests/ui/consts/const-eval/raw-pointer-ub.stderr2
-rw-r--r--tests/ui/consts/const-eval/shift_overflow.stderr2
-rw-r--r--tests/ui/consts/const-eval/size-of-t.stderr4
-rw-r--r--tests/ui/consts/const-eval/stable-metric/ctfe-fn-call.stderr2
-rw-r--r--tests/ui/consts/const-eval/stable-metric/ctfe-labelled-loop.stderr2
-rw-r--r--tests/ui/consts/const-eval/stable-metric/ctfe-recursion.stderr2
-rw-r--r--tests/ui/consts/const-eval/transmute-const-promotion.stderr2
-rw-r--r--tests/ui/consts/const-eval/transmute-const.32bit.stderr2
-rw-r--r--tests/ui/consts/const-eval/transmute-const.64bit.stderr2
-rw-r--r--tests/ui/consts/const-eval/ub-enum-overwrite.stderr2
-rw-r--r--tests/ui/consts/const-eval/ub-incorrect-vtable.32bit.stderr22
-rw-r--r--tests/ui/consts/const-eval/ub-incorrect-vtable.64bit.stderr22
-rw-r--r--tests/ui/consts/const-eval/ub-nonnull.chalk.64bit.stderr2
-rw-r--r--tests/ui/consts/const-eval/ub-ref-ptr.rs2
-rw-r--r--tests/ui/consts/const-eval/ub-ref-ptr.stderr4
-rw-r--r--tests/ui/consts/const-eval/ub-slice-get-unchecked.stderr2
-rw-r--r--tests/ui/consts/const-eval/ub-upvars.32bit.stderr4
-rw-r--r--tests/ui/consts/const-eval/ub-upvars.64bit.stderr4
-rw-r--r--tests/ui/consts/const-eval/ub-wide-ptr.chalk.64bit.stderr2
-rw-r--r--tests/ui/consts/const-eval/ub-wide-ptr.rs2
-rw-r--r--tests/ui/consts/const-eval/ub-wide-ptr.stderr16
-rw-r--r--tests/ui/consts/const-eval/ub-write-through-immutable.rs30
-rw-r--r--tests/ui/consts/const-eval/ub-write-through-immutable.stderr55
-rw-r--r--tests/ui/consts/const-eval/union-const-eval-field.stderr2
-rw-r--r--tests/ui/consts/const-eval/union_promotion.stderr2
-rw-r--r--tests/ui/consts/const-eval/unused-broken-const-late.stderr2
-rw-r--r--tests/ui/consts/const-eval/unused-broken-const.stderr2
-rw-r--r--tests/ui/consts/const-eval/unwind-abort.stderr2
74 files changed, 359 insertions, 331 deletions
diff --git a/tests/ui/consts/const-eval/assign-to-static-within-other-static.stderr b/tests/ui/consts/const-eval/assign-to-static-within-other-static.stderr
index 4b6784acf..5300111a6 100644
--- a/tests/ui/consts/const-eval/assign-to-static-within-other-static.stderr
+++ b/tests/ui/consts/const-eval/assign-to-static-within-other-static.stderr
@@ -4,6 +4,6 @@ error[E0080]: could not evaluate static initializer
LL | FOO = 5;
| ^^^^^^^ modifying a static's initial value from another static's initializer
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/conditional_array_execution.stderr b/tests/ui/consts/const-eval/conditional_array_execution.stderr
index c3401fbae..300343780 100644
--- a/tests/ui/consts/const-eval/conditional_array_execution.stderr
+++ b/tests/ui/consts/const-eval/conditional_array_execution.stderr
@@ -4,6 +4,6 @@ error[E0080]: evaluation of constant value failed
LL | const FOO: u32 = [X - Y, Y - X][(X < Y) as usize];
| ^^^^^ attempt to compute `5_u32 - 6_u32`, which would overflow
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/const-eval-intrinsic-promotion.stderr b/tests/ui/consts/const-eval/const-eval-intrinsic-promotion.stderr
index ed6a6ee6e..d533dcaa6 100644
--- a/tests/ui/consts/const-eval/const-eval-intrinsic-promotion.stderr
+++ b/tests/ui/consts/const-eval/const-eval-intrinsic-promotion.stderr
@@ -8,6 +8,6 @@ LL | &std::intrinsics::size_of::<i32>();
LL | }
| - temporary value is freed at the end of this statement
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0716`.
diff --git a/tests/ui/consts/const-eval/const-eval-overflow-3.stderr b/tests/ui/consts/const-eval/const-eval-overflow-3.stderr
index 73f421b5b..0437cd3ad 100644
--- a/tests/ui/consts/const-eval/const-eval-overflow-3.stderr
+++ b/tests/ui/consts/const-eval/const-eval-overflow-3.stderr
@@ -4,6 +4,6 @@ error[E0080]: evaluation of constant value failed
LL | = [0; (i8::MAX + 1) as usize];
| ^^^^^^^^^^^^^ attempt to compute `i8::MAX + 1_i8`, which would overflow
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/const-eval-overflow-4.stderr b/tests/ui/consts/const-eval/const-eval-overflow-4.stderr
index 94f419319..ce5e59901 100644
--- a/tests/ui/consts/const-eval/const-eval-overflow-4.stderr
+++ b/tests/ui/consts/const-eval/const-eval-overflow-4.stderr
@@ -4,6 +4,6 @@ error[E0080]: evaluation of constant value failed
LL | : [u32; (i8::MAX as i8 + 1i8) as usize]
| ^^^^^^^^^^^^^^^^^^^^^ attempt to compute `i8::MAX + 1_i8`, which would overflow
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/const-eval-span.stderr b/tests/ui/consts/const-eval/const-eval-span.stderr
index fe33ad490..ba11759a7 100644
--- a/tests/ui/consts/const-eval/const-eval-span.stderr
+++ b/tests/ui/consts/const-eval/const-eval-span.stderr
@@ -4,6 +4,6 @@ error[E0308]: mismatched types
LL | V = CONSTANT,
| ^^^^^^^^ expected `isize`, found `S`
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/consts/const-eval/const_fn_target_feature.stderr b/tests/ui/consts/const-eval/const_fn_target_feature.stderr
index 36918b52c..0c7c69b79 100644
--- a/tests/ui/consts/const-eval/const_fn_target_feature.stderr
+++ b/tests/ui/consts/const-eval/const_fn_target_feature.stderr
@@ -4,6 +4,6 @@ error[E0080]: evaluation of constant value failed
LL | const B: () = unsafe { avx2_fn() };
| ^^^^^^^^^ calling a function that requires unavailable target features: avx2
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/const_panic-normalize-tabs-115498.stderr b/tests/ui/consts/const-eval/const_panic-normalize-tabs-115498.stderr
index 82c63dd17..5f4af2561 100644
--- a/tests/ui/consts/const-eval/const_panic-normalize-tabs-115498.stderr
+++ b/tests/ui/consts/const-eval/const_panic-normalize-tabs-115498.stderr
@@ -6,6 +6,6 @@ LL | struct Bug([u8; panic!{"\t"}]);
|
= 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
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/const_panic_stability.e2021.stderr b/tests/ui/consts/const-eval/const_panic_stability.e2021.stderr
index 9e8179181..aad36b52b 100644
--- a/tests/ui/consts/const-eval/const_panic_stability.e2021.stderr
+++ b/tests/ui/consts/const-eval/const_panic_stability.e2021.stderr
@@ -9,5 +9,5 @@ help: you might be missing a string literal to format with
LL | panic!("{}", { "foo" });
| +++++
-error: aborting due to previous error
+error: aborting due to 1 previous error
diff --git a/tests/ui/consts/const-eval/const_panic_track_caller.stderr b/tests/ui/consts/const-eval/const_panic_track_caller.stderr
index 846458176..a7df82705 100644
--- a/tests/ui/consts/const-eval/const_panic_track_caller.stderr
+++ b/tests/ui/consts/const-eval/const_panic_track_caller.stderr
@@ -15,6 +15,6 @@ note: inside `X`
LL | const X: u32 = c();
| ^^^
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/erroneous-const.stderr b/tests/ui/consts/const-eval/erroneous-const.stderr
index 0e31520fd..bd25e96c2 100644
--- a/tests/ui/consts/const-eval/erroneous-const.stderr
+++ b/tests/ui/consts/const-eval/erroneous-const.stderr
@@ -10,6 +10,6 @@ note: erroneous constant encountered
LL | PrintName::<T>::VOID;
| ^^^^^^^^^^^^^^^^^^^^
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/erroneous-const2.stderr b/tests/ui/consts/const-eval/erroneous-const2.stderr
index 4ca44694c..6a5839e3d 100644
--- a/tests/ui/consts/const-eval/erroneous-const2.stderr
+++ b/tests/ui/consts/const-eval/erroneous-const2.stderr
@@ -10,6 +10,6 @@ note: erroneous constant encountered
LL | PrintName::<i32>::VOID;
| ^^^^^^^^^^^^^^^^^^^^^^
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/heap/alloc_intrinsic_errors.stderr b/tests/ui/consts/const-eval/heap/alloc_intrinsic_errors.stderr
index 23ba2c2f5..cdde14756 100644
--- a/tests/ui/consts/const-eval/heap/alloc_intrinsic_errors.stderr
+++ b/tests/ui/consts/const-eval/heap/alloc_intrinsic_errors.stderr
@@ -15,6 +15,6 @@ note: inside `FOO`
LL | const FOO: i32 = foo();
| ^^^^^
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/heap/alloc_intrinsic_nontransient_fail.stderr b/tests/ui/consts/const-eval/heap/alloc_intrinsic_nontransient_fail.stderr
index 2103f842b..dfaecfbcd 100644
--- a/tests/ui/consts/const-eval/heap/alloc_intrinsic_nontransient_fail.stderr
+++ b/tests/ui/consts/const-eval/heap/alloc_intrinsic_nontransient_fail.stderr
@@ -6,5 +6,5 @@ LL | const FOO: *const i32 = foo();
|
= note: memory only reachable via raw pointers is not supported
-error: aborting due to previous error
+error: aborting due to 1 previous error
diff --git a/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.32bit.stderr b/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.32bit.stderr
index 82de91eff..383c167d3 100644
--- a/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.32bit.stderr
+++ b/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.32bit.stderr
@@ -6,9 +6,9 @@ LL | const BAR: &i32 = unsafe { &*(intrinsics::const_allocate(4, 4) as *mut i32)
|
= 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: 4, align: 4) {
- ╾ALLOC0╼ │ ╾──╼
+ ╾ALLOC0<imm>╼ │ ╾──╼
}
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.64bit.stderr b/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.64bit.stderr
index de23aafe0..d06792283 100644
--- a/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.64bit.stderr
+++ b/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.64bit.stderr
@@ -6,9 +6,9 @@ LL | const BAR: &i32 = unsafe { &*(intrinsics::const_allocate(4, 4) as *mut i32)
|
= 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: 8) {
- ╾ALLOC0╼ │ ╾──────╼
+ ╾ALLOC0<imm>╼ │ ╾──────╼
}
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/heap/alloc_intrinsic_untyped.stderr b/tests/ui/consts/const-eval/heap/alloc_intrinsic_untyped.stderr
index b62766473..3903ccd6a 100644
--- a/tests/ui/consts/const-eval/heap/alloc_intrinsic_untyped.stderr
+++ b/tests/ui/consts/const-eval/heap/alloc_intrinsic_untyped.stderr
@@ -6,5 +6,5 @@ LL | const BAR: *mut i32 = unsafe { intrinsics::const_allocate(4, 4) as *mut i32
|
= note: memory only reachable via raw pointers is not supported
-error: aborting due to previous error
+error: aborting due to 1 previous error
diff --git a/tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.stderr b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.stderr
index 916344a7b..d2d323e5a 100644
--- a/tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.stderr
+++ b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.stderr
@@ -4,6 +4,6 @@ error[E0080]: evaluation of constant value failed
LL | intrinsics::const_deallocate(ptr, 4, 4);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: ALLOC0 has been freed, so this pointer is dangling
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/index-out-of-bounds-never-type.stderr b/tests/ui/consts/const-eval/index-out-of-bounds-never-type.stderr
index 8bcd03005..4e7ef52f6 100644
--- a/tests/ui/consts/const-eval/index-out-of-bounds-never-type.stderr
+++ b/tests/ui/consts/const-eval/index-out-of-bounds-never-type.stderr
@@ -10,6 +10,6 @@ note: the above error was encountered while instantiating `fn f::<()>`
LL | f::<()>();
| ^^^^^^^^^
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/index_out_of_bounds.stderr b/tests/ui/consts/const-eval/index_out_of_bounds.stderr
index 8bb3a0c67..d8df74fa0 100644
--- a/tests/ui/consts/const-eval/index_out_of_bounds.stderr
+++ b/tests/ui/consts/const-eval/index_out_of_bounds.stderr
@@ -4,6 +4,6 @@ error[E0080]: could not evaluate static initializer
LL | static FOO: i32 = [][0];
| ^^^^^ index out of bounds: the length is 0 but the index is 0
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/index_out_of_bounds_propagated.stderr b/tests/ui/consts/const-eval/index_out_of_bounds_propagated.stderr
index d247d691d..64c87af43 100644
--- a/tests/ui/consts/const-eval/index_out_of_bounds_propagated.stderr
+++ b/tests/ui/consts/const-eval/index_out_of_bounds_propagated.stderr
@@ -6,5 +6,5 @@ LL | array[1];
|
= note: `#[deny(unconditional_panic)]` on by default
-error: aborting due to previous error
+error: aborting due to 1 previous error
diff --git a/tests/ui/consts/const-eval/infinite_loop.stderr b/tests/ui/consts/const-eval/infinite_loop.stderr
index f0434a847..e7a0a96a1 100644
--- a/tests/ui/consts/const-eval/infinite_loop.stderr
+++ b/tests/ui/consts/const-eval/infinite_loop.stderr
@@ -23,5 +23,5 @@ LL | | }];
| |_____^
= note: `#[deny(long_running_const_eval)]` on by default
-error: aborting due to previous error
+error: aborting due to 1 previous error
diff --git a/tests/ui/consts/const-eval/issue-44578.stderr b/tests/ui/consts/const-eval/issue-44578.stderr
index eea42c8ce..6aabe5301 100644
--- a/tests/ui/consts/const-eval/issue-44578.stderr
+++ b/tests/ui/consts/const-eval/issue-44578.stderr
@@ -27,6 +27,6 @@ LL | println!("{}", <Bar<u16, u8> as Foo>::AMT);
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
= 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
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/issue-49296.stderr b/tests/ui/consts/const-eval/issue-49296.stderr
index 2022a16e7..485a11d1f 100644
--- a/tests/ui/consts/const-eval/issue-49296.stderr
+++ b/tests/ui/consts/const-eval/issue-49296.stderr
@@ -4,6 +4,6 @@ error[E0080]: evaluation of constant value failed
LL | const X: u64 = *wat(42);
| ^^^^^^^^ memory access failed: ALLOC0 has been freed, so this pointer is dangling
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/issue-50814-2.mir-opt.stderr b/tests/ui/consts/const-eval/issue-50814-2.mir-opt.stderr
index 6454ce3d1..f3ec3200f 100644
--- a/tests/ui/consts/const-eval/issue-50814-2.mir-opt.stderr
+++ b/tests/ui/consts/const-eval/issue-50814-2.mir-opt.stderr
@@ -16,6 +16,6 @@ note: erroneous constant encountered
LL | &<A<T> as Foo<T>>::BAR
| ^^^^^^^^^^^^^^^^^^^^^^
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/issue-50814-2.normal.stderr b/tests/ui/consts/const-eval/issue-50814-2.normal.stderr
index c6b1df6c8..f552c8fde 100644
--- a/tests/ui/consts/const-eval/issue-50814-2.normal.stderr
+++ b/tests/ui/consts/const-eval/issue-50814-2.normal.stderr
@@ -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 previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/issue-50814.stderr b/tests/ui/consts/const-eval/issue-50814.stderr
index 48a20d0bb..65c49956f 100644
--- a/tests/ui/consts/const-eval/issue-50814.stderr
+++ b/tests/ui/consts/const-eval/issue-50814.stderr
@@ -16,6 +16,6 @@ note: the above error was encountered while instantiating `fn foo::<i32>`
LL | foo(0);
| ^^^^^^
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/issue-52475.stderr b/tests/ui/consts/const-eval/issue-52475.stderr
index ebf9d12a6..daaee0378 100644
--- a/tests/ui/consts/const-eval/issue-52475.stderr
+++ b/tests/ui/consts/const-eval/issue-52475.stderr
@@ -24,5 +24,5 @@ LL | | }];
| |_____^
= note: `#[deny(long_running_const_eval)]` on by default
-error: aborting due to previous error
+error: aborting due to 1 previous error
diff --git a/tests/ui/consts/const-eval/issue-70723.stderr b/tests/ui/consts/const-eval/issue-70723.stderr
index 572a43072..7cece4ed5 100644
--- a/tests/ui/consts/const-eval/issue-70723.stderr
+++ b/tests/ui/consts/const-eval/issue-70723.stderr
@@ -13,5 +13,5 @@ LL | static _X: () = loop {};
| ^^^^^^^^^^^^^
= note: `#[deny(long_running_const_eval)]` on by default
-error: aborting due to previous error
+error: aborting due to 1 previous error
diff --git a/tests/ui/consts/const-eval/issue-85155.stderr b/tests/ui/consts/const-eval/issue-85155.stderr
index 3d2c76b7e..a88e959a8 100644
--- a/tests/ui/consts/const-eval/issue-85155.stderr
+++ b/tests/ui/consts/const-eval/issue-85155.stderr
@@ -10,6 +10,6 @@ note: the above error was encountered while instantiating `fn post_monomorphizat
LL | post_monomorphization_error::stdarch_intrinsic::<2>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/issue-85907.stderr b/tests/ui/consts/const-eval/issue-85907.stderr
index fd7b40572..519227bc6 100644
--- a/tests/ui/consts/const-eval/issue-85907.stderr
+++ b/tests/ui/consts/const-eval/issue-85907.stderr
@@ -6,5 +6,5 @@ LL | panic!(123);
|
= 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
+error: aborting due to 1 previous error
diff --git a/tests/ui/consts/const-eval/issue-91827-extern-types-field-offset.rs b/tests/ui/consts/const-eval/issue-91827-extern-types-field-offset.rs
new file mode 100644
index 000000000..c6960fa72
--- /dev/null
+++ b/tests/ui/consts/const-eval/issue-91827-extern-types-field-offset.rs
@@ -0,0 +1,43 @@
+// Test that we can handle unsized types with an extern type tail part.
+// Regression test for issue #91827.
+
+#![feature(extern_types)]
+
+use std::ptr::addr_of;
+
+extern "C" {
+ type Opaque;
+}
+
+struct Newtype(Opaque);
+
+struct S {
+ i: i32,
+ j: i32,
+ a: Newtype,
+}
+
+const NEWTYPE: () = unsafe {
+ let buf = [0i32; 4];
+ let x: &Newtype = &*(&buf as *const _ as *const Newtype);
+
+ // Projecting to the newtype works, because it is always at offset 0.
+ let field = &x.0;
+};
+
+const OFFSET: () = unsafe {
+ let buf = [0i32; 4];
+ let x: &S = &*(&buf as *const _ as *const S);
+
+ // Accessing sized fields is perfectly fine, even at non-zero offsets.
+ let field = &x.i;
+ let field = &x.j;
+
+ // This needs to compute the field offset, but we don't know the type's alignment, so this
+ // fails.
+ let field = &x.a;
+ //~^ ERROR: evaluation of constant value failed
+ //~| does not have a known offset
+};
+
+fn main() {}
diff --git a/tests/ui/consts/const-eval/issue-91827-extern-types-field-offset.stderr b/tests/ui/consts/const-eval/issue-91827-extern-types-field-offset.stderr
new file mode 100644
index 000000000..99f37fedd
--- /dev/null
+++ b/tests/ui/consts/const-eval/issue-91827-extern-types-field-offset.stderr
@@ -0,0 +1,9 @@
+error[E0080]: evaluation of constant value failed
+ --> $DIR/issue-91827-extern-types-field-offset.rs:38:17
+ |
+LL | let field = &x.a;
+ | ^^^^ `extern type` does not have a known offset
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/issue-91827-extern-types.rs b/tests/ui/consts/const-eval/issue-91827-extern-types.rs
deleted file mode 100644
index c9aaa6e55..000000000
--- a/tests/ui/consts/const-eval/issue-91827-extern-types.rs
+++ /dev/null
@@ -1,59 +0,0 @@
-// run-pass
-//
-// Test that we can handle unsized types with an extern type tail part.
-// Regression test for issue #91827.
-
-#![feature(extern_types)]
-
-use std::ptr::addr_of;
-
-extern "C" {
- type Opaque;
-}
-
-unsafe impl Sync for Opaque {}
-
-#[repr(C)]
-pub struct List<T> {
- len: usize,
- data: [T; 0],
- tail: Opaque,
-}
-
-#[repr(C)]
-pub struct ListImpl<T, const N: usize> {
- len: usize,
- data: [T; N],
-}
-
-impl<T> List<T> {
- const fn as_slice(&self) -> &[T] {
- unsafe {
- let ptr = addr_of!(self.tail) as *const T;
- std::slice::from_raw_parts(ptr, self.len)
- }
- }
-}
-
-impl<T, const N: usize> ListImpl<T, N> {
- const fn as_list(&self) -> &List<T> {
- unsafe { std::mem::transmute(self) }
- }
-}
-
-pub static A: ListImpl<u128, 3> = ListImpl {
- len: 3,
- data: [5, 6, 7],
-};
-pub static A_REF: &'static List<u128> = A.as_list();
-pub static A_TAIL_OFFSET: isize = tail_offset(A.as_list());
-
-const fn tail_offset<T>(list: &List<T>) -> isize {
- unsafe { (addr_of!(list.tail) as *const u8).offset_from(list as *const List<T> as *const u8) }
-}
-
-fn main() {
- assert_eq!(A_REF.as_slice(), &[5, 6, 7]);
- // Check that interpreter and code generation agree about the position of the tail field.
- assert_eq!(A_TAIL_OFFSET, tail_offset(A_REF));
-}
diff --git a/tests/ui/consts/const-eval/livedrop.stderr b/tests/ui/consts/const-eval/livedrop.stderr
index d04fdb70e..1add81406 100644
--- a/tests/ui/consts/const-eval/livedrop.stderr
+++ b/tests/ui/consts/const-eval/livedrop.stderr
@@ -7,6 +7,6 @@ LL | let mut always_returned = None;
LL | always_returned = never_returned;
| --------------- value is dropped here
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0493`.
diff --git a/tests/ui/consts/const-eval/match-test-ptr-null.stderr b/tests/ui/consts/const-eval/match-test-ptr-null.stderr
index 05c3951c1..1e14c70fc 100644
--- a/tests/ui/consts/const-eval/match-test-ptr-null.stderr
+++ b/tests/ui/consts/const-eval/match-test-ptr-null.stderr
@@ -7,5 +7,5 @@ LL | match &1 as *const i32 as usize {
= note: at compile-time, pointers do not have an integer value
= note: avoiding this restriction via `transmute`, `union`, or raw pointers leads to compile-time undefined behavior
-error: aborting due to previous error
+error: aborting due to 1 previous error
diff --git a/tests/ui/consts/const-eval/mod-static-with-const-fn.stderr b/tests/ui/consts/const-eval/mod-static-with-const-fn.stderr
index d127d1d45..901ae1922 100644
--- a/tests/ui/consts/const-eval/mod-static-with-const-fn.stderr
+++ b/tests/ui/consts/const-eval/mod-static-with-const-fn.stderr
@@ -4,6 +4,6 @@ error[E0080]: could not evaluate static initializer
LL | *FOO.0.get() = 5;
| ^^^^^^^^^^^^^^^^ modifying a static's initial value from another static's initializer
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/nonnull_as_ref_ub.stderr b/tests/ui/consts/const-eval/nonnull_as_ref_ub.stderr
index e34f3f43c..b878c8d1b 100644
--- a/tests/ui/consts/const-eval/nonnull_as_ref_ub.stderr
+++ b/tests/ui/consts/const-eval/nonnull_as_ref_ub.stderr
@@ -4,6 +4,6 @@ error[E0080]: evaluation of constant value failed
LL | const _: () = assert!(42 == *unsafe { NON_NULL.as_ref() });
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access failed: 0x1[noalloc] is a dangling pointer (it has no provenance)
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/panic-assoc-never-type.stderr b/tests/ui/consts/const-eval/panic-assoc-never-type.stderr
index 50660664f..eef392559 100644
--- a/tests/ui/consts/const-eval/panic-assoc-never-type.stderr
+++ b/tests/ui/consts/const-eval/panic-assoc-never-type.stderr
@@ -20,6 +20,6 @@ LL | let _ = PrintName::VOID;
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/panic-never-type.stderr b/tests/ui/consts/const-eval/panic-never-type.stderr
index 6bff14a45..d3ba3eefb 100644
--- a/tests/ui/consts/const-eval/panic-never-type.stderr
+++ b/tests/ui/consts/const-eval/panic-never-type.stderr
@@ -6,6 +6,6 @@ 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: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/partial_ptr_overwrite.stderr b/tests/ui/consts/const-eval/partial_ptr_overwrite.stderr
index b948e07b9..3203ca764 100644
--- a/tests/ui/consts/const-eval/partial_ptr_overwrite.stderr
+++ b/tests/ui/consts/const-eval/partial_ptr_overwrite.stderr
@@ -7,6 +7,6 @@ LL | *(ptr as *mut u8) = 123;
= 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
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/promoted_const_fn_fail.stderr b/tests/ui/consts/const-eval/promoted_const_fn_fail.stderr
index 2d4e7c83d..9aec54793 100644
--- a/tests/ui/consts/const-eval/promoted_const_fn_fail.stderr
+++ b/tests/ui/consts/const-eval/promoted_const_fn_fail.stderr
@@ -9,6 +9,6 @@ LL | let x: &'static u8 = &(bar() + 1);
LL | }
| - temporary value is freed at the end of this statement
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0716`.
diff --git a/tests/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.stderr b/tests/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.stderr
index 9ebae3a18..71e104789 100644
--- a/tests/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.stderr
+++ b/tests/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.stderr
@@ -9,6 +9,6 @@ LL | let x: &'static u8 = &(bar() + 1);
LL | }
| - temporary value is freed at the end of this statement
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0716`.
diff --git a/tests/ui/consts/const-eval/raw-bytes.32bit.stderr b/tests/ui/consts/const-eval/raw-bytes.32bit.stderr
index 689ebf752..57815e6af 100644
--- a/tests/ui/consts/const-eval/raw-bytes.32bit.stderr
+++ b/tests/ui/consts/const-eval/raw-bytes.32bit.stderr
@@ -1,5 +1,5 @@
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:20:1
+ --> $DIR/raw-bytes.rs:22:1
|
LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) };
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x00000001, but expected a valid enum tag
@@ -10,7 +10,7 @@ LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:28:1
+ --> $DIR/raw-bytes.rs:30:1
|
LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
| ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x00000000, but expected a valid enum tag
@@ -21,7 +21,7 @@ LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:42:1
+ --> $DIR/raw-bytes.rs:44:1
|
LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant
@@ -32,7 +32,7 @@ LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:44:1
+ --> $DIR/raw-bytes.rs:46:1
|
LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant
@@ -43,7 +43,7 @@ LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:50:1
+ --> $DIR/raw-bytes.rs:52:1
|
LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute(!0u32) }));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0.1: encountered 0xffffffff, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
@@ -54,7 +54,7 @@ LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::tran
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:54:1
+ --> $DIR/raw-bytes.rs:57:1
|
LL | const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
@@ -65,7 +65,7 @@ LL | const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:57:1
+ --> $DIR/raw-bytes.rs:60:1
|
LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) };
| ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
@@ -76,7 +76,7 @@ LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:59:1
+ --> $DIR/raw-bytes.rs:62:1
|
LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
@@ -87,7 +87,7 @@ LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:65:1
+ --> $DIR/raw-bytes.rs:68:1
|
LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 42, but expected something in the range 10..=30
@@ -98,7 +98,7 @@ LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:71:1
+ --> $DIR/raw-bytes.rs:74:1
|
LL | const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 20, but expected something less or equal to 10, or greater or equal to 30
@@ -109,7 +109,7 @@ LL | const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:74:1
+ --> $DIR/raw-bytes.rs:77:1
|
LL | const NULL_FAT_PTR: NonNull<dyn Send> = unsafe {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
@@ -120,7 +120,7 @@ LL | const NULL_FAT_PTR: NonNull<dyn Send> = unsafe {
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:82:1
+ --> $DIR/raw-bytes.rs:85:1
|
LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) };
| ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1)
@@ -131,7 +131,7 @@ LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:86:1
+ --> $DIR/raw-bytes.rs:89:1
|
LL | const UNALIGNED_BOX: Box<u16> = unsafe { mem::transmute(&[0u8; 4]) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned box (required 2 byte alignment but found 1)
@@ -142,7 +142,7 @@ LL | const UNALIGNED_BOX: Box<u16> = unsafe { mem::transmute(&[0u8; 4]) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:90:1
+ --> $DIR/raw-bytes.rs:93:1
|
LL | const NULL: &u16 = unsafe { mem::transmute(0usize) };
| ^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null reference
@@ -153,7 +153,7 @@ LL | const NULL: &u16 = unsafe { mem::transmute(0usize) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:93:1
+ --> $DIR/raw-bytes.rs:96:1
|
LL | const NULL_BOX: Box<u16> = unsafe { mem::transmute(0usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null box
@@ -164,7 +164,7 @@ LL | const NULL_BOX: Box<u16> = unsafe { mem::transmute(0usize) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:96:1
+ --> $DIR/raw-bytes.rs:99:1
|
LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (0x539[noalloc] has no provenance)
@@ -175,7 +175,7 @@ LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:99:1
+ --> $DIR/raw-bytes.rs:102:1
|
LL | const USIZE_AS_BOX: Box<u8> = unsafe { mem::transmute(1337usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (0x539[noalloc] has no provenance)
@@ -186,7 +186,7 @@ LL | const USIZE_AS_BOX: Box<u8> = unsafe { mem::transmute(1337usize) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:102:1
+ --> $DIR/raw-bytes.rs:105:1
|
LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a function pointer
@@ -197,7 +197,7 @@ LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:104:1
+ --> $DIR/raw-bytes.rs:107:1
|
LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0xd[noalloc], but expected a function pointer
@@ -208,10 +208,10 @@ LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:106:1
+ --> $DIR/raw-bytes.rs:109:1
|
LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
- | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC3, but expected a function pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC3<imm>, but expected a function pointer
|
= 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: 4, align: 4) {
@@ -219,7 +219,7 @@ LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:112:1
+ --> $DIR/raw-bytes.rs:115:1
|
LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to uninhabited type Bar
@@ -230,7 +230,7 @@ LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:137:1
+ --> $DIR/raw-bytes.rs:140:1
|
LL | const STR_TOO_LONG: &str = unsafe { mem::transmute((&42u8, 999usize)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation)
@@ -241,7 +241,7 @@ LL | const STR_TOO_LONG: &str = unsafe { mem::transmute((&42u8, 999usize)) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:139:1
+ --> $DIR/raw-bytes.rs:142:1
|
LL | const NESTED_STR_MUCH_TOO_LONG: (&str,) = (unsafe { mem::transmute((&42, usize::MAX)) },);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered invalid reference metadata: slice is bigger than largest supported object
@@ -252,7 +252,7 @@ LL | const NESTED_STR_MUCH_TOO_LONG: (&str,) = (unsafe { mem::transmute((&42, us
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:141:1
+ --> $DIR/raw-bytes.rs:144:1
|
LL | const MY_STR_MUCH_TOO_LONG: &MyStr = unsafe { mem::transmute((&42u8, usize::MAX)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object
@@ -263,7 +263,7 @@ LL | const MY_STR_MUCH_TOO_LONG: &MyStr = unsafe { mem::transmute((&42u8, usize:
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:144:1
+ --> $DIR/raw-bytes.rs:147:1
|
LL | const STR_NO_INIT: &str = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) };
| ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered uninitialized memory, but expected a string
@@ -274,7 +274,7 @@ LL | const STR_NO_INIT: &str = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit:
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:146:1
+ --> $DIR/raw-bytes.rs:149:1
|
LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered uninitialized memory, but expected a string
@@ -285,7 +285,7 @@ LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUni
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:148:1
+ --> $DIR/raw-bytes.rs:151:1
|
LL | const MYSTR_NO_INIT_ISSUE83182: &MyStr = unsafe { mem::transmute::<&[_], _>(&[&()]) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered a pointer, but expected a string
@@ -298,7 +298,7 @@ LL | const MYSTR_NO_INIT_ISSUE83182: &MyStr = unsafe { mem::transmute::<&[_], _>
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:152:1
+ --> $DIR/raw-bytes.rs:155:1
|
LL | const SLICE_TOO_LONG: &[u8] = unsafe { mem::transmute((&42u8, 999usize)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation)
@@ -309,7 +309,7 @@ LL | const SLICE_TOO_LONG: &[u8] = unsafe { mem::transmute((&42u8, 999usize)) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:154:1
+ --> $DIR/raw-bytes.rs:157:1
|
LL | const SLICE_TOO_LONG_OVERFLOW: &[u32] = unsafe { mem::transmute((&42u32, isize::MAX)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object
@@ -320,7 +320,7 @@ LL | const SLICE_TOO_LONG_OVERFLOW: &[u32] = unsafe { mem::transmute((&42u32, is
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:157:1
+ --> $DIR/raw-bytes.rs:160:1
|
LL | const SLICE_TOO_LONG_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, 999usize)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (going beyond the bounds of its allocation)
@@ -331,7 +331,7 @@ LL | const SLICE_TOO_LONG_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, 999us
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:160:1
+ --> $DIR/raw-bytes.rs:163:1
|
LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x03, but expected a boolean
@@ -342,13 +342,13 @@ LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
}
note: erroneous constant encountered
- --> $DIR/raw-bytes.rs:160:40
+ --> $DIR/raw-bytes.rs:163:40
|
LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:166:1
+ --> $DIR/raw-bytes.rs:169:1
|
LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered 0x03, but expected a boolean
@@ -359,13 +359,13 @@ LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3
}
note: erroneous constant encountered
- --> $DIR/raw-bytes.rs:166:42
+ --> $DIR/raw-bytes.rs:169:42
|
LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:170:1
+ --> $DIR/raw-bytes.rs:173:1
|
LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.1[0]: encountered 0x03, but expected a boolean
@@ -376,16 +376,16 @@ LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::tran
}
note: erroneous constant encountered
- --> $DIR/raw-bytes.rs:170:42
+ --> $DIR/raw-bytes.rs:173:42
|
LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:175:1
+ --> $DIR/raw-bytes.rs:178:1
|
LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u8))) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC17, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC17<imm>, but expected a vtable pointer
|
= 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) {
@@ -393,10 +393,10 @@ LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W((
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:179:1
+ --> $DIR/raw-bytes.rs:182:1
|
LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u64))) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC19, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC19<imm>, but expected a vtable pointer
|
= 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) {
@@ -404,7 +404,7 @@ LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W((
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:183:1
+ --> $DIR/raw-bytes.rs:186:1
|
LL | const TRAIT_OBJ_INT_VTABLE: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, 4usize))) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered 0x4[noalloc], but expected a vtable pointer
@@ -415,10 +415,10 @@ LL | const TRAIT_OBJ_INT_VTABLE: W<&dyn Trait> = unsafe { mem::transmute(W((&92u
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:186:1
+ --> $DIR/raw-bytes.rs:189:1
|
LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &[&42u8; 8]))) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC22, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC22<imm>, but expected a vtable pointer
|
= 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) {
@@ -426,7 +426,7 @@ LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::trans
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:190:1
+ --> $DIR/raw-bytes.rs:193:1
|
LL | const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_, &bool>(&3u8) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.<dyn-downcast>: encountered 0x03, but expected a boolean
@@ -437,7 +437,7 @@ LL | const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_,
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:194:1
+ --> $DIR/raw-bytes.rs:197:1
|
LL | const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute((&92u8, 0usize)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a vtable pointer
@@ -448,10 +448,10 @@ LL | const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:196:1
+ --> $DIR/raw-bytes.rs:199:1
|
LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC27, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC27<imm>, but expected a vtable pointer
|
= 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) {
@@ -459,29 +459,7 @@ LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transm
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:201:1
- |
-LL | const LAYOUT_INVALID_ZERO: Layout = unsafe { Layout::from_size_align_unchecked(0x1000, 0x00) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .align.0.<enum-tag>: encountered 0x00000000, but expected a valid enum tag
- |
- = 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 00 10 00 00 │ ........
- }
-
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:205:1
- |
-LL | const LAYOUT_INVALID_THREE: Layout = unsafe { Layout::from_size_align_unchecked(9, 3) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .align.0.<enum-tag>: encountered 0x00000003, but expected a valid enum tag
- |
- = 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) {
- 03 00 00 00 09 00 00 00 │ ........
- }
-
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:209:1
+ --> $DIR/raw-bytes.rs:203:1
|
LL | const _: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) };
| ^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to uninhabited type [!; 1]
@@ -492,7 +470,7 @@ LL | const _: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:210:1
+ --> $DIR/raw-bytes.rs:204:1
|
LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 1]) };
| ^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a value of the never type `!`
@@ -503,7 +481,7 @@ LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 1]) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:211:1
+ --> $DIR/raw-bytes.rs:205:1
|
LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 42]) };
| ^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a value of the never type `!`
@@ -514,7 +492,7 @@ LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 42]) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:215:1
+ --> $DIR/raw-bytes.rs:209:1
|
LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) };
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized memory, but expected an integer
@@ -525,7 +503,7 @@ LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) }
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:218:1
+ --> $DIR/raw-bytes.rs:212:1
|
LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, mem::size_of::<&u32>()) };
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a pointer, but expected an integer
@@ -538,7 +516,7 @@ LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, mem:
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:221:1
+ --> $DIR/raw-bytes.rs:215:1
|
LL | pub static S6: &[bool] = unsafe { from_raw_parts((&D0) as *const _ as _, 4) };
| ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean
@@ -549,7 +527,7 @@ LL | pub static S6: &[bool] = unsafe { from_raw_parts((&D0) as *const _ as _, 4)
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:225:1
+ --> $DIR/raw-bytes.rs:219:1
|
LL | pub static S7: &[u16] = unsafe {
| ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[1]: encountered uninitialized memory, but expected an integer
@@ -560,7 +538,7 @@ LL | pub static S7: &[u16] = unsafe {
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:232:1
+ --> $DIR/raw-bytes.rs:226:1
|
LL | pub static R4: &[u8] = unsafe {
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized memory, but expected an integer
@@ -571,7 +549,7 @@ LL | pub static R4: &[u8] = unsafe {
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:237:1
+ --> $DIR/raw-bytes.rs:231:1
|
LL | pub static R5: &[u8] = unsafe {
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a pointer, but expected an integer
@@ -584,7 +562,7 @@ LL | pub static R5: &[u8] = unsafe {
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:242:1
+ --> $DIR/raw-bytes.rs:236:1
|
LL | pub static R6: &[bool] = unsafe {
| ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean
@@ -594,6 +572,6 @@ LL | pub static R6: &[bool] = unsafe {
╾ALLOC_ID╼ 04 00 00 00 │ ╾──╼....
}
-error: aborting due to 52 previous errors
+error: aborting due to 50 previous errors
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/raw-bytes.64bit.stderr b/tests/ui/consts/const-eval/raw-bytes.64bit.stderr
index 3447a8ab4..c875d91cc 100644
--- a/tests/ui/consts/const-eval/raw-bytes.64bit.stderr
+++ b/tests/ui/consts/const-eval/raw-bytes.64bit.stderr
@@ -1,5 +1,5 @@
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:20:1
+ --> $DIR/raw-bytes.rs:22:1
|
LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) };
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x0000000000000001, but expected a valid enum tag
@@ -10,7 +10,7 @@ LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:28:1
+ --> $DIR/raw-bytes.rs:30:1
|
LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
| ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x0000000000000000, but expected a valid enum tag
@@ -21,7 +21,7 @@ LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:42:1
+ --> $DIR/raw-bytes.rs:44:1
|
LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant
@@ -32,7 +32,7 @@ LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:44:1
+ --> $DIR/raw-bytes.rs:46:1
|
LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant
@@ -43,7 +43,7 @@ LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:50:1
+ --> $DIR/raw-bytes.rs:52:1
|
LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute(!0u32) }));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0.1: encountered 0xffffffff, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
@@ -54,7 +54,7 @@ LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::tran
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:54:1
+ --> $DIR/raw-bytes.rs:57:1
|
LL | const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
@@ -65,7 +65,7 @@ LL | const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:57:1
+ --> $DIR/raw-bytes.rs:60:1
|
LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) };
| ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
@@ -76,7 +76,7 @@ LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:59:1
+ --> $DIR/raw-bytes.rs:62:1
|
LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
@@ -87,7 +87,7 @@ LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:65:1
+ --> $DIR/raw-bytes.rs:68:1
|
LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 42, but expected something in the range 10..=30
@@ -98,7 +98,7 @@ LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:71:1
+ --> $DIR/raw-bytes.rs:74:1
|
LL | const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 20, but expected something less or equal to 10, or greater or equal to 30
@@ -109,7 +109,7 @@ LL | const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:74:1
+ --> $DIR/raw-bytes.rs:77:1
|
LL | const NULL_FAT_PTR: NonNull<dyn Send> = unsafe {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
@@ -120,7 +120,7 @@ LL | const NULL_FAT_PTR: NonNull<dyn Send> = unsafe {
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:82:1
+ --> $DIR/raw-bytes.rs:85:1
|
LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) };
| ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1)
@@ -131,7 +131,7 @@ LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:86:1
+ --> $DIR/raw-bytes.rs:89:1
|
LL | const UNALIGNED_BOX: Box<u16> = unsafe { mem::transmute(&[0u8; 4]) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned box (required 2 byte alignment but found 1)
@@ -142,7 +142,7 @@ LL | const UNALIGNED_BOX: Box<u16> = unsafe { mem::transmute(&[0u8; 4]) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:90:1
+ --> $DIR/raw-bytes.rs:93:1
|
LL | const NULL: &u16 = unsafe { mem::transmute(0usize) };
| ^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null reference
@@ -153,7 +153,7 @@ LL | const NULL: &u16 = unsafe { mem::transmute(0usize) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:93:1
+ --> $DIR/raw-bytes.rs:96:1
|
LL | const NULL_BOX: Box<u16> = unsafe { mem::transmute(0usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null box
@@ -164,7 +164,7 @@ LL | const NULL_BOX: Box<u16> = unsafe { mem::transmute(0usize) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:96:1
+ --> $DIR/raw-bytes.rs:99:1
|
LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (0x539[noalloc] has no provenance)
@@ -175,7 +175,7 @@ LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:99:1
+ --> $DIR/raw-bytes.rs:102:1
|
LL | const USIZE_AS_BOX: Box<u8> = unsafe { mem::transmute(1337usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (0x539[noalloc] has no provenance)
@@ -186,7 +186,7 @@ LL | const USIZE_AS_BOX: Box<u8> = unsafe { mem::transmute(1337usize) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:102:1
+ --> $DIR/raw-bytes.rs:105:1
|
LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a function pointer
@@ -197,7 +197,7 @@ LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:104:1
+ --> $DIR/raw-bytes.rs:107:1
|
LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0xd[noalloc], but expected a function pointer
@@ -208,10 +208,10 @@ LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:106:1
+ --> $DIR/raw-bytes.rs:109:1
|
LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
- | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC3, but expected a function pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC3<imm>, but expected a function pointer
|
= 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: 8) {
@@ -219,7 +219,7 @@ LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:112:1
+ --> $DIR/raw-bytes.rs:115:1
|
LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
| ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to uninhabited type Bar
@@ -230,7 +230,7 @@ LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:137:1
+ --> $DIR/raw-bytes.rs:140:1
|
LL | const STR_TOO_LONG: &str = unsafe { mem::transmute((&42u8, 999usize)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation)
@@ -241,7 +241,7 @@ LL | const STR_TOO_LONG: &str = unsafe { mem::transmute((&42u8, 999usize)) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:139:1
+ --> $DIR/raw-bytes.rs:142:1
|
LL | const NESTED_STR_MUCH_TOO_LONG: (&str,) = (unsafe { mem::transmute((&42, usize::MAX)) },);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered invalid reference metadata: slice is bigger than largest supported object
@@ -252,7 +252,7 @@ LL | const NESTED_STR_MUCH_TOO_LONG: (&str,) = (unsafe { mem::transmute((&42, us
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:141:1
+ --> $DIR/raw-bytes.rs:144:1
|
LL | const MY_STR_MUCH_TOO_LONG: &MyStr = unsafe { mem::transmute((&42u8, usize::MAX)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object
@@ -263,7 +263,7 @@ LL | const MY_STR_MUCH_TOO_LONG: &MyStr = unsafe { mem::transmute((&42u8, usize:
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:144:1
+ --> $DIR/raw-bytes.rs:147:1
|
LL | const STR_NO_INIT: &str = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) };
| ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered uninitialized memory, but expected a string
@@ -274,7 +274,7 @@ LL | const STR_NO_INIT: &str = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit:
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:146:1
+ --> $DIR/raw-bytes.rs:149:1
|
LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered uninitialized memory, but expected a string
@@ -285,7 +285,7 @@ LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUni
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:148:1
+ --> $DIR/raw-bytes.rs:151:1
|
LL | const MYSTR_NO_INIT_ISSUE83182: &MyStr = unsafe { mem::transmute::<&[_], _>(&[&()]) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered a pointer, but expected a string
@@ -298,7 +298,7 @@ LL | const MYSTR_NO_INIT_ISSUE83182: &MyStr = unsafe { mem::transmute::<&[_], _>
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:152:1
+ --> $DIR/raw-bytes.rs:155:1
|
LL | const SLICE_TOO_LONG: &[u8] = unsafe { mem::transmute((&42u8, 999usize)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation)
@@ -309,7 +309,7 @@ LL | const SLICE_TOO_LONG: &[u8] = unsafe { mem::transmute((&42u8, 999usize)) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:154:1
+ --> $DIR/raw-bytes.rs:157:1
|
LL | const SLICE_TOO_LONG_OVERFLOW: &[u32] = unsafe { mem::transmute((&42u32, isize::MAX)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object
@@ -320,7 +320,7 @@ LL | const SLICE_TOO_LONG_OVERFLOW: &[u32] = unsafe { mem::transmute((&42u32, is
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:157:1
+ --> $DIR/raw-bytes.rs:160:1
|
LL | const SLICE_TOO_LONG_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, 999usize)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (going beyond the bounds of its allocation)
@@ -331,7 +331,7 @@ LL | const SLICE_TOO_LONG_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, 999us
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:160:1
+ --> $DIR/raw-bytes.rs:163:1
|
LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x03, but expected a boolean
@@ -342,13 +342,13 @@ LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
}
note: erroneous constant encountered
- --> $DIR/raw-bytes.rs:160:40
+ --> $DIR/raw-bytes.rs:163:40
|
LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:166:1
+ --> $DIR/raw-bytes.rs:169:1
|
LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered 0x03, but expected a boolean
@@ -359,13 +359,13 @@ LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3
}
note: erroneous constant encountered
- --> $DIR/raw-bytes.rs:166:42
+ --> $DIR/raw-bytes.rs:169:42
|
LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:170:1
+ --> $DIR/raw-bytes.rs:173:1
|
LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.1[0]: encountered 0x03, but expected a boolean
@@ -376,16 +376,16 @@ LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::tran
}
note: erroneous constant encountered
- --> $DIR/raw-bytes.rs:170:42
+ --> $DIR/raw-bytes.rs:173:42
|
LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:175:1
+ --> $DIR/raw-bytes.rs:178:1
|
LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u8))) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC17, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC17<imm>, but expected a vtable pointer
|
= 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) {
@@ -393,10 +393,10 @@ LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W((
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:179:1
+ --> $DIR/raw-bytes.rs:182:1
|
LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u64))) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC19, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC19<imm>, but expected a vtable pointer
|
= 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) {
@@ -404,7 +404,7 @@ LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W((
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:183:1
+ --> $DIR/raw-bytes.rs:186:1
|
LL | const TRAIT_OBJ_INT_VTABLE: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, 4usize))) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered 0x4[noalloc], but expected a vtable pointer
@@ -415,10 +415,10 @@ LL | const TRAIT_OBJ_INT_VTABLE: W<&dyn Trait> = unsafe { mem::transmute(W((&92u
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:186:1
+ --> $DIR/raw-bytes.rs:189:1
|
LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &[&42u8; 8]))) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC22, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC22<imm>, but expected a vtable pointer
|
= 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) {
@@ -426,7 +426,7 @@ LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::trans
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:190:1
+ --> $DIR/raw-bytes.rs:193:1
|
LL | const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_, &bool>(&3u8) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.<dyn-downcast>: encountered 0x03, but expected a boolean
@@ -437,7 +437,7 @@ LL | const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_,
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:194:1
+ --> $DIR/raw-bytes.rs:197:1
|
LL | const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute((&92u8, 0usize)) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a vtable pointer
@@ -448,10 +448,10 @@ LL | const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:196:1
+ --> $DIR/raw-bytes.rs:199:1
|
LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC27, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC27<imm>, but expected a vtable pointer
|
= 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) {
@@ -459,29 +459,7 @@ LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transm
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:201:1
- |
-LL | const LAYOUT_INVALID_ZERO: Layout = unsafe { Layout::from_size_align_unchecked(0x1000, 0x00) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .align.0.<enum-tag>: encountered 0x0000000000000000, but expected a valid enum tag
- |
- = 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 00 10 00 00 00 00 00 00 │ ................
- }
-
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:205:1
- |
-LL | const LAYOUT_INVALID_THREE: Layout = unsafe { Layout::from_size_align_unchecked(9, 3) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .align.0.<enum-tag>: encountered 0x0000000000000003, but expected a valid enum tag
- |
- = 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) {
- 03 00 00 00 00 00 00 00 09 00 00 00 00 00 00 00 │ ................
- }
-
-error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:209:1
+ --> $DIR/raw-bytes.rs:203:1
|
LL | const _: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) };
| ^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to uninhabited type [!; 1]
@@ -492,7 +470,7 @@ LL | const _: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:210:1
+ --> $DIR/raw-bytes.rs:204:1
|
LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 1]) };
| ^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a value of the never type `!`
@@ -503,7 +481,7 @@ LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 1]) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:211:1
+ --> $DIR/raw-bytes.rs:205:1
|
LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 42]) };
| ^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a value of the never type `!`
@@ -514,7 +492,7 @@ LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 42]) };
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:215:1
+ --> $DIR/raw-bytes.rs:209:1
|
LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) };
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized memory, but expected an integer
@@ -525,7 +503,7 @@ LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) }
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:218:1
+ --> $DIR/raw-bytes.rs:212:1
|
LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, mem::size_of::<&u32>()) };
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a pointer, but expected an integer
@@ -538,7 +516,7 @@ LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, mem:
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:221:1
+ --> $DIR/raw-bytes.rs:215:1
|
LL | pub static S6: &[bool] = unsafe { from_raw_parts((&D0) as *const _ as _, 4) };
| ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean
@@ -549,7 +527,7 @@ LL | pub static S6: &[bool] = unsafe { from_raw_parts((&D0) as *const _ as _, 4)
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:225:1
+ --> $DIR/raw-bytes.rs:219:1
|
LL | pub static S7: &[u16] = unsafe {
| ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[1]: encountered uninitialized memory, but expected an integer
@@ -560,7 +538,7 @@ LL | pub static S7: &[u16] = unsafe {
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:232:1
+ --> $DIR/raw-bytes.rs:226:1
|
LL | pub static R4: &[u8] = unsafe {
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized memory, but expected an integer
@@ -571,7 +549,7 @@ LL | pub static R4: &[u8] = unsafe {
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:237:1
+ --> $DIR/raw-bytes.rs:231:1
|
LL | pub static R5: &[u8] = unsafe {
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a pointer, but expected an integer
@@ -584,7 +562,7 @@ LL | pub static R5: &[u8] = unsafe {
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
error[E0080]: it is undefined behavior to use this value
- --> $DIR/raw-bytes.rs:242:1
+ --> $DIR/raw-bytes.rs:236:1
|
LL | pub static R6: &[bool] = unsafe {
| ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean
@@ -594,6 +572,6 @@ LL | pub static R6: &[bool] = unsafe {
╾ALLOC_ID╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........
}
-error: aborting due to 52 previous errors
+error: aborting due to 50 previous errors
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/raw-bytes.rs b/tests/ui/consts/const-eval/raw-bytes.rs
index e00592222..ae65a5cb8 100644
--- a/tests/ui/consts/const-eval/raw-bytes.rs
+++ b/tests/ui/consts/const-eval/raw-bytes.rs
@@ -1,7 +1,7 @@
// stderr-per-bitwidth
// ignore-endian-big
// ignore-tidy-linelength
-// normalize-stderr-test "╾─*ALLOC[0-9]+(\+[a-z0-9]+)?─*╼" -> "╾ALLOC_ID$1╼"
+// normalize-stderr-test "╾─*ALLOC[0-9]+(\+[a-z0-9]+)?(<imm>)?─*╼" -> "╾ALLOC_ID$1╼"
#![feature(never_type, rustc_attrs, ptr_metadata, slice_from_ptr_range, const_slice_from_ptr_range)]
#![allow(invalid_value)]
@@ -12,6 +12,8 @@ use std::ptr::NonNull;
use std::num::{NonZeroU8, NonZeroUsize};
use std::slice::{from_ptr_range, from_raw_parts};
+// # Bad enums and chars
+
#[repr(usize)]
#[derive(Copy, Clone)]
enum Enum {
@@ -50,6 +52,7 @@ const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8)
const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute(!0u32) }));
//~^ ERROR is undefined behavior
+// # Bad pointers and references
const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) };
//~^ ERROR it is undefined behavior to use this value
@@ -196,16 +199,7 @@ const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute((&92
const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) };
//~^ ERROR it is undefined behavior to use this value
-
-// not ok, since alignment needs to be non-zero.
-const LAYOUT_INVALID_ZERO: Layout = unsafe { Layout::from_size_align_unchecked(0x1000, 0x00) };
-//~^ ERROR it is undefined behavior to use this value
-
-// not ok, since alignment needs to be a power of two.
-const LAYOUT_INVALID_THREE: Layout = unsafe { Layout::from_size_align_unchecked(9, 3) };
-//~^ ERROR it is undefined behavior to use this value
-
-
+// Uninhabited types
const _: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) }; //~ ERROR undefined behavior
const _: &[!] = unsafe { &*(1_usize as *const [!; 1]) }; //~ ERROR undefined behavior
const _: &[!] = unsafe { &*(1_usize as *const [!; 42]) }; //~ ERROR undefined behavior
diff --git a/tests/ui/consts/const-eval/raw-pointer-ub.stderr b/tests/ui/consts/const-eval/raw-pointer-ub.stderr
index 60fcd461c..cba06fdc6 100644
--- a/tests/ui/consts/const-eval/raw-pointer-ub.stderr
+++ b/tests/ui/consts/const-eval/raw-pointer-ub.stderr
@@ -17,7 +17,7 @@ error[E0080]: evaluation of constant value failed
|
note: inside `copy_nonoverlapping::<u32>`
--> $SRC_DIR/core/src/intrinsics.rs:LL:COL
-note: inside `ptr::const_ptr::<impl *const u32>::copy_to_nonoverlapping`
+note: inside `std::ptr::const_ptr::<impl *const u32>::copy_to_nonoverlapping`
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
note: inside `MISALIGNED_COPY`
--> $DIR/raw-pointer-ub.rs:22:5
diff --git a/tests/ui/consts/const-eval/shift_overflow.stderr b/tests/ui/consts/const-eval/shift_overflow.stderr
index e8d4076a6..901bfa10e 100644
--- a/tests/ui/consts/const-eval/shift_overflow.stderr
+++ b/tests/ui/consts/const-eval/shift_overflow.stderr
@@ -4,6 +4,6 @@ error[E0080]: evaluation of constant value failed
LL | X = 1 << ((u32::MAX as u64) + 1),
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to shift left by `4294967296_u64`, which would overflow
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/size-of-t.stderr b/tests/ui/consts/const-eval/size-of-t.stderr
index abe641046..418ac6f61 100644
--- a/tests/ui/consts/const-eval/size-of-t.stderr
+++ b/tests/ui/consts/const-eval/size-of-t.stderr
@@ -5,7 +5,7 @@ LL | let _arr: [u8; size_of::<T>()];
| ^ cannot perform const operation using `T`
|
= note: type parameters may not be used in const expressions
- = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions
+ = help: add `#![feature(generic_const_exprs)]` to allow generic const expressions
-error: aborting due to previous error
+error: aborting due to 1 previous error
diff --git a/tests/ui/consts/const-eval/stable-metric/ctfe-fn-call.stderr b/tests/ui/consts/const-eval/stable-metric/ctfe-fn-call.stderr
index a3fd712ca..f087c9960 100644
--- a/tests/ui/consts/const-eval/stable-metric/ctfe-fn-call.stderr
+++ b/tests/ui/consts/const-eval/stable-metric/ctfe-fn-call.stderr
@@ -13,5 +13,5 @@ LL | const X: u32 = call_foo();
| ^^^^^^^^^^^^
= note: `#[deny(long_running_const_eval)]` on by default
-error: aborting due to previous error
+error: aborting due to 1 previous error
diff --git a/tests/ui/consts/const-eval/stable-metric/ctfe-labelled-loop.stderr b/tests/ui/consts/const-eval/stable-metric/ctfe-labelled-loop.stderr
index 5808ee35a..ecb48fc62 100644
--- a/tests/ui/consts/const-eval/stable-metric/ctfe-labelled-loop.stderr
+++ b/tests/ui/consts/const-eval/stable-metric/ctfe-labelled-loop.stderr
@@ -19,5 +19,5 @@ LL | const X: u32 = labelled_loop(19);
| ^^^^^^^^^^^^
= note: `#[deny(long_running_const_eval)]` on by default
-error: aborting due to previous error
+error: aborting due to 1 previous error
diff --git a/tests/ui/consts/const-eval/stable-metric/ctfe-recursion.stderr b/tests/ui/consts/const-eval/stable-metric/ctfe-recursion.stderr
index 524c8e554..a05d792c9 100644
--- a/tests/ui/consts/const-eval/stable-metric/ctfe-recursion.stderr
+++ b/tests/ui/consts/const-eval/stable-metric/ctfe-recursion.stderr
@@ -13,5 +13,5 @@ LL | const X: u32 = recurse(19);
| ^^^^^^^^^^^^
= note: `#[deny(long_running_const_eval)]` on by default
-error: aborting due to previous error
+error: aborting due to 1 previous error
diff --git a/tests/ui/consts/const-eval/transmute-const-promotion.stderr b/tests/ui/consts/const-eval/transmute-const-promotion.stderr
index 434a957f6..3603db03b 100644
--- a/tests/ui/consts/const-eval/transmute-const-promotion.stderr
+++ b/tests/ui/consts/const-eval/transmute-const-promotion.stderr
@@ -9,6 +9,6 @@ LL |
LL | }
| - temporary value is freed at the end of this statement
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0716`.
diff --git a/tests/ui/consts/const-eval/transmute-const.32bit.stderr b/tests/ui/consts/const-eval/transmute-const.32bit.stderr
index 09fd79986..35a5cabaa 100644
--- a/tests/ui/consts/const-eval/transmute-const.32bit.stderr
+++ b/tests/ui/consts/const-eval/transmute-const.32bit.stderr
@@ -9,6 +9,6 @@ LL | static FOO: bool = unsafe { mem::transmute(3u8) };
03 │ .
}
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/transmute-const.64bit.stderr b/tests/ui/consts/const-eval/transmute-const.64bit.stderr
index 09fd79986..35a5cabaa 100644
--- a/tests/ui/consts/const-eval/transmute-const.64bit.stderr
+++ b/tests/ui/consts/const-eval/transmute-const.64bit.stderr
@@ -9,6 +9,6 @@ LL | static FOO: bool = unsafe { mem::transmute(3u8) };
03 │ .
}
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/ub-enum-overwrite.stderr b/tests/ui/consts/const-eval/ub-enum-overwrite.stderr
index 5750212b4..2a133c057 100644
--- a/tests/ui/consts/const-eval/ub-enum-overwrite.stderr
+++ b/tests/ui/consts/const-eval/ub-enum-overwrite.stderr
@@ -4,6 +4,6 @@ error[E0080]: evaluation of constant value failed
LL | unsafe { *p }
| ^^ using uninitialized data, but this operation requires initialized memory
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/ub-incorrect-vtable.32bit.stderr b/tests/ui/consts/const-eval/ub-incorrect-vtable.32bit.stderr
index 7b30233c0..5c47cbfdf 100644
--- a/tests/ui/consts/const-eval/ub-incorrect-vtable.32bit.stderr
+++ b/tests/ui/consts/const-eval/ub-incorrect-vtable.32bit.stderr
@@ -2,55 +2,55 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-incorrect-vtable.rs:18:1
|
LL | const INVALID_VTABLE_ALIGNMENT: &dyn Trait =
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC1, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC1<imm>, but expected a vtable pointer
|
= 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) {
- ╾ALLOC0╼ ╾ALLOC1╼ │ ╾──╼╾──╼
+ ╾ALLOC0<imm>╼ ╾ALLOC1<imm>╼ │ ╾──╼╾──╼
}
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-incorrect-vtable.rs:23:1
|
LL | const INVALID_VTABLE_SIZE: &dyn Trait =
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC3, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC3<imm>, but expected a vtable pointer
|
= 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) {
- ╾ALLOC2╼ ╾ALLOC3╼ │ ╾──╼╾──╼
+ ╾ALLOC2<imm>╼ ╾ALLOC3<imm>╼ │ ╾──╼╾──╼
}
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-incorrect-vtable.rs:33:1
|
LL | const INVALID_VTABLE_ALIGNMENT_UB: W<&dyn Trait> =
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC5, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC5<imm>, but expected a vtable pointer
|
= 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) {
- ╾ALLOC4╼ ╾ALLOC5╼ │ ╾──╼╾──╼
+ ╾ALLOC4<imm>╼ ╾ALLOC5<imm>╼ │ ╾──╼╾──╼
}
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-incorrect-vtable.rs:38:1
|
LL | const INVALID_VTABLE_SIZE_UB: W<&dyn Trait> =
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC7, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC7<imm>, but expected a vtable pointer
|
= 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) {
- ╾ALLOC6╼ ╾ALLOC7╼ │ ╾──╼╾──╼
+ ╾ALLOC6<imm>╼ ╾ALLOC7<imm>╼ │ ╾──╼╾──╼
}
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-incorrect-vtable.rs:44:1
|
LL | const INVALID_VTABLE_UB: W<&dyn Trait> =
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC9, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC9<imm>, but expected a vtable pointer
|
= 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) {
- ╾ALLOC8╼ ╾ALLOC9╼ │ ╾──╼╾──╼
+ ╾ALLOC8<imm>╼ ╾ALLOC9<imm>╼ │ ╾──╼╾──╼
}
error[E0080]: it is undefined behavior to use this value
@@ -61,7 +61,7 @@ LL | const G: Wide = unsafe { Transmute { t: FOO }.u };
|
= 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) {
- ╾ALLOC10╼ ╾ALLOC11╼ │ ╾──╼╾──╼
+ ╾ALLOC10<imm>╼ ╾ALLOC11╼ │ ╾──╼╾──╼
}
error: aborting due to 6 previous errors
diff --git a/tests/ui/consts/const-eval/ub-incorrect-vtable.64bit.stderr b/tests/ui/consts/const-eval/ub-incorrect-vtable.64bit.stderr
index 9330ae3c9..f400073ac 100644
--- a/tests/ui/consts/const-eval/ub-incorrect-vtable.64bit.stderr
+++ b/tests/ui/consts/const-eval/ub-incorrect-vtable.64bit.stderr
@@ -2,55 +2,55 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-incorrect-vtable.rs:18:1
|
LL | const INVALID_VTABLE_ALIGNMENT: &dyn Trait =
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC1, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC1<imm>, but expected a vtable pointer
|
= 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) {
- ╾ALLOC0╼ ╾ALLOC1╼ │ ╾──────╼╾──────╼
+ ╾ALLOC0<imm>╼ ╾ALLOC1<imm>╼ │ ╾──────╼╾──────╼
}
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-incorrect-vtable.rs:23:1
|
LL | const INVALID_VTABLE_SIZE: &dyn Trait =
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC3, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC3<imm>, but expected a vtable pointer
|
= 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) {
- ╾ALLOC2╼ ╾ALLOC3╼ │ ╾──────╼╾──────╼
+ ╾ALLOC2<imm>╼ ╾ALLOC3<imm>╼ │ ╾──────╼╾──────╼
}
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-incorrect-vtable.rs:33:1
|
LL | const INVALID_VTABLE_ALIGNMENT_UB: W<&dyn Trait> =
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC5, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC5<imm>, but expected a vtable pointer
|
= 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) {
- ╾ALLOC4╼ ╾ALLOC5╼ │ ╾──────╼╾──────╼
+ ╾ALLOC4<imm>╼ ╾ALLOC5<imm>╼ │ ╾──────╼╾──────╼
}
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-incorrect-vtable.rs:38:1
|
LL | const INVALID_VTABLE_SIZE_UB: W<&dyn Trait> =
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC7, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC7<imm>, but expected a vtable pointer
|
= 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) {
- ╾ALLOC6╼ ╾ALLOC7╼ │ ╾──────╼╾──────╼
+ ╾ALLOC6<imm>╼ ╾ALLOC7<imm>╼ │ ╾──────╼╾──────╼
}
error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-incorrect-vtable.rs:44:1
|
LL | const INVALID_VTABLE_UB: W<&dyn Trait> =
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC9, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC9<imm>, but expected a vtable pointer
|
= 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) {
- ╾ALLOC8╼ ╾ALLOC9╼ │ ╾──────╼╾──────╼
+ ╾ALLOC8<imm>╼ ╾ALLOC9<imm>╼ │ ╾──────╼╾──────╼
}
error[E0080]: it is undefined behavior to use this value
@@ -61,7 +61,7 @@ LL | const G: Wide = unsafe { Transmute { t: FOO }.u };
|
= 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) {
- ╾ALLOC10╼ ╾ALLOC11╼ │ ╾──────╼╾──────╼
+ ╾ALLOC10<imm>╼ ╾ALLOC11╼ │ ╾──────╼╾──────╼
}
error: aborting due to 6 previous errors
diff --git a/tests/ui/consts/const-eval/ub-nonnull.chalk.64bit.stderr b/tests/ui/consts/const-eval/ub-nonnull.chalk.64bit.stderr
index 2a4b6f3b7..fef6c92af 100644
--- a/tests/ui/consts/const-eval/ub-nonnull.chalk.64bit.stderr
+++ b/tests/ui/consts/const-eval/ub-nonnull.chalk.64bit.stderr
@@ -4,6 +4,6 @@ error[E0284]: type annotations needed: cannot satisfy `<usize as SliceIndex<[u8]
LL | let out_of_bounds_ptr = &ptr[255];
| ^^^^^^^^ cannot satisfy `<usize as SliceIndex<[u8]>>::Output == _`
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0284`.
diff --git a/tests/ui/consts/const-eval/ub-ref-ptr.rs b/tests/ui/consts/const-eval/ub-ref-ptr.rs
index 08d4dce4d..9e49e3de8 100644
--- a/tests/ui/consts/const-eval/ub-ref-ptr.rs
+++ b/tests/ui/consts/const-eval/ub-ref-ptr.rs
@@ -1,7 +1,7 @@
// ignore-tidy-linelength
// Strip out raw byte dumps to make comparison platform-independent:
// normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
-// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
+// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?(<imm>)?─*╼ )+ *│.*" -> "HEX_DUMP"
#![allow(invalid_value)]
use std::mem;
diff --git a/tests/ui/consts/const-eval/ub-ref-ptr.stderr b/tests/ui/consts/const-eval/ub-ref-ptr.stderr
index c608bad2a..3bbf29773 100644
--- a/tests/ui/consts/const-eval/ub-ref-ptr.stderr
+++ b/tests/ui/consts/const-eval/ub-ref-ptr.stderr
@@ -141,7 +141,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-ref-ptr.rs:59:1
|
LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
- | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC2, but expected a function pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC2<imm>, but expected a function pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
@@ -155,7 +155,7 @@ error[E0080]: evaluation of constant value failed
|
note: inside `std::ptr::read::<u32>`
--> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
-note: inside `ptr::const_ptr::<impl *const u32>::read`
+note: inside `std::ptr::const_ptr::<impl *const u32>::read`
--> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
note: inside `UNALIGNED_READ`
--> $DIR/ub-ref-ptr.rs:66:5
diff --git a/tests/ui/consts/const-eval/ub-slice-get-unchecked.stderr b/tests/ui/consts/const-eval/ub-slice-get-unchecked.stderr
index 403fb5e09..de96821e8 100644
--- a/tests/ui/consts/const-eval/ub-slice-get-unchecked.stderr
+++ b/tests/ui/consts/const-eval/ub-slice-get-unchecked.stderr
@@ -6,6 +6,6 @@ LL | const B: &[()] = unsafe { A.get_unchecked(3..1) };
|
= note: calls in constants are limited to constant functions, tuple structs and tuple variants
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/consts/const-eval/ub-upvars.32bit.stderr b/tests/ui/consts/const-eval/ub-upvars.32bit.stderr
index 353a9b782..5342fea66 100644
--- a/tests/ui/consts/const-eval/ub-upvars.32bit.stderr
+++ b/tests/ui/consts/const-eval/ub-upvars.32bit.stderr
@@ -6,9 +6,9 @@ LL | const BAD_UPVAR: &dyn FnOnce() = &{
|
= 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) {
- ╾ALLOC0╼ ╾ALLOC1╼ │ ╾──╼╾──╼
+ ╾ALLOC0<imm>╼ ╾ALLOC1╼ │ ╾──╼╾──╼
}
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/ub-upvars.64bit.stderr b/tests/ui/consts/const-eval/ub-upvars.64bit.stderr
index 097f6b049..a2496dfc2 100644
--- a/tests/ui/consts/const-eval/ub-upvars.64bit.stderr
+++ b/tests/ui/consts/const-eval/ub-upvars.64bit.stderr
@@ -6,9 +6,9 @@ LL | const BAD_UPVAR: &dyn FnOnce() = &{
|
= 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) {
- ╾ALLOC0╼ ╾ALLOC1╼ │ ╾──────╼╾──────╼
+ ╾ALLOC0<imm>╼ ╾ALLOC1╼ │ ╾──────╼╾──────╼
}
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/ub-wide-ptr.chalk.64bit.stderr b/tests/ui/consts/const-eval/ub-wide-ptr.chalk.64bit.stderr
index 39352ca84..533db90ce 100644
--- a/tests/ui/consts/const-eval/ub-wide-ptr.chalk.64bit.stderr
+++ b/tests/ui/consts/const-eval/ub-wide-ptr.chalk.64bit.stderr
@@ -4,6 +4,6 @@ error[E0282]: type annotations needed
LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]);
| ^^^^^^^^^^^^^^ cannot infer type for type parameter `U` declared on the function `transmute`
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0282`.
diff --git a/tests/ui/consts/const-eval/ub-wide-ptr.rs b/tests/ui/consts/const-eval/ub-wide-ptr.rs
index dc8d4c640..3c1baab3e 100644
--- a/tests/ui/consts/const-eval/ub-wide-ptr.rs
+++ b/tests/ui/consts/const-eval/ub-wide-ptr.rs
@@ -5,7 +5,7 @@ use std::mem;
// Strip out raw byte dumps to make comparison platform-independent:
// normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
-// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
+// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?(<imm>)?─*╼ )+ *│.*" -> "HEX_DUMP"
// normalize-stderr-test "offset \d+" -> "offset N"
// normalize-stderr-test "size \d+" -> "size N"
diff --git a/tests/ui/consts/const-eval/ub-wide-ptr.stderr b/tests/ui/consts/const-eval/ub-wide-ptr.stderr
index b20379485..91ce531c9 100644
--- a/tests/ui/consts/const-eval/ub-wide-ptr.stderr
+++ b/tests/ui/consts/const-eval/ub-wide-ptr.stderr
@@ -189,7 +189,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-wide-ptr.rs:113:1
|
LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u8))) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC12, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC12<imm>, but expected a vtable pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
@@ -200,7 +200,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-wide-ptr.rs:117:1
|
LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u64))) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC14, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC14<imm>, but expected a vtable pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
@@ -222,7 +222,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-wide-ptr.rs:124:1
|
LL | const TRAIT_OBJ_UNALIGNED_VTABLE: &dyn Trait = unsafe { mem::transmute((&92u8, &[0u8; 128])) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC17, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC17<imm>, but expected a vtable pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
@@ -233,7 +233,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-wide-ptr.rs:127:1
|
LL | const TRAIT_OBJ_BAD_DROP_FN_NULL: &dyn Trait = unsafe { mem::transmute((&92u8, &[0usize; 8])) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC19, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC19<imm>, but expected a vtable pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
@@ -244,7 +244,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-wide-ptr.rs:130:1
|
LL | const TRAIT_OBJ_BAD_DROP_FN_INT: &dyn Trait = unsafe { mem::transmute((&92u8, &[1usize; 8])) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC21, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC21<imm>, but expected a vtable pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
@@ -255,7 +255,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-wide-ptr.rs:133:1
|
LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &[&42u8; 8]))) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC23, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC23<imm>, but expected a vtable pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
@@ -288,7 +288,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-wide-ptr.rs:145:1
|
LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC28, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC28<imm>, but expected a vtable pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
@@ -310,7 +310,7 @@ error[E0080]: it is undefined behavior to use this value
--> $DIR/ub-wide-ptr.rs:154:1
|
LL | static mut RAW_TRAIT_OBJ_VTABLE_INVALID_THROUGH_REF: *const dyn Trait = unsafe {
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC31, but expected a vtable pointer
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC31<imm>, but expected a vtable pointer
|
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
diff --git a/tests/ui/consts/const-eval/ub-write-through-immutable.rs b/tests/ui/consts/const-eval/ub-write-through-immutable.rs
new file mode 100644
index 000000000..945367f18
--- /dev/null
+++ b/tests/ui/consts/const-eval/ub-write-through-immutable.rs
@@ -0,0 +1,30 @@
+//! Ensure we catch UB due to writing through a shared reference.
+#![feature(const_mut_refs, const_refs_to_cell)]
+#![deny(writes_through_immutable_pointer)]
+#![allow(invalid_reference_casting)]
+
+use std::mem;
+use std::cell::UnsafeCell;
+
+const WRITE_AFTER_CAST: () = unsafe {
+ let mut x = 0;
+ let ptr = &x as *const i32 as *mut i32;
+ *ptr = 0; //~ERROR: writes_through_immutable_pointer
+ //~^ previously accepted
+};
+
+const WRITE_AFTER_TRANSMUTE: () = unsafe {
+ let mut x = 0;
+ let ptr: *mut i32 = mem::transmute(&x);
+ *ptr = 0; //~ERROR: writes_through_immutable_pointer
+ //~^ previously accepted
+};
+
+// it's okay when there is interior mutability;
+const WRITE_INTERIOR_MUT: () = unsafe {
+ let x = UnsafeCell::new(0);
+ let ptr = &x as *const _ as *mut i32;
+ *ptr = 0;
+};
+
+fn main() {}
diff --git a/tests/ui/consts/const-eval/ub-write-through-immutable.stderr b/tests/ui/consts/const-eval/ub-write-through-immutable.stderr
new file mode 100644
index 000000000..27eb2d2c0
--- /dev/null
+++ b/tests/ui/consts/const-eval/ub-write-through-immutable.stderr
@@ -0,0 +1,55 @@
+error: writing through a pointer that was derived from a shared (immutable) reference
+ --> $DIR/ub-write-through-immutable.rs:12:5
+ |
+LL | *ptr = 0;
+ | ^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #X <https://github.com/rust-lang/rust/issues/X>
+note: the lint level is defined here
+ --> $DIR/ub-write-through-immutable.rs:3:9
+ |
+LL | #![deny(writes_through_immutable_pointer)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: writing through a pointer that was derived from a shared (immutable) reference
+ --> $DIR/ub-write-through-immutable.rs:19:5
+ |
+LL | *ptr = 0;
+ | ^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #X <https://github.com/rust-lang/rust/issues/X>
+
+error: aborting due to 2 previous errors
+
+Future incompatibility report: Future breakage diagnostic:
+error: writing through a pointer that was derived from a shared (immutable) reference
+ --> $DIR/ub-write-through-immutable.rs:12:5
+ |
+LL | *ptr = 0;
+ | ^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #X <https://github.com/rust-lang/rust/issues/X>
+note: the lint level is defined here
+ --> $DIR/ub-write-through-immutable.rs:3:9
+ |
+LL | #![deny(writes_through_immutable_pointer)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Future breakage diagnostic:
+error: writing through a pointer that was derived from a shared (immutable) reference
+ --> $DIR/ub-write-through-immutable.rs:19:5
+ |
+LL | *ptr = 0;
+ | ^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #X <https://github.com/rust-lang/rust/issues/X>
+note: the lint level is defined here
+ --> $DIR/ub-write-through-immutable.rs:3:9
+ |
+LL | #![deny(writes_through_immutable_pointer)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
diff --git a/tests/ui/consts/const-eval/union-const-eval-field.stderr b/tests/ui/consts/const-eval/union-const-eval-field.stderr
index b299208ae..b1de225ec 100644
--- a/tests/ui/consts/const-eval/union-const-eval-field.stderr
+++ b/tests/ui/consts/const-eval/union-const-eval-field.stderr
@@ -18,6 +18,6 @@ LL | FIELD3
|
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/union_promotion.stderr b/tests/ui/consts/const-eval/union_promotion.stderr
index 42f17de20..49a285f84 100644
--- a/tests/ui/consts/const-eval/union_promotion.stderr
+++ b/tests/ui/consts/const-eval/union_promotion.stderr
@@ -11,6 +11,6 @@ LL | | };
LL | }
| - temporary value is freed at the end of this statement
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0716`.
diff --git a/tests/ui/consts/const-eval/unused-broken-const-late.stderr b/tests/ui/consts/const-eval/unused-broken-const-late.stderr
index cdb70a69d..c2cf2f381 100644
--- a/tests/ui/consts/const-eval/unused-broken-const-late.stderr
+++ b/tests/ui/consts/const-eval/unused-broken-const-late.stderr
@@ -6,6 +6,6 @@ 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: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/unused-broken-const.stderr b/tests/ui/consts/const-eval/unused-broken-const.stderr
index fbb10feb7..fd0ee316f 100644
--- a/tests/ui/consts/const-eval/unused-broken-const.stderr
+++ b/tests/ui/consts/const-eval/unused-broken-const.stderr
@@ -4,6 +4,6 @@ error[E0080]: evaluation of constant value failed
LL | const FOO: i32 = [][0];
| ^^^^^ index out of bounds: the length is 0 but the index is 0
-error: aborting due to previous error
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/const-eval/unwind-abort.stderr b/tests/ui/consts/const-eval/unwind-abort.stderr
index 759ce15ab..d7330beca 100644
--- a/tests/ui/consts/const-eval/unwind-abort.stderr
+++ b/tests/ui/consts/const-eval/unwind-abort.stderr
@@ -16,6 +16,6 @@ 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
+error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0080`.