summaryrefslogtreecommitdiffstats
path: root/tests/ui/consts/const-eval
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/ui/consts/const-eval/assign-to-static-within-other-static.rs (renamed from src/test/ui/consts/const-eval/assign-to-static-within-other-static.rs)0
-rw-r--r--tests/ui/consts/const-eval/assign-to-static-within-other-static.stderr (renamed from src/test/ui/consts/const-eval/assign-to-static-within-other-static.stderr)0
-rw-r--r--tests/ui/consts/const-eval/auxiliary/post_monomorphization_error.rs (renamed from src/test/ui/consts/const-eval/auxiliary/post_monomorphization_error.rs)0
-rw-r--r--tests/ui/consts/const-eval/auxiliary/stability.rs (renamed from src/test/ui/consts/const-eval/auxiliary/stability.rs)0
-rw-r--r--tests/ui/consts/const-eval/conditional_array_execution.rs (renamed from src/test/ui/consts/const-eval/conditional_array_execution.rs)0
-rw-r--r--tests/ui/consts/const-eval/conditional_array_execution.stderr (renamed from src/test/ui/consts/const-eval/conditional_array_execution.stderr)0
-rw-r--r--tests/ui/consts/const-eval/const-eval-intrinsic-promotion.rs (renamed from src/test/ui/consts/const-eval/const-eval-intrinsic-promotion.rs)0
-rw-r--r--tests/ui/consts/const-eval/const-eval-intrinsic-promotion.stderr (renamed from src/test/ui/consts/const-eval/const-eval-intrinsic-promotion.stderr)0
-rw-r--r--tests/ui/consts/const-eval/const-eval-overflow-2.rs (renamed from src/test/ui/consts/const-eval/const-eval-overflow-2.rs)0
-rw-r--r--tests/ui/consts/const-eval/const-eval-overflow-2.stderr (renamed from src/test/ui/consts/const-eval/const-eval-overflow-2.stderr)0
-rw-r--r--tests/ui/consts/const-eval/const-eval-overflow-3.rs (renamed from src/test/ui/consts/const-eval/const-eval-overflow-3.rs)0
-rw-r--r--tests/ui/consts/const-eval/const-eval-overflow-3.stderr (renamed from src/test/ui/consts/const-eval/const-eval-overflow-3.stderr)0
-rw-r--r--tests/ui/consts/const-eval/const-eval-overflow-3b.rs (renamed from src/test/ui/consts/const-eval/const-eval-overflow-3b.rs)0
-rw-r--r--tests/ui/consts/const-eval/const-eval-overflow-3b.stderr (renamed from src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr)0
-rw-r--r--tests/ui/consts/const-eval/const-eval-overflow-4.rs (renamed from src/test/ui/consts/const-eval/const-eval-overflow-4.rs)0
-rw-r--r--tests/ui/consts/const-eval/const-eval-overflow-4.stderr (renamed from src/test/ui/consts/const-eval/const-eval-overflow-4.stderr)0
-rw-r--r--tests/ui/consts/const-eval/const-eval-overflow-4b.rs (renamed from src/test/ui/consts/const-eval/const-eval-overflow-4b.rs)0
-rw-r--r--tests/ui/consts/const-eval/const-eval-overflow-4b.stderr (renamed from src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr)0
-rw-r--r--tests/ui/consts/const-eval/const-eval-overflow2.rs (renamed from src/test/ui/consts/const-eval/const-eval-overflow2.rs)0
-rw-r--r--tests/ui/consts/const-eval/const-eval-overflow2.stderr (renamed from src/test/ui/consts/const-eval/const-eval-overflow2.stderr)0
-rw-r--r--tests/ui/consts/const-eval/const-eval-overflow2b.rs (renamed from src/test/ui/consts/const-eval/const-eval-overflow2b.rs)0
-rw-r--r--tests/ui/consts/const-eval/const-eval-overflow2b.stderr (renamed from src/test/ui/consts/const-eval/const-eval-overflow2b.stderr)0
-rw-r--r--tests/ui/consts/const-eval/const-eval-overflow2c.rs (renamed from src/test/ui/consts/const-eval/const-eval-overflow2c.rs)0
-rw-r--r--tests/ui/consts/const-eval/const-eval-overflow2c.stderr (renamed from src/test/ui/consts/const-eval/const-eval-overflow2c.stderr)0
-rw-r--r--tests/ui/consts/const-eval/const-eval-query-stack.rs (renamed from src/test/ui/consts/const-eval/const-eval-query-stack.rs)0
-rw-r--r--tests/ui/consts/const-eval/const-eval-query-stack.stderr (renamed from src/test/ui/consts/const-eval/const-eval-query-stack.stderr)0
-rw-r--r--tests/ui/consts/const-eval/const-eval-span.rs (renamed from src/test/ui/consts/const-eval/const-eval-span.rs)0
-rw-r--r--tests/ui/consts/const-eval/const-eval-span.stderr (renamed from src/test/ui/consts/const-eval/const-eval-span.stderr)0
-rw-r--r--tests/ui/consts/const-eval/const-pointer-values-in-various-types.64bit.stderr (renamed from src/test/ui/consts/const-eval/const-pointer-values-in-various-types.64bit.stderr)0
-rw-r--r--tests/ui/consts/const-eval/const-pointer-values-in-various-types.rs (renamed from src/test/ui/consts/const-eval/const-pointer-values-in-various-types.rs)0
-rw-r--r--tests/ui/consts/const-eval/const_fn_ptr.rs (renamed from src/test/ui/consts/const-eval/const_fn_ptr.rs)0
-rw-r--r--tests/ui/consts/const-eval/const_fn_ptr.stderr (renamed from src/test/ui/consts/const-eval/const_fn_ptr.stderr)0
-rw-r--r--tests/ui/consts/const-eval/const_fn_ptr_fail.rs (renamed from src/test/ui/consts/const-eval/const_fn_ptr_fail.rs)0
-rw-r--r--tests/ui/consts/const-eval/const_fn_ptr_fail.stderr (renamed from src/test/ui/consts/const-eval/const_fn_ptr_fail.stderr)0
-rw-r--r--tests/ui/consts/const-eval/const_fn_ptr_fail2.rs (renamed from src/test/ui/consts/const-eval/const_fn_ptr_fail2.rs)0
-rw-r--r--tests/ui/consts/const-eval/const_fn_ptr_fail2.stderr (renamed from src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr)0
-rw-r--r--tests/ui/consts/const-eval/const_let.rs (renamed from src/test/ui/consts/const-eval/const_let.rs)0
-rw-r--r--tests/ui/consts/const-eval/const_let.stderr (renamed from src/test/ui/consts/const-eval/const_let.stderr)0
-rw-r--r--tests/ui/consts/const-eval/const_panic.rs (renamed from src/test/ui/consts/const-eval/const_panic.rs)0
-rw-r--r--tests/ui/consts/const-eval/const_panic.stderr (renamed from src/test/ui/consts/const-eval/const_panic.stderr)0
-rw-r--r--tests/ui/consts/const-eval/const_panic_2021.rs (renamed from src/test/ui/consts/const-eval/const_panic_2021.rs)0
-rw-r--r--tests/ui/consts/const-eval/const_panic_2021.stderr (renamed from src/test/ui/consts/const-eval/const_panic_2021.stderr)0
-rw-r--r--tests/ui/consts/const-eval/const_panic_libcore_bin.rs (renamed from src/test/ui/consts/const-eval/const_panic_libcore_bin.rs)0
-rw-r--r--tests/ui/consts/const-eval/const_panic_libcore_bin.stderr (renamed from src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr)0
-rw-r--r--tests/ui/consts/const-eval/const_panic_stability.e2018.stderr (renamed from src/test/ui/consts/const-eval/const_panic_stability.e2018.stderr)0
-rw-r--r--tests/ui/consts/const-eval/const_panic_stability.e2021.stderr (renamed from src/test/ui/consts/const-eval/const_panic_stability.e2021.stderr)0
-rw-r--r--tests/ui/consts/const-eval/const_panic_stability.rs (renamed from src/test/ui/consts/const-eval/const_panic_stability.rs)0
-rw-r--r--tests/ui/consts/const-eval/const_panic_track_caller.rs (renamed from src/test/ui/consts/const-eval/const_panic_track_caller.rs)0
-rw-r--r--tests/ui/consts/const-eval/const_panic_track_caller.stderr (renamed from src/test/ui/consts/const-eval/const_panic_track_caller.stderr)0
-rw-r--r--tests/ui/consts/const-eval/const_prop_errors.rs (renamed from src/test/ui/consts/const-eval/const_prop_errors.rs)0
-rw-r--r--tests/ui/consts/const-eval/const_raw_ptr_ops.rs (renamed from src/test/ui/consts/const-eval/const_raw_ptr_ops.rs)0
-rw-r--r--tests/ui/consts/const-eval/const_raw_ptr_ops.stderr (renamed from src/test/ui/consts/const-eval/const_raw_ptr_ops.stderr)0
-rw-r--r--tests/ui/consts/const-eval/const_raw_ptr_ops2.rs (renamed from src/test/ui/consts/const-eval/const_raw_ptr_ops2.rs)0
-rw-r--r--tests/ui/consts/const-eval/const_raw_ptr_ops2.stderr (renamed from src/test/ui/consts/const-eval/const_raw_ptr_ops2.stderr)0
-rw-r--r--tests/ui/consts/const-eval/const_signed_pat.rs (renamed from src/test/ui/consts/const-eval/const_signed_pat.rs)0
-rw-r--r--tests/ui/consts/const-eval/dangling.rs (renamed from src/test/ui/consts/const-eval/dangling.rs)0
-rw-r--r--tests/ui/consts/const-eval/dangling.stderr (renamed from src/test/ui/consts/const-eval/dangling.stderr)0
-rw-r--r--tests/ui/consts/const-eval/dont_promote_unstable_const_fn.rs (renamed from src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.rs)0
-rw-r--r--tests/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr (renamed from src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr)0
-rw-r--r--tests/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.rs (renamed from src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.rs)0
-rw-r--r--tests/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.stderr (renamed from src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.stderr)0
-rw-r--r--tests/ui/consts/const-eval/double_check.rs (renamed from src/test/ui/consts/const-eval/double_check.rs)0
-rw-r--r--tests/ui/consts/const-eval/double_check2.rs (renamed from src/test/ui/consts/const-eval/double_check2.rs)0
-rw-r--r--tests/ui/consts/const-eval/duration_conversion.rs (renamed from src/test/ui/consts/const-eval/duration_conversion.rs)0
-rw-r--r--tests/ui/consts/const-eval/enum_discr.rs (renamed from src/test/ui/consts/const-eval/enum_discr.rs)0
-rw-r--r--tests/ui/consts/const-eval/erroneous-const.rs (renamed from src/test/ui/consts/const-eval/erroneous-const.rs)0
-rw-r--r--tests/ui/consts/const-eval/erroneous-const.stderr (renamed from src/test/ui/consts/const-eval/erroneous-const.stderr)0
-rw-r--r--tests/ui/consts/const-eval/erroneous-const2.rs (renamed from src/test/ui/consts/const-eval/erroneous-const2.rs)0
-rw-r--r--tests/ui/consts/const-eval/erroneous-const2.stderr (renamed from src/test/ui/consts/const-eval/erroneous-const2.stderr)0
-rw-r--r--tests/ui/consts/const-eval/extern_fat_pointer.rs (renamed from src/test/ui/consts/const-eval/extern_fat_pointer.rs)0
-rw-r--r--tests/ui/consts/const-eval/format.rs (renamed from src/test/ui/consts/const-eval/format.rs)0
-rw-r--r--tests/ui/consts/const-eval/format.stderr (renamed from src/test/ui/consts/const-eval/format.stderr)0
-rw-r--r--tests/ui/consts/const-eval/generic-slice.rs (renamed from src/test/ui/consts/const-eval/generic-slice.rs)0
-rw-r--r--tests/ui/consts/const-eval/generic-slice.stderr (renamed from src/test/ui/consts/const-eval/generic-slice.stderr)0
-rw-r--r--tests/ui/consts/const-eval/heap/alloc_intrinsic_errors.rs (renamed from src/test/ui/consts/const-eval/heap/alloc_intrinsic_errors.rs)0
-rw-r--r--tests/ui/consts/const-eval/heap/alloc_intrinsic_errors.stderr (renamed from src/test/ui/consts/const-eval/heap/alloc_intrinsic_errors.stderr)0
-rw-r--r--tests/ui/consts/const-eval/heap/alloc_intrinsic_nontransient.rs (renamed from src/test/ui/consts/const-eval/heap/alloc_intrinsic_nontransient.rs)0
-rw-r--r--tests/ui/consts/const-eval/heap/alloc_intrinsic_nontransient_fail.rs (renamed from src/test/ui/consts/const-eval/heap/alloc_intrinsic_nontransient_fail.rs)0
-rw-r--r--tests/ui/consts/const-eval/heap/alloc_intrinsic_nontransient_fail.stderr (renamed from src/test/ui/consts/const-eval/heap/alloc_intrinsic_nontransient_fail.stderr)0
-rw-r--r--tests/ui/consts/const-eval/heap/alloc_intrinsic_transient.rs (renamed from src/test/ui/consts/const-eval/heap/alloc_intrinsic_transient.rs)0
-rw-r--r--tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.32bit.stderr (renamed from src/test/ui/consts/const-eval/heap/alloc_intrinsic_uninit.32bit.stderr)0
-rw-r--r--tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.64bit.stderr (renamed from src/test/ui/consts/const-eval/heap/alloc_intrinsic_uninit.64bit.stderr)0
-rw-r--r--tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.rs (renamed from src/test/ui/consts/const-eval/heap/alloc_intrinsic_uninit.rs)0
-rw-r--r--tests/ui/consts/const-eval/heap/alloc_intrinsic_untyped.rs (renamed from src/test/ui/consts/const-eval/heap/alloc_intrinsic_untyped.rs)0
-rw-r--r--tests/ui/consts/const-eval/heap/alloc_intrinsic_untyped.stderr (renamed from src/test/ui/consts/const-eval/heap/alloc_intrinsic_untyped.stderr)0
-rw-r--r--tests/ui/consts/const-eval/heap/alloc_intrinsic_zero_sized.rs (renamed from src/test/ui/consts/const-eval/heap/alloc_intrinsic_zero_sized.rs)0
-rw-r--r--tests/ui/consts/const-eval/heap/dealloc_intrinsic.rs (renamed from src/test/ui/consts/const-eval/heap/dealloc_intrinsic.rs)0
-rw-r--r--tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.rs (renamed from src/test/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.rs)0
-rw-r--r--tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.stderr (renamed from src/test/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.stderr)0
-rw-r--r--tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.rs (renamed from src/test/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.rs)0
-rw-r--r--tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.stderr (renamed from src/test/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.stderr)0
-rw-r--r--tests/ui/consts/const-eval/heap/dealloc_intrinsic_incorrect_layout.rs (renamed from src/test/ui/consts/const-eval/heap/dealloc_intrinsic_incorrect_layout.rs)0
-rw-r--r--tests/ui/consts/const-eval/heap/dealloc_intrinsic_incorrect_layout.stderr (renamed from src/test/ui/consts/const-eval/heap/dealloc_intrinsic_incorrect_layout.stderr)0
-rw-r--r--tests/ui/consts/const-eval/heap/dealloc_intrinsic_zero_sized.rs (renamed from src/test/ui/consts/const-eval/heap/dealloc_intrinsic_zero_sized.rs)0
-rw-r--r--tests/ui/consts/const-eval/ice-generic-assoc-const.rs (renamed from src/test/ui/consts/const-eval/ice-generic-assoc-const.rs)0
-rw-r--r--tests/ui/consts/const-eval/ice-packed.rs (renamed from src/test/ui/consts/const-eval/ice-packed.rs)0
-rw-r--r--tests/ui/consts/const-eval/index-out-of-bounds-never-type.rs (renamed from src/test/ui/consts/const-eval/index-out-of-bounds-never-type.rs)0
-rw-r--r--tests/ui/consts/const-eval/index-out-of-bounds-never-type.stderr (renamed from src/test/ui/consts/const-eval/index-out-of-bounds-never-type.stderr)0
-rw-r--r--tests/ui/consts/const-eval/index_out_of_bounds.rs (renamed from src/test/ui/consts/const-eval/index_out_of_bounds.rs)0
-rw-r--r--tests/ui/consts/const-eval/index_out_of_bounds.stderr (renamed from src/test/ui/consts/const-eval/index_out_of_bounds.stderr)0
-rw-r--r--tests/ui/consts/const-eval/index_out_of_bounds_propagated.rs (renamed from src/test/ui/consts/const-eval/index_out_of_bounds_propagated.rs)0
-rw-r--r--tests/ui/consts/const-eval/index_out_of_bounds_propagated.stderr (renamed from src/test/ui/consts/const-eval/index_out_of_bounds_propagated.stderr)0
-rw-r--r--tests/ui/consts/const-eval/infinite_loop.rs (renamed from src/test/ui/consts/const-eval/infinite_loop.rs)0
-rw-r--r--tests/ui/consts/const-eval/infinite_loop.stderr (renamed from src/test/ui/consts/const-eval/infinite_loop.stderr)0
-rw-r--r--tests/ui/consts/const-eval/issue-100878.rs (renamed from src/test/ui/consts/const-eval/issue-100878.rs)0
-rw-r--r--tests/ui/consts/const-eval/issue-104390.rs (renamed from src/test/ui/consts/const-eval/issue-104390.rs)0
-rw-r--r--tests/ui/consts/const-eval/issue-104390.stderr (renamed from src/test/ui/consts/const-eval/issue-104390.stderr)0
-rw-r--r--tests/ui/consts/const-eval/issue-43197.rs (renamed from src/test/ui/consts/const-eval/issue-43197.rs)0
-rw-r--r--tests/ui/consts/const-eval/issue-43197.stderr (renamed from src/test/ui/consts/const-eval/issue-43197.stderr)0
-rw-r--r--tests/ui/consts/const-eval/issue-44578.rs (renamed from src/test/ui/consts/const-eval/issue-44578.rs)0
-rw-r--r--tests/ui/consts/const-eval/issue-44578.stderr (renamed from src/test/ui/consts/const-eval/issue-44578.stderr)0
-rw-r--r--tests/ui/consts/const-eval/issue-47971.rs (renamed from src/test/ui/consts/const-eval/issue-47971.rs)0
-rw-r--r--tests/ui/consts/const-eval/issue-49296.rs (renamed from src/test/ui/consts/const-eval/issue-49296.rs)0
-rw-r--r--tests/ui/consts/const-eval/issue-49296.stderr (renamed from src/test/ui/consts/const-eval/issue-49296.stderr)0
-rw-r--r--tests/ui/consts/const-eval/issue-50706.rs (renamed from src/test/ui/consts/const-eval/issue-50706.rs)0
-rw-r--r--tests/ui/consts/const-eval/issue-50814-2.rs (renamed from src/test/ui/consts/const-eval/issue-50814-2.rs)0
-rw-r--r--tests/ui/consts/const-eval/issue-50814-2.stderr (renamed from src/test/ui/consts/const-eval/issue-50814-2.stderr)0
-rw-r--r--tests/ui/consts/const-eval/issue-50814.rs (renamed from src/test/ui/consts/const-eval/issue-50814.rs)0
-rw-r--r--tests/ui/consts/const-eval/issue-50814.stderr (renamed from src/test/ui/consts/const-eval/issue-50814.stderr)0
-rw-r--r--tests/ui/consts/const-eval/issue-51300.rs (renamed from src/test/ui/consts/const-eval/issue-51300.rs)0
-rw-r--r--tests/ui/consts/const-eval/issue-52475.rs (renamed from src/test/ui/consts/const-eval/issue-52475.rs)0
-rw-r--r--tests/ui/consts/const-eval/issue-52475.stderr (renamed from src/test/ui/consts/const-eval/issue-52475.stderr)0
-rw-r--r--tests/ui/consts/const-eval/issue-53157.rs (renamed from src/test/ui/consts/const-eval/issue-53157.rs)0
-rw-r--r--tests/ui/consts/const-eval/issue-53401.rs (renamed from src/test/ui/consts/const-eval/issue-53401.rs)0
-rw-r--r--tests/ui/consts/const-eval/issue-55541.rs (renamed from src/test/ui/consts/const-eval/issue-55541.rs)0
-rw-r--r--tests/ui/consts/const-eval/issue-64908.rs (renamed from src/test/ui/consts/const-eval/issue-64908.rs)0
-rw-r--r--tests/ui/consts/const-eval/issue-64970.rs (renamed from src/test/ui/consts/const-eval/issue-64970.rs)0
-rw-r--r--tests/ui/consts/const-eval/issue-65394.rs (renamed from src/test/ui/consts/const-eval/issue-65394.rs)0
-rw-r--r--tests/ui/consts/const-eval/issue-65394.stderr (renamed from src/test/ui/consts/const-eval/issue-65394.stderr)0
-rw-r--r--tests/ui/consts/const-eval/issue-70723.rs (renamed from src/test/ui/consts/const-eval/issue-70723.rs)0
-rw-r--r--tests/ui/consts/const-eval/issue-70723.stderr (renamed from src/test/ui/consts/const-eval/issue-70723.stderr)0
-rw-r--r--tests/ui/consts/const-eval/issue-70804-fn-subtyping.rs (renamed from src/test/ui/consts/const-eval/issue-70804-fn-subtyping.rs)0
-rw-r--r--tests/ui/consts/const-eval/issue-84957-const-str-as-bytes.rs (renamed from src/test/ui/consts/const-eval/issue-84957-const-str-as-bytes.rs)0
-rw-r--r--tests/ui/consts/const-eval/issue-85155.rs (renamed from src/test/ui/consts/const-eval/issue-85155.rs)0
-rw-r--r--tests/ui/consts/const-eval/issue-85155.stderr (renamed from src/test/ui/consts/const-eval/issue-85155.stderr)0
-rw-r--r--tests/ui/consts/const-eval/issue-85907.rs (renamed from src/test/ui/consts/const-eval/issue-85907.rs)0
-rw-r--r--tests/ui/consts/const-eval/issue-85907.stderr (renamed from src/test/ui/consts/const-eval/issue-85907.stderr)0
-rw-r--r--tests/ui/consts/const-eval/issue-91827-extern-types.rs (renamed from src/test/ui/consts/const-eval/issue-91827-extern-types.rs)0
-rw-r--r--tests/ui/consts/const-eval/livedrop.rs (renamed from src/test/ui/consts/const-eval/livedrop.rs)0
-rw-r--r--tests/ui/consts/const-eval/livedrop.stderr (renamed from src/test/ui/consts/const-eval/livedrop.stderr)0
-rw-r--r--tests/ui/consts/const-eval/match-test-ptr-null.rs (renamed from src/test/ui/consts/const-eval/match-test-ptr-null.rs)0
-rw-r--r--tests/ui/consts/const-eval/match-test-ptr-null.stderr (renamed from src/test/ui/consts/const-eval/match-test-ptr-null.stderr)0
-rw-r--r--tests/ui/consts/const-eval/mod-static-with-const-fn.rs (renamed from src/test/ui/consts/const-eval/mod-static-with-const-fn.rs)0
-rw-r--r--tests/ui/consts/const-eval/mod-static-with-const-fn.stderr (renamed from src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr)0
-rw-r--r--tests/ui/consts/const-eval/no_lint_for_statically_known_error.rs (renamed from src/test/ui/consts/const-eval/no_lint_for_statically_known_error.rs)0
-rw-r--r--tests/ui/consts/const-eval/nrvo.rs (renamed from src/test/ui/consts/const-eval/nrvo.rs)0
-rw-r--r--tests/ui/consts/const-eval/panic-assoc-never-type.rs (renamed from src/test/ui/consts/const-eval/panic-assoc-never-type.rs)0
-rw-r--r--tests/ui/consts/const-eval/panic-assoc-never-type.stderr (renamed from src/test/ui/consts/const-eval/panic-assoc-never-type.stderr)0
-rw-r--r--tests/ui/consts/const-eval/panic-never-type.rs (renamed from src/test/ui/consts/const-eval/panic-never-type.rs)0
-rw-r--r--tests/ui/consts/const-eval/panic-never-type.stderr (renamed from src/test/ui/consts/const-eval/panic-never-type.stderr)0
-rw-r--r--tests/ui/consts/const-eval/partial_ptr_overwrite.rs (renamed from src/test/ui/consts/const-eval/partial_ptr_overwrite.rs)0
-rw-r--r--tests/ui/consts/const-eval/partial_ptr_overwrite.stderr (renamed from src/test/ui/consts/const-eval/partial_ptr_overwrite.stderr)0
-rw-r--r--tests/ui/consts/const-eval/promote-static.rs (renamed from src/test/ui/consts/const-eval/promote-static.rs)0
-rw-r--r--tests/ui/consts/const-eval/promote_mutable_zst_mir_borrowck.rs (renamed from src/test/ui/consts/const-eval/promote_mutable_zst_mir_borrowck.rs)0
-rw-r--r--tests/ui/consts/const-eval/promoted_const_fn_fail.rs (renamed from src/test/ui/consts/const-eval/promoted_const_fn_fail.rs)0
-rw-r--r--tests/ui/consts/const-eval/promoted_const_fn_fail.stderr (renamed from src/test/ui/consts/const-eval/promoted_const_fn_fail.stderr)0
-rw-r--r--tests/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.rs (renamed from src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.rs)0
-rw-r--r--tests/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.stderr (renamed from src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.stderr)0
-rw-r--r--tests/ui/consts/const-eval/promoted_errors.noopt.stderr (renamed from src/test/ui/consts/const-eval/promoted_errors.noopt.stderr)0
-rw-r--r--tests/ui/consts/const-eval/promoted_errors.opt.stderr (renamed from src/test/ui/consts/const-eval/promoted_errors.opt.stderr)0
-rw-r--r--tests/ui/consts/const-eval/promoted_errors.opt_with_overflow_checks.stderr (renamed from src/test/ui/consts/const-eval/promoted_errors.opt_with_overflow_checks.stderr)0
-rw-r--r--tests/ui/consts/const-eval/promoted_errors.rs (renamed from src/test/ui/consts/const-eval/promoted_errors.rs)0
-rw-r--r--tests/ui/consts/const-eval/promoted_raw_ptr_ops.rs (renamed from src/test/ui/consts/const-eval/promoted_raw_ptr_ops.rs)0
-rw-r--r--tests/ui/consts/const-eval/promoted_raw_ptr_ops.stderr (renamed from src/test/ui/consts/const-eval/promoted_raw_ptr_ops.stderr)0
-rw-r--r--tests/ui/consts/const-eval/raw-bytes.32bit.stderr596
-rw-r--r--tests/ui/consts/const-eval/raw-bytes.64bit.stderr596
-rw-r--r--tests/ui/consts/const-eval/raw-bytes.rs263
-rw-r--r--tests/ui/consts/const-eval/ref_to_int_match.32bit.stderr (renamed from src/test/ui/consts/const-eval/ref_to_int_match.32bit.stderr)0
-rw-r--r--tests/ui/consts/const-eval/ref_to_int_match.64bit.stderr (renamed from src/test/ui/consts/const-eval/ref_to_int_match.64bit.stderr)0
-rw-r--r--tests/ui/consts/const-eval/ref_to_int_match.rs (renamed from src/test/ui/consts/const-eval/ref_to_int_match.rs)0
-rw-r--r--tests/ui/consts/const-eval/shift_overflow.rs (renamed from src/test/ui/consts/const-eval/shift_overflow.rs)0
-rw-r--r--tests/ui/consts/const-eval/shift_overflow.stderr (renamed from src/test/ui/consts/const-eval/shift_overflow.stderr)0
-rw-r--r--tests/ui/consts/const-eval/simd/insert_extract.rs (renamed from src/test/ui/consts/const-eval/simd/insert_extract.rs)0
-rw-r--r--tests/ui/consts/const-eval/simple_with_undef.rs (renamed from src/test/ui/consts/const-eval/simple_with_undef.rs)0
-rw-r--r--tests/ui/consts/const-eval/size-of-t.rs (renamed from src/test/ui/consts/const-eval/size-of-t.rs)0
-rw-r--r--tests/ui/consts/const-eval/size-of-t.stderr (renamed from src/test/ui/consts/const-eval/size-of-t.stderr)0
-rw-r--r--tests/ui/consts/const-eval/strlen.rs (renamed from src/test/ui/consts/const-eval/strlen.rs)0
-rw-r--r--tests/ui/consts/const-eval/transmute-const-promotion.rs (renamed from src/test/ui/consts/const-eval/transmute-const-promotion.rs)0
-rw-r--r--tests/ui/consts/const-eval/transmute-const-promotion.stderr (renamed from src/test/ui/consts/const-eval/transmute-const-promotion.stderr)0
-rw-r--r--tests/ui/consts/const-eval/transmute-const.32bit.stderr (renamed from src/test/ui/consts/const-eval/transmute-const.32bit.stderr)0
-rw-r--r--tests/ui/consts/const-eval/transmute-const.64bit.stderr (renamed from src/test/ui/consts/const-eval/transmute-const.64bit.stderr)0
-rw-r--r--tests/ui/consts/const-eval/transmute-const.rs (renamed from src/test/ui/consts/const-eval/transmute-const.rs)0
-rw-r--r--tests/ui/consts/const-eval/ub-enum-overwrite.rs (renamed from src/test/ui/consts/const-eval/ub-enum-overwrite.rs)0
-rw-r--r--tests/ui/consts/const-eval/ub-enum-overwrite.stderr (renamed from src/test/ui/consts/const-eval/ub-enum-overwrite.stderr)0
-rw-r--r--tests/ui/consts/const-eval/ub-enum.32bit.stderr (renamed from src/test/ui/consts/const-eval/ub-enum.32bit.stderr)46
-rw-r--r--tests/ui/consts/const-eval/ub-enum.64bit.stderr (renamed from src/test/ui/consts/const-eval/ub-enum.64bit.stderr)46
-rw-r--r--tests/ui/consts/const-eval/ub-enum.rs (renamed from src/test/ui/consts/const-eval/ub-enum.rs)3
-rw-r--r--tests/ui/consts/const-eval/ub-incorrect-vtable.32bit.stderr (renamed from src/test/ui/consts/const-eval/ub-incorrect-vtable.32bit.stderr)0
-rw-r--r--tests/ui/consts/const-eval/ub-incorrect-vtable.64bit.stderr (renamed from src/test/ui/consts/const-eval/ub-incorrect-vtable.64bit.stderr)0
-rw-r--r--tests/ui/consts/const-eval/ub-incorrect-vtable.rs (renamed from src/test/ui/consts/const-eval/ub-incorrect-vtable.rs)0
-rw-r--r--tests/ui/consts/const-eval/ub-int-array.32bit.stderr (renamed from src/test/ui/consts/const-eval/ub-int-array.32bit.stderr)0
-rw-r--r--tests/ui/consts/const-eval/ub-int-array.64bit.stderr (renamed from src/test/ui/consts/const-eval/ub-int-array.64bit.stderr)0
-rw-r--r--tests/ui/consts/const-eval/ub-int-array.rs (renamed from src/test/ui/consts/const-eval/ub-int-array.rs)0
-rw-r--r--tests/ui/consts/const-eval/ub-nonnull.chalk.64bit.stderr (renamed from src/test/ui/consts/const-eval/ub-nonnull.chalk.64bit.stderr)0
-rw-r--r--tests/ui/consts/const-eval/ub-nonnull.rs (renamed from src/test/ui/consts/const-eval/ub-nonnull.rs)4
-rw-r--r--tests/ui/consts/const-eval/ub-nonnull.stderr81
-rw-r--r--tests/ui/consts/const-eval/ub-ref-ptr.rs (renamed from src/test/ui/consts/const-eval/ub-ref-ptr.rs)13
-rw-r--r--tests/ui/consts/const-eval/ub-ref-ptr.stderr186
-rw-r--r--tests/ui/consts/const-eval/ub-uninhabit.rs25
-rw-r--r--tests/ui/consts/const-eval/ub-uninhabit.stderr32
-rw-r--r--tests/ui/consts/const-eval/ub-upvars.32bit.stderr (renamed from src/test/ui/consts/const-eval/ub-upvars.32bit.stderr)0
-rw-r--r--tests/ui/consts/const-eval/ub-upvars.64bit.stderr (renamed from src/test/ui/consts/const-eval/ub-upvars.64bit.stderr)0
-rw-r--r--tests/ui/consts/const-eval/ub-upvars.rs (renamed from src/test/ui/consts/const-eval/ub-upvars.rs)0
-rw-r--r--tests/ui/consts/const-eval/ub-wide-ptr.chalk.64bit.stderr (renamed from src/test/ui/consts/const-eval/ub-wide-ptr.chalk.64bit.stderr)0
-rw-r--r--tests/ui/consts/const-eval/ub-wide-ptr.rs (renamed from src/test/ui/consts/const-eval/ub-wide-ptr.rs)4
-rw-r--r--tests/ui/consts/const-eval/ub-wide-ptr.stderr297
-rw-r--r--tests/ui/consts/const-eval/union-const-eval-field.rs (renamed from src/test/ui/consts/const-eval/union-const-eval-field.rs)0
-rw-r--r--tests/ui/consts/const-eval/union-const-eval-field.stderr (renamed from src/test/ui/consts/const-eval/union-const-eval-field.stderr)0
-rw-r--r--tests/ui/consts/const-eval/union-ice.rs (renamed from src/test/ui/consts/const-eval/union-ice.rs)0
-rw-r--r--tests/ui/consts/const-eval/union-ice.stderr (renamed from src/test/ui/consts/const-eval/union-ice.stderr)0
-rw-r--r--tests/ui/consts/const-eval/union-ub.32bit.stderr (renamed from src/test/ui/consts/const-eval/union-ub.32bit.stderr)0
-rw-r--r--tests/ui/consts/const-eval/union-ub.64bit.stderr (renamed from src/test/ui/consts/const-eval/union-ub.64bit.stderr)0
-rw-r--r--tests/ui/consts/const-eval/union-ub.rs (renamed from src/test/ui/consts/const-eval/union-ub.rs)0
-rw-r--r--tests/ui/consts/const-eval/union_promotion.rs (renamed from src/test/ui/consts/const-eval/union_promotion.rs)0
-rw-r--r--tests/ui/consts/const-eval/union_promotion.stderr (renamed from src/test/ui/consts/const-eval/union_promotion.stderr)0
-rw-r--r--tests/ui/consts/const-eval/unused-broken-const.rs (renamed from src/test/ui/consts/const-eval/unused-broken-const.rs)0
-rw-r--r--tests/ui/consts/const-eval/unused-broken-const.stderr (renamed from src/test/ui/consts/const-eval/unused-broken-const.stderr)0
-rw-r--r--tests/ui/consts/const-eval/unwind-abort.rs (renamed from src/test/ui/consts/const-eval/unwind-abort.rs)0
-rw-r--r--tests/ui/consts/const-eval/unwind-abort.stderr (renamed from src/test/ui/consts/const-eval/unwind-abort.stderr)0
-rw-r--r--tests/ui/consts/const-eval/valid-const.rs (renamed from src/test/ui/consts/const-eval/valid-const.rs)0
-rw-r--r--tests/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr (renamed from src/test/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr)0
-rw-r--r--tests/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr (renamed from src/test/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr)0
-rw-r--r--tests/ui/consts/const-eval/validate_uninhabited_zsts.rs (renamed from src/test/ui/consts/const-eval/validate_uninhabited_zsts.rs)0
-rw-r--r--tests/ui/consts/const-eval/write-to-uninhabited-enum-variant.rs (renamed from src/test/ui/consts/const-eval/write-to-uninhabited-enum-variant.rs)0
-rw-r--r--tests/ui/consts/const-eval/zst_operand_eval.rs (renamed from src/test/ui/consts/const-eval/zst_operand_eval.rs)0
225 files changed, 2143 insertions, 49 deletions
diff --git a/src/test/ui/consts/const-eval/assign-to-static-within-other-static.rs b/tests/ui/consts/const-eval/assign-to-static-within-other-static.rs
index ecf97223f..ecf97223f 100644
--- a/src/test/ui/consts/const-eval/assign-to-static-within-other-static.rs
+++ b/tests/ui/consts/const-eval/assign-to-static-within-other-static.rs
diff --git a/src/test/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..4b6784acf 100644
--- a/src/test/ui/consts/const-eval/assign-to-static-within-other-static.stderr
+++ b/tests/ui/consts/const-eval/assign-to-static-within-other-static.stderr
diff --git a/src/test/ui/consts/const-eval/auxiliary/post_monomorphization_error.rs b/tests/ui/consts/const-eval/auxiliary/post_monomorphization_error.rs
index bdeaa0cd3..bdeaa0cd3 100644
--- a/src/test/ui/consts/const-eval/auxiliary/post_monomorphization_error.rs
+++ b/tests/ui/consts/const-eval/auxiliary/post_monomorphization_error.rs
diff --git a/src/test/ui/consts/const-eval/auxiliary/stability.rs b/tests/ui/consts/const-eval/auxiliary/stability.rs
index e61595518..e61595518 100644
--- a/src/test/ui/consts/const-eval/auxiliary/stability.rs
+++ b/tests/ui/consts/const-eval/auxiliary/stability.rs
diff --git a/src/test/ui/consts/const-eval/conditional_array_execution.rs b/tests/ui/consts/const-eval/conditional_array_execution.rs
index 27d5383d6..27d5383d6 100644
--- a/src/test/ui/consts/const-eval/conditional_array_execution.rs
+++ b/tests/ui/consts/const-eval/conditional_array_execution.rs
diff --git a/src/test/ui/consts/const-eval/conditional_array_execution.stderr b/tests/ui/consts/const-eval/conditional_array_execution.stderr
index c3401fbae..c3401fbae 100644
--- a/src/test/ui/consts/const-eval/conditional_array_execution.stderr
+++ b/tests/ui/consts/const-eval/conditional_array_execution.stderr
diff --git a/src/test/ui/consts/const-eval/const-eval-intrinsic-promotion.rs b/tests/ui/consts/const-eval/const-eval-intrinsic-promotion.rs
index bdcf53785..bdcf53785 100644
--- a/src/test/ui/consts/const-eval/const-eval-intrinsic-promotion.rs
+++ b/tests/ui/consts/const-eval/const-eval-intrinsic-promotion.rs
diff --git a/src/test/ui/consts/const-eval/const-eval-intrinsic-promotion.stderr b/tests/ui/consts/const-eval/const-eval-intrinsic-promotion.stderr
index ed6a6ee6e..ed6a6ee6e 100644
--- a/src/test/ui/consts/const-eval/const-eval-intrinsic-promotion.stderr
+++ b/tests/ui/consts/const-eval/const-eval-intrinsic-promotion.stderr
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-2.rs b/tests/ui/consts/const-eval/const-eval-overflow-2.rs
index 535d91359..535d91359 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow-2.rs
+++ b/tests/ui/consts/const-eval/const-eval-overflow-2.rs
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-2.stderr b/tests/ui/consts/const-eval/const-eval-overflow-2.stderr
index 7b1fe49d4..7b1fe49d4 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow-2.stderr
+++ b/tests/ui/consts/const-eval/const-eval-overflow-2.stderr
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-3.rs b/tests/ui/consts/const-eval/const-eval-overflow-3.rs
index bcc966dc9..bcc966dc9 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow-3.rs
+++ b/tests/ui/consts/const-eval/const-eval-overflow-3.rs
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-3.stderr b/tests/ui/consts/const-eval/const-eval-overflow-3.stderr
index 73f421b5b..73f421b5b 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow-3.stderr
+++ b/tests/ui/consts/const-eval/const-eval-overflow-3.stderr
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-3b.rs b/tests/ui/consts/const-eval/const-eval-overflow-3b.rs
index 480069e67..480069e67 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow-3b.rs
+++ b/tests/ui/consts/const-eval/const-eval-overflow-3b.rs
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr b/tests/ui/consts/const-eval/const-eval-overflow-3b.stderr
index f19917001..f19917001 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr
+++ b/tests/ui/consts/const-eval/const-eval-overflow-3b.stderr
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-4.rs b/tests/ui/consts/const-eval/const-eval-overflow-4.rs
index 762c7a968..762c7a968 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow-4.rs
+++ b/tests/ui/consts/const-eval/const-eval-overflow-4.rs
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-4.stderr b/tests/ui/consts/const-eval/const-eval-overflow-4.stderr
index 94f419319..94f419319 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow-4.stderr
+++ b/tests/ui/consts/const-eval/const-eval-overflow-4.stderr
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-4b.rs b/tests/ui/consts/const-eval/const-eval-overflow-4b.rs
index ce9c980de..ce9c980de 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow-4b.rs
+++ b/tests/ui/consts/const-eval/const-eval-overflow-4b.rs
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr b/tests/ui/consts/const-eval/const-eval-overflow-4b.stderr
index 1f8e40231..1f8e40231 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr
+++ b/tests/ui/consts/const-eval/const-eval-overflow-4b.stderr
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2.rs b/tests/ui/consts/const-eval/const-eval-overflow2.rs
index 1676f7c2a..1676f7c2a 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow2.rs
+++ b/tests/ui/consts/const-eval/const-eval-overflow2.rs
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2.stderr b/tests/ui/consts/const-eval/const-eval-overflow2.stderr
index 341c15daf..341c15daf 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow2.stderr
+++ b/tests/ui/consts/const-eval/const-eval-overflow2.stderr
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2b.rs b/tests/ui/consts/const-eval/const-eval-overflow2b.rs
index 59d1df568..59d1df568 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow2b.rs
+++ b/tests/ui/consts/const-eval/const-eval-overflow2b.rs
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr b/tests/ui/consts/const-eval/const-eval-overflow2b.stderr
index e661836b4..e661836b4 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr
+++ b/tests/ui/consts/const-eval/const-eval-overflow2b.stderr
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2c.rs b/tests/ui/consts/const-eval/const-eval-overflow2c.rs
index 33b892601..33b892601 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow2c.rs
+++ b/tests/ui/consts/const-eval/const-eval-overflow2c.rs
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr b/tests/ui/consts/const-eval/const-eval-overflow2c.stderr
index 1fad15492..1fad15492 100644
--- a/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr
+++ b/tests/ui/consts/const-eval/const-eval-overflow2c.stderr
diff --git a/src/test/ui/consts/const-eval/const-eval-query-stack.rs b/tests/ui/consts/const-eval/const-eval-query-stack.rs
index 8f8a8cee3..8f8a8cee3 100644
--- a/src/test/ui/consts/const-eval/const-eval-query-stack.rs
+++ b/tests/ui/consts/const-eval/const-eval-query-stack.rs
diff --git a/src/test/ui/consts/const-eval/const-eval-query-stack.stderr b/tests/ui/consts/const-eval/const-eval-query-stack.stderr
index b97975c4c..b97975c4c 100644
--- a/src/test/ui/consts/const-eval/const-eval-query-stack.stderr
+++ b/tests/ui/consts/const-eval/const-eval-query-stack.stderr
diff --git a/src/test/ui/consts/const-eval/const-eval-span.rs b/tests/ui/consts/const-eval/const-eval-span.rs
index 82f101b47..82f101b47 100644
--- a/src/test/ui/consts/const-eval/const-eval-span.rs
+++ b/tests/ui/consts/const-eval/const-eval-span.rs
diff --git a/src/test/ui/consts/const-eval/const-eval-span.stderr b/tests/ui/consts/const-eval/const-eval-span.stderr
index c5b001899..c5b001899 100644
--- a/src/test/ui/consts/const-eval/const-eval-span.stderr
+++ b/tests/ui/consts/const-eval/const-eval-span.stderr
diff --git a/src/test/ui/consts/const-eval/const-pointer-values-in-various-types.64bit.stderr b/tests/ui/consts/const-eval/const-pointer-values-in-various-types.64bit.stderr
index bf98d0394..bf98d0394 100644
--- a/src/test/ui/consts/const-eval/const-pointer-values-in-various-types.64bit.stderr
+++ b/tests/ui/consts/const-eval/const-pointer-values-in-various-types.64bit.stderr
diff --git a/src/test/ui/consts/const-eval/const-pointer-values-in-various-types.rs b/tests/ui/consts/const-eval/const-pointer-values-in-various-types.rs
index 45eed9d84..45eed9d84 100644
--- a/src/test/ui/consts/const-eval/const-pointer-values-in-various-types.rs
+++ b/tests/ui/consts/const-eval/const-pointer-values-in-various-types.rs
diff --git a/src/test/ui/consts/const-eval/const_fn_ptr.rs b/tests/ui/consts/const-eval/const_fn_ptr.rs
index b3c677c69..b3c677c69 100644
--- a/src/test/ui/consts/const-eval/const_fn_ptr.rs
+++ b/tests/ui/consts/const-eval/const_fn_ptr.rs
diff --git a/src/test/ui/consts/const-eval/const_fn_ptr.stderr b/tests/ui/consts/const-eval/const_fn_ptr.stderr
index ca1585f88..ca1585f88 100644
--- a/src/test/ui/consts/const-eval/const_fn_ptr.stderr
+++ b/tests/ui/consts/const-eval/const_fn_ptr.stderr
diff --git a/src/test/ui/consts/const-eval/const_fn_ptr_fail.rs b/tests/ui/consts/const-eval/const_fn_ptr_fail.rs
index 1896eba82..1896eba82 100644
--- a/src/test/ui/consts/const-eval/const_fn_ptr_fail.rs
+++ b/tests/ui/consts/const-eval/const_fn_ptr_fail.rs
diff --git a/src/test/ui/consts/const-eval/const_fn_ptr_fail.stderr b/tests/ui/consts/const-eval/const_fn_ptr_fail.stderr
index ec5de5759..ec5de5759 100644
--- a/src/test/ui/consts/const-eval/const_fn_ptr_fail.stderr
+++ b/tests/ui/consts/const-eval/const_fn_ptr_fail.stderr
diff --git a/src/test/ui/consts/const-eval/const_fn_ptr_fail2.rs b/tests/ui/consts/const-eval/const_fn_ptr_fail2.rs
index b873940c4..b873940c4 100644
--- a/src/test/ui/consts/const-eval/const_fn_ptr_fail2.rs
+++ b/tests/ui/consts/const-eval/const_fn_ptr_fail2.rs
diff --git a/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr b/tests/ui/consts/const-eval/const_fn_ptr_fail2.stderr
index 0734f479f..0734f479f 100644
--- a/src/test/ui/consts/const-eval/const_fn_ptr_fail2.stderr
+++ b/tests/ui/consts/const-eval/const_fn_ptr_fail2.stderr
diff --git a/src/test/ui/consts/const-eval/const_let.rs b/tests/ui/consts/const-eval/const_let.rs
index 1e2bcc55b..1e2bcc55b 100644
--- a/src/test/ui/consts/const-eval/const_let.rs
+++ b/tests/ui/consts/const-eval/const_let.rs
diff --git a/src/test/ui/consts/const-eval/const_let.stderr b/tests/ui/consts/const-eval/const_let.stderr
index 63442f557..63442f557 100644
--- a/src/test/ui/consts/const-eval/const_let.stderr
+++ b/tests/ui/consts/const-eval/const_let.stderr
diff --git a/src/test/ui/consts/const-eval/const_panic.rs b/tests/ui/consts/const-eval/const_panic.rs
index 5b9a8f8e2..5b9a8f8e2 100644
--- a/src/test/ui/consts/const-eval/const_panic.rs
+++ b/tests/ui/consts/const-eval/const_panic.rs
diff --git a/src/test/ui/consts/const-eval/const_panic.stderr b/tests/ui/consts/const-eval/const_panic.stderr
index 0f7be4607..0f7be4607 100644
--- a/src/test/ui/consts/const-eval/const_panic.stderr
+++ b/tests/ui/consts/const-eval/const_panic.stderr
diff --git a/src/test/ui/consts/const-eval/const_panic_2021.rs b/tests/ui/consts/const-eval/const_panic_2021.rs
index 4702aa2f5..4702aa2f5 100644
--- a/src/test/ui/consts/const-eval/const_panic_2021.rs
+++ b/tests/ui/consts/const-eval/const_panic_2021.rs
diff --git a/src/test/ui/consts/const-eval/const_panic_2021.stderr b/tests/ui/consts/const-eval/const_panic_2021.stderr
index 192fa3a12..192fa3a12 100644
--- a/src/test/ui/consts/const-eval/const_panic_2021.stderr
+++ b/tests/ui/consts/const-eval/const_panic_2021.stderr
diff --git a/src/test/ui/consts/const-eval/const_panic_libcore_bin.rs b/tests/ui/consts/const-eval/const_panic_libcore_bin.rs
index d4dc1a51d..d4dc1a51d 100644
--- a/src/test/ui/consts/const-eval/const_panic_libcore_bin.rs
+++ b/tests/ui/consts/const-eval/const_panic_libcore_bin.rs
diff --git a/src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr b/tests/ui/consts/const-eval/const_panic_libcore_bin.stderr
index df19ed4a8..df19ed4a8 100644
--- a/src/test/ui/consts/const-eval/const_panic_libcore_bin.stderr
+++ b/tests/ui/consts/const-eval/const_panic_libcore_bin.stderr
diff --git a/src/test/ui/consts/const-eval/const_panic_stability.e2018.stderr b/tests/ui/consts/const-eval/const_panic_stability.e2018.stderr
index 3553a18d3..3553a18d3 100644
--- a/src/test/ui/consts/const-eval/const_panic_stability.e2018.stderr
+++ b/tests/ui/consts/const-eval/const_panic_stability.e2018.stderr
diff --git a/src/test/ui/consts/const-eval/const_panic_stability.e2021.stderr b/tests/ui/consts/const-eval/const_panic_stability.e2021.stderr
index 9e8179181..9e8179181 100644
--- a/src/test/ui/consts/const-eval/const_panic_stability.e2021.stderr
+++ b/tests/ui/consts/const-eval/const_panic_stability.e2021.stderr
diff --git a/src/test/ui/consts/const-eval/const_panic_stability.rs b/tests/ui/consts/const-eval/const_panic_stability.rs
index 1aee6f27e..1aee6f27e 100644
--- a/src/test/ui/consts/const-eval/const_panic_stability.rs
+++ b/tests/ui/consts/const-eval/const_panic_stability.rs
diff --git a/src/test/ui/consts/const-eval/const_panic_track_caller.rs b/tests/ui/consts/const-eval/const_panic_track_caller.rs
index 9cf7a3ba7..9cf7a3ba7 100644
--- a/src/test/ui/consts/const-eval/const_panic_track_caller.rs
+++ b/tests/ui/consts/const-eval/const_panic_track_caller.rs
diff --git a/src/test/ui/consts/const-eval/const_panic_track_caller.stderr b/tests/ui/consts/const-eval/const_panic_track_caller.stderr
index 846458176..846458176 100644
--- a/src/test/ui/consts/const-eval/const_panic_track_caller.stderr
+++ b/tests/ui/consts/const-eval/const_panic_track_caller.stderr
diff --git a/src/test/ui/consts/const-eval/const_prop_errors.rs b/tests/ui/consts/const-eval/const_prop_errors.rs
index f9a36d379..f9a36d379 100644
--- a/src/test/ui/consts/const-eval/const_prop_errors.rs
+++ b/tests/ui/consts/const-eval/const_prop_errors.rs
diff --git a/src/test/ui/consts/const-eval/const_raw_ptr_ops.rs b/tests/ui/consts/const-eval/const_raw_ptr_ops.rs
index cd7c98007..cd7c98007 100644
--- a/src/test/ui/consts/const-eval/const_raw_ptr_ops.rs
+++ b/tests/ui/consts/const-eval/const_raw_ptr_ops.rs
diff --git a/src/test/ui/consts/const-eval/const_raw_ptr_ops.stderr b/tests/ui/consts/const-eval/const_raw_ptr_ops.stderr
index 12244450e..12244450e 100644
--- a/src/test/ui/consts/const-eval/const_raw_ptr_ops.stderr
+++ b/tests/ui/consts/const-eval/const_raw_ptr_ops.stderr
diff --git a/src/test/ui/consts/const-eval/const_raw_ptr_ops2.rs b/tests/ui/consts/const-eval/const_raw_ptr_ops2.rs
index ec5508a1e..ec5508a1e 100644
--- a/src/test/ui/consts/const-eval/const_raw_ptr_ops2.rs
+++ b/tests/ui/consts/const-eval/const_raw_ptr_ops2.rs
diff --git a/src/test/ui/consts/const-eval/const_raw_ptr_ops2.stderr b/tests/ui/consts/const-eval/const_raw_ptr_ops2.stderr
index e41dea873..e41dea873 100644
--- a/src/test/ui/consts/const-eval/const_raw_ptr_ops2.stderr
+++ b/tests/ui/consts/const-eval/const_raw_ptr_ops2.stderr
diff --git a/src/test/ui/consts/const-eval/const_signed_pat.rs b/tests/ui/consts/const-eval/const_signed_pat.rs
index c61239bb6..c61239bb6 100644
--- a/src/test/ui/consts/const-eval/const_signed_pat.rs
+++ b/tests/ui/consts/const-eval/const_signed_pat.rs
diff --git a/src/test/ui/consts/const-eval/dangling.rs b/tests/ui/consts/const-eval/dangling.rs
index 4fcf87921..4fcf87921 100644
--- a/src/test/ui/consts/const-eval/dangling.rs
+++ b/tests/ui/consts/const-eval/dangling.rs
diff --git a/src/test/ui/consts/const-eval/dangling.stderr b/tests/ui/consts/const-eval/dangling.stderr
index 92d70573d..92d70573d 100644
--- a/src/test/ui/consts/const-eval/dangling.stderr
+++ b/tests/ui/consts/const-eval/dangling.stderr
diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.rs b/tests/ui/consts/const-eval/dont_promote_unstable_const_fn.rs
index 4b3cf7073..4b3cf7073 100644
--- a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.rs
+++ b/tests/ui/consts/const-eval/dont_promote_unstable_const_fn.rs
diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr b/tests/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr
index 2e697b219..2e697b219 100644
--- a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr
+++ b/tests/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr
diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.rs b/tests/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.rs
index ea35f4680..ea35f4680 100644
--- a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.rs
+++ b/tests/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.rs
diff --git a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.stderr b/tests/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.stderr
index aa742d784..aa742d784 100644
--- a/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.stderr
+++ b/tests/ui/consts/const-eval/dont_promote_unstable_const_fn_cross_crate.stderr
diff --git a/src/test/ui/consts/const-eval/double_check.rs b/tests/ui/consts/const-eval/double_check.rs
index 56ca0aa1f..56ca0aa1f 100644
--- a/src/test/ui/consts/const-eval/double_check.rs
+++ b/tests/ui/consts/const-eval/double_check.rs
diff --git a/src/test/ui/consts/const-eval/double_check2.rs b/tests/ui/consts/const-eval/double_check2.rs
index 81f5dde45..81f5dde45 100644
--- a/src/test/ui/consts/const-eval/double_check2.rs
+++ b/tests/ui/consts/const-eval/double_check2.rs
diff --git a/src/test/ui/consts/const-eval/duration_conversion.rs b/tests/ui/consts/const-eval/duration_conversion.rs
index 87b12937d..87b12937d 100644
--- a/src/test/ui/consts/const-eval/duration_conversion.rs
+++ b/tests/ui/consts/const-eval/duration_conversion.rs
diff --git a/src/test/ui/consts/const-eval/enum_discr.rs b/tests/ui/consts/const-eval/enum_discr.rs
index e09258f11..e09258f11 100644
--- a/src/test/ui/consts/const-eval/enum_discr.rs
+++ b/tests/ui/consts/const-eval/enum_discr.rs
diff --git a/src/test/ui/consts/const-eval/erroneous-const.rs b/tests/ui/consts/const-eval/erroneous-const.rs
index e0fd057a2..e0fd057a2 100644
--- a/src/test/ui/consts/const-eval/erroneous-const.rs
+++ b/tests/ui/consts/const-eval/erroneous-const.rs
diff --git a/src/test/ui/consts/const-eval/erroneous-const.stderr b/tests/ui/consts/const-eval/erroneous-const.stderr
index 03030392a..03030392a 100644
--- a/src/test/ui/consts/const-eval/erroneous-const.stderr
+++ b/tests/ui/consts/const-eval/erroneous-const.stderr
diff --git a/src/test/ui/consts/const-eval/erroneous-const2.rs b/tests/ui/consts/const-eval/erroneous-const2.rs
index 15c0f9107..15c0f9107 100644
--- a/src/test/ui/consts/const-eval/erroneous-const2.rs
+++ b/tests/ui/consts/const-eval/erroneous-const2.rs
diff --git a/src/test/ui/consts/const-eval/erroneous-const2.stderr b/tests/ui/consts/const-eval/erroneous-const2.stderr
index 8626f4d78..8626f4d78 100644
--- a/src/test/ui/consts/const-eval/erroneous-const2.stderr
+++ b/tests/ui/consts/const-eval/erroneous-const2.stderr
diff --git a/src/test/ui/consts/const-eval/extern_fat_pointer.rs b/tests/ui/consts/const-eval/extern_fat_pointer.rs
index d91d07827..d91d07827 100644
--- a/src/test/ui/consts/const-eval/extern_fat_pointer.rs
+++ b/tests/ui/consts/const-eval/extern_fat_pointer.rs
diff --git a/src/test/ui/consts/const-eval/format.rs b/tests/ui/consts/const-eval/format.rs
index 0d8b7c12d..0d8b7c12d 100644
--- a/src/test/ui/consts/const-eval/format.rs
+++ b/tests/ui/consts/const-eval/format.rs
diff --git a/src/test/ui/consts/const-eval/format.stderr b/tests/ui/consts/const-eval/format.stderr
index 4bf39db58..4bf39db58 100644
--- a/src/test/ui/consts/const-eval/format.stderr
+++ b/tests/ui/consts/const-eval/format.stderr
diff --git a/src/test/ui/consts/const-eval/generic-slice.rs b/tests/ui/consts/const-eval/generic-slice.rs
index 21360a1c4..21360a1c4 100644
--- a/src/test/ui/consts/const-eval/generic-slice.rs
+++ b/tests/ui/consts/const-eval/generic-slice.rs
diff --git a/src/test/ui/consts/const-eval/generic-slice.stderr b/tests/ui/consts/const-eval/generic-slice.stderr
index c38088df4..c38088df4 100644
--- a/src/test/ui/consts/const-eval/generic-slice.stderr
+++ b/tests/ui/consts/const-eval/generic-slice.stderr
diff --git a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_errors.rs b/tests/ui/consts/const-eval/heap/alloc_intrinsic_errors.rs
index ac9e8b64b..ac9e8b64b 100644
--- a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_errors.rs
+++ b/tests/ui/consts/const-eval/heap/alloc_intrinsic_errors.rs
diff --git a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_errors.stderr b/tests/ui/consts/const-eval/heap/alloc_intrinsic_errors.stderr
index 8f3b3d5f7..8f3b3d5f7 100644
--- a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_errors.stderr
+++ b/tests/ui/consts/const-eval/heap/alloc_intrinsic_errors.stderr
diff --git a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_nontransient.rs b/tests/ui/consts/const-eval/heap/alloc_intrinsic_nontransient.rs
index 0a8fc7bca..0a8fc7bca 100644
--- a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_nontransient.rs
+++ b/tests/ui/consts/const-eval/heap/alloc_intrinsic_nontransient.rs
diff --git a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_nontransient_fail.rs b/tests/ui/consts/const-eval/heap/alloc_intrinsic_nontransient_fail.rs
index f746f2700..f746f2700 100644
--- a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_nontransient_fail.rs
+++ b/tests/ui/consts/const-eval/heap/alloc_intrinsic_nontransient_fail.rs
diff --git a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_nontransient_fail.stderr b/tests/ui/consts/const-eval/heap/alloc_intrinsic_nontransient_fail.stderr
index 00ab0dfc5..00ab0dfc5 100644
--- a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_nontransient_fail.stderr
+++ b/tests/ui/consts/const-eval/heap/alloc_intrinsic_nontransient_fail.stderr
diff --git a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_transient.rs b/tests/ui/consts/const-eval/heap/alloc_intrinsic_transient.rs
index 92193bb33..92193bb33 100644
--- a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_transient.rs
+++ b/tests/ui/consts/const-eval/heap/alloc_intrinsic_transient.rs
diff --git a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_uninit.32bit.stderr b/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.32bit.stderr
index a0f4519ea..a0f4519ea 100644
--- a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_uninit.32bit.stderr
+++ b/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.32bit.stderr
diff --git a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_uninit.64bit.stderr b/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.64bit.stderr
index d2bffa425..d2bffa425 100644
--- a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_uninit.64bit.stderr
+++ b/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.64bit.stderr
diff --git a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_uninit.rs b/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.rs
index b53c9ac7a..b53c9ac7a 100644
--- a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_uninit.rs
+++ b/tests/ui/consts/const-eval/heap/alloc_intrinsic_uninit.rs
diff --git a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_untyped.rs b/tests/ui/consts/const-eval/heap/alloc_intrinsic_untyped.rs
index 77871c394..77871c394 100644
--- a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_untyped.rs
+++ b/tests/ui/consts/const-eval/heap/alloc_intrinsic_untyped.rs
diff --git a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_untyped.stderr b/tests/ui/consts/const-eval/heap/alloc_intrinsic_untyped.stderr
index 36002b850..36002b850 100644
--- a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_untyped.stderr
+++ b/tests/ui/consts/const-eval/heap/alloc_intrinsic_untyped.stderr
diff --git a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_zero_sized.rs b/tests/ui/consts/const-eval/heap/alloc_intrinsic_zero_sized.rs
index 407e69d41..407e69d41 100644
--- a/src/test/ui/consts/const-eval/heap/alloc_intrinsic_zero_sized.rs
+++ b/tests/ui/consts/const-eval/heap/alloc_intrinsic_zero_sized.rs
diff --git a/src/test/ui/consts/const-eval/heap/dealloc_intrinsic.rs b/tests/ui/consts/const-eval/heap/dealloc_intrinsic.rs
index aac90cd54..aac90cd54 100644
--- a/src/test/ui/consts/const-eval/heap/dealloc_intrinsic.rs
+++ b/tests/ui/consts/const-eval/heap/dealloc_intrinsic.rs
diff --git a/src/test/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.rs b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.rs
index b6d89a58d..b6d89a58d 100644
--- a/src/test/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.rs
+++ b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.rs
diff --git a/src/test/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.stderr b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.stderr
index 4eb1c42e1..4eb1c42e1 100644
--- a/src/test/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.stderr
+++ b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_dangling.stderr
diff --git a/src/test/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.rs b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.rs
index 4010b4769..4010b4769 100644
--- a/src/test/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.rs
+++ b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.rs
diff --git a/src/test/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.stderr b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.stderr
index 8177a0850..8177a0850 100644
--- a/src/test/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.stderr
+++ b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_duplicate.stderr
diff --git a/src/test/ui/consts/const-eval/heap/dealloc_intrinsic_incorrect_layout.rs b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_incorrect_layout.rs
index 031d70fdc..031d70fdc 100644
--- a/src/test/ui/consts/const-eval/heap/dealloc_intrinsic_incorrect_layout.rs
+++ b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_incorrect_layout.rs
diff --git a/src/test/ui/consts/const-eval/heap/dealloc_intrinsic_incorrect_layout.stderr b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_incorrect_layout.stderr
index 650b409b1..650b409b1 100644
--- a/src/test/ui/consts/const-eval/heap/dealloc_intrinsic_incorrect_layout.stderr
+++ b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_incorrect_layout.stderr
diff --git a/src/test/ui/consts/const-eval/heap/dealloc_intrinsic_zero_sized.rs b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_zero_sized.rs
index 84fb4d2ea..84fb4d2ea 100644
--- a/src/test/ui/consts/const-eval/heap/dealloc_intrinsic_zero_sized.rs
+++ b/tests/ui/consts/const-eval/heap/dealloc_intrinsic_zero_sized.rs
diff --git a/src/test/ui/consts/const-eval/ice-generic-assoc-const.rs b/tests/ui/consts/const-eval/ice-generic-assoc-const.rs
index e514682af..e514682af 100644
--- a/src/test/ui/consts/const-eval/ice-generic-assoc-const.rs
+++ b/tests/ui/consts/const-eval/ice-generic-assoc-const.rs
diff --git a/src/test/ui/consts/const-eval/ice-packed.rs b/tests/ui/consts/const-eval/ice-packed.rs
index 4758a5a9d..4758a5a9d 100644
--- a/src/test/ui/consts/const-eval/ice-packed.rs
+++ b/tests/ui/consts/const-eval/ice-packed.rs
diff --git a/src/test/ui/consts/const-eval/index-out-of-bounds-never-type.rs b/tests/ui/consts/const-eval/index-out-of-bounds-never-type.rs
index bc2ea3f18..bc2ea3f18 100644
--- a/src/test/ui/consts/const-eval/index-out-of-bounds-never-type.rs
+++ b/tests/ui/consts/const-eval/index-out-of-bounds-never-type.rs
diff --git a/src/test/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..8bcd03005 100644
--- a/src/test/ui/consts/const-eval/index-out-of-bounds-never-type.stderr
+++ b/tests/ui/consts/const-eval/index-out-of-bounds-never-type.stderr
diff --git a/src/test/ui/consts/const-eval/index_out_of_bounds.rs b/tests/ui/consts/const-eval/index_out_of_bounds.rs
index 80e0d28fe..80e0d28fe 100644
--- a/src/test/ui/consts/const-eval/index_out_of_bounds.rs
+++ b/tests/ui/consts/const-eval/index_out_of_bounds.rs
diff --git a/src/test/ui/consts/const-eval/index_out_of_bounds.stderr b/tests/ui/consts/const-eval/index_out_of_bounds.stderr
index 8bb3a0c67..8bb3a0c67 100644
--- a/src/test/ui/consts/const-eval/index_out_of_bounds.stderr
+++ b/tests/ui/consts/const-eval/index_out_of_bounds.stderr
diff --git a/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.rs b/tests/ui/consts/const-eval/index_out_of_bounds_propagated.rs
index 608e6e112..608e6e112 100644
--- a/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.rs
+++ b/tests/ui/consts/const-eval/index_out_of_bounds_propagated.rs
diff --git a/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.stderr b/tests/ui/consts/const-eval/index_out_of_bounds_propagated.stderr
index d247d691d..d247d691d 100644
--- a/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.stderr
+++ b/tests/ui/consts/const-eval/index_out_of_bounds_propagated.stderr
diff --git a/src/test/ui/consts/const-eval/infinite_loop.rs b/tests/ui/consts/const-eval/infinite_loop.rs
index 4babc9a28..4babc9a28 100644
--- a/src/test/ui/consts/const-eval/infinite_loop.rs
+++ b/tests/ui/consts/const-eval/infinite_loop.rs
diff --git a/src/test/ui/consts/const-eval/infinite_loop.stderr b/tests/ui/consts/const-eval/infinite_loop.stderr
index 8b58cb279..8b58cb279 100644
--- a/src/test/ui/consts/const-eval/infinite_loop.stderr
+++ b/tests/ui/consts/const-eval/infinite_loop.stderr
diff --git a/src/test/ui/consts/const-eval/issue-100878.rs b/tests/ui/consts/const-eval/issue-100878.rs
index 353ce5050..353ce5050 100644
--- a/src/test/ui/consts/const-eval/issue-100878.rs
+++ b/tests/ui/consts/const-eval/issue-100878.rs
diff --git a/src/test/ui/consts/const-eval/issue-104390.rs b/tests/ui/consts/const-eval/issue-104390.rs
index 602d81824..602d81824 100644
--- a/src/test/ui/consts/const-eval/issue-104390.rs
+++ b/tests/ui/consts/const-eval/issue-104390.rs
diff --git a/src/test/ui/consts/const-eval/issue-104390.stderr b/tests/ui/consts/const-eval/issue-104390.stderr
index 865b9996e..865b9996e 100644
--- a/src/test/ui/consts/const-eval/issue-104390.stderr
+++ b/tests/ui/consts/const-eval/issue-104390.stderr
diff --git a/src/test/ui/consts/const-eval/issue-43197.rs b/tests/ui/consts/const-eval/issue-43197.rs
index 145463f0a..145463f0a 100644
--- a/src/test/ui/consts/const-eval/issue-43197.rs
+++ b/tests/ui/consts/const-eval/issue-43197.rs
diff --git a/src/test/ui/consts/const-eval/issue-43197.stderr b/tests/ui/consts/const-eval/issue-43197.stderr
index c59f13e48..c59f13e48 100644
--- a/src/test/ui/consts/const-eval/issue-43197.stderr
+++ b/tests/ui/consts/const-eval/issue-43197.stderr
diff --git a/src/test/ui/consts/const-eval/issue-44578.rs b/tests/ui/consts/const-eval/issue-44578.rs
index e4dcc6230..e4dcc6230 100644
--- a/src/test/ui/consts/const-eval/issue-44578.rs
+++ b/tests/ui/consts/const-eval/issue-44578.rs
diff --git a/src/test/ui/consts/const-eval/issue-44578.stderr b/tests/ui/consts/const-eval/issue-44578.stderr
index 0cbf54480..0cbf54480 100644
--- a/src/test/ui/consts/const-eval/issue-44578.stderr
+++ b/tests/ui/consts/const-eval/issue-44578.stderr
diff --git a/src/test/ui/consts/const-eval/issue-47971.rs b/tests/ui/consts/const-eval/issue-47971.rs
index b98e76031..b98e76031 100644
--- a/src/test/ui/consts/const-eval/issue-47971.rs
+++ b/tests/ui/consts/const-eval/issue-47971.rs
diff --git a/src/test/ui/consts/const-eval/issue-49296.rs b/tests/ui/consts/const-eval/issue-49296.rs
index 917777a32..917777a32 100644
--- a/src/test/ui/consts/const-eval/issue-49296.rs
+++ b/tests/ui/consts/const-eval/issue-49296.rs
diff --git a/src/test/ui/consts/const-eval/issue-49296.stderr b/tests/ui/consts/const-eval/issue-49296.stderr
index cc4f1594c..cc4f1594c 100644
--- a/src/test/ui/consts/const-eval/issue-49296.stderr
+++ b/tests/ui/consts/const-eval/issue-49296.stderr
diff --git a/src/test/ui/consts/const-eval/issue-50706.rs b/tests/ui/consts/const-eval/issue-50706.rs
index a13c27f2e..a13c27f2e 100644
--- a/src/test/ui/consts/const-eval/issue-50706.rs
+++ b/tests/ui/consts/const-eval/issue-50706.rs
diff --git a/src/test/ui/consts/const-eval/issue-50814-2.rs b/tests/ui/consts/const-eval/issue-50814-2.rs
index 53eb7b149..53eb7b149 100644
--- a/src/test/ui/consts/const-eval/issue-50814-2.rs
+++ b/tests/ui/consts/const-eval/issue-50814-2.rs
diff --git a/src/test/ui/consts/const-eval/issue-50814-2.stderr b/tests/ui/consts/const-eval/issue-50814-2.stderr
index 956f7aec9..956f7aec9 100644
--- a/src/test/ui/consts/const-eval/issue-50814-2.stderr
+++ b/tests/ui/consts/const-eval/issue-50814-2.stderr
diff --git a/src/test/ui/consts/const-eval/issue-50814.rs b/tests/ui/consts/const-eval/issue-50814.rs
index 374ed1d93..374ed1d93 100644
--- a/src/test/ui/consts/const-eval/issue-50814.rs
+++ b/tests/ui/consts/const-eval/issue-50814.rs
diff --git a/src/test/ui/consts/const-eval/issue-50814.stderr b/tests/ui/consts/const-eval/issue-50814.stderr
index 05b6271f4..05b6271f4 100644
--- a/src/test/ui/consts/const-eval/issue-50814.stderr
+++ b/tests/ui/consts/const-eval/issue-50814.stderr
diff --git a/src/test/ui/consts/const-eval/issue-51300.rs b/tests/ui/consts/const-eval/issue-51300.rs
index 8e68e8c91..8e68e8c91 100644
--- a/src/test/ui/consts/const-eval/issue-51300.rs
+++ b/tests/ui/consts/const-eval/issue-51300.rs
diff --git a/src/test/ui/consts/const-eval/issue-52475.rs b/tests/ui/consts/const-eval/issue-52475.rs
index ce65407bb..ce65407bb 100644
--- a/src/test/ui/consts/const-eval/issue-52475.rs
+++ b/tests/ui/consts/const-eval/issue-52475.rs
diff --git a/src/test/ui/consts/const-eval/issue-52475.stderr b/tests/ui/consts/const-eval/issue-52475.stderr
index 8536ff02c..8536ff02c 100644
--- a/src/test/ui/consts/const-eval/issue-52475.stderr
+++ b/tests/ui/consts/const-eval/issue-52475.stderr
diff --git a/src/test/ui/consts/const-eval/issue-53157.rs b/tests/ui/consts/const-eval/issue-53157.rs
index 850338625..850338625 100644
--- a/src/test/ui/consts/const-eval/issue-53157.rs
+++ b/tests/ui/consts/const-eval/issue-53157.rs
diff --git a/src/test/ui/consts/const-eval/issue-53401.rs b/tests/ui/consts/const-eval/issue-53401.rs
index 31c946c3c..31c946c3c 100644
--- a/src/test/ui/consts/const-eval/issue-53401.rs
+++ b/tests/ui/consts/const-eval/issue-53401.rs
diff --git a/src/test/ui/consts/const-eval/issue-55541.rs b/tests/ui/consts/const-eval/issue-55541.rs
index fa5a493ab..fa5a493ab 100644
--- a/src/test/ui/consts/const-eval/issue-55541.rs
+++ b/tests/ui/consts/const-eval/issue-55541.rs
diff --git a/src/test/ui/consts/const-eval/issue-64908.rs b/tests/ui/consts/const-eval/issue-64908.rs
index d2e095072..d2e095072 100644
--- a/src/test/ui/consts/const-eval/issue-64908.rs
+++ b/tests/ui/consts/const-eval/issue-64908.rs
diff --git a/src/test/ui/consts/const-eval/issue-64970.rs b/tests/ui/consts/const-eval/issue-64970.rs
index ba530438f..ba530438f 100644
--- a/src/test/ui/consts/const-eval/issue-64970.rs
+++ b/tests/ui/consts/const-eval/issue-64970.rs
diff --git a/src/test/ui/consts/const-eval/issue-65394.rs b/tests/ui/consts/const-eval/issue-65394.rs
index e6639826c..e6639826c 100644
--- a/src/test/ui/consts/const-eval/issue-65394.rs
+++ b/tests/ui/consts/const-eval/issue-65394.rs
diff --git a/src/test/ui/consts/const-eval/issue-65394.stderr b/tests/ui/consts/const-eval/issue-65394.stderr
index ae6f0e937..ae6f0e937 100644
--- a/src/test/ui/consts/const-eval/issue-65394.stderr
+++ b/tests/ui/consts/const-eval/issue-65394.stderr
diff --git a/src/test/ui/consts/const-eval/issue-70723.rs b/tests/ui/consts/const-eval/issue-70723.rs
index 3c81afa67..3c81afa67 100644
--- a/src/test/ui/consts/const-eval/issue-70723.rs
+++ b/tests/ui/consts/const-eval/issue-70723.rs
diff --git a/src/test/ui/consts/const-eval/issue-70723.stderr b/tests/ui/consts/const-eval/issue-70723.stderr
index 09fb3e060..09fb3e060 100644
--- a/src/test/ui/consts/const-eval/issue-70723.stderr
+++ b/tests/ui/consts/const-eval/issue-70723.stderr
diff --git a/src/test/ui/consts/const-eval/issue-70804-fn-subtyping.rs b/tests/ui/consts/const-eval/issue-70804-fn-subtyping.rs
index abd1d32ab..abd1d32ab 100644
--- a/src/test/ui/consts/const-eval/issue-70804-fn-subtyping.rs
+++ b/tests/ui/consts/const-eval/issue-70804-fn-subtyping.rs
diff --git a/src/test/ui/consts/const-eval/issue-84957-const-str-as-bytes.rs b/tests/ui/consts/const-eval/issue-84957-const-str-as-bytes.rs
index 7e235c491..7e235c491 100644
--- a/src/test/ui/consts/const-eval/issue-84957-const-str-as-bytes.rs
+++ b/tests/ui/consts/const-eval/issue-84957-const-str-as-bytes.rs
diff --git a/src/test/ui/consts/const-eval/issue-85155.rs b/tests/ui/consts/const-eval/issue-85155.rs
index c3216d53d..c3216d53d 100644
--- a/src/test/ui/consts/const-eval/issue-85155.rs
+++ b/tests/ui/consts/const-eval/issue-85155.rs
diff --git a/src/test/ui/consts/const-eval/issue-85155.stderr b/tests/ui/consts/const-eval/issue-85155.stderr
index 3d2c76b7e..3d2c76b7e 100644
--- a/src/test/ui/consts/const-eval/issue-85155.stderr
+++ b/tests/ui/consts/const-eval/issue-85155.stderr
diff --git a/src/test/ui/consts/const-eval/issue-85907.rs b/tests/ui/consts/const-eval/issue-85907.rs
index 6ae40ae6d..6ae40ae6d 100644
--- a/src/test/ui/consts/const-eval/issue-85907.rs
+++ b/tests/ui/consts/const-eval/issue-85907.rs
diff --git a/src/test/ui/consts/const-eval/issue-85907.stderr b/tests/ui/consts/const-eval/issue-85907.stderr
index fd7b40572..fd7b40572 100644
--- a/src/test/ui/consts/const-eval/issue-85907.stderr
+++ b/tests/ui/consts/const-eval/issue-85907.stderr
diff --git a/src/test/ui/consts/const-eval/issue-91827-extern-types.rs b/tests/ui/consts/const-eval/issue-91827-extern-types.rs
index 43c99799f..43c99799f 100644
--- a/src/test/ui/consts/const-eval/issue-91827-extern-types.rs
+++ b/tests/ui/consts/const-eval/issue-91827-extern-types.rs
diff --git a/src/test/ui/consts/const-eval/livedrop.rs b/tests/ui/consts/const-eval/livedrop.rs
index 543f1f0ec..543f1f0ec 100644
--- a/src/test/ui/consts/const-eval/livedrop.rs
+++ b/tests/ui/consts/const-eval/livedrop.rs
diff --git a/src/test/ui/consts/const-eval/livedrop.stderr b/tests/ui/consts/const-eval/livedrop.stderr
index d04fdb70e..d04fdb70e 100644
--- a/src/test/ui/consts/const-eval/livedrop.stderr
+++ b/tests/ui/consts/const-eval/livedrop.stderr
diff --git a/src/test/ui/consts/const-eval/match-test-ptr-null.rs b/tests/ui/consts/const-eval/match-test-ptr-null.rs
index 4af97b548..4af97b548 100644
--- a/src/test/ui/consts/const-eval/match-test-ptr-null.rs
+++ b/tests/ui/consts/const-eval/match-test-ptr-null.rs
diff --git a/src/test/ui/consts/const-eval/match-test-ptr-null.stderr b/tests/ui/consts/const-eval/match-test-ptr-null.stderr
index 05c3951c1..05c3951c1 100644
--- a/src/test/ui/consts/const-eval/match-test-ptr-null.stderr
+++ b/tests/ui/consts/const-eval/match-test-ptr-null.stderr
diff --git a/src/test/ui/consts/const-eval/mod-static-with-const-fn.rs b/tests/ui/consts/const-eval/mod-static-with-const-fn.rs
index b6b74e67d..b6b74e67d 100644
--- a/src/test/ui/consts/const-eval/mod-static-with-const-fn.rs
+++ b/tests/ui/consts/const-eval/mod-static-with-const-fn.rs
diff --git a/src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr b/tests/ui/consts/const-eval/mod-static-with-const-fn.stderr
index d127d1d45..d127d1d45 100644
--- a/src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr
+++ b/tests/ui/consts/const-eval/mod-static-with-const-fn.stderr
diff --git a/src/test/ui/consts/const-eval/no_lint_for_statically_known_error.rs b/tests/ui/consts/const-eval/no_lint_for_statically_known_error.rs
index 910ca3c4b..910ca3c4b 100644
--- a/src/test/ui/consts/const-eval/no_lint_for_statically_known_error.rs
+++ b/tests/ui/consts/const-eval/no_lint_for_statically_known_error.rs
diff --git a/src/test/ui/consts/const-eval/nrvo.rs b/tests/ui/consts/const-eval/nrvo.rs
index 1d2c6acc0..1d2c6acc0 100644
--- a/src/test/ui/consts/const-eval/nrvo.rs
+++ b/tests/ui/consts/const-eval/nrvo.rs
diff --git a/src/test/ui/consts/const-eval/panic-assoc-never-type.rs b/tests/ui/consts/const-eval/panic-assoc-never-type.rs
index 28edf5144..28edf5144 100644
--- a/src/test/ui/consts/const-eval/panic-assoc-never-type.rs
+++ b/tests/ui/consts/const-eval/panic-assoc-never-type.rs
diff --git a/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr b/tests/ui/consts/const-eval/panic-assoc-never-type.stderr
index 7c36a3a42..7c36a3a42 100644
--- a/src/test/ui/consts/const-eval/panic-assoc-never-type.stderr
+++ b/tests/ui/consts/const-eval/panic-assoc-never-type.stderr
diff --git a/src/test/ui/consts/const-eval/panic-never-type.rs b/tests/ui/consts/const-eval/panic-never-type.rs
index a9e9026d9..a9e9026d9 100644
--- a/src/test/ui/consts/const-eval/panic-never-type.rs
+++ b/tests/ui/consts/const-eval/panic-never-type.rs
diff --git a/src/test/ui/consts/const-eval/panic-never-type.stderr b/tests/ui/consts/const-eval/panic-never-type.stderr
index 6bff14a45..6bff14a45 100644
--- a/src/test/ui/consts/const-eval/panic-never-type.stderr
+++ b/tests/ui/consts/const-eval/panic-never-type.stderr
diff --git a/src/test/ui/consts/const-eval/partial_ptr_overwrite.rs b/tests/ui/consts/const-eval/partial_ptr_overwrite.rs
index d6c768868..d6c768868 100644
--- a/src/test/ui/consts/const-eval/partial_ptr_overwrite.rs
+++ b/tests/ui/consts/const-eval/partial_ptr_overwrite.rs
diff --git a/src/test/ui/consts/const-eval/partial_ptr_overwrite.stderr b/tests/ui/consts/const-eval/partial_ptr_overwrite.stderr
index 13ca4379b..13ca4379b 100644
--- a/src/test/ui/consts/const-eval/partial_ptr_overwrite.stderr
+++ b/tests/ui/consts/const-eval/partial_ptr_overwrite.stderr
diff --git a/src/test/ui/consts/const-eval/promote-static.rs b/tests/ui/consts/const-eval/promote-static.rs
index d3c663c53..d3c663c53 100644
--- a/src/test/ui/consts/const-eval/promote-static.rs
+++ b/tests/ui/consts/const-eval/promote-static.rs
diff --git a/src/test/ui/consts/const-eval/promote_mutable_zst_mir_borrowck.rs b/tests/ui/consts/const-eval/promote_mutable_zst_mir_borrowck.rs
index edda10e6e..edda10e6e 100644
--- a/src/test/ui/consts/const-eval/promote_mutable_zst_mir_borrowck.rs
+++ b/tests/ui/consts/const-eval/promote_mutable_zst_mir_borrowck.rs
diff --git a/src/test/ui/consts/const-eval/promoted_const_fn_fail.rs b/tests/ui/consts/const-eval/promoted_const_fn_fail.rs
index 656dd33e1..656dd33e1 100644
--- a/src/test/ui/consts/const-eval/promoted_const_fn_fail.rs
+++ b/tests/ui/consts/const-eval/promoted_const_fn_fail.rs
diff --git a/src/test/ui/consts/const-eval/promoted_const_fn_fail.stderr b/tests/ui/consts/const-eval/promoted_const_fn_fail.stderr
index 2d4e7c83d..2d4e7c83d 100644
--- a/src/test/ui/consts/const-eval/promoted_const_fn_fail.stderr
+++ b/tests/ui/consts/const-eval/promoted_const_fn_fail.stderr
diff --git a/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.rs b/tests/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.rs
index 5009dbcb9..5009dbcb9 100644
--- a/src/test/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.rs
+++ b/tests/ui/consts/const-eval/promoted_const_fn_fail_deny_const_err.rs
diff --git a/src/test/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..9ebae3a18 100644
--- a/src/test/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
diff --git a/src/test/ui/consts/const-eval/promoted_errors.noopt.stderr b/tests/ui/consts/const-eval/promoted_errors.noopt.stderr
index 2a254bfde..2a254bfde 100644
--- a/src/test/ui/consts/const-eval/promoted_errors.noopt.stderr
+++ b/tests/ui/consts/const-eval/promoted_errors.noopt.stderr
diff --git a/src/test/ui/consts/const-eval/promoted_errors.opt.stderr b/tests/ui/consts/const-eval/promoted_errors.opt.stderr
index 2a254bfde..2a254bfde 100644
--- a/src/test/ui/consts/const-eval/promoted_errors.opt.stderr
+++ b/tests/ui/consts/const-eval/promoted_errors.opt.stderr
diff --git a/src/test/ui/consts/const-eval/promoted_errors.opt_with_overflow_checks.stderr b/tests/ui/consts/const-eval/promoted_errors.opt_with_overflow_checks.stderr
index 2a254bfde..2a254bfde 100644
--- a/src/test/ui/consts/const-eval/promoted_errors.opt_with_overflow_checks.stderr
+++ b/tests/ui/consts/const-eval/promoted_errors.opt_with_overflow_checks.stderr
diff --git a/src/test/ui/consts/const-eval/promoted_errors.rs b/tests/ui/consts/const-eval/promoted_errors.rs
index 2c42d0356..2c42d0356 100644
--- a/src/test/ui/consts/const-eval/promoted_errors.rs
+++ b/tests/ui/consts/const-eval/promoted_errors.rs
diff --git a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.rs b/tests/ui/consts/const-eval/promoted_raw_ptr_ops.rs
index 1800b0a97..1800b0a97 100644
--- a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.rs
+++ b/tests/ui/consts/const-eval/promoted_raw_ptr_ops.rs
diff --git a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.stderr b/tests/ui/consts/const-eval/promoted_raw_ptr_ops.stderr
index 01fcf2ec2..01fcf2ec2 100644
--- a/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.stderr
+++ b/tests/ui/consts/const-eval/promoted_raw_ptr_ops.stderr
diff --git a/tests/ui/consts/const-eval/raw-bytes.32bit.stderr b/tests/ui/consts/const-eval/raw-bytes.32bit.stderr
new file mode 100644
index 000000000..91a426580
--- /dev/null
+++ b/tests/ui/consts/const-eval/raw-bytes.32bit.stderr
@@ -0,0 +1,596 @@
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:20:1
+ |
+LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) };
+ | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x00000001, 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: 4, align: 4) {
+ 01 00 00 00 │ ....
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:28:1
+ |
+LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
+ | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<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: 4, align: 4) {
+ 00 00 00 00 │ ....
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:42:1
+ |
+LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(B)>.0: encountered a value of the never type `!`
+ |
+ = 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: 1, align: 1) {
+ 01 │ .
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:44:1
+ |
+LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(D)>.0: encountered a value of uninhabited type Never
+ |
+ = 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: 1, align: 1) {
+ 03 │ .
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:50: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`)
+ |
+ = 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) {
+ 78 00 00 00 ff ff ff ff │ x.......
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:54:1
+ |
+LL | const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: 4, align: 4) {
+ 00 00 00 00 │ ....
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:57:1
+ |
+LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: 1, align: 1) {
+ 00 │ .
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:59:1
+ |
+LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: 4, align: 4) {
+ 00 00 00 00 │ ....
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:65:1
+ |
+LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 42, but expected something in the range 10..=30
+ |
+ = 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) {
+ 2a 00 00 00 │ *...
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:71: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
+ |
+ = 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) {
+ 14 00 00 00 │ ....
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:74:1
+ |
+LL | const NULL_FAT_PTR: NonNull<dyn Send> = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: 8, align: 4) {
+ 00 00 00 00 ╾ALLOC_ID╼ │ ....╾──╼
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:82:1
+ |
+LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) };
+ | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1)
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: 4, align: 4) {
+ ╾ALLOC_ID╼ │ ╾──╼
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:86: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)
+ |
+ = 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) {
+ ╾ALLOC_ID╼ │ ╾──╼
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:90:1
+ |
+LL | const NULL: &u16 = unsafe { mem::transmute(0usize) };
+ | ^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null reference
+ |
+ = 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) {
+ 00 00 00 00 │ ....
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:93:1
+ |
+LL | const NULL_BOX: Box<u16> = unsafe { mem::transmute(0usize) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null box
+ |
+ = 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) {
+ 00 00 00 00 │ ....
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:96:1
+ |
+LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (address 0x539 is unallocated)
+ |
+ = 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) {
+ 39 05 00 00 │ 9...
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:99:1
+ |
+LL | const USIZE_AS_BOX: Box<u8> = unsafe { mem::transmute(1337usize) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (address 0x539 is unallocated)
+ |
+ = 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) {
+ 39 05 00 00 │ 9...
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:102:1
+ |
+LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, 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) {
+ 00 00 00 00 │ ....
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:104:1
+ |
+LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0xd[noalloc], 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) {
+ 0d 00 00 00 │ ....
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:106:1
+ |
+LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered allocN, 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) {
+ ╾ALLOC_ID╼ │ ╾──╼
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:112:1
+ |
+LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to uninhabited type Bar
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: 4, align: 4) {
+ 01 00 00 00 │ ....
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:137: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)
+ |
+ = 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) {
+ ╾ALLOC_ID╼ e7 03 00 00 │ ╾──╼....
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:139: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
+ |
+ = 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) {
+ ╾ALLOC_ID╼ ff ff ff ff │ ╾──╼....
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:141: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
+ |
+ = 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) {
+ ╾ALLOC_ID╼ ff ff ff ff │ ╾──╼....
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:144:1
+ |
+LL | const STR_NO_INIT: &str = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered uninitialized data in `str`
+ |
+ = 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) {
+ ╾ALLOC_ID╼ 01 00 00 00 │ ╾──╼....
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:146:1
+ |
+LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered uninitialized data in `str`
+ |
+ = 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) {
+ ╾ALLOC_ID╼ 01 00 00 00 │ ╾──╼....
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:148:1
+ |
+LL | const MYSTR_NO_INIT_ISSUE83182: &MyStr = unsafe { mem::transmute::<&[_], _>(&[&()]) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ |
+ = help: this code performed an operation that depends on the underlying bytes representing a pointer
+ = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
+ = note: the raw bytes of the constant (size: 8, align: 4) {
+ ╾ALLOC_ID╼ 01 00 00 00 │ ╾──╼....
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:152: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)
+ |
+ = 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) {
+ ╾ALLOC_ID╼ e7 03 00 00 │ ╾──╼....
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:154: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
+ |
+ = 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) {
+ ╾ALLOC_ID╼ ff ff ff 7f │ ╾──╼....
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:157: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)
+ |
+ = 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) {
+ ╾ALLOC_ID╼ e7 03 00 00 │ ╾──╼....
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:160:1
+ |
+LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x03, but expected a boolean
+ |
+ = 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) {
+ ╾ALLOC_ID╼ │ ╾──╼
+ }
+
+note: erroneous constant used
+ --> $DIR/raw-bytes.rs:160: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
+ |
+LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered 0x03, but expected a boolean
+ |
+ = 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) {
+ ╾ALLOC_ID╼ │ ╾──╼
+ }
+
+note: erroneous constant used
+ --> $DIR/raw-bytes.rs:166: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
+ |
+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
+ |
+ = 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) {
+ ╾ALLOC_ID╼ │ ╾──╼
+ }
+
+note: erroneous constant used
+ --> $DIR/raw-bytes.rs:170: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
+ |
+LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u8))) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, 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) {
+ ╾ALLOC_ID╼ ╾ALLOC_ID╼ │ ╾──╼╾──╼
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:179:1
+ |
+LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u64))) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, 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) {
+ ╾ALLOC_ID╼ ╾ALLOC_ID╼ │ ╾──╼╾──╼
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:183: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
+ |
+ = 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) {
+ ╾ALLOC_ID╼ 04 00 00 00 │ ╾──╼....
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:186: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 allocN, 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) {
+ ╾ALLOC_ID╼ ╾ALLOC_ID╼ │ ╾──╼╾──╼
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:190: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
+ |
+ = 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) {
+ ╾ALLOC_ID╼ ╾ALLOC_ID╼ │ ╾──╼╾──╼
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:194: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
+ |
+ = 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) {
+ ╾ALLOC_ID╼ 00 00 00 00 │ ╾──╼....
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:196:1
+ |
+LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered allocN, 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) {
+ ╾ALLOC_ID╼ ╾ALLOC_ID╼ │ ╾──╼╾──╼
+ }
+
+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 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 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) {
+ 09 00 00 00 03 00 00 00 │ ........
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:209:1
+ |
+LL | const _: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) };
+ | ^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to uninhabited type [!; 1]
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: 4, align: 4) {
+ 01 00 00 00 │ ....
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:210:1
+ |
+LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 1]) };
+ | ^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a value of the never type `!`
+ |
+ = 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) {
+ 01 00 00 00 01 00 00 00 │ ........
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:211:1
+ |
+LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 42]) };
+ | ^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a value of the never type `!`
+ |
+ = 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) {
+ 01 00 00 00 2a 00 00 00 │ ....*...
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:215:1
+ |
+LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) };
+ | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized bytes
+ |
+ = 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) {
+ ╾ALLOC_ID╼ 01 00 00 00 │ ╾──╼....
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:218:1
+ |
+LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, mem::size_of::<&u32>()) };
+ | ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ |
+ = help: this code performed an operation that depends on the underlying bytes representing a pointer
+ = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
+ = note: the raw bytes of the constant (size: 8, align: 4) {
+ ╾ALLOC_ID╼ 04 00 00 00 │ ╾──╼....
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:221: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
+ |
+ = 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) {
+ ╾ALLOC_ID╼ 04 00 00 00 │ ╾──╼....
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:225:1
+ |
+LL | pub static S7: &[u16] = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[1]: encountered uninitialized bytes
+ |
+ = 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) {
+ ╾ALLOC_ID+0x2╼ 04 00 00 00 │ ╾──╼....
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:232:1
+ |
+LL | pub static R4: &[u8] = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized bytes
+ |
+ = 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) {
+ ╾ALLOC_ID╼ 01 00 00 00 │ ╾──╼....
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:237:1
+ |
+LL | pub static R5: &[u8] = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ |
+ = help: this code performed an operation that depends on the underlying bytes representing a pointer
+ = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
+ = note: the raw bytes of the constant (size: 8, align: 4) {
+ ╾ALLOC_ID╼ 04 00 00 00 │ ╾──╼....
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:242:1
+ |
+LL | pub static R6: &[bool] = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean
+ |
+ = 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) {
+ ╾ALLOC_ID╼ 04 00 00 00 │ ╾──╼....
+ }
+
+error: aborting due to 52 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
new file mode 100644
index 000000000..e4c5e62f6
--- /dev/null
+++ b/tests/ui/consts/const-eval/raw-bytes.64bit.stderr
@@ -0,0 +1,596 @@
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:20:1
+ |
+LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) };
+ | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x0000000000000001, 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: 8) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:28:1
+ |
+LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
+ | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<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: 8, align: 8) {
+ 00 00 00 00 00 00 00 00 │ ........
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:42:1
+ |
+LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(B)>.0: encountered a value of the never type `!`
+ |
+ = 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: 1, align: 1) {
+ 01 │ .
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:44:1
+ |
+LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(D)>.0: encountered a value of uninhabited type Never
+ |
+ = 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: 1, align: 1) {
+ 03 │ .
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:50: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`)
+ |
+ = 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) {
+ 78 00 00 00 ff ff ff ff │ x.......
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:54:1
+ |
+LL | const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: 8, align: 8) {
+ 00 00 00 00 00 00 00 00 │ ........
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:57:1
+ |
+LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: 1, align: 1) {
+ 00 │ .
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:59:1
+ |
+LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: 8, align: 8) {
+ 00 00 00 00 00 00 00 00 │ ........
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:65:1
+ |
+LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 42, but expected something in the range 10..=30
+ |
+ = 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) {
+ 2a 00 00 00 │ *...
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:71: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
+ |
+ = 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) {
+ 14 00 00 00 │ ....
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:74:1
+ |
+LL | const NULL_FAT_PTR: NonNull<dyn Send> = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: 16, align: 8) {
+ 00 00 00 00 00 00 00 00 ╾ALLOC_ID╼ │ ........╾──────╼
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:82:1
+ |
+LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) };
+ | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1)
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: 8, align: 8) {
+ ╾ALLOC_ID╼ │ ╾──────╼
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:86: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)
+ |
+ = 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) {
+ ╾ALLOC_ID╼ │ ╾──────╼
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:90:1
+ |
+LL | const NULL: &u16 = unsafe { mem::transmute(0usize) };
+ | ^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null reference
+ |
+ = 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) {
+ 00 00 00 00 00 00 00 00 │ ........
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:93:1
+ |
+LL | const NULL_BOX: Box<u16> = unsafe { mem::transmute(0usize) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null box
+ |
+ = 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) {
+ 00 00 00 00 00 00 00 00 │ ........
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:96:1
+ |
+LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (address 0x539 is unallocated)
+ |
+ = 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) {
+ 39 05 00 00 00 00 00 00 │ 9.......
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:99:1
+ |
+LL | const USIZE_AS_BOX: Box<u8> = unsafe { mem::transmute(1337usize) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (address 0x539 is unallocated)
+ |
+ = 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) {
+ 39 05 00 00 00 00 00 00 │ 9.......
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:102:1
+ |
+LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, 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) {
+ 00 00 00 00 00 00 00 00 │ ........
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:104:1
+ |
+LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0xd[noalloc], 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) {
+ 0d 00 00 00 00 00 00 00 │ ........
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:106:1
+ |
+LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered allocN, 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) {
+ ╾ALLOC_ID╼ │ ╾──────╼
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:112:1
+ |
+LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to uninhabited type Bar
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: 8, align: 8) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:137: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)
+ |
+ = 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) {
+ ╾ALLOC_ID╼ e7 03 00 00 00 00 00 00 │ ╾──────╼........
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:139: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
+ |
+ = 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) {
+ ╾ALLOC_ID╼ ff ff ff ff ff ff ff ff │ ╾──────╼........
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:141: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
+ |
+ = 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) {
+ ╾ALLOC_ID╼ ff ff ff ff ff ff ff ff │ ╾──────╼........
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:144:1
+ |
+LL | const STR_NO_INIT: &str = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered uninitialized data in `str`
+ |
+ = 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) {
+ ╾ALLOC_ID╼ 01 00 00 00 00 00 00 00 │ ╾──────╼........
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:146:1
+ |
+LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered uninitialized data in `str`
+ |
+ = 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) {
+ ╾ALLOC_ID╼ 01 00 00 00 00 00 00 00 │ ╾──────╼........
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:148:1
+ |
+LL | const MYSTR_NO_INIT_ISSUE83182: &MyStr = unsafe { mem::transmute::<&[_], _>(&[&()]) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ |
+ = help: this code performed an operation that depends on the underlying bytes representing a pointer
+ = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
+ = note: the raw bytes of the constant (size: 16, align: 8) {
+ ╾ALLOC_ID╼ 01 00 00 00 00 00 00 00 │ ╾──────╼........
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:152: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)
+ |
+ = 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) {
+ ╾ALLOC_ID╼ e7 03 00 00 00 00 00 00 │ ╾──────╼........
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:154: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
+ |
+ = 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) {
+ ╾ALLOC_ID╼ ff ff ff ff ff ff ff 7f │ ╾──────╼........
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:157: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)
+ |
+ = 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) {
+ ╾ALLOC_ID╼ e7 03 00 00 00 00 00 00 │ ╾──────╼........
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:160:1
+ |
+LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x03, but expected a boolean
+ |
+ = 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) {
+ ╾ALLOC_ID╼ │ ╾──────╼
+ }
+
+note: erroneous constant used
+ --> $DIR/raw-bytes.rs:160: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
+ |
+LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered 0x03, but expected a boolean
+ |
+ = 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) {
+ ╾ALLOC_ID╼ │ ╾──────╼
+ }
+
+note: erroneous constant used
+ --> $DIR/raw-bytes.rs:166: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
+ |
+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
+ |
+ = 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) {
+ ╾ALLOC_ID╼ │ ╾──────╼
+ }
+
+note: erroneous constant used
+ --> $DIR/raw-bytes.rs:170: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
+ |
+LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u8))) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, 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) {
+ ╾ALLOC_ID╼ ╾ALLOC_ID╼ │ ╾──────╼╾──────╼
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:179:1
+ |
+LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u64))) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered allocN, 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) {
+ ╾ALLOC_ID╼ ╾ALLOC_ID╼ │ ╾──────╼╾──────╼
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:183: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
+ |
+ = 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) {
+ ╾ALLOC_ID╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:186: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 allocN, 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) {
+ ╾ALLOC_ID╼ ╾ALLOC_ID╼ │ ╾──────╼╾──────╼
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:190: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
+ |
+ = 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) {
+ ╾ALLOC_ID╼ ╾ALLOC_ID╼ │ ╾──────╼╾──────╼
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:194: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
+ |
+ = 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) {
+ ╾ALLOC_ID╼ 00 00 00 00 00 00 00 00 │ ╾──────╼........
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:196:1
+ |
+LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered allocN, 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) {
+ ╾ALLOC_ID╼ ╾ALLOC_ID╼ │ ╾──────╼╾──────╼
+ }
+
+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 10 00 00 00 00 00 00 00 00 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) {
+ 09 00 00 00 00 00 00 00 03 00 00 00 00 00 00 00 │ ................
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:209:1
+ |
+LL | const _: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) };
+ | ^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to uninhabited type [!; 1]
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: 8, align: 8) {
+ 01 00 00 00 00 00 00 00 │ ........
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:210:1
+ |
+LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 1]) };
+ | ^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a value of the never type `!`
+ |
+ = 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) {
+ 01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 │ ................
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:211:1
+ |
+LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 42]) };
+ | ^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a value of the never type `!`
+ |
+ = 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) {
+ 01 00 00 00 00 00 00 00 2a 00 00 00 00 00 00 00 │ ........*.......
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:215:1
+ |
+LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) };
+ | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized bytes
+ |
+ = 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) {
+ ╾ALLOC_ID╼ 01 00 00 00 00 00 00 00 │ ╾──────╼........
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:218:1
+ |
+LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, mem::size_of::<&u32>()) };
+ | ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ |
+ = help: this code performed an operation that depends on the underlying bytes representing a pointer
+ = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
+ = note: the raw bytes of the constant (size: 16, align: 8) {
+ ╾ALLOC_ID╼ 08 00 00 00 00 00 00 00 │ ╾──────╼........
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:221: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
+ |
+ = 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) {
+ ╾ALLOC_ID╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:225:1
+ |
+LL | pub static S7: &[u16] = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[1]: encountered uninitialized bytes
+ |
+ = 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) {
+ ╾ALLOC_ID+0x2╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:232:1
+ |
+LL | pub static R4: &[u8] = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized bytes
+ |
+ = 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) {
+ ╾ALLOC_ID╼ 01 00 00 00 00 00 00 00 │ ╾──────╼........
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:237:1
+ |
+LL | pub static R5: &[u8] = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ |
+ = help: this code performed an operation that depends on the underlying bytes representing a pointer
+ = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
+ = note: the raw bytes of the constant (size: 16, align: 8) {
+ ╾ALLOC_ID╼ 08 00 00 00 00 00 00 00 │ ╾──────╼........
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/raw-bytes.rs:242:1
+ |
+LL | pub static R6: &[bool] = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean
+ |
+ = 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) {
+ ╾ALLOC_ID╼ 04 00 00 00 00 00 00 00 │ ╾──────╼........
+ }
+
+error: aborting due to 52 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
new file mode 100644
index 000000000..6c1238c0a
--- /dev/null
+++ b/tests/ui/consts/const-eval/raw-bytes.rs
@@ -0,0 +1,263 @@
+// stderr-per-bitwidth
+// ignore-endian-big
+// ignore-tidy-linelength
+// normalize-stderr-test "╾─*a(lloc)?[0-9]+(\+[a-z0-9]+)?─*╼" -> "╾ALLOC_ID$2╼"
+// normalize-stderr-test "alloc\d+" -> "allocN"
+#![feature(never_type, rustc_attrs, ptr_metadata, slice_from_ptr_range, const_slice_from_ptr_range)]
+#![allow(invalid_value)]
+
+use std::mem;
+use std::alloc::Layout;
+use std::ptr::NonNull;
+use std::num::{NonZeroU8, NonZeroUsize};
+use std::slice::{from_ptr_range, from_raw_parts};
+
+#[repr(usize)]
+#[derive(Copy, Clone)]
+enum Enum {
+ A = 0,
+}
+const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) };
+//~^ ERROR is undefined behavior
+
+#[repr(usize)]
+#[derive(Copy, Clone)]
+enum Enum2 {
+ A = 2,
+}
+const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
+//~^ ERROR is undefined behavior
+
+#[derive(Copy, Clone)]
+enum Never {}
+
+// An enum with 3 variants of which some are uninhabited -- so the uninhabited variants *do*
+// have a discriminant.
+enum UninhDiscriminant {
+ A,
+ B(!),
+ C,
+ D(Never),
+}
+const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) };
+//~^ ERROR is undefined behavior
+const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) };
+//~^ ERROR is undefined behavior
+
+// Invalid enum field content (mostly to test printing of paths for enum tuple
+// variants and tuples).
+// Need to create something which does not clash with enum layout optimizations.
+const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute(!0u32) }));
+//~^ ERROR is undefined behavior
+
+
+const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) };
+//~^ ERROR it is undefined behavior to use this value
+
+const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) };
+//~^ ERROR it is undefined behavior to use this value
+const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) };
+//~^ ERROR it is undefined behavior to use this value
+
+#[rustc_layout_scalar_valid_range_start(10)]
+#[rustc_layout_scalar_valid_range_end(30)]
+struct RestrictedRange1(u32);
+const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) };
+//~^ ERROR it is undefined behavior to use this value
+
+#[rustc_layout_scalar_valid_range_start(30)]
+#[rustc_layout_scalar_valid_range_end(10)]
+struct RestrictedRange2(u32);
+const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) };
+//~^ ERROR it is undefined behavior to use this value
+
+const NULL_FAT_PTR: NonNull<dyn Send> = unsafe {
+//~^ ERROR it is undefined behavior to use this value
+ let x: &dyn Send = &42;
+ let meta = std::ptr::metadata(x);
+ mem::transmute((0_usize, meta))
+};
+
+
+const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) };
+//~^ ERROR it is undefined behavior to use this value
+//~| constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1)
+
+const UNALIGNED_BOX: Box<u16> = unsafe { mem::transmute(&[0u8; 4]) };
+//~^ ERROR it is undefined behavior to use this value
+//~| constructing invalid value: encountered an unaligned box (required 2 byte alignment but found 1)
+
+const NULL: &u16 = unsafe { mem::transmute(0usize) };
+//~^ ERROR it is undefined behavior to use this value
+
+const NULL_BOX: Box<u16> = unsafe { mem::transmute(0usize) };
+//~^ ERROR it is undefined behavior to use this value
+
+const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };
+//~^ ERROR it is undefined behavior to use this value
+
+const USIZE_AS_BOX: Box<u8> = unsafe { mem::transmute(1337usize) };
+//~^ ERROR it is undefined behavior to use this value
+
+const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) };
+//~^ ERROR it is undefined behavior to use this value
+const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) };
+//~^ ERROR it is undefined behavior to use this value
+const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
+//~^ ERROR it is undefined behavior to use this value
+
+#[derive(Copy, Clone)]
+enum Bar {}
+
+const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
+//~^ ERROR it is undefined behavior to use this value
+
+
+/// A newtype wrapper to prevent MIR generation from inserting reborrows that would affect the error
+/// message.
+#[repr(transparent)]
+struct W<T>(T);
+
+#[repr(C)]
+union MaybeUninit<T: Copy> {
+ uninit: (),
+ init: T,
+}
+
+trait Trait {}
+impl Trait for bool {}
+
+// custom unsized type
+struct MyStr(str);
+
+// custom unsized type with sized fields
+struct MySlice<T: ?Sized>(bool, T);
+type MySliceBool = MySlice<[bool]>;
+
+const STR_TOO_LONG: &str = unsafe { mem::transmute((&42u8, 999usize)) };
+//~^ ERROR it is undefined behavior to use this value
+const NESTED_STR_MUCH_TOO_LONG: (&str,) = (unsafe { mem::transmute((&42, usize::MAX)) },);
+//~^ ERROR it is undefined behavior to use this value
+const MY_STR_MUCH_TOO_LONG: &MyStr = unsafe { mem::transmute((&42u8, usize::MAX)) };
+//~^ ERROR it is undefined behavior to use this value
+
+const STR_NO_INIT: &str = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) };
+//~^ ERROR it is undefined behavior to use this value
+const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) };
+//~^ ERROR it is undefined behavior to use this value
+const MYSTR_NO_INIT_ISSUE83182: &MyStr = unsafe { mem::transmute::<&[_], _>(&[&()]) };
+//~^ ERROR: it is undefined behavior to use this value
+
+// # slice
+const SLICE_TOO_LONG: &[u8] = unsafe { mem::transmute((&42u8, 999usize)) };
+//~^ ERROR it is undefined behavior to use this value
+const SLICE_TOO_LONG_OVERFLOW: &[u32] = unsafe { mem::transmute((&42u32, isize::MAX)) };
+//~^ ERROR it is undefined behavior to use this value
+// bad slice box: length too big
+const SLICE_TOO_LONG_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, 999usize)) };
+//~^ ERROR it is undefined behavior to use this value
+// bad data *inside* the slice
+const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
+//~^ ERROR it is undefined behavior to use this value
+//~| constant
+
+
+// bad: sized field is not okay
+const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]);
+//~^ ERROR it is undefined behavior to use this value
+//~| constant
+// bad: unsized part is not okay
+const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]);
+//~^ ERROR it is undefined behavior to use this value
+//~| constant
+
+// bad trait object
+const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u8))) };
+//~^ ERROR it is undefined behavior to use this value
+//~| expected a vtable
+// bad trait object
+const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u64))) };
+//~^ ERROR it is undefined behavior to use this value
+//~| expected a vtable
+// bad trait object
+const TRAIT_OBJ_INT_VTABLE: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, 4usize))) };
+//~^ ERROR it is undefined behavior to use this value
+//~| expected a vtable
+const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &[&42u8; 8]))) };
+//~^ ERROR it is undefined behavior to use this value
+//~| expected a vtable
+// bad data *inside* the trait object
+const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_, &bool>(&3u8) };
+//~^ ERROR it is undefined behavior to use this value
+//~| expected a boolean
+
+const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute((&92u8, 0usize)) };
+//~^ ERROR it is undefined behavior to use this value
+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
+
+
+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
+
+
+// Reading uninitialized data
+pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) };
+//~^ ERROR: it is undefined behavior to use this value
+// Reinterpret pointers as integers (UB in CTFE.)
+pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, mem::size_of::<&u32>()) };
+//~^ ERROR: it is undefined behavior to use this value
+// Layout mismatch
+pub static S6: &[bool] = unsafe { from_raw_parts((&D0) as *const _ as _, 4) };
+//~^ ERROR: it is undefined behavior to use this value
+
+// Reading padding is not ok
+pub static S7: &[u16] = unsafe {
+ //~^ ERROR: it is undefined behavior to use this value
+ let ptr = (&D2 as *const Struct as *const u16).add(1);
+
+ from_raw_parts(ptr, 4)
+};
+
+pub static R4: &[u8] = unsafe {
+ //~^ ERROR: it is undefined behavior to use this value
+ let ptr = (&D1) as *const mem::MaybeUninit<&u32> as *const u8;
+ from_ptr_range(ptr..ptr.add(1))
+};
+pub static R5: &[u8] = unsafe {
+ //~^ ERROR: it is undefined behavior to use this value
+ let ptr = &D3 as *const &u32;
+ from_ptr_range(ptr.cast()..ptr.add(1).cast())
+};
+pub static R6: &[bool] = unsafe {
+ //~^ ERROR: it is undefined behavior to use this value
+ let ptr = &D0 as *const u32 as *const bool;
+ from_ptr_range(ptr..ptr.add(4))
+};
+
+const D0: u32 = 0x11111111; // Constant chosen for endianness-independent behavior.
+const D1: mem::MaybeUninit<&u32> = mem::MaybeUninit::uninit();
+const D2: Struct = Struct { a: 1, b: 2, c: 3, d: 4 };
+const D3: &u32 = &42;
+
+#[repr(C)]
+struct Struct {
+ a: u8,
+ // _pad: [mem::MaybeUninit<u8>; 3]
+ b: u32,
+ c: u16,
+ d: u8,
+ // _pad: [mem::MaybeUninit<u8>; 1]
+}
+
+fn main() {}
diff --git a/src/test/ui/consts/const-eval/ref_to_int_match.32bit.stderr b/tests/ui/consts/const-eval/ref_to_int_match.32bit.stderr
index 032ceb246..032ceb246 100644
--- a/src/test/ui/consts/const-eval/ref_to_int_match.32bit.stderr
+++ b/tests/ui/consts/const-eval/ref_to_int_match.32bit.stderr
diff --git a/src/test/ui/consts/const-eval/ref_to_int_match.64bit.stderr b/tests/ui/consts/const-eval/ref_to_int_match.64bit.stderr
index 032ceb246..032ceb246 100644
--- a/src/test/ui/consts/const-eval/ref_to_int_match.64bit.stderr
+++ b/tests/ui/consts/const-eval/ref_to_int_match.64bit.stderr
diff --git a/src/test/ui/consts/const-eval/ref_to_int_match.rs b/tests/ui/consts/const-eval/ref_to_int_match.rs
index 70c6e7d94..70c6e7d94 100644
--- a/src/test/ui/consts/const-eval/ref_to_int_match.rs
+++ b/tests/ui/consts/const-eval/ref_to_int_match.rs
diff --git a/src/test/ui/consts/const-eval/shift_overflow.rs b/tests/ui/consts/const-eval/shift_overflow.rs
index e843584b6..e843584b6 100644
--- a/src/test/ui/consts/const-eval/shift_overflow.rs
+++ b/tests/ui/consts/const-eval/shift_overflow.rs
diff --git a/src/test/ui/consts/const-eval/shift_overflow.stderr b/tests/ui/consts/const-eval/shift_overflow.stderr
index e8d4076a6..e8d4076a6 100644
--- a/src/test/ui/consts/const-eval/shift_overflow.stderr
+++ b/tests/ui/consts/const-eval/shift_overflow.stderr
diff --git a/src/test/ui/consts/const-eval/simd/insert_extract.rs b/tests/ui/consts/const-eval/simd/insert_extract.rs
index 3472c05d1..3472c05d1 100644
--- a/src/test/ui/consts/const-eval/simd/insert_extract.rs
+++ b/tests/ui/consts/const-eval/simd/insert_extract.rs
diff --git a/src/test/ui/consts/const-eval/simple_with_undef.rs b/tests/ui/consts/const-eval/simple_with_undef.rs
index 1a416dd46..1a416dd46 100644
--- a/src/test/ui/consts/const-eval/simple_with_undef.rs
+++ b/tests/ui/consts/const-eval/simple_with_undef.rs
diff --git a/src/test/ui/consts/const-eval/size-of-t.rs b/tests/ui/consts/const-eval/size-of-t.rs
index efbdeec70..efbdeec70 100644
--- a/src/test/ui/consts/const-eval/size-of-t.rs
+++ b/tests/ui/consts/const-eval/size-of-t.rs
diff --git a/src/test/ui/consts/const-eval/size-of-t.stderr b/tests/ui/consts/const-eval/size-of-t.stderr
index abe641046..abe641046 100644
--- a/src/test/ui/consts/const-eval/size-of-t.stderr
+++ b/tests/ui/consts/const-eval/size-of-t.stderr
diff --git a/src/test/ui/consts/const-eval/strlen.rs b/tests/ui/consts/const-eval/strlen.rs
index 7b14a5235..7b14a5235 100644
--- a/src/test/ui/consts/const-eval/strlen.rs
+++ b/tests/ui/consts/const-eval/strlen.rs
diff --git a/src/test/ui/consts/const-eval/transmute-const-promotion.rs b/tests/ui/consts/const-eval/transmute-const-promotion.rs
index 1f0240d4b..1f0240d4b 100644
--- a/src/test/ui/consts/const-eval/transmute-const-promotion.rs
+++ b/tests/ui/consts/const-eval/transmute-const-promotion.rs
diff --git a/src/test/ui/consts/const-eval/transmute-const-promotion.stderr b/tests/ui/consts/const-eval/transmute-const-promotion.stderr
index 434a957f6..434a957f6 100644
--- a/src/test/ui/consts/const-eval/transmute-const-promotion.stderr
+++ b/tests/ui/consts/const-eval/transmute-const-promotion.stderr
diff --git a/src/test/ui/consts/const-eval/transmute-const.32bit.stderr b/tests/ui/consts/const-eval/transmute-const.32bit.stderr
index 09fd79986..09fd79986 100644
--- a/src/test/ui/consts/const-eval/transmute-const.32bit.stderr
+++ b/tests/ui/consts/const-eval/transmute-const.32bit.stderr
diff --git a/src/test/ui/consts/const-eval/transmute-const.64bit.stderr b/tests/ui/consts/const-eval/transmute-const.64bit.stderr
index 09fd79986..09fd79986 100644
--- a/src/test/ui/consts/const-eval/transmute-const.64bit.stderr
+++ b/tests/ui/consts/const-eval/transmute-const.64bit.stderr
diff --git a/src/test/ui/consts/const-eval/transmute-const.rs b/tests/ui/consts/const-eval/transmute-const.rs
index d9d0a3aea..d9d0a3aea 100644
--- a/src/test/ui/consts/const-eval/transmute-const.rs
+++ b/tests/ui/consts/const-eval/transmute-const.rs
diff --git a/src/test/ui/consts/const-eval/ub-enum-overwrite.rs b/tests/ui/consts/const-eval/ub-enum-overwrite.rs
index 086a1001d..086a1001d 100644
--- a/src/test/ui/consts/const-eval/ub-enum-overwrite.rs
+++ b/tests/ui/consts/const-eval/ub-enum-overwrite.rs
diff --git a/src/test/ui/consts/const-eval/ub-enum-overwrite.stderr b/tests/ui/consts/const-eval/ub-enum-overwrite.stderr
index 5750212b4..5750212b4 100644
--- a/src/test/ui/consts/const-eval/ub-enum-overwrite.stderr
+++ b/tests/ui/consts/const-eval/ub-enum-overwrite.stderr
diff --git a/src/test/ui/consts/const-eval/ub-enum.32bit.stderr b/tests/ui/consts/const-eval/ub-enum.32bit.stderr
index 93bc96e67..2d86bd88f 100644
--- a/src/test/ui/consts/const-eval/ub-enum.32bit.stderr
+++ b/tests/ui/consts/const-eval/ub-enum.32bit.stderr
@@ -1,16 +1,16 @@
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-enum.rs:24:1
+ --> $DIR/ub-enum.rs:27:1
|
LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) };
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x00000001, 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: 4, align: 4) {
- 01 00 00 00 │ ....
+ = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
+ HEX_DUMP
}
error[E0080]: evaluation of constant value failed
- --> $DIR/ub-enum.rs:27:1
+ --> $DIR/ub-enum.rs:30:1
|
LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
| ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -19,7 +19,7 @@ LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
error[E0080]: evaluation of constant value failed
- --> $DIR/ub-enum.rs:30:1
+ --> $DIR/ub-enum.rs:33:1
|
LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -28,18 +28,18 @@ LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
= 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/ub-enum.rs:42:1
+ --> $DIR/ub-enum.rs:45:1
|
LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
| ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<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: 4, align: 4) {
- 00 00 00 00 │ ....
+ = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
+ HEX_DUMP
}
error[E0080]: evaluation of constant value failed
- --> $DIR/ub-enum.rs:44:1
+ --> $DIR/ub-enum.rs:47:1
|
LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -48,7 +48,7 @@ LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
error[E0080]: evaluation of constant value failed
- --> $DIR/ub-enum.rs:47:1
+ --> $DIR/ub-enum.rs:50:1
|
LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -57,13 +57,13 @@ LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
error[E0080]: evaluation of constant value failed
- --> $DIR/ub-enum.rs:56:42
+ --> $DIR/ub-enum.rs:59:42
|
LL | const BAD_ENUM2_UNDEF : Enum2 = unsafe { MaybeUninit { uninit: () }.init };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
error[E0080]: evaluation of constant value failed
- --> $DIR/ub-enum.rs:61:1
+ --> $DIR/ub-enum.rs:64:1
|
LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -72,46 +72,46 @@ LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
= 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/ub-enum.rs:78:1
+ --> $DIR/ub-enum.rs:81:1
|
LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(B)>.0: encountered a value of the never type `!`
|
= 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: 1, align: 1) {
- 01 │ .
+ = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
+ HEX_DUMP
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-enum.rs:80:1
+ --> $DIR/ub-enum.rs:83:1
|
LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(D)>.0: encountered a value of uninhabited type Never
|
= 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: 1, align: 1) {
- 03 │ .
+ = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
+ HEX_DUMP
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-enum.rs:88:1
+ --> $DIR/ub-enum.rs:91: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`)
|
= 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) {
- 78 00 00 00 ff ff ff ff │ x.......
+ = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
+ HEX_DUMP
}
error[E0080]: evaluation of constant value failed
- --> $DIR/ub-enum.rs:93:77
+ --> $DIR/ub-enum.rs:96:77
|
LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) };
| ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
error[E0080]: evaluation of constant value failed
- --> $DIR/ub-enum.rs:95:77
+ --> $DIR/ub-enum.rs:98:77
|
LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) };
| ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
diff --git a/src/test/ui/consts/const-eval/ub-enum.64bit.stderr b/tests/ui/consts/const-eval/ub-enum.64bit.stderr
index 280ba25a8..a89d7ec5f 100644
--- a/src/test/ui/consts/const-eval/ub-enum.64bit.stderr
+++ b/tests/ui/consts/const-eval/ub-enum.64bit.stderr
@@ -1,16 +1,16 @@
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-enum.rs:24:1
+ --> $DIR/ub-enum.rs:27:1
|
LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) };
| ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x0000000000000001, 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: 8) {
- 01 00 00 00 00 00 00 00 │ ........
+ = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
+ HEX_DUMP
}
error[E0080]: evaluation of constant value failed
- --> $DIR/ub-enum.rs:27:1
+ --> $DIR/ub-enum.rs:30:1
|
LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
| ^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -19,7 +19,7 @@ LL | const BAD_ENUM_PTR: Enum = unsafe { mem::transmute(&1) };
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
error[E0080]: evaluation of constant value failed
- --> $DIR/ub-enum.rs:30:1
+ --> $DIR/ub-enum.rs:33:1
|
LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -28,18 +28,18 @@ LL | const BAD_ENUM_WRAPPED: Wrap<Enum> = unsafe { mem::transmute(&1) };
= 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/ub-enum.rs:42:1
+ --> $DIR/ub-enum.rs:45:1
|
LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
| ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<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: 8, align: 8) {
- 00 00 00 00 00 00 00 00 │ ........
+ = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
+ HEX_DUMP
}
error[E0080]: evaluation of constant value failed
- --> $DIR/ub-enum.rs:44:1
+ --> $DIR/ub-enum.rs:47:1
|
LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -48,7 +48,7 @@ LL | const BAD_ENUM2_PTR: Enum2 = unsafe { mem::transmute(&0) };
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
error[E0080]: evaluation of constant value failed
- --> $DIR/ub-enum.rs:47:1
+ --> $DIR/ub-enum.rs:50:1
|
LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -57,13 +57,13 @@ LL | const BAD_ENUM2_WRAPPED: Wrap<Enum2> = unsafe { mem::transmute(&0) };
= help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
error[E0080]: evaluation of constant value failed
- --> $DIR/ub-enum.rs:56:42
+ --> $DIR/ub-enum.rs:59:42
|
LL | const BAD_ENUM2_UNDEF : Enum2 = unsafe { MaybeUninit { uninit: () }.init };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
error[E0080]: evaluation of constant value failed
- --> $DIR/ub-enum.rs:61:1
+ --> $DIR/ub-enum.rs:64:1
|
LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
@@ -72,46 +72,46 @@ LL | const BAD_ENUM2_OPTION_PTR: Option<Enum2> = unsafe { mem::transmute(&0) };
= 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/ub-enum.rs:78:1
+ --> $DIR/ub-enum.rs:81:1
|
LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(B)>.0: encountered a value of the never type `!`
|
= 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: 1, align: 1) {
- 01 │ .
+ = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
+ HEX_DUMP
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-enum.rs:80:1
+ --> $DIR/ub-enum.rs:83:1
|
LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(D)>.0: encountered a value of uninhabited type Never
|
= 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: 1, align: 1) {
- 03 │ .
+ = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
+ HEX_DUMP
}
error[E0080]: it is undefined behavior to use this value
- --> $DIR/ub-enum.rs:88:1
+ --> $DIR/ub-enum.rs:91: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`)
|
= 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) {
- 78 00 00 00 ff ff ff ff │ x.......
+ = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
+ HEX_DUMP
}
error[E0080]: evaluation of constant value failed
- --> $DIR/ub-enum.rs:93:77
+ --> $DIR/ub-enum.rs:96:77
|
LL | const BAD_UNINHABITED_WITH_DATA1: Result<(i32, Never), (i32, !)> = unsafe { mem::transmute(0u64) };
| ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
error[E0080]: evaluation of constant value failed
- --> $DIR/ub-enum.rs:95:77
+ --> $DIR/ub-enum.rs:98:77
|
LL | const BAD_UNINHABITED_WITH_DATA2: Result<(i32, !), (i32, Never)> = unsafe { mem::transmute(0u64) };
| ^^^^^^^^^^^^^^^^^^^^ transmuting to uninhabited type
diff --git a/src/test/ui/consts/const-eval/ub-enum.rs b/tests/ui/consts/const-eval/ub-enum.rs
index 6935be2f9..8f26d9a00 100644
--- a/src/test/ui/consts/const-eval/ub-enum.rs
+++ b/tests/ui/consts/const-eval/ub-enum.rs
@@ -1,4 +1,7 @@
// stderr-per-bitwidth
+// 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] |╾─*a(lloc)?[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
#![feature(never_type)]
#![allow(invalid_value)]
diff --git a/src/test/ui/consts/const-eval/ub-incorrect-vtable.32bit.stderr b/tests/ui/consts/const-eval/ub-incorrect-vtable.32bit.stderr
index 965256de2..965256de2 100644
--- a/src/test/ui/consts/const-eval/ub-incorrect-vtable.32bit.stderr
+++ b/tests/ui/consts/const-eval/ub-incorrect-vtable.32bit.stderr
diff --git a/src/test/ui/consts/const-eval/ub-incorrect-vtable.64bit.stderr b/tests/ui/consts/const-eval/ub-incorrect-vtable.64bit.stderr
index bd542a7a5..bd542a7a5 100644
--- a/src/test/ui/consts/const-eval/ub-incorrect-vtable.64bit.stderr
+++ b/tests/ui/consts/const-eval/ub-incorrect-vtable.64bit.stderr
diff --git a/src/test/ui/consts/const-eval/ub-incorrect-vtable.rs b/tests/ui/consts/const-eval/ub-incorrect-vtable.rs
index 4bb30b75b..4bb30b75b 100644
--- a/src/test/ui/consts/const-eval/ub-incorrect-vtable.rs
+++ b/tests/ui/consts/const-eval/ub-incorrect-vtable.rs
diff --git a/src/test/ui/consts/const-eval/ub-int-array.32bit.stderr b/tests/ui/consts/const-eval/ub-int-array.32bit.stderr
index edcde13b0..edcde13b0 100644
--- a/src/test/ui/consts/const-eval/ub-int-array.32bit.stderr
+++ b/tests/ui/consts/const-eval/ub-int-array.32bit.stderr
diff --git a/src/test/ui/consts/const-eval/ub-int-array.64bit.stderr b/tests/ui/consts/const-eval/ub-int-array.64bit.stderr
index edcde13b0..edcde13b0 100644
--- a/src/test/ui/consts/const-eval/ub-int-array.64bit.stderr
+++ b/tests/ui/consts/const-eval/ub-int-array.64bit.stderr
diff --git a/src/test/ui/consts/const-eval/ub-int-array.rs b/tests/ui/consts/const-eval/ub-int-array.rs
index a68d3fb17..a68d3fb17 100644
--- a/src/test/ui/consts/const-eval/ub-int-array.rs
+++ b/tests/ui/consts/const-eval/ub-int-array.rs
diff --git a/src/test/ui/consts/const-eval/ub-nonnull.chalk.64bit.stderr b/tests/ui/consts/const-eval/ub-nonnull.chalk.64bit.stderr
index 2a4b6f3b7..2a4b6f3b7 100644
--- a/src/test/ui/consts/const-eval/ub-nonnull.chalk.64bit.stderr
+++ b/tests/ui/consts/const-eval/ub-nonnull.chalk.64bit.stderr
diff --git a/src/test/ui/consts/const-eval/ub-nonnull.rs b/tests/ui/consts/const-eval/ub-nonnull.rs
index 490925822..a64b3a74c 100644
--- a/src/test/ui/consts/const-eval/ub-nonnull.rs
+++ b/tests/ui/consts/const-eval/ub-nonnull.rs
@@ -1,4 +1,6 @@
-// stderr-per-bitwidth
+// 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] |╾─*a(lloc)?[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
#![feature(rustc_attrs, ptr_metadata)]
#![allow(invalid_value)] // make sure we cannot allow away the errors tested here
diff --git a/tests/ui/consts/const-eval/ub-nonnull.stderr b/tests/ui/consts/const-eval/ub-nonnull.stderr
new file mode 100644
index 000000000..961648708
--- /dev/null
+++ b/tests/ui/consts/const-eval/ub-nonnull.stderr
@@ -0,0 +1,81 @@
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-nonnull.rs:14:1
+ |
+LL | const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
+ HEX_DUMP
+ }
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/ub-nonnull.rs:20:30
+ |
+LL | let out_of_bounds_ptr = &ptr[255];
+ | ^^^^^^^^ dereferencing pointer failed: alloc11 has size 1, so pointer to 256 bytes starting at offset 0 is out-of-bounds
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-nonnull.rs:24:1
+ |
+LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
+ HEX_DUMP
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-nonnull.rs:26:1
+ |
+LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
+ HEX_DUMP
+ }
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/ub-nonnull.rs:34:36
+ |
+LL | const UNINIT: NonZeroU8 = unsafe { MaybeUninit { uninit: () }.init };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-nonnull.rs:43:1
+ |
+LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 42, but expected something in the range 10..=30
+ |
+ = 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) {
+ HEX_DUMP
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-nonnull.rs:49: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
+ |
+ = 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) {
+ HEX_DUMP
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-nonnull.rs:52:1
+ |
+LL | const NULL_FAT_PTR: NonNull<dyn Send> = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
+ HEX_DUMP
+ }
+
+error: aborting due to 8 previous errors
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/const-eval/ub-ref-ptr.rs b/tests/ui/consts/const-eval/ub-ref-ptr.rs
index a1c812390..369e45194 100644
--- a/src/test/ui/consts/const-eval/ub-ref-ptr.rs
+++ b/tests/ui/consts/const-eval/ub-ref-ptr.rs
@@ -1,6 +1,9 @@
// ignore-tidy-linelength
-// stderr-per-bitwidth
+// 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] |╾─*a(lloc)?[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
#![allow(invalid_value)]
+#![feature(const_ptr_read)]
use std::mem;
@@ -57,4 +60,12 @@ const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) };
const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
//~^ ERROR it is undefined behavior to use this value
+
+const UNALIGNED_READ: () = unsafe {
+ let x = &[0u8; 4];
+ let ptr = x.as_ptr().cast::<u32>();
+ ptr.read(); //~ inside `UNALIGNED_READ`
+};
+
+
fn main() {}
diff --git a/tests/ui/consts/const-eval/ub-ref-ptr.stderr b/tests/ui/consts/const-eval/ub-ref-ptr.stderr
new file mode 100644
index 000000000..ce618802b
--- /dev/null
+++ b/tests/ui/consts/const-eval/ub-ref-ptr.stderr
@@ -0,0 +1,186 @@
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-ref-ptr.rs:16:1
+ |
+LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) };
+ | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1)
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
+ HEX_DUMP
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-ref-ptr.rs:20: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)
+ |
+ = 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) {
+ HEX_DUMP
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-ref-ptr.rs:24:1
+ |
+LL | const NULL: &u16 = unsafe { mem::transmute(0usize) };
+ | ^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null reference
+ |
+ = 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) {
+ HEX_DUMP
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-ref-ptr.rs:27:1
+ |
+LL | const NULL_BOX: Box<u16> = unsafe { mem::transmute(0usize) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null box
+ |
+ = 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) {
+ HEX_DUMP
+ }
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/ub-ref-ptr.rs:34:1
+ |
+LL | const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ |
+ = help: this code performed an operation that depends on the underlying bytes representing a pointer
+ = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/ub-ref-ptr.rs:37:39
+ |
+LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ |
+ = help: this code performed an operation that depends on the underlying bytes representing a pointer
+ = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
+
+note: erroneous constant used
+ --> $DIR/ub-ref-ptr.rs:37:38
+ |
+LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }];
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/ub-ref-ptr.rs:40:86
+ |
+LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) };
+ | ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ |
+ = help: this code performed an operation that depends on the underlying bytes representing a pointer
+ = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
+
+note: erroneous constant used
+ --> $DIR/ub-ref-ptr.rs:40:85
+ |
+LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) };
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-ref-ptr.rs:43:1
+ |
+LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (address 0x539 is unallocated)
+ |
+ = 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) {
+ HEX_DUMP
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-ref-ptr.rs:46:1
+ |
+LL | const USIZE_AS_BOX: Box<u8> = unsafe { mem::transmute(1337usize) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (address 0x539 is unallocated)
+ |
+ = 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) {
+ HEX_DUMP
+ }
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/ub-ref-ptr.rs:49:41
+ |
+LL | const UNINIT_PTR: *const i32 = unsafe { MaybeUninit { uninit: () }.init };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-ref-ptr.rs:53:1
+ |
+LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, 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) {
+ HEX_DUMP
+ }
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/ub-ref-ptr.rs:55:38
+ |
+LL | const UNINIT_FN_PTR: fn() = unsafe { MaybeUninit { uninit: () }.init };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-ref-ptr.rs:58:1
+ |
+LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0xd[noalloc], 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) {
+ HEX_DUMP
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-ref-ptr.rs:60:1
+ |
+LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered alloc41, 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) {
+ HEX_DUMP
+ }
+
+error: accessing memory with alignment 1, but alignment 4 is required
+ --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/104616>
+note: inside `std::ptr::read::<u32>`
+ --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+note: inside `ptr::const_ptr::<impl *const u32>::read`
+ --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+note: inside `UNALIGNED_READ`
+ --> $DIR/ub-ref-ptr.rs:67:5
+ |
+LL | ptr.read();
+ | ^^^^^^^^^^
+ = note: `#[deny(invalid_alignment)]` on by default
+
+error: aborting due to 15 previous errors
+
+For more information about this error, try `rustc --explain E0080`.
+Future incompatibility report: Future breakage diagnostic:
+error: accessing memory with alignment 1, but alignment 4 is required
+ --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #68585 <https://github.com/rust-lang/rust/issues/104616>
+note: inside `std::ptr::read::<u32>`
+ --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+note: inside `ptr::const_ptr::<impl *const u32>::read`
+ --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL
+note: inside `UNALIGNED_READ`
+ --> $DIR/ub-ref-ptr.rs:67:5
+ |
+LL | ptr.read();
+ | ^^^^^^^^^^
+ = note: `#[deny(invalid_alignment)]` on by default
+
diff --git a/tests/ui/consts/const-eval/ub-uninhabit.rs b/tests/ui/consts/const-eval/ub-uninhabit.rs
new file mode 100644
index 000000000..4c4ef216d
--- /dev/null
+++ b/tests/ui/consts/const-eval/ub-uninhabit.rs
@@ -0,0 +1,25 @@
+// 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] |╾─*a(lloc)?[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
+
+use std::mem;
+
+#[derive(Copy, Clone)]
+enum Bar {}
+
+#[repr(C)]
+union MaybeUninit<T: Copy> {
+ uninit: (),
+ init: T,
+}
+
+const BAD_BAD_BAD: Bar = unsafe { MaybeUninit { uninit: () }.init };
+//~^ ERROR it is undefined behavior to use this value
+
+const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
+//~^ ERROR it is undefined behavior to use this value
+
+const BAD_BAD_ARRAY: [Bar; 1] = unsafe { MaybeUninit { uninit: () }.init };
+//~^ ERROR it is undefined behavior to use this value
+
+fn main() {}
diff --git a/tests/ui/consts/const-eval/ub-uninhabit.stderr b/tests/ui/consts/const-eval/ub-uninhabit.stderr
new file mode 100644
index 000000000..0ae376d03
--- /dev/null
+++ b/tests/ui/consts/const-eval/ub-uninhabit.stderr
@@ -0,0 +1,32 @@
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-uninhabit.rs:16:1
+ |
+LL | const BAD_BAD_BAD: Bar = unsafe { MaybeUninit { uninit: () }.init };
+ | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a value of uninhabited type Bar
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {}
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-uninhabit.rs:19:1
+ |
+LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to uninhabited type Bar
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
+ HEX_DUMP
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-uninhabit.rs:22:1
+ |
+LL | const BAD_BAD_ARRAY: [Bar; 1] = unsafe { MaybeUninit { uninit: () }.init };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [0]: encountered a value of uninhabited type Bar
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
+ = note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {}
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/const-eval/ub-upvars.32bit.stderr b/tests/ui/consts/const-eval/ub-upvars.32bit.stderr
index f7898e55e..f7898e55e 100644
--- a/src/test/ui/consts/const-eval/ub-upvars.32bit.stderr
+++ b/tests/ui/consts/const-eval/ub-upvars.32bit.stderr
diff --git a/src/test/ui/consts/const-eval/ub-upvars.64bit.stderr b/tests/ui/consts/const-eval/ub-upvars.64bit.stderr
index 60432380e..60432380e 100644
--- a/src/test/ui/consts/const-eval/ub-upvars.64bit.stderr
+++ b/tests/ui/consts/const-eval/ub-upvars.64bit.stderr
diff --git a/src/test/ui/consts/const-eval/ub-upvars.rs b/tests/ui/consts/const-eval/ub-upvars.rs
index ceac59870..ceac59870 100644
--- a/src/test/ui/consts/const-eval/ub-upvars.rs
+++ b/tests/ui/consts/const-eval/ub-upvars.rs
diff --git a/src/test/ui/consts/const-eval/ub-wide-ptr.chalk.64bit.stderr b/tests/ui/consts/const-eval/ub-wide-ptr.chalk.64bit.stderr
index 39352ca84..39352ca84 100644
--- a/src/test/ui/consts/const-eval/ub-wide-ptr.chalk.64bit.stderr
+++ b/tests/ui/consts/const-eval/ub-wide-ptr.chalk.64bit.stderr
diff --git a/src/test/ui/consts/const-eval/ub-wide-ptr.rs b/tests/ui/consts/const-eval/ub-wide-ptr.rs
index 2894ef831..a765dc712 100644
--- a/src/test/ui/consts/const-eval/ub-wide-ptr.rs
+++ b/tests/ui/consts/const-eval/ub-wide-ptr.rs
@@ -1,9 +1,11 @@
-// stderr-per-bitwidth
// ignore-tidy-linelength
#![allow(unused)]
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] |╾─*a(lloc)?[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
// normalize-stderr-test "offset \d+" -> "offset N"
// normalize-stderr-test "alloc\d+" -> "allocN"
// 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
new file mode 100644
index 000000000..f38e7916b
--- /dev/null
+++ b/tests/ui/consts/const-eval/ub-wide-ptr.stderr
@@ -0,0 +1,297 @@
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-wide-ptr.rs:38: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)
+ |
+ = 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) {
+ HEX_DUMP
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-wide-ptr.rs:40: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
+ |
+ = 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) {
+ HEX_DUMP
+ }
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/ub-wide-ptr.rs:43:1
+ |
+LL | const STR_LENGTH_PTR: &str = unsafe { mem::transmute((&42u8, &3)) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ |
+ = help: this code performed an operation that depends on the underlying bytes representing a pointer
+ = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/ub-wide-ptr.rs:46:1
+ |
+LL | const MY_STR_LENGTH_PTR: &MyStr = unsafe { mem::transmute((&42u8, &3)) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ |
+ = help: this code performed an operation that depends on the underlying bytes representing a pointer
+ = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-wide-ptr.rs:48: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
+ |
+ = 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) {
+ HEX_DUMP
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-wide-ptr.rs:52:1
+ |
+LL | const STR_NO_INIT: &str = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered uninitialized data in `str`
+ |
+ = 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) {
+ HEX_DUMP
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-wide-ptr.rs:55:1
+ |
+LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered uninitialized data in `str`
+ |
+ = 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) {
+ HEX_DUMP
+ }
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/ub-wide-ptr.rs:62:1
+ |
+LL | const SLICE_LENGTH_UNINIT: &[u8] = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-wide-ptr.rs:69: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)
+ |
+ = 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) {
+ HEX_DUMP
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-wide-ptr.rs:72: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
+ |
+ = 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) {
+ HEX_DUMP
+ }
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/ub-wide-ptr.rs:75:1
+ |
+LL | const SLICE_LENGTH_PTR: &[u8] = unsafe { mem::transmute((&42u8, &3)) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ |
+ = help: this code performed an operation that depends on the underlying bytes representing a pointer
+ = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-wide-ptr.rs:78: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)
+ |
+ = 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) {
+ HEX_DUMP
+ }
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/ub-wide-ptr.rs:81:1
+ |
+LL | const SLICE_LENGTH_PTR_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, &3)) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes
+ |
+ = help: this code performed an operation that depends on the underlying bytes representing a pointer
+ = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-wide-ptr.rs:85:1
+ |
+LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x03, but expected a boolean
+ |
+ = 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) {
+ HEX_DUMP
+ }
+
+note: erroneous constant used
+ --> $DIR/ub-wide-ptr.rs:85:40
+ |
+LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-wide-ptr.rs:92: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
+ |
+ = 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) {
+ HEX_DUMP
+ }
+
+note: erroneous constant used
+ --> $DIR/ub-wide-ptr.rs:92:42
+ |
+LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-wide-ptr.rs:96: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
+ |
+ = 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) {
+ HEX_DUMP
+ }
+
+note: erroneous constant used
+ --> $DIR/ub-wide-ptr.rs:96:42
+ |
+LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/ub-wide-ptr.rs:104:1
+ |
+LL | const RAW_SLICE_LENGTH_UNINIT: *const [u8] = unsafe {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
+
+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 allocN, 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) {
+ HEX_DUMP
+ }
+
+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 allocN, 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) {
+ HEX_DUMP
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-wide-ptr.rs:121: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
+ |
+ = 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) {
+ HEX_DUMP
+ }
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/ub-wide-ptr.rs:124:57
+ |
+LL | const TRAIT_OBJ_UNALIGNED_VTABLE: &dyn Trait = unsafe { mem::transmute((&92u8, &[0u8; 128])) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/ub-wide-ptr.rs:127:57
+ |
+LL | const TRAIT_OBJ_BAD_DROP_FN_NULL: &dyn Trait = unsafe { mem::transmute((&92u8, &[0usize; 8])) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable
+
+error[E0080]: evaluation of constant value failed
+ --> $DIR/ub-wide-ptr.rs:130:56
+ |
+LL | const TRAIT_OBJ_BAD_DROP_FN_INT: &dyn Trait = unsafe { mem::transmute((&92u8, &[1usize; 8])) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable
+
+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 allocN, 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) {
+ HEX_DUMP
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-wide-ptr.rs:138: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
+ |
+ = 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) {
+ HEX_DUMP
+ }
+
+error[E0080]: it is undefined behavior to use this value
+ --> $DIR/ub-wide-ptr.rs:143: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
+ |
+ = 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) {
+ HEX_DUMP
+ }
+
+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 allocN, 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) {
+ HEX_DUMP
+ }
+
+error[E0080]: could not evaluate static initializer
+ --> $DIR/ub-wide-ptr.rs:151:5
+ |
+LL | mem::transmute::<_, &dyn Trait>((&92u8, 0usize))
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ out-of-bounds pointer use: null pointer is a dangling pointer (it has no provenance)
+
+error[E0080]: could not evaluate static initializer
+ --> $DIR/ub-wide-ptr.rs:155:5
+ |
+LL | mem::transmute::<_, &dyn Trait>((&92u8, &3u64))
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using allocN as vtable pointer but it does not point to a vtable
+
+error: aborting due to 29 previous errors
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/const-eval/union-const-eval-field.rs b/tests/ui/consts/const-eval/union-const-eval-field.rs
index a94fcbbfa..a94fcbbfa 100644
--- a/src/test/ui/consts/const-eval/union-const-eval-field.rs
+++ b/tests/ui/consts/const-eval/union-const-eval-field.rs
diff --git a/src/test/ui/consts/const-eval/union-const-eval-field.stderr b/tests/ui/consts/const-eval/union-const-eval-field.stderr
index 9899c56c0..9899c56c0 100644
--- a/src/test/ui/consts/const-eval/union-const-eval-field.stderr
+++ b/tests/ui/consts/const-eval/union-const-eval-field.stderr
diff --git a/src/test/ui/consts/const-eval/union-ice.rs b/tests/ui/consts/const-eval/union-ice.rs
index dd970a355..dd970a355 100644
--- a/src/test/ui/consts/const-eval/union-ice.rs
+++ b/tests/ui/consts/const-eval/union-ice.rs
diff --git a/src/test/ui/consts/const-eval/union-ice.stderr b/tests/ui/consts/const-eval/union-ice.stderr
index bd39a0551..bd39a0551 100644
--- a/src/test/ui/consts/const-eval/union-ice.stderr
+++ b/tests/ui/consts/const-eval/union-ice.stderr
diff --git a/src/test/ui/consts/const-eval/union-ub.32bit.stderr b/tests/ui/consts/const-eval/union-ub.32bit.stderr
index e5c8f88be..e5c8f88be 100644
--- a/src/test/ui/consts/const-eval/union-ub.32bit.stderr
+++ b/tests/ui/consts/const-eval/union-ub.32bit.stderr
diff --git a/src/test/ui/consts/const-eval/union-ub.64bit.stderr b/tests/ui/consts/const-eval/union-ub.64bit.stderr
index e5c8f88be..e5c8f88be 100644
--- a/src/test/ui/consts/const-eval/union-ub.64bit.stderr
+++ b/tests/ui/consts/const-eval/union-ub.64bit.stderr
diff --git a/src/test/ui/consts/const-eval/union-ub.rs b/tests/ui/consts/const-eval/union-ub.rs
index 043870c9c..043870c9c 100644
--- a/src/test/ui/consts/const-eval/union-ub.rs
+++ b/tests/ui/consts/const-eval/union-ub.rs
diff --git a/src/test/ui/consts/const-eval/union_promotion.rs b/tests/ui/consts/const-eval/union_promotion.rs
index 18894c45f..18894c45f 100644
--- a/src/test/ui/consts/const-eval/union_promotion.rs
+++ b/tests/ui/consts/const-eval/union_promotion.rs
diff --git a/src/test/ui/consts/const-eval/union_promotion.stderr b/tests/ui/consts/const-eval/union_promotion.stderr
index 42f17de20..42f17de20 100644
--- a/src/test/ui/consts/const-eval/union_promotion.stderr
+++ b/tests/ui/consts/const-eval/union_promotion.stderr
diff --git a/src/test/ui/consts/const-eval/unused-broken-const.rs b/tests/ui/consts/const-eval/unused-broken-const.rs
index 0d2776bc2..0d2776bc2 100644
--- a/src/test/ui/consts/const-eval/unused-broken-const.rs
+++ b/tests/ui/consts/const-eval/unused-broken-const.rs
diff --git a/src/test/ui/consts/const-eval/unused-broken-const.stderr b/tests/ui/consts/const-eval/unused-broken-const.stderr
index fbb10feb7..fbb10feb7 100644
--- a/src/test/ui/consts/const-eval/unused-broken-const.stderr
+++ b/tests/ui/consts/const-eval/unused-broken-const.stderr
diff --git a/src/test/ui/consts/const-eval/unwind-abort.rs b/tests/ui/consts/const-eval/unwind-abort.rs
index 2b0e58166..2b0e58166 100644
--- a/src/test/ui/consts/const-eval/unwind-abort.rs
+++ b/tests/ui/consts/const-eval/unwind-abort.rs
diff --git a/src/test/ui/consts/const-eval/unwind-abort.stderr b/tests/ui/consts/const-eval/unwind-abort.stderr
index 759ce15ab..759ce15ab 100644
--- a/src/test/ui/consts/const-eval/unwind-abort.stderr
+++ b/tests/ui/consts/const-eval/unwind-abort.stderr
diff --git a/src/test/ui/consts/const-eval/valid-const.rs b/tests/ui/consts/const-eval/valid-const.rs
index 5f47d1c4f..5f47d1c4f 100644
--- a/src/test/ui/consts/const-eval/valid-const.rs
+++ b/tests/ui/consts/const-eval/valid-const.rs
diff --git a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr b/tests/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr
index 9710bf476..9710bf476 100644
--- a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr
+++ b/tests/ui/consts/const-eval/validate_uninhabited_zsts.32bit.stderr
diff --git a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr b/tests/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr
index 9710bf476..9710bf476 100644
--- a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr
+++ b/tests/ui/consts/const-eval/validate_uninhabited_zsts.64bit.stderr
diff --git a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.rs b/tests/ui/consts/const-eval/validate_uninhabited_zsts.rs
index c0b326215..c0b326215 100644
--- a/src/test/ui/consts/const-eval/validate_uninhabited_zsts.rs
+++ b/tests/ui/consts/const-eval/validate_uninhabited_zsts.rs
diff --git a/src/test/ui/consts/const-eval/write-to-uninhabited-enum-variant.rs b/tests/ui/consts/const-eval/write-to-uninhabited-enum-variant.rs
index cccb7879f..cccb7879f 100644
--- a/src/test/ui/consts/const-eval/write-to-uninhabited-enum-variant.rs
+++ b/tests/ui/consts/const-eval/write-to-uninhabited-enum-variant.rs
diff --git a/src/test/ui/consts/const-eval/zst_operand_eval.rs b/tests/ui/consts/const-eval/zst_operand_eval.rs
index 5f7ddf7f7..5f7ddf7f7 100644
--- a/src/test/ui/consts/const-eval/zst_operand_eval.rs
+++ b/tests/ui/consts/const-eval/zst_operand_eval.rs