about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-02-26 08:02:40 +0000
committerbors <bors@rust-lang.org>2024-02-26 08:02:40 +0000
commit7cadf0b2da0d83d5d38c8eddb033acf1508942e0 (patch)
tree0cc9d713cfbed1a362010c110d1ba7f421ec2f07 /tests
parent8d74063672a9b1eb283e685cd059187f86d9373d (diff)
parentdb0b49b945f56356ee495cd8b909545d566ef92e (diff)
downloadrust-7cadf0b2da0d83d5d38c8eddb033acf1508942e0.tar.gz
rust-7cadf0b2da0d83d5d38c8eddb033acf1508942e0.zip
Auto merge of #3326 - rust-lang:rustup-2024-02-26, r=RalfJung
Automatic Rustup

also fixes https://github.com/rust-lang/miri/issues/3308
Diffstat (limited to 'tests')
-rw-r--r--tests/codegen/array-equality.rs4
-rw-r--r--tests/codegen/enum/enum-debug-niche-2.rs17
-rw-r--r--tests/codegen/function-arguments.rs8
-rw-r--r--tests/codegen/intrinsics/transmute-niched.rs6
-rw-r--r--tests/codegen/issues/issue-119422.rs22
-rw-r--r--tests/codegen/loads.rs8
-rw-r--r--tests/codegen/option-as-slice.rs9
-rw-r--r--tests/codegen/option-nonzero-eq.rs8
-rw-r--r--tests/codegen/slice-ref-equality.rs8
-rw-r--r--tests/codegen/transmute-optimized.rs6
-rw-r--r--tests/debuginfo/msvc-pretty-enums.rs80
-rw-r--r--tests/debuginfo/numeric-types.rs28
-rw-r--r--tests/mir-opt/instsimplify/combine_transmutes.rs4
-rw-r--r--tests/rustdoc/auxiliary/issue-106421-force-unstable.rs9
-rw-r--r--tests/rustdoc/issue-106421-not-internal.rs8
-rw-r--r--tests/rustdoc/issue-106421.rs8
-rw-r--r--tests/rustdoc/type-layout.rs2
-rw-r--r--tests/ui/abi/compatibility.rs9
-rw-r--r--tests/ui/associated-type-bounds/implied-bounds-cycle.rs10
-rw-r--r--tests/ui/associated-type-bounds/implied-bounds-cycle.stderr17
-rw-r--r--tests/ui/async-await/async-assoc-fn-anon-lifetimes.rs2
-rw-r--r--tests/ui/cfg/cfg-target-abi.rs1
-rw-r--r--tests/ui/check-cfg/well-known-values.rs1
-rw-r--r--tests/ui/check-cfg/well-known-values.stderr56
-rw-r--r--tests/ui/const-generics/min_const_generics/macro.rs2
-rw-r--r--tests/ui/consts/const-eval/raw-bytes.32bit.stderr114
-rw-r--r--tests/ui/consts/const-eval/raw-bytes.64bit.stderr114
-rw-r--r--tests/ui/consts/const-eval/raw-bytes.rs9
-rw-r--r--tests/ui/consts/const-eval/ub-nonnull.rs10
-rw-r--r--tests/ui/consts/const-eval/ub-nonnull.stderr14
-rw-r--r--tests/ui/consts/const-eval/valid-const.rs9
-rw-r--r--tests/ui/consts/const_in_pattern/accept_structural.rs1
-rw-r--r--tests/ui/consts/const_in_pattern/issue-65466.rs7
-rw-r--r--tests/ui/consts/const_in_pattern/issue-65466.stderr21
-rw-r--r--tests/ui/consts/ice-48279.rs2
-rw-r--r--tests/ui/consts/tuple-struct-constructors.rs7
-rw-r--r--tests/ui/drop/dropck-eyepatch-reorder.rs1
-rw-r--r--tests/ui/drop/dropck-eyepatch.rs1
-rw-r--r--tests/ui/feature-gates/feature-gate-cfg-target-abi.rs13
-rw-r--r--tests/ui/feature-gates/feature-gate-cfg-target-abi.stderr43
-rw-r--r--tests/ui/imports/local-modularized-tricky-pass-2.rs1
-rw-r--r--tests/ui/intrinsics/panic-uninitialized-zeroed.rs12
-rw-r--r--tests/ui/issues/issue-31776.rs1
-rw-r--r--tests/ui/issues/issue-41053.rs2
-rw-r--r--tests/ui/issues/issue-64593.rs3
-rw-r--r--tests/ui/layout/unsafe-cell-hides-niche.rs28
-rw-r--r--tests/ui/layout/zero-sized-array-enum-niche.rs5
-rw-r--r--tests/ui/layout/zero-sized-array-enum-niche.stderr10
-rw-r--r--tests/ui/lint/auxiliary/non_local_macro.rs26
-rw-r--r--tests/ui/lint/clashing-extern-fn.rs33
-rw-r--r--tests/ui/lint/clashing-extern-fn.stderr50
-rw-r--r--tests/ui/lint/ice-array-into-iter-lint-issue-121532.rs11
-rw-r--r--tests/ui/lint/ice-array-into-iter-lint-issue-121532.stderr9
-rw-r--r--tests/ui/lint/ice-unions-known-panics-lint-issue-121534.rs21
-rw-r--r--tests/ui/lint/invalid_value.rs13
-rw-r--r--tests/ui/lint/invalid_value.stderr186
-rw-r--r--tests/ui/lint/lint-ctypes-enum.rs41
-rw-r--r--tests/ui/lint/lint-ctypes-enum.stderr44
-rw-r--r--tests/ui/lint/non_local_definitions.rs385
-rw-r--r--tests/ui/lint/non_local_definitions.stderr640
-rw-r--r--tests/ui/macros/type-macros-simple.rs2
-rw-r--r--tests/ui/match/issue-72896-non-partial-eq-const.rs4
-rw-r--r--tests/ui/match/issue-72896-non-partial-eq-const.stderr21
-rw-r--r--tests/ui/numbers-arithmetic/overflowing-neg-nonzero.rs6
-rw-r--r--tests/ui/packed/issue-46152.rs1
-rw-r--r--tests/ui/print_type_sizes/niche-filling.rs44
-rw-r--r--tests/ui/privacy/associated-item-privacy-trait.rs2
-rw-r--r--tests/ui/privacy/private-in-public-non-principal.rs1
-rw-r--r--tests/ui/privacy/private-in-public-non-principal.stderr8
-rw-r--r--tests/ui/proc-macro/nested-macro-rules.rs1
-rw-r--r--tests/ui/proc-macro/nested-macro-rules.stderr27
-rw-r--r--tests/ui/rust-2018/uniform-paths/issue-55779.rs2
-rw-r--r--tests/ui/structs-enums/enum-null-pointer-opt.rs5
-rw-r--r--tests/ui/structs-enums/enum-null-pointer-opt.stderr2
-rw-r--r--tests/ui/structs-enums/type-sizes.rs25
-rw-r--r--tests/ui/suggestions/core-std-import-order-issue-83564.rs7
-rw-r--r--tests/ui/suggestions/core-std-import-order-issue-83564.stderr12
-rw-r--r--tests/ui/traits/next-solver/specialization-transmute.rs7
-rw-r--r--tests/ui/traits/next-solver/specialization-transmute.stderr6
79 files changed, 1750 insertions, 653 deletions
diff --git a/tests/codegen/array-equality.rs b/tests/codegen/array-equality.rs
index 94354228886..5b85da1d4a0 100644
--- a/tests/codegen/array-equality.rs
+++ b/tests/codegen/array-equality.rs
@@ -1,7 +1,7 @@
 //@ compile-flags: -O -Z merge-functions=disabled
 //@ only-x86_64
-
 #![crate_type = "lib"]
+#![feature(generic_nonzero)]
 
 // CHECK-LABEL: @array_eq_value
 #[no_mangle]
@@ -63,7 +63,7 @@ pub fn array_eq_zero_short(x: [u16; 3]) -> bool {
 
 // CHECK-LABEL: @array_eq_none_short(i40
 #[no_mangle]
-pub fn array_eq_none_short(x: [Option<std::num::NonZeroU8>; 5]) -> bool {
+pub fn array_eq_none_short(x: [Option<std::num::NonZero<u8>>; 5]) -> bool {
     // CHECK-NEXT: start:
     // CHECK-NEXT: %[[EQ:.+]] = icmp eq i40 %0, 0
     // CHECK-NEXT: ret i1 %[[EQ]]
diff --git a/tests/codegen/enum/enum-debug-niche-2.rs b/tests/codegen/enum/enum-debug-niche-2.rs
index 4315741e0bd..25871885e7e 100644
--- a/tests/codegen/enum/enum-debug-niche-2.rs
+++ b/tests/codegen/enum/enum-debug-niche-2.rs
@@ -1,20 +1,17 @@
-// This tests that optimized enum debug info accurately reflects the enum layout.
-// This is ignored for the fallback mode on MSVC due to problems with PDB.
-
-//
-//@ ignore-msvc
-
+//! This tests that optimized enum debug info accurately reflects the enum layout.
+//! This is ignored for the fallback mode on MSVC due to problems with PDB.
+//!
 //@ compile-flags: -g -C no-prepopulate-passes
-
+//@ ignore-msvc
+//
 // CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_variant_part,{{.*}}size: 32,{{.*}}
 // CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "Placeholder",{{.*}}extraData: i128 4294967295{{[,)].*}}
 // CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "Error",{{.*}}extraData: i128 0{{[,)].*}}
-
-#![feature(never_type)]
+#![feature(generic_nonzero, never_type)]
 
 #[derive(Copy, Clone)]
 pub struct Entity {
-    private: std::num::NonZeroU32,
+    private: std::num::NonZero<u32>,
 }
 
 #[derive(Copy, Clone, PartialEq, Eq)]
diff --git a/tests/codegen/function-arguments.rs b/tests/codegen/function-arguments.rs
index 88cedcf46b6..b75c188f51a 100644
--- a/tests/codegen/function-arguments.rs
+++ b/tests/codegen/function-arguments.rs
@@ -1,10 +1,10 @@
 //@ compile-flags: -O -C no-prepopulate-passes
-
 #![crate_type = "lib"]
 #![feature(dyn_star)]
+#![feature(generic_nonzero)]
 
 use std::mem::MaybeUninit;
-use std::num::NonZeroU64;
+use std::num::NonZero;
 use std::marker::PhantomPinned;
 use std::ptr::NonNull;
 
@@ -70,13 +70,13 @@ pub fn int(x: u64) -> u64 {
 
 // CHECK: noundef i64 @nonzero_int(i64 noundef %x)
 #[no_mangle]
-pub fn nonzero_int(x: NonZeroU64) -> NonZeroU64 {
+pub fn nonzero_int(x: NonZero<u64>) -> NonZero<u64> {
   x
 }
 
 // CHECK: noundef i64 @option_nonzero_int(i64 noundef %x)
 #[no_mangle]
-pub fn option_nonzero_int(x: Option<NonZeroU64>) -> Option<NonZeroU64> {
+pub fn option_nonzero_int(x: Option<NonZero<u64>>) -> Option<NonZero<u64>> {
   x
 }
 
diff --git a/tests/codegen/intrinsics/transmute-niched.rs b/tests/codegen/intrinsics/transmute-niched.rs
index 7c448c82e4b..b5e0da1b2f5 100644
--- a/tests/codegen/intrinsics/transmute-niched.rs
+++ b/tests/codegen/intrinsics/transmute-niched.rs
@@ -2,11 +2,11 @@
 //@ [OPT] compile-flags: -C opt-level=3 -C no-prepopulate-passes
 //@ [DBG] compile-flags: -C opt-level=0 -C no-prepopulate-passes
 //@ only-64bit (so I don't need to worry about usize)
-
 #![crate_type = "lib"]
+#![feature(generic_nonzero)]
 
 use std::mem::transmute;
-use std::num::NonZeroU32;
+use std::num::NonZero;
 
 #[repr(u8)]
 pub enum SmallEnum {
@@ -130,7 +130,7 @@ pub unsafe fn check_enum_to_char(x: Minus100ToPlus100) -> char {
 
 // CHECK-LABEL: @check_swap_pair(
 #[no_mangle]
-pub unsafe fn check_swap_pair(x: (char, NonZeroU32)) -> (NonZeroU32, char) {
+pub unsafe fn check_swap_pair(x: (char, NonZero<u32>)) -> (NonZero<u32>, char) {
     // OPT: %0 = icmp ule i32 %x.0, 1114111
     // OPT: call void @llvm.assume(i1 %0)
     // OPT: %1 = icmp uge i32 %x.0, 1
diff --git a/tests/codegen/issues/issue-119422.rs b/tests/codegen/issues/issue-119422.rs
index 937fdcf28f5..19480b4dc9e 100644
--- a/tests/codegen/issues/issue-119422.rs
+++ b/tests/codegen/issues/issue-119422.rs
@@ -1,13 +1,13 @@
 //! This test checks that compiler don't generate useless compares to zeros
-//! for NonZero integer types.
-
+//! for `NonZero` integer types.
+//!
 //@ compile-flags: -O --edition=2021 -Zmerge-functions=disabled
 //@ only-64bit (because the LLVM type of i64 for usize shows up)
-
 #![crate_type = "lib"]
+#![feature(generic_nonzero)]
 
-use core::num::*;
 use core::ptr::NonNull;
+use core::num::NonZero;
 
 // CHECK-LABEL: @check_non_null
 #[no_mangle]
@@ -18,7 +18,7 @@ pub fn check_non_null(x: NonNull<u8>) -> bool {
 
 // CHECK-LABEL: @equals_zero_is_false_u8
 #[no_mangle]
-pub fn equals_zero_is_false_u8(x: NonZeroU8) -> bool {
+pub fn equals_zero_is_false_u8(x: NonZero<u8>) -> bool {
     // CHECK-NOT: br
     // CHECK: ret i1 false
     // CHECK-NOT: br
@@ -27,7 +27,7 @@ pub fn equals_zero_is_false_u8(x: NonZeroU8) -> bool {
 
 // CHECK-LABEL: @not_equals_zero_is_true_u8
 #[no_mangle]
-pub fn not_equals_zero_is_true_u8(x: NonZeroU8) -> bool {
+pub fn not_equals_zero_is_true_u8(x: NonZero<u8>) -> bool {
     // CHECK-NOT: br
     // CHECK: ret i1 true
     // CHECK-NOT: br
@@ -36,7 +36,7 @@ pub fn not_equals_zero_is_true_u8(x: NonZeroU8) -> bool {
 
 // CHECK-LABEL: @equals_zero_is_false_i8
 #[no_mangle]
-pub fn equals_zero_is_false_i8(x: NonZeroI8) -> bool {
+pub fn equals_zero_is_false_i8(x: NonZero<i8>) -> bool {
     // CHECK-NOT: br
     // CHECK: ret i1 false
     // CHECK-NOT: br
@@ -45,7 +45,7 @@ pub fn equals_zero_is_false_i8(x: NonZeroI8) -> bool {
 
 // CHECK-LABEL: @not_equals_zero_is_true_i8
 #[no_mangle]
-pub fn not_equals_zero_is_true_i8(x: NonZeroI8) -> bool {
+pub fn not_equals_zero_is_true_i8(x: NonZero<i8>) -> bool {
     // CHECK-NOT: br
     // CHECK: ret i1 true
     // CHECK-NOT: br
@@ -54,7 +54,7 @@ pub fn not_equals_zero_is_true_i8(x: NonZeroI8) -> bool {
 
 // CHECK-LABEL: @usize_try_from_u32
 #[no_mangle]
-pub fn usize_try_from_u32(x: NonZeroU32) -> NonZeroUsize {
+pub fn usize_try_from_u32(x: NonZero<u32>) -> NonZero<usize> {
     // CHECK-NOT: br
     // CHECK: zext i32 %{{.*}} to i64
     // CHECK-NOT: br
@@ -64,7 +64,7 @@ pub fn usize_try_from_u32(x: NonZeroU32) -> NonZeroUsize {
 
 // CHECK-LABEL: @isize_try_from_i32
 #[no_mangle]
-pub fn isize_try_from_i32(x: NonZeroI32) -> NonZeroIsize {
+pub fn isize_try_from_i32(x: NonZero<i32>) -> NonZero<isize> {
     // CHECK-NOT: br
     // CHECK: sext i32 %{{.*}} to i64
     // CHECK-NOT: br
@@ -74,7 +74,7 @@ pub fn isize_try_from_i32(x: NonZeroI32) -> NonZeroIsize {
 
 // CHECK-LABEL: @u64_from_nonzero_is_not_zero
 #[no_mangle]
-pub fn u64_from_nonzero_is_not_zero(x: NonZeroU64)->bool {
+pub fn u64_from_nonzero_is_not_zero(x: NonZero<u64>)->bool {
     // CHECK-NOT: br
     // CHECK: ret i1 false
     // CHECK-NOT: br
diff --git a/tests/codegen/loads.rs b/tests/codegen/loads.rs
index 0471d83c25a..b86b3dd3a19 100644
--- a/tests/codegen/loads.rs
+++ b/tests/codegen/loads.rs
@@ -1,9 +1,9 @@
 //@ compile-flags: -C no-prepopulate-passes -Zmir-opt-level=0
-
 #![crate_type = "lib"]
+#![feature(generic_nonzero)]
 
 use std::mem::MaybeUninit;
-use std::num::NonZeroU16;
+use std::num::NonZero;
 
 pub struct Bytes {
     a: u8,
@@ -99,14 +99,14 @@ pub fn load_int(x: &u16) -> u16 {
 
 // CHECK-LABEL: @load_nonzero_int
 #[no_mangle]
-pub fn load_nonzero_int(x: &NonZeroU16) -> NonZeroU16 {
+pub fn load_nonzero_int(x: &NonZero<u16>) -> NonZero<u16> {
     // CHECK: load i16, ptr %x, align 2, !range ![[NONZEROU16_RANGE:[0-9]+]], !noundef !{{[0-9]+}}
     *x
 }
 
 // CHECK-LABEL: @load_option_nonzero_int
 #[no_mangle]
-pub fn load_option_nonzero_int(x: &Option<NonZeroU16>) -> Option<NonZeroU16> {
+pub fn load_option_nonzero_int(x: &Option<NonZero<u16>>) -> Option<NonZero<u16>> {
     // CHECK: load i16, ptr %x, align 2, !noundef ![[NOUNDEF]]{{$}}
     *x
 }
diff --git a/tests/codegen/option-as-slice.rs b/tests/codegen/option-as-slice.rs
index 990ec1d1f66..14a39243607 100644
--- a/tests/codegen/option-as-slice.rs
+++ b/tests/codegen/option-as-slice.rs
@@ -1,14 +1,13 @@
 //@ compile-flags: -O -Z randomize-layout=no
 //@ only-x86_64
 //@ ignore-llvm-version: 16.0.0
-// ^ needs https://reviews.llvm.org/D146149 in 16.0.1
-
+//  ^-- needs https://reviews.llvm.org/D146149 in 16.0.1
 #![crate_type = "lib"]
-#![feature(option_as_slice)]
+#![feature(generic_nonzero)]
 
 extern crate core;
 
-use core::num::NonZeroU64;
+use core::num::NonZero;
 use core::option::Option;
 
 // CHECK-LABEL: @u64_opt_as_slice
@@ -23,7 +22,7 @@ pub fn u64_opt_as_slice(o: &Option<u64>) -> &[u64] {
 
 // CHECK-LABEL: @nonzero_u64_opt_as_slice
 #[no_mangle]
-pub fn nonzero_u64_opt_as_slice(o: &Option<NonZeroU64>) -> &[NonZeroU64] {
+pub fn nonzero_u64_opt_as_slice(o: &Option<NonZero<u64>>) -> &[NonZero<u64>] {
     // CHECK-NOT: select
     // CHECK-NOT: br
     // CHECK-NOT: switch
diff --git a/tests/codegen/option-nonzero-eq.rs b/tests/codegen/option-nonzero-eq.rs
index f6be90a5dde..f637b1aef97 100644
--- a/tests/codegen/option-nonzero-eq.rs
+++ b/tests/codegen/option-nonzero-eq.rs
@@ -1,18 +1,18 @@
 //@ compile-flags: -O -Zmerge-functions=disabled
-
 #![crate_type = "lib"]
+#![feature(generic_nonzero)]
 
 extern crate core;
 use core::cmp::Ordering;
-use core::num::{NonZeroU32, NonZeroI64};
 use core::ptr::NonNull;
+use core::num::NonZero;
 
 // See also tests/assembly/option-nonzero-eq.rs, for cases with `assume`s in the
 // LLVM and thus don't optimize down clearly here, but do in assembly.
 
 // CHECK-lABEL: @non_zero_eq
 #[no_mangle]
-pub fn non_zero_eq(l: Option<NonZeroU32>, r: Option<NonZeroU32>) -> bool {
+pub fn non_zero_eq(l: Option<NonZero<u32>>, r: Option<NonZero<u32>>) -> bool {
     // CHECK: start:
     // CHECK-NEXT: icmp eq i32
     // CHECK-NEXT: ret i1
@@ -21,7 +21,7 @@ pub fn non_zero_eq(l: Option<NonZeroU32>, r: Option<NonZeroU32>) -> bool {
 
 // CHECK-lABEL: @non_zero_signed_eq
 #[no_mangle]
-pub fn non_zero_signed_eq(l: Option<NonZeroI64>, r: Option<NonZeroI64>) -> bool {
+pub fn non_zero_signed_eq(l: Option<NonZero<i64>>, r: Option<NonZero<i64>>) -> bool {
     // CHECK: start:
     // CHECK-NEXT: icmp eq i64
     // CHECK-NEXT: ret i1
diff --git a/tests/codegen/slice-ref-equality.rs b/tests/codegen/slice-ref-equality.rs
index 371e685ec6c..85d9c34a30b 100644
--- a/tests/codegen/slice-ref-equality.rs
+++ b/tests/codegen/slice-ref-equality.rs
@@ -1,8 +1,8 @@
 //@ compile-flags: -O -Zmerge-functions=disabled
-
 #![crate_type = "lib"]
+#![feature(generic_nonzero)]
 
-use std::num::{NonZeroI16, NonZeroU32};
+use std::num::NonZero;
 
 // #71602 reported a simple array comparison just generating a loop.
 // This was originally fixed by ensuring it generates a single bcmp,
@@ -70,7 +70,7 @@ fn eq_slice_of_i32(x: &[i32], y: &[i32]) -> bool {
 // CHECK-SAME: [[USIZE:i16|i32|i64]] noundef %1
 // CHECK-SAME: [[USIZE]] noundef %3
 #[no_mangle]
-fn eq_slice_of_nonzero(x: &[NonZeroU32], y: &[NonZeroU32]) -> bool {
+fn eq_slice_of_nonzero(x: &[NonZero<i32>], y: &[NonZero<i32>]) -> bool {
     // CHECK: icmp eq [[USIZE]] %1, %3
     // CHECK: %[[BYTES:.+]] = shl nsw [[USIZE]] %1, 2
     // CHECK: tail call{{( noundef)?}} i32 @{{bcmp|memcmp}}(ptr
@@ -82,7 +82,7 @@ fn eq_slice_of_nonzero(x: &[NonZeroU32], y: &[NonZeroU32]) -> bool {
 // CHECK-SAME: [[USIZE:i16|i32|i64]] noundef %1
 // CHECK-SAME: [[USIZE]] noundef %3
 #[no_mangle]
-fn eq_slice_of_option_of_nonzero(x: &[Option<NonZeroI16>], y: &[Option<NonZeroI16>]) -> bool {
+fn eq_slice_of_option_of_nonzero(x: &[Option<NonZero<i16>>], y: &[Option<NonZero<i16>>]) -> bool {
     // CHECK: icmp eq [[USIZE]] %1, %3
     // CHECK: %[[BYTES:.+]] = shl nsw [[USIZE]] %1, 1
     // CHECK: tail call{{( noundef)?}} i32 @{{bcmp|memcmp}}(ptr
diff --git a/tests/codegen/transmute-optimized.rs b/tests/codegen/transmute-optimized.rs
index 9217def76b5..1a5f53e625a 100644
--- a/tests/codegen/transmute-optimized.rs
+++ b/tests/codegen/transmute-optimized.rs
@@ -1,6 +1,6 @@
 //@ compile-flags: -O -Z merge-functions=disabled
-
 #![crate_type = "lib"]
+#![feature(generic_nonzero)]
 
 // This tests that LLVM can optimize based on the niches in the source or
 // destination types for transmutes.
@@ -33,7 +33,7 @@ pub fn non_null_is_null(x: std::ptr::NonNull<i32>) -> bool {
 
 // CHECK-LABEL: i1 @non_zero_is_null(
 #[no_mangle]
-pub fn non_zero_is_null(x: std::num::NonZeroUsize) -> bool {
+pub fn non_zero_is_null(x: std::num::NonZero<usize>) -> bool {
     // CHECK: ret i1 false
     let p: *const i32 = unsafe { std::mem::transmute(x) };
     p.is_null()
@@ -72,7 +72,7 @@ pub fn normal_div(a: u32, b: u32) -> u32 {
 
 // CHECK-LABEL: i32 @div_transmute_nonzero(i32
 #[no_mangle]
-pub fn div_transmute_nonzero(a: u32, b: std::num::NonZeroI32) -> u32 {
+pub fn div_transmute_nonzero(a: u32, b: std::num::NonZero<i32>) -> u32 {
     // CHECK-NOT: call core::panicking::panic
     // CHECK: %[[R:.+]] = udiv i32 %a, %b
     // CHECK-NEXT: ret i32 %[[R]]
diff --git a/tests/debuginfo/msvc-pretty-enums.rs b/tests/debuginfo/msvc-pretty-enums.rs
index c6dd9f7939d..cfac14a22c4 100644
--- a/tests/debuginfo/msvc-pretty-enums.rs
+++ b/tests/debuginfo/msvc-pretty-enums.rs
@@ -1,143 +1,143 @@
 //@ only-cdb
 //@ compile-flags:-g
-
+//
 // cdb-command: g
-
+//
 // cdb-command: dx a
 // cdb-check:a                : Some [Type: enum2$<core::option::Option<msvc_pretty_enums::CStyleEnum> >]
 // cdb-check:    [+0x000] __0              : Low (0x2) [Type: msvc_pretty_enums::CStyleEnum]
-
+//
 // cdb-command: dx b
 // cdb-check:b                : None [Type: enum2$<core::option::Option<msvc_pretty_enums::CStyleEnum> >]
-
+//
 // cdb-command: dx c
 // cdb-check:c                : Tag1 [Type: enum2$<msvc_pretty_enums::NicheLayoutEnum>]
-
+//
 // cdb-command: dx d
 // cdb-check:d                : Data [Type: enum2$<msvc_pretty_enums::NicheLayoutEnum>]
 // cdb-check:    [+0x000] my_data          : High (0x10) [Type: msvc_pretty_enums::CStyleEnum]
-
+//
 // cdb-command: dx e
 // cdb-check:e                : Tag2 [Type: enum2$<msvc_pretty_enums::NicheLayoutEnum>]
-
+//
 // cdb-command: dx f
 // cdb-check:f                : Some [Type: enum2$<core::option::Option<ref$<u32> > >]
 // cdb-check:    [+0x000] __0              : 0x[...] : 0x1 [Type: unsigned int *]
-
+//
 // cdb-command: dx g
 // cdb-check:g                : None [Type: enum2$<core::option::Option<ref$<u32> > >]
-
+//
 // cdb-command: dx h
 // cdb-check:h                : Some [Type: enum2$<core::option::Option<u32> >]
 // cdb-check:    [+0x004] __0              : 0xc [Type: unsigned int]
-
+//
 // cdb-command: dx i
 // cdb-check:i                : None [Type: enum2$<core::option::Option<u32> >]
-
+//
 // cdb-command: dx j
 // cdb-check:j                : High (0x10) [Type: msvc_pretty_enums::CStyleEnum]
-
+//
 // cdb-command: dx k
 // cdb-check:k                : Some [Type: enum2$<core::option::Option<alloc::string::String> >]
 // cdb-check:    [+0x000] __0              : "IAMA optional string!" [Type: alloc::string::String]
-
+//
 // cdb-command: dx l
 // cdb-check:l                : Ok [Type: enum2$<core::result::Result<u32,enum2$<msvc_pretty_enums::Empty> > >]
 // cdb-check:    [+0x000] __0              : 0x2a [Type: unsigned int]
-
+//
 // cdb-command: dx niche128_some
 // cdb-check: niche128_some    : Some [Type: enum2$<core::option::Option<core::num::nonzero::NonZero<i128> > >]
 // Note: we can't actually read the value of the field because CDB cannot handle 128 bit integers.
 // cdb-check:    [+0x000] __0 [...] [Type: core::num::nonzero::NonZero<i128>]
-
+//
 // cdb-command: dx niche128_none
 // cdb-check: niche128_none    : None [Type: enum2$<core::option::Option<core::num::nonzero::NonZero<i128> > >]
-
+//
 // cdb-command: dx wrapping_niche128_untagged
 // cdb-check: wrapping_niche128_untagged : X [Type: enum2$<msvc_pretty_enums::Wrapping128Niche>]
 // cdb-check:    [+0x[...]] __0              [Type: msvc_pretty_enums::Wrapping128]
-
+//
 // cdb-command: dx wrapping_niche128_none1
 // cdb-check: wrapping_niche128_none1 : Y [Type: enum2$<msvc_pretty_enums::Wrapping128Niche>]
 // cdb-check:    [+0x[...]] __0              [Type: msvc_pretty_enums::Wrapping128]
-
+//
 // cdb-command: dx wrapping_niche128_none2
 // cdb-check: wrapping_niche128_none2 : Z [Type: enum2$<msvc_pretty_enums::Wrapping128Niche>]
 // cdb-check:    [+0x[...]] __0              [Type: msvc_pretty_enums::Wrapping128]
-
+//
 // cdb-command: dx direct_tag_128_a,d
 // cdb-check: direct_tag_128_a,d : A [Type: enum2$<msvc_pretty_enums::DirectTag128>]
 // cdb-check:     [+0x[...]] __0              : 42 [Type: unsigned int]
-
+//
 // cdb-command: dx direct_tag_128_b,d
 // cdb-check: direct_tag_128_b,d : B [Type: enum2$<msvc_pretty_enums::DirectTag128>]
 // cdb-check:     [+0x[...]] __0              : 137 [Type: unsigned int]
-
+//
 // cdb-command: dx niche_w_fields_1_some,d
 // cdb-check: niche_w_fields_1_some,d : A [Type: enum2$<msvc_pretty_enums::NicheLayoutWithFields1>]
 // cdb-check:     [+0x[...]] __0              : 0x[...] : 77 [Type: unsigned char *]
 // cdb-check:     [+0x[...]] __1              : 7 [Type: unsigned int]
-
+//
 // cdb-command: dx niche_w_fields_1_none,d
 // cdb-check: niche_w_fields_1_none,d : B [Type: enum2$<msvc_pretty_enums::NicheLayoutWithFields1>]
 // cdb-check:     [+0x[...]] __0              : 99 [Type: unsigned int]
-
+//
 // cdb-command: dx niche_w_fields_2_some,d
 // cdb-check: niche_w_fields_2_some,d : A [Type: enum2$<msvc_pretty_enums::NicheLayoutWithFields2>]
 // cdb-check:     [+0x[...]] __0              : 800 [Type: core::num::nonzero::NonZero<u32>]
 // cdb-check:     [+0x[...]] __1              : 900 [Type: unsigned __int64]
-
+//
 // cdb-command: dx niche_w_fields_2_none,d
 // cdb-check: niche_w_fields_2_none,d : B [Type: enum2$<msvc_pretty_enums::NicheLayoutWithFields2>]
 // cdb-check:     [+0x[...]] __0              : 1000 [Type: unsigned __int64]
-
+//
 // cdb-command: dx niche_w_fields_3_some,d
 // cdb-check: niche_w_fields_3_some,d : A [Type: enum2$<msvc_pretty_enums::NicheLayoutWithFields3>]
 // cdb-check:     [+0x[...]] __0              : 137 [Type: unsigned char]
 // cdb-check:     [+0x[...]] __1              : true [Type: bool]
-
+//
 // cdb-command: dx niche_w_fields_3_niche1,d
 // cdb-check: niche_w_fields_3_niche1,d : B [Type: enum2$<msvc_pretty_enums::NicheLayoutWithFields3>]
 // cdb-check:     [+0x[...]] __0              : 12 [Type: unsigned char]
-
+//
 // cdb-command: dx niche_w_fields_3_niche2,d
 // cdb-check: niche_w_fields_3_niche2,d : C [Type: enum2$<msvc_pretty_enums::NicheLayoutWithFields3>]
 // cdb-check:     [+0x[...]] __0              : false [Type: bool]
-
+//
 // cdb-command: dx niche_w_fields_3_niche3,d
 // cdb-check: niche_w_fields_3_niche3,d : D [Type: enum2$<msvc_pretty_enums::NicheLayoutWithFields3>]
 // cdb-check:     [+0x[...]] __0              : 34 [Type: unsigned char]
-
+//
 // cdb-command: dx niche_w_fields_3_niche4,d
 // cdb-check: niche_w_fields_3_niche4,d : E [Type: enum2$<msvc_pretty_enums::NicheLayoutWithFields3>]
 // cdb-check:     [+0x[...]] __0              : 56 [Type: unsigned char]
-
+//
 // cdb-command: dx niche_w_fields_3_niche5,d
 // cdb-check: niche_w_fields_3_niche5,d : F [Type: enum2$<msvc_pretty_enums::NicheLayoutWithFields3>]
-
+//
 // cdb-command: dx -r3 niche_w_fields_std_result_ok,d
 // cdb-check: niche_w_fields_std_result_ok,d : Ok [Type: enum2$<core::result::Result<alloc::boxed::Box<slice2$<u8>,alloc::alloc::Global>,u64> >]
 // cdb-check:    [+0x[...]] __0              [Type: alloc::boxed::Box<slice2$<u8>,alloc::alloc::Global>]
 // cdb-check:        [+0x[...]] data_ptr         : [...]
 // cdb-check:        [+0x[...]] length           : 3 [...]
-
+//
 // cdb-command: dx -r3 niche_w_fields_std_result_err,d
 // cdb-check: niche_w_fields_std_result_err,d : Err [Type: enum2$<core::result::Result<alloc::boxed::Box<slice2$<u8>,alloc::alloc::Global>,u64> >]
 // cdb-check:    [+0x[...]] __0              : 789 [Type: unsigned __int64]
-
+//
 // cdb-command: dx -r2 arbitrary_discr1,d
 // cdb-check: arbitrary_discr1,d : Abc [Type: enum2$<msvc_pretty_enums::ArbitraryDiscr>]
 // cdb-check:     [+0x[...]] __0              : 1234 [Type: unsigned int]
-
+//
 // cdb-command: dx -r2 arbitrary_discr2,d
 // cdb-check: arbitrary_discr2,d : Def [Type: enum2$<msvc_pretty_enums::ArbitraryDiscr>]
 // cdb-check:     [+0x[...]] __0              : 5678 [Type: unsigned int]
-
+#![feature(generic_nonzero)]
 #![feature(rustc_attrs)]
 #![feature(repr128)]
 #![feature(arbitrary_enum_discriminant)]
 
-use std::num::{NonZeroI128, NonZeroU32};
+use std::num::NonZero;
 
 pub enum CStyleEnum {
     Low = 2,
@@ -160,7 +160,7 @@ enum NicheLayoutWithFields1<'a> {
 }
 
 enum NicheLayoutWithFields2 {
-    A(NonZeroU32, u64),
+    A(NonZero<u32>, u64),
     B(u64),
 }
 
@@ -210,8 +210,8 @@ fn main() {
     let j = CStyleEnum::High;
     let k = Some("IAMA optional string!".to_string());
     let l = Result::<u32, Empty>::Ok(42);
-    let niche128_some = Some(NonZeroI128::new(123456).unwrap());
-    let niche128_none: Option<NonZeroI128> = None;
+    let niche128_some = NonZero::new(123456i128);
+    let niche128_none: Option<NonZero<i128>> = None;
 
     let wrapping_niche128_untagged =
         unsafe { Wrapping128Niche::X(Wrapping128(340282366920938463463374607431768211454)) };
@@ -224,7 +224,7 @@ fn main() {
     let niche_w_fields_1_some = NicheLayoutWithFields1::A(&77, 7);
     let niche_w_fields_1_none = NicheLayoutWithFields1::B(99);
 
-    let niche_w_fields_2_some = NicheLayoutWithFields2::A(NonZeroU32::new(800).unwrap(), 900);
+    let niche_w_fields_2_some = NicheLayoutWithFields2::A(NonZero::new(800).unwrap(), 900);
     let niche_w_fields_2_none = NicheLayoutWithFields2::B(1000);
 
     let niche_w_fields_3_some = NicheLayoutWithFields3::A(137, true);
diff --git a/tests/debuginfo/numeric-types.rs b/tests/debuginfo/numeric-types.rs
index e3df1fbc520..74c9e5e1dc3 100644
--- a/tests/debuginfo/numeric-types.rs
+++ b/tests/debuginfo/numeric-types.rs
@@ -237,25 +237,25 @@
 
 // lldb-command:print nz_usize
 // lldb-check:[...]$11 = 122 { __0 = 122 }
-
+#![feature(generic_nonzero)]
 
 use std::num::*;
 use std::sync::atomic::*;
 
 fn main() {
-    let nz_i8 = NonZeroI8::new(11).unwrap();
-    let nz_i16 = NonZeroI16::new(22).unwrap();
-    let nz_i32 = NonZeroI32::new(33).unwrap();
-    let nz_i64 = NonZeroI64::new(44).unwrap();
-    let nz_i128 = NonZeroI128::new(55).unwrap();
-    let nz_isize = NonZeroIsize::new(66).unwrap();
-
-    let nz_u8 = NonZeroU8::new(77).unwrap();
-    let nz_u16 = NonZeroU16::new(88).unwrap();
-    let nz_u32 = NonZeroU32::new(99).unwrap();
-    let nz_u64 = NonZeroU64::new(100).unwrap();
-    let nz_u128 = NonZeroU128::new(111).unwrap();
-    let nz_usize = NonZeroUsize::new(122).unwrap();
+    let nz_i8 = NonZero::new(11i8).unwrap();
+    let nz_i16 = NonZero::new(22i16).unwrap();
+    let nz_i32 = NonZero::new(33i32).unwrap();
+    let nz_i64 = NonZero::new(44i64).unwrap();
+    let nz_i128 = NonZero::new(55i128).unwrap();
+    let nz_isize = NonZero::new(66isize).unwrap();
+
+    let nz_u8 = NonZero::new(77u8).unwrap();
+    let nz_u16 = NonZero::new(88u16).unwrap();
+    let nz_u32 = NonZero::new(99u32).unwrap();
+    let nz_u64 = NonZero::new(100u64).unwrap();
+    let nz_u128 = NonZero::new(111u128).unwrap();
+    let nz_usize = NonZero::new(122usize).unwrap();
 
     let w_i8 = Wrapping(10i8);
     let w_i16 = Wrapping(20i16);
diff --git a/tests/mir-opt/instsimplify/combine_transmutes.rs b/tests/mir-opt/instsimplify/combine_transmutes.rs
index 7f45ebf2c86..3707ee17690 100644
--- a/tests/mir-opt/instsimplify/combine_transmutes.rs
+++ b/tests/mir-opt/instsimplify/combine_transmutes.rs
@@ -1,9 +1,9 @@
 //@ unit-test: InstSimplify
 //@ compile-flags: -C panic=abort
-
 #![crate_type = "lib"]
 #![feature(core_intrinsics)]
 #![feature(custom_mir)]
+#![feature(generic_nonzero)]
 
 use std::intrinsics::mir::*;
 use std::mem::{MaybeUninit, ManuallyDrop, transmute};
@@ -54,7 +54,7 @@ pub unsafe fn adt_transmutes() {
     // CHECK: as i32 (Transmute);
     // CHECK: ({{_.*}}.1: std::mem::ManuallyDrop<std::string::String>);
 
-    let _a: u8 = transmute(Some(std::num::NonZeroU8::MAX));
+    let _a: u8 = transmute(Some(std::num::NonZero::<u8>::MAX));
     let _a: i16 = transmute(std::num::Wrapping(0_i16));
     let _a: u16 = transmute(std::num::Wrapping(0_i16));
     let _a: u32 = transmute(Union32 { i32: 0 });
diff --git a/tests/rustdoc/auxiliary/issue-106421-force-unstable.rs b/tests/rustdoc/auxiliary/issue-106421-force-unstable.rs
new file mode 100644
index 00000000000..589d44c1f77
--- /dev/null
+++ b/tests/rustdoc/auxiliary/issue-106421-force-unstable.rs
@@ -0,0 +1,9 @@
+//@ compile-flags: -Zforce-unstable-if-unmarked
+#![crate_name="foo"]
+pub struct FatalError;
+
+impl FatalError {
+    pub fn raise(self) -> ! {
+        loop {}
+    }
+}
diff --git a/tests/rustdoc/issue-106421-not-internal.rs b/tests/rustdoc/issue-106421-not-internal.rs
new file mode 100644
index 00000000000..1d744fba53f
--- /dev/null
+++ b/tests/rustdoc/issue-106421-not-internal.rs
@@ -0,0 +1,8 @@
+//@ aux-build:issue-106421-force-unstable.rs
+//@ ignore-cross-compile
+// This is the version where a non-compiler-internal crate inlines a compiler-internal one.
+// In this case, the item shouldn't be documented, because regular users can't get at it.
+extern crate foo;
+
+// @!has issue_106421_not_internal/struct.FatalError.html '//*[@id="method.raise"]' 'fn raise'
+pub use foo::FatalError;
diff --git a/tests/rustdoc/issue-106421.rs b/tests/rustdoc/issue-106421.rs
new file mode 100644
index 00000000000..d4141a4ab0c
--- /dev/null
+++ b/tests/rustdoc/issue-106421.rs
@@ -0,0 +1,8 @@
+//@ aux-build:issue-106421-force-unstable.rs
+//@ ignore-cross-compile
+//@ compile-flags: -Zforce-unstable-if-unmarked
+
+extern crate foo;
+
+// @has issue_106421/struct.FatalError.html '//*[@id="method.raise"]' 'fn raise'
+pub use foo::FatalError;
diff --git a/tests/rustdoc/type-layout.rs b/tests/rustdoc/type-layout.rs
index 05f8e4dc9e9..b2ff4add63e 100644
--- a/tests/rustdoc/type-layout.rs
+++ b/tests/rustdoc/type-layout.rs
@@ -81,7 +81,7 @@ pub enum Variants {
 // @hasraw - '<code>Some</code>: 4 bytes'
 pub enum WithNiche {
     None,
-    Some(std::num::NonZeroU32),
+    Some(std::num::NonZero<u32>),
 }
 
 // @hasraw type_layout/enum.Uninhabited.html 'Size: '
diff --git a/tests/ui/abi/compatibility.rs b/tests/ui/abi/compatibility.rs
index 911438e0d54..fcf31aa970c 100644
--- a/tests/ui/abi/compatibility.rs
+++ b/tests/ui/abi/compatibility.rs
@@ -64,6 +64,7 @@
   [csky] needs-llvm-components: csky
 */
 #![feature(rustc_attrs, unsized_fn_params, transparent_unions)]
+#![cfg_attr(host, feature(generic_nonzero))]
 #![cfg_attr(not(host), feature(no_core, lang_items), no_std, no_core)]
 #![allow(unused, improper_ctypes_definitions, internal_features)]
 
@@ -74,7 +75,7 @@
 
 #[cfg(host)]
 use std::{
-    any::Any, marker::PhantomData, mem::ManuallyDrop, num::NonZeroI32, ptr::NonNull, rc::Rc,
+    any::Any, marker::PhantomData, mem::ManuallyDrop, num::NonZero, ptr::NonNull, rc::Rc,
     sync::Arc,
 };
 
@@ -145,7 +146,7 @@ mod prelude {
     #[repr(transparent)]
     #[rustc_layout_scalar_valid_range_start(1)]
     #[rustc_nonnull_optimization_guaranteed]
-    pub struct NonZeroI32(i32);
+    pub struct NonZero<T>(T);
 
     // This just stands in for a non-trivial type.
     pub struct Vec<T> {
@@ -274,7 +275,7 @@ test_abi_compatible!(isize_int, isize, i64);
 test_abi_compatible!(zst_unit, Zst, ());
 #[cfg(not(any(target_arch = "sparc64")))]
 test_abi_compatible!(zst_array, Zst, [u8; 0]);
-test_abi_compatible!(nonzero_int, NonZeroI32, i32);
+test_abi_compatible!(nonzero_int, NonZero<i32>, i32);
 
 // `DispatchFromDyn` relies on ABI compatibility.
 // This is interesting since these types are not `repr(transparent)`. So this is not part of our
@@ -381,6 +382,6 @@ test_nonnull!(mut_unsized, &mut [i32]);
 test_nonnull!(fn_, fn());
 test_nonnull!(nonnull, NonNull<i32>);
 test_nonnull!(nonnull_unsized, NonNull<dyn Any>);
-test_nonnull!(non_zero, NonZeroI32);
+test_nonnull!(non_zero, NonZero<i32>);
 
 fn main() {}
diff --git a/tests/ui/associated-type-bounds/implied-bounds-cycle.rs b/tests/ui/associated-type-bounds/implied-bounds-cycle.rs
new file mode 100644
index 00000000000..785d47d4791
--- /dev/null
+++ b/tests/ui/associated-type-bounds/implied-bounds-cycle.rs
@@ -0,0 +1,10 @@
+#![feature(associated_type_bounds)]
+
+trait A {
+    type T;
+}
+
+trait B: A<T: B> {}
+//~^ ERROR cycle detected when computing the implied predicates of `B`
+
+fn main() {}
diff --git a/tests/ui/associated-type-bounds/implied-bounds-cycle.stderr b/tests/ui/associated-type-bounds/implied-bounds-cycle.stderr
new file mode 100644
index 00000000000..1c1c64ea5f5
--- /dev/null
+++ b/tests/ui/associated-type-bounds/implied-bounds-cycle.stderr
@@ -0,0 +1,17 @@
+error[E0391]: cycle detected when computing the implied predicates of `B`
+  --> $DIR/implied-bounds-cycle.rs:7:15
+   |
+LL | trait B: A<T: B> {}
+   |               ^
+   |
+   = note: ...which immediately requires computing the implied predicates of `B` again
+note: cycle used when computing normalized predicates of `B`
+  --> $DIR/implied-bounds-cycle.rs:7:1
+   |
+LL | trait B: A<T: B> {}
+   | ^^^^^^^^^^^^^^^^
+   = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0391`.
diff --git a/tests/ui/async-await/async-assoc-fn-anon-lifetimes.rs b/tests/ui/async-await/async-assoc-fn-anon-lifetimes.rs
index 28705bfc0c8..1a2aae8fb23 100644
--- a/tests/ui/async-await/async-assoc-fn-anon-lifetimes.rs
+++ b/tests/ui/async-await/async-assoc-fn-anon-lifetimes.rs
@@ -5,6 +5,8 @@
 
 //@ edition:2018
 
+#![allow(non_local_definitions)]
+
 struct A<'a, 'b>(&'a &'b i32);
 struct B<'a>(&'a i32);
 
diff --git a/tests/ui/cfg/cfg-target-abi.rs b/tests/ui/cfg/cfg-target-abi.rs
index 5d13337c1c3..306ae077325 100644
--- a/tests/ui/cfg/cfg-target-abi.rs
+++ b/tests/ui/cfg/cfg-target-abi.rs
@@ -1,5 +1,4 @@
 //@ run-pass
-#![feature(cfg_target_abi)]
 
 #[cfg(target_abi = "eabihf")]
 pub fn main() {
diff --git a/tests/ui/check-cfg/well-known-values.rs b/tests/ui/check-cfg/well-known-values.rs
index 0c55e35a993..859a36c604c 100644
--- a/tests/ui/check-cfg/well-known-values.rs
+++ b/tests/ui/check-cfg/well-known-values.rs
@@ -10,7 +10,6 @@
 #![feature(cfg_overflow_checks)]
 #![feature(cfg_relocation_model)]
 #![feature(cfg_sanitize)]
-#![feature(cfg_target_abi)]
 #![feature(cfg_target_has_atomic)]
 #![feature(cfg_target_has_atomic_equal_alignment)]
 #![feature(cfg_target_thread_local)]
diff --git a/tests/ui/check-cfg/well-known-values.stderr b/tests/ui/check-cfg/well-known-values.stderr
index 6535cd9a1a1..5f52421fef5 100644
--- a/tests/ui/check-cfg/well-known-values.stderr
+++ b/tests/ui/check-cfg/well-known-values.stderr
@@ -1,5 +1,5 @@
 warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
-  --> $DIR/well-known-values.rs:26:5
+  --> $DIR/well-known-values.rs:25:5
    |
 LL |     clippy = "_UNEXPECTED_VALUE",
    |     ^^^^^^----------------------
@@ -11,7 +11,7 @@ LL |     clippy = "_UNEXPECTED_VALUE",
    = note: `#[warn(unexpected_cfgs)]` on by default
 
 warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
-  --> $DIR/well-known-values.rs:28:5
+  --> $DIR/well-known-values.rs:27:5
    |
 LL |     debug_assertions = "_UNEXPECTED_VALUE",
    |     ^^^^^^^^^^^^^^^^----------------------
@@ -22,7 +22,7 @@ LL |     debug_assertions = "_UNEXPECTED_VALUE",
    = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
 
 warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
-  --> $DIR/well-known-values.rs:30:5
+  --> $DIR/well-known-values.rs:29:5
    |
 LL |     doc = "_UNEXPECTED_VALUE",
    |     ^^^----------------------
@@ -33,7 +33,7 @@ LL |     doc = "_UNEXPECTED_VALUE",
    = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
 
 warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
-  --> $DIR/well-known-values.rs:32:5
+  --> $DIR/well-known-values.rs:31:5
    |
 LL |     doctest = "_UNEXPECTED_VALUE",
    |     ^^^^^^^----------------------
@@ -44,7 +44,7 @@ LL |     doctest = "_UNEXPECTED_VALUE",
    = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
 
 warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
-  --> $DIR/well-known-values.rs:34:5
+  --> $DIR/well-known-values.rs:33:5
    |
 LL |     miri = "_UNEXPECTED_VALUE",
    |     ^^^^----------------------
@@ -55,7 +55,7 @@ LL |     miri = "_UNEXPECTED_VALUE",
    = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
 
 warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
-  --> $DIR/well-known-values.rs:36:5
+  --> $DIR/well-known-values.rs:35:5
    |
 LL |     overflow_checks = "_UNEXPECTED_VALUE",
    |     ^^^^^^^^^^^^^^^----------------------
@@ -66,7 +66,7 @@ LL |     overflow_checks = "_UNEXPECTED_VALUE",
    = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
 
 warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
-  --> $DIR/well-known-values.rs:38:5
+  --> $DIR/well-known-values.rs:37:5
    |
 LL |     panic = "_UNEXPECTED_VALUE",
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -75,7 +75,7 @@ LL |     panic = "_UNEXPECTED_VALUE",
    = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
 
 warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
-  --> $DIR/well-known-values.rs:40:5
+  --> $DIR/well-known-values.rs:39:5
    |
 LL |     proc_macro = "_UNEXPECTED_VALUE",
    |     ^^^^^^^^^^----------------------
@@ -86,7 +86,7 @@ LL |     proc_macro = "_UNEXPECTED_VALUE",
    = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
 
 warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
-  --> $DIR/well-known-values.rs:42:5
+  --> $DIR/well-known-values.rs:41:5
    |
 LL |     relocation_model = "_UNEXPECTED_VALUE",
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -95,7 +95,7 @@ LL |     relocation_model = "_UNEXPECTED_VALUE",
    = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
 
 warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
-  --> $DIR/well-known-values.rs:44:5
+  --> $DIR/well-known-values.rs:43:5
    |
 LL |     sanitize = "_UNEXPECTED_VALUE",
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -104,7 +104,7 @@ LL |     sanitize = "_UNEXPECTED_VALUE",
    = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
 
 warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
-  --> $DIR/well-known-values.rs:46:5
+  --> $DIR/well-known-values.rs:45:5
    |
 LL |     target_abi = "_UNEXPECTED_VALUE",
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -113,7 +113,7 @@ LL |     target_abi = "_UNEXPECTED_VALUE",
    = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
 
 warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
-  --> $DIR/well-known-values.rs:48:5
+  --> $DIR/well-known-values.rs:47:5
    |
 LL |     target_arch = "_UNEXPECTED_VALUE",
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -122,7 +122,7 @@ LL |     target_arch = "_UNEXPECTED_VALUE",
    = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
 
 warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
-  --> $DIR/well-known-values.rs:50:5
+  --> $DIR/well-known-values.rs:49:5
    |
 LL |     target_endian = "_UNEXPECTED_VALUE",
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -131,16 +131,16 @@ LL |     target_endian = "_UNEXPECTED_VALUE",
    = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
 
 warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
-  --> $DIR/well-known-values.rs:52:5
+  --> $DIR/well-known-values.rs:51:5
    |
 LL |     target_env = "_UNEXPECTED_VALUE",
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
-   = note: expected values for `target_env` are: ``, `eabihf`, `gnu`, `gnueabihf`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `psx`, `relibc`, `sgx`, `uclibc`
+   = note: expected values for `target_env` are: ``, `gnu`, `msvc`, `musl`, `newlib`, `nto70`, `nto71`, `ohos`, `psx`, `relibc`, `sgx`, `uclibc`
    = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
 
 warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
-  --> $DIR/well-known-values.rs:54:5
+  --> $DIR/well-known-values.rs:53:5
    |
 LL |     target_family = "_UNEXPECTED_VALUE",
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -149,7 +149,7 @@ LL |     target_family = "_UNEXPECTED_VALUE",
    = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
 
 warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
-  --> $DIR/well-known-values.rs:56:5
+  --> $DIR/well-known-values.rs:55:5
    |
 LL |     target_feature = "_UNEXPECTED_VALUE",
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -158,7 +158,7 @@ LL |     target_feature = "_UNEXPECTED_VALUE",
    = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
 
 warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
-  --> $DIR/well-known-values.rs:58:5
+  --> $DIR/well-known-values.rs:57:5
    |
 LL |     target_has_atomic = "_UNEXPECTED_VALUE",
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -167,7 +167,7 @@ LL |     target_has_atomic = "_UNEXPECTED_VALUE",
    = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
 
 warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
-  --> $DIR/well-known-values.rs:60:5
+  --> $DIR/well-known-values.rs:59:5
    |
 LL |     target_has_atomic_equal_alignment = "_UNEXPECTED_VALUE",
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -176,7 +176,7 @@ LL |     target_has_atomic_equal_alignment = "_UNEXPECTED_VALUE",
    = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
 
 warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
-  --> $DIR/well-known-values.rs:62:5
+  --> $DIR/well-known-values.rs:61:5
    |
 LL |     target_has_atomic_load_store = "_UNEXPECTED_VALUE",
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -185,7 +185,7 @@ LL |     target_has_atomic_load_store = "_UNEXPECTED_VALUE",
    = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
 
 warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
-  --> $DIR/well-known-values.rs:64:5
+  --> $DIR/well-known-values.rs:63:5
    |
 LL |     target_os = "_UNEXPECTED_VALUE",
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -194,7 +194,7 @@ LL |     target_os = "_UNEXPECTED_VALUE",
    = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
 
 warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
-  --> $DIR/well-known-values.rs:66:5
+  --> $DIR/well-known-values.rs:65:5
    |
 LL |     target_pointer_width = "_UNEXPECTED_VALUE",
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -203,7 +203,7 @@ LL |     target_pointer_width = "_UNEXPECTED_VALUE",
    = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
 
 warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
-  --> $DIR/well-known-values.rs:68:5
+  --> $DIR/well-known-values.rs:67:5
    |
 LL |     target_thread_local = "_UNEXPECTED_VALUE",
    |     ^^^^^^^^^^^^^^^^^^^----------------------
@@ -214,7 +214,7 @@ LL |     target_thread_local = "_UNEXPECTED_VALUE",
    = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
 
 warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
-  --> $DIR/well-known-values.rs:70:5
+  --> $DIR/well-known-values.rs:69:5
    |
 LL |     target_vendor = "_UNEXPECTED_VALUE",
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -223,7 +223,7 @@ LL |     target_vendor = "_UNEXPECTED_VALUE",
    = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
 
 warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
-  --> $DIR/well-known-values.rs:72:5
+  --> $DIR/well-known-values.rs:71:5
    |
 LL |     test = "_UNEXPECTED_VALUE",
    |     ^^^^----------------------
@@ -234,7 +234,7 @@ LL |     test = "_UNEXPECTED_VALUE",
    = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
 
 warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
-  --> $DIR/well-known-values.rs:74:5
+  --> $DIR/well-known-values.rs:73:5
    |
 LL |     unix = "_UNEXPECTED_VALUE",
    |     ^^^^----------------------
@@ -245,7 +245,7 @@ LL |     unix = "_UNEXPECTED_VALUE",
    = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
 
 warning: unexpected `cfg` condition value: `_UNEXPECTED_VALUE`
-  --> $DIR/well-known-values.rs:76:5
+  --> $DIR/well-known-values.rs:75:5
    |
 LL |     windows = "_UNEXPECTED_VALUE",
    |     ^^^^^^^----------------------
@@ -256,7 +256,7 @@ LL |     windows = "_UNEXPECTED_VALUE",
    = note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration
 
 warning: unexpected `cfg` condition value: `linuz`
-  --> $DIR/well-known-values.rs:82:7
+  --> $DIR/well-known-values.rs:81:7
    |
 LL | #[cfg(target_os = "linuz")] // testing that we suggest `linux`
    |       ^^^^^^^^^^^^-------
diff --git a/tests/ui/const-generics/min_const_generics/macro.rs b/tests/ui/const-generics/min_const_generics/macro.rs
index b7e8083a861..52f47628f8f 100644
--- a/tests/ui/const-generics/min_const_generics/macro.rs
+++ b/tests/ui/const-generics/min_const_generics/macro.rs
@@ -1,4 +1,6 @@
 //@ run-pass
+#![allow(non_local_definitions)]
+
 struct Example<const N: usize>;
 
 macro_rules! external_macro {
diff --git a/tests/ui/consts/const-eval/raw-bytes.32bit.stderr b/tests/ui/consts/const-eval/raw-bytes.32bit.stderr
index 57815e6af65..c06c3074116 100644
--- a/tests/ui/consts/const-eval/raw-bytes.32bit.stderr
+++ b/tests/ui/consts/const-eval/raw-bytes.32bit.stderr
@@ -1,5 +1,5 @@
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:22:1
+  --> $DIR/raw-bytes.rs:21:1
    |
 LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) };
    | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x00000001, but expected a valid enum tag
@@ -10,7 +10,7 @@ LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:30:1
+  --> $DIR/raw-bytes.rs:29:1
    |
 LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
    | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x00000000, but expected a valid enum tag
@@ -21,7 +21,7 @@ LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:44:1
+  --> $DIR/raw-bytes.rs:43:1
    |
 LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant
@@ -32,7 +32,7 @@ LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:46:1
+  --> $DIR/raw-bytes.rs:45:1
    |
 LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant
@@ -43,7 +43,7 @@ LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:52:1
+  --> $DIR/raw-bytes.rs:51:1
    |
 LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute(!0u32) }));
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0.1: encountered 0xffffffff, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
@@ -54,7 +54,7 @@ LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::tran
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:57:1
+  --> $DIR/raw-bytes.rs:56:1
    |
 LL | const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
@@ -65,10 +65,10 @@ LL | const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:60:1
+  --> $DIR/raw-bytes.rs:59:1
    |
-LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) };
-   | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
+LL | const NULL_U8: NonZero<u8> = 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) {
@@ -76,10 +76,10 @@ LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:62:1
+  --> $DIR/raw-bytes.rs:61:1
    |
-LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) };
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
+LL | const NULL_USIZE: NonZero<usize> = 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) {
@@ -87,7 +87,7 @@ LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:68:1
+  --> $DIR/raw-bytes.rs:67:1
    |
 LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 42, but expected something in the range 10..=30
@@ -98,7 +98,7 @@ LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:74:1
+  --> $DIR/raw-bytes.rs:73:1
    |
 LL | const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 20, but expected something less or equal to 10, or greater or equal to 30
@@ -109,7 +109,7 @@ LL | const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:77:1
+  --> $DIR/raw-bytes.rs:76:1
    |
 LL | const NULL_FAT_PTR: NonNull<dyn Send> = unsafe {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
@@ -120,7 +120,7 @@ LL | const NULL_FAT_PTR: NonNull<dyn Send> = unsafe {
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:85:1
+  --> $DIR/raw-bytes.rs:84:1
    |
 LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) };
    | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1)
@@ -131,7 +131,7 @@ LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:89:1
+  --> $DIR/raw-bytes.rs:88:1
    |
 LL | const UNALIGNED_BOX: Box<u16> = unsafe { mem::transmute(&[0u8; 4]) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned box (required 2 byte alignment but found 1)
@@ -142,7 +142,7 @@ LL | const UNALIGNED_BOX: Box<u16> = unsafe { mem::transmute(&[0u8; 4]) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:93:1
+  --> $DIR/raw-bytes.rs:92:1
    |
 LL | const NULL: &u16 = unsafe { mem::transmute(0usize) };
    | ^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null reference
@@ -153,7 +153,7 @@ LL | const NULL: &u16 = unsafe { mem::transmute(0usize) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:96:1
+  --> $DIR/raw-bytes.rs:95:1
    |
 LL | const NULL_BOX: Box<u16> = unsafe { mem::transmute(0usize) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null box
@@ -164,7 +164,7 @@ LL | const NULL_BOX: Box<u16> = unsafe { mem::transmute(0usize) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:99:1
+  --> $DIR/raw-bytes.rs:98:1
    |
 LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (0x539[noalloc] has no provenance)
@@ -175,7 +175,7 @@ LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:102:1
+  --> $DIR/raw-bytes.rs:101:1
    |
 LL | const USIZE_AS_BOX: Box<u8> = unsafe { mem::transmute(1337usize) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (0x539[noalloc] has no provenance)
@@ -186,7 +186,7 @@ LL | const USIZE_AS_BOX: Box<u8> = unsafe { mem::transmute(1337usize) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:105:1
+  --> $DIR/raw-bytes.rs:104:1
    |
 LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) };
    | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a function pointer
@@ -197,7 +197,7 @@ LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:107:1
+  --> $DIR/raw-bytes.rs:106:1
    |
 LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0xd[noalloc], but expected a function pointer
@@ -208,7 +208,7 @@ LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:109:1
+  --> $DIR/raw-bytes.rs:108:1
    |
 LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
    | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC3<imm>, but expected a function pointer
@@ -219,7 +219,7 @@ LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:115:1
+  --> $DIR/raw-bytes.rs:114:1
    |
 LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
    | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to uninhabited type Bar
@@ -230,7 +230,7 @@ LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:140:1
+  --> $DIR/raw-bytes.rs:139:1
    |
 LL | const STR_TOO_LONG: &str = unsafe { mem::transmute((&42u8, 999usize)) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation)
@@ -241,7 +241,7 @@ LL | const STR_TOO_LONG: &str = unsafe { mem::transmute((&42u8, 999usize)) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:142:1
+  --> $DIR/raw-bytes.rs:141:1
    |
 LL | const NESTED_STR_MUCH_TOO_LONG: (&str,) = (unsafe { mem::transmute((&42, usize::MAX)) },);
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered invalid reference metadata: slice is bigger than largest supported object
@@ -252,7 +252,7 @@ LL | const NESTED_STR_MUCH_TOO_LONG: (&str,) = (unsafe { mem::transmute((&42, us
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:144:1
+  --> $DIR/raw-bytes.rs:143:1
    |
 LL | const MY_STR_MUCH_TOO_LONG: &MyStr = unsafe { mem::transmute((&42u8, usize::MAX)) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object
@@ -263,7 +263,7 @@ LL | const MY_STR_MUCH_TOO_LONG: &MyStr = unsafe { mem::transmute((&42u8, usize:
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:147:1
+  --> $DIR/raw-bytes.rs:146:1
    |
 LL | const STR_NO_INIT: &str = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) };
    | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered uninitialized memory, but expected a string
@@ -274,7 +274,7 @@ LL | const STR_NO_INIT: &str = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit:
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:149:1
+  --> $DIR/raw-bytes.rs:148:1
    |
 LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered uninitialized memory, but expected a string
@@ -285,7 +285,7 @@ LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUni
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:151:1
+  --> $DIR/raw-bytes.rs:150:1
    |
 LL | const MYSTR_NO_INIT_ISSUE83182: &MyStr = unsafe { mem::transmute::<&[_], _>(&[&()]) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered a pointer, but expected a string
@@ -298,7 +298,7 @@ LL | const MYSTR_NO_INIT_ISSUE83182: &MyStr = unsafe { mem::transmute::<&[_], _>
    = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:155:1
+  --> $DIR/raw-bytes.rs:154:1
    |
 LL | const SLICE_TOO_LONG: &[u8] = unsafe { mem::transmute((&42u8, 999usize)) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation)
@@ -309,7 +309,7 @@ LL | const SLICE_TOO_LONG: &[u8] = unsafe { mem::transmute((&42u8, 999usize)) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:157:1
+  --> $DIR/raw-bytes.rs:156:1
    |
 LL | const SLICE_TOO_LONG_OVERFLOW: &[u32] = unsafe { mem::transmute((&42u32, isize::MAX)) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object
@@ -320,7 +320,7 @@ LL | const SLICE_TOO_LONG_OVERFLOW: &[u32] = unsafe { mem::transmute((&42u32, is
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:160:1
+  --> $DIR/raw-bytes.rs:159:1
    |
 LL | const SLICE_TOO_LONG_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, 999usize)) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (going beyond the bounds of its allocation)
@@ -331,7 +331,7 @@ LL | const SLICE_TOO_LONG_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, 999us
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:163:1
+  --> $DIR/raw-bytes.rs:162:1
    |
 LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x03, but expected a boolean
@@ -342,13 +342,13 @@ LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
            }
 
 note: erroneous constant encountered
-  --> $DIR/raw-bytes.rs:163:40
+  --> $DIR/raw-bytes.rs:162: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:169:1
+  --> $DIR/raw-bytes.rs:168:1
    |
 LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]);
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered 0x03, but expected a boolean
@@ -359,13 +359,13 @@ LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3
            }
 
 note: erroneous constant encountered
-  --> $DIR/raw-bytes.rs:169:42
+  --> $DIR/raw-bytes.rs:168: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:173:1
+  --> $DIR/raw-bytes.rs:172:1
    |
 LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]);
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.1[0]: encountered 0x03, but expected a boolean
@@ -376,13 +376,13 @@ LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::tran
            }
 
 note: erroneous constant encountered
-  --> $DIR/raw-bytes.rs:173:42
+  --> $DIR/raw-bytes.rs:172: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:178:1
+  --> $DIR/raw-bytes.rs:177:1
    |
 LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u8))) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC17<imm>, but expected a vtable pointer
@@ -393,7 +393,7 @@ LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W((
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:182:1
+  --> $DIR/raw-bytes.rs:181:1
    |
 LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u64))) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC19<imm>, but expected a vtable pointer
@@ -404,7 +404,7 @@ LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W((
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:186:1
+  --> $DIR/raw-bytes.rs:185:1
    |
 LL | const TRAIT_OBJ_INT_VTABLE: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, 4usize))) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered 0x4[noalloc], but expected a vtable pointer
@@ -415,7 +415,7 @@ LL | const TRAIT_OBJ_INT_VTABLE: W<&dyn Trait> = unsafe { mem::transmute(W((&92u
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:189:1
+  --> $DIR/raw-bytes.rs:188:1
    |
 LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &[&42u8; 8]))) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC22<imm>, but expected a vtable pointer
@@ -426,7 +426,7 @@ LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::trans
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:193:1
+  --> $DIR/raw-bytes.rs:192:1
    |
 LL | const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_, &bool>(&3u8) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.<dyn-downcast>: encountered 0x03, but expected a boolean
@@ -437,7 +437,7 @@ LL | const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_,
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:197:1
+  --> $DIR/raw-bytes.rs:196:1
    |
 LL | const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute((&92u8, 0usize)) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a vtable pointer
@@ -448,7 +448,7 @@ LL | const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:199:1
+  --> $DIR/raw-bytes.rs:198:1
    |
 LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC27<imm>, but expected a vtable pointer
@@ -459,7 +459,7 @@ LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transm
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:203:1
+  --> $DIR/raw-bytes.rs:202:1
    |
 LL | const _: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) };
    | ^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to uninhabited type [!; 1]
@@ -470,7 +470,7 @@ LL | const _: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:204:1
+  --> $DIR/raw-bytes.rs:203:1
    |
 LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 1]) };
    | ^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a value of the never type `!`
@@ -481,7 +481,7 @@ LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 1]) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:205:1
+  --> $DIR/raw-bytes.rs:204:1
    |
 LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 42]) };
    | ^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a value of the never type `!`
@@ -492,7 +492,7 @@ LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 42]) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:209:1
+  --> $DIR/raw-bytes.rs:208:1
    |
 LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) };
    | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized memory, but expected an integer
@@ -503,7 +503,7 @@ LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) }
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:212:1
+  --> $DIR/raw-bytes.rs:211:1
    |
 LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, mem::size_of::<&u32>()) };
    | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a pointer, but expected an integer
@@ -516,7 +516,7 @@ LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, mem:
    = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:215:1
+  --> $DIR/raw-bytes.rs:214: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
@@ -527,7 +527,7 @@ LL | pub static S6: &[bool] = unsafe { from_raw_parts((&D0) as *const _ as _, 4)
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:219:1
+  --> $DIR/raw-bytes.rs:218:1
    |
 LL | pub static S7: &[u16] = unsafe {
    | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[1]: encountered uninitialized memory, but expected an integer
@@ -538,7 +538,7 @@ LL | pub static S7: &[u16] = unsafe {
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:226:1
+  --> $DIR/raw-bytes.rs:225:1
    |
 LL | pub static R4: &[u8] = unsafe {
    | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized memory, but expected an integer
@@ -549,7 +549,7 @@ LL | pub static R4: &[u8] = unsafe {
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:231:1
+  --> $DIR/raw-bytes.rs:230:1
    |
 LL | pub static R5: &[u8] = unsafe {
    | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a pointer, but expected an integer
@@ -562,7 +562,7 @@ LL | pub static R5: &[u8] = unsafe {
    = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:236:1
+  --> $DIR/raw-bytes.rs:235:1
    |
 LL | pub static R6: &[bool] = unsafe {
    | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean
diff --git a/tests/ui/consts/const-eval/raw-bytes.64bit.stderr b/tests/ui/consts/const-eval/raw-bytes.64bit.stderr
index c875d91ccb8..0589280524c 100644
--- a/tests/ui/consts/const-eval/raw-bytes.64bit.stderr
+++ b/tests/ui/consts/const-eval/raw-bytes.64bit.stderr
@@ -1,5 +1,5 @@
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:22:1
+  --> $DIR/raw-bytes.rs:21:1
    |
 LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) };
    | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x0000000000000001, but expected a valid enum tag
@@ -10,7 +10,7 @@ LL | const BAD_ENUM: Enum = unsafe { mem::transmute(1usize) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:30:1
+  --> $DIR/raw-bytes.rs:29:1
    |
 LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
    | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered 0x0000000000000000, but expected a valid enum tag
@@ -21,7 +21,7 @@ LL | const BAD_ENUM2: Enum2 = unsafe { mem::transmute(0usize) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:44:1
+  --> $DIR/raw-bytes.rs:43:1
    |
 LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute(1u8) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant
@@ -32,7 +32,7 @@ LL | const BAD_UNINHABITED_VARIANT1: UninhDiscriminant = unsafe { mem::transmute
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:46:1
+  --> $DIR/raw-bytes.rs:45:1
    |
 LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute(3u8) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-tag>: encountered an uninhabited enum variant
@@ -43,7 +43,7 @@ LL | const BAD_UNINHABITED_VARIANT2: UninhDiscriminant = unsafe { mem::transmute
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:52:1
+  --> $DIR/raw-bytes.rs:51:1
    |
 LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute(!0u32) }));
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0.1: encountered 0xffffffff, but expected a valid unicode scalar value (in `0..=0x10FFFF` but not in `0xD800..=0xDFFF`)
@@ -54,7 +54,7 @@ LL | const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::tran
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:57:1
+  --> $DIR/raw-bytes.rs:56:1
    |
 LL | const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
@@ -65,10 +65,10 @@ LL | const NULL_PTR: NonNull<u8> = unsafe { mem::transmute(0usize) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:60:1
+  --> $DIR/raw-bytes.rs:59:1
    |
-LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) };
-   | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
+LL | const NULL_U8: NonZero<u8> = 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) {
@@ -76,10 +76,10 @@ LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:62:1
+  --> $DIR/raw-bytes.rs:61:1
    |
-LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) };
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
+LL | const NULL_USIZE: NonZero<usize> = 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) {
@@ -87,7 +87,7 @@ LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:68:1
+  --> $DIR/raw-bytes.rs:67:1
    |
 LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 42, but expected something in the range 10..=30
@@ -98,7 +98,7 @@ LL | const BAD_RANGE1: RestrictedRange1 = unsafe { RestrictedRange1(42) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:74:1
+  --> $DIR/raw-bytes.rs:73:1
    |
 LL | const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 20, but expected something less or equal to 10, or greater or equal to 30
@@ -109,7 +109,7 @@ LL | const BAD_RANGE2: RestrictedRange2 = unsafe { RestrictedRange2(20) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:77:1
+  --> $DIR/raw-bytes.rs:76:1
    |
 LL | const NULL_FAT_PTR: NonNull<dyn Send> = unsafe {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0, but expected something greater or equal to 1
@@ -120,7 +120,7 @@ LL | const NULL_FAT_PTR: NonNull<dyn Send> = unsafe {
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:85:1
+  --> $DIR/raw-bytes.rs:84:1
    |
 LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) };
    | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1)
@@ -131,7 +131,7 @@ LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:89:1
+  --> $DIR/raw-bytes.rs:88:1
    |
 LL | const UNALIGNED_BOX: Box<u16> = unsafe { mem::transmute(&[0u8; 4]) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned box (required 2 byte alignment but found 1)
@@ -142,7 +142,7 @@ LL | const UNALIGNED_BOX: Box<u16> = unsafe { mem::transmute(&[0u8; 4]) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:93:1
+  --> $DIR/raw-bytes.rs:92:1
    |
 LL | const NULL: &u16 = unsafe { mem::transmute(0usize) };
    | ^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null reference
@@ -153,7 +153,7 @@ LL | const NULL: &u16 = unsafe { mem::transmute(0usize) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:96:1
+  --> $DIR/raw-bytes.rs:95:1
    |
 LL | const NULL_BOX: Box<u16> = unsafe { mem::transmute(0usize) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null box
@@ -164,7 +164,7 @@ LL | const NULL_BOX: Box<u16> = unsafe { mem::transmute(0usize) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:99:1
+  --> $DIR/raw-bytes.rs:98:1
    |
 LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (0x539[noalloc] has no provenance)
@@ -175,7 +175,7 @@ LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:102:1
+  --> $DIR/raw-bytes.rs:101:1
    |
 LL | const USIZE_AS_BOX: Box<u8> = unsafe { mem::transmute(1337usize) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (0x539[noalloc] has no provenance)
@@ -186,7 +186,7 @@ LL | const USIZE_AS_BOX: Box<u8> = unsafe { mem::transmute(1337usize) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:105:1
+  --> $DIR/raw-bytes.rs:104:1
    |
 LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) };
    | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a function pointer
@@ -197,7 +197,7 @@ LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:107:1
+  --> $DIR/raw-bytes.rs:106:1
    |
 LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0xd[noalloc], but expected a function pointer
@@ -208,7 +208,7 @@ LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:109:1
+  --> $DIR/raw-bytes.rs:108:1
    |
 LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
    | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC3<imm>, but expected a function pointer
@@ -219,7 +219,7 @@ LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:115:1
+  --> $DIR/raw-bytes.rs:114:1
    |
 LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
    | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to uninhabited type Bar
@@ -230,7 +230,7 @@ LL | const BAD_BAD_REF: &Bar = unsafe { mem::transmute(1usize) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:140:1
+  --> $DIR/raw-bytes.rs:139:1
    |
 LL | const STR_TOO_LONG: &str = unsafe { mem::transmute((&42u8, 999usize)) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation)
@@ -241,7 +241,7 @@ LL | const STR_TOO_LONG: &str = unsafe { mem::transmute((&42u8, 999usize)) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:142:1
+  --> $DIR/raw-bytes.rs:141:1
    |
 LL | const NESTED_STR_MUCH_TOO_LONG: (&str,) = (unsafe { mem::transmute((&42, usize::MAX)) },);
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered invalid reference metadata: slice is bigger than largest supported object
@@ -252,7 +252,7 @@ LL | const NESTED_STR_MUCH_TOO_LONG: (&str,) = (unsafe { mem::transmute((&42, us
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:144:1
+  --> $DIR/raw-bytes.rs:143:1
    |
 LL | const MY_STR_MUCH_TOO_LONG: &MyStr = unsafe { mem::transmute((&42u8, usize::MAX)) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object
@@ -263,7 +263,7 @@ LL | const MY_STR_MUCH_TOO_LONG: &MyStr = unsafe { mem::transmute((&42u8, usize:
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:147:1
+  --> $DIR/raw-bytes.rs:146:1
    |
 LL | const STR_NO_INIT: &str = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) };
    | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: encountered uninitialized memory, but expected a string
@@ -274,7 +274,7 @@ LL | const STR_NO_INIT: &str = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit:
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:149:1
+  --> $DIR/raw-bytes.rs:148:1
    |
 LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUninit::<u8> { uninit: () }]) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered uninitialized memory, but expected a string
@@ -285,7 +285,7 @@ LL | const MYSTR_NO_INIT: &MyStr = unsafe { mem::transmute::<&[_], _>(&[MaybeUni
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:151:1
+  --> $DIR/raw-bytes.rs:150:1
    |
 LL | const MYSTR_NO_INIT_ISSUE83182: &MyStr = unsafe { mem::transmute::<&[_], _>(&[&()]) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered a pointer, but expected a string
@@ -298,7 +298,7 @@ LL | const MYSTR_NO_INIT_ISSUE83182: &MyStr = unsafe { mem::transmute::<&[_], _>
    = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:155:1
+  --> $DIR/raw-bytes.rs:154:1
    |
 LL | const SLICE_TOO_LONG: &[u8] = unsafe { mem::transmute((&42u8, 999usize)) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (going beyond the bounds of its allocation)
@@ -309,7 +309,7 @@ LL | const SLICE_TOO_LONG: &[u8] = unsafe { mem::transmute((&42u8, 999usize)) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:157:1
+  --> $DIR/raw-bytes.rs:156:1
    |
 LL | const SLICE_TOO_LONG_OVERFLOW: &[u32] = unsafe { mem::transmute((&42u32, isize::MAX)) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered invalid reference metadata: slice is bigger than largest supported object
@@ -320,7 +320,7 @@ LL | const SLICE_TOO_LONG_OVERFLOW: &[u32] = unsafe { mem::transmute((&42u32, is
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:160:1
+  --> $DIR/raw-bytes.rs:159:1
    |
 LL | const SLICE_TOO_LONG_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, 999usize)) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (going beyond the bounds of its allocation)
@@ -331,7 +331,7 @@ LL | const SLICE_TOO_LONG_BOX: Box<[u8]> = unsafe { mem::transmute((&42u8, 999us
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:163:1
+  --> $DIR/raw-bytes.rs:162:1
    |
 LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x03, but expected a boolean
@@ -342,13 +342,13 @@ LL | const SLICE_CONTENT_INVALID: &[bool] = &[unsafe { mem::transmute(3u8) }];
            }
 
 note: erroneous constant encountered
-  --> $DIR/raw-bytes.rs:163:40
+  --> $DIR/raw-bytes.rs:162: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:169:1
+  --> $DIR/raw-bytes.rs:168:1
    |
 LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3u8) }, [false]);
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.0: encountered 0x03, but expected a boolean
@@ -359,13 +359,13 @@ LL | const MYSLICE_PREFIX_BAD: &MySliceBool = &MySlice(unsafe { mem::transmute(3
            }
 
 note: erroneous constant encountered
-  --> $DIR/raw-bytes.rs:169:42
+  --> $DIR/raw-bytes.rs:168: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:173:1
+  --> $DIR/raw-bytes.rs:172:1
    |
 LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::transmute(3u8) }]);
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.1[0]: encountered 0x03, but expected a boolean
@@ -376,13 +376,13 @@ LL | const MYSLICE_SUFFIX_BAD: &MySliceBool = &MySlice(true, [unsafe { mem::tran
            }
 
 note: erroneous constant encountered
-  --> $DIR/raw-bytes.rs:173:42
+  --> $DIR/raw-bytes.rs:172: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:178:1
+  --> $DIR/raw-bytes.rs:177:1
    |
 LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u8))) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC17<imm>, but expected a vtable pointer
@@ -393,7 +393,7 @@ LL | const TRAIT_OBJ_SHORT_VTABLE_1: W<&dyn Trait> = unsafe { mem::transmute(W((
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:182:1
+  --> $DIR/raw-bytes.rs:181:1
    |
 LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &3u64))) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC19<imm>, but expected a vtable pointer
@@ -404,7 +404,7 @@ LL | const TRAIT_OBJ_SHORT_VTABLE_2: W<&dyn Trait> = unsafe { mem::transmute(W((
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:186:1
+  --> $DIR/raw-bytes.rs:185:1
    |
 LL | const TRAIT_OBJ_INT_VTABLE: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, 4usize))) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered 0x4[noalloc], but expected a vtable pointer
@@ -415,7 +415,7 @@ LL | const TRAIT_OBJ_INT_VTABLE: W<&dyn Trait> = unsafe { mem::transmute(W((&92u
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:189:1
+  --> $DIR/raw-bytes.rs:188:1
    |
 LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::transmute(W((&92u8, &[&42u8; 8]))) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered ALLOC22<imm>, but expected a vtable pointer
@@ -426,7 +426,7 @@ LL | const TRAIT_OBJ_BAD_DROP_FN_NOT_FN_PTR: W<&dyn Trait> = unsafe { mem::trans
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:193:1
+  --> $DIR/raw-bytes.rs:192:1
    |
 LL | const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_, &bool>(&3u8) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.<dyn-downcast>: encountered 0x03, but expected a boolean
@@ -437,7 +437,7 @@ LL | const TRAIT_OBJ_CONTENT_INVALID: &dyn Trait = unsafe { mem::transmute::<_,
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:197:1
+  --> $DIR/raw-bytes.rs:196:1
    |
 LL | const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute((&92u8, 0usize)) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a vtable pointer
@@ -448,7 +448,7 @@ LL | const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:199:1
+  --> $DIR/raw-bytes.rs:198:1
    |
 LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transmute((&92u8, &3u64)) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered ALLOC27<imm>, but expected a vtable pointer
@@ -459,7 +459,7 @@ LL | const RAW_TRAIT_OBJ_VTABLE_INVALID: *const dyn Trait = unsafe { mem::transm
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:203:1
+  --> $DIR/raw-bytes.rs:202:1
    |
 LL | const _: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) };
    | ^^^^^^^^^^^^^^^^ constructing invalid value: encountered a reference pointing to uninhabited type [!; 1]
@@ -470,7 +470,7 @@ LL | const _: &[!; 1] = unsafe { &*(1_usize as *const [!; 1]) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:204:1
+  --> $DIR/raw-bytes.rs:203:1
    |
 LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 1]) };
    | ^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a value of the never type `!`
@@ -481,7 +481,7 @@ LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 1]) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:205:1
+  --> $DIR/raw-bytes.rs:204:1
    |
 LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 42]) };
    | ^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a value of the never type `!`
@@ -492,7 +492,7 @@ LL | const _: &[!] = unsafe { &*(1_usize as *const [!; 42]) };
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:209:1
+  --> $DIR/raw-bytes.rs:208:1
    |
 LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) };
    | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized memory, but expected an integer
@@ -503,7 +503,7 @@ LL | pub static S4: &[u8] = unsafe { from_raw_parts((&D1) as *const _ as _, 1) }
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:212:1
+  --> $DIR/raw-bytes.rs:211:1
    |
 LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, mem::size_of::<&u32>()) };
    | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a pointer, but expected an integer
@@ -516,7 +516,7 @@ LL | pub static S5: &[u8] = unsafe { from_raw_parts((&D3) as *const _ as _, mem:
    = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:215:1
+  --> $DIR/raw-bytes.rs:214: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
@@ -527,7 +527,7 @@ LL | pub static S6: &[bool] = unsafe { from_raw_parts((&D0) as *const _ as _, 4)
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:219:1
+  --> $DIR/raw-bytes.rs:218:1
    |
 LL | pub static S7: &[u16] = unsafe {
    | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[1]: encountered uninitialized memory, but expected an integer
@@ -538,7 +538,7 @@ LL | pub static S7: &[u16] = unsafe {
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:226:1
+  --> $DIR/raw-bytes.rs:225:1
    |
 LL | pub static R4: &[u8] = unsafe {
    | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered uninitialized memory, but expected an integer
@@ -549,7 +549,7 @@ LL | pub static R4: &[u8] = unsafe {
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:231:1
+  --> $DIR/raw-bytes.rs:230:1
    |
 LL | pub static R5: &[u8] = unsafe {
    | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered a pointer, but expected an integer
@@ -562,7 +562,7 @@ LL | pub static R5: &[u8] = unsafe {
    = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/raw-bytes.rs:236:1
+  --> $DIR/raw-bytes.rs:235:1
    |
 LL | pub static R6: &[bool] = unsafe {
    | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>[0]: encountered 0x11, but expected a boolean
diff --git a/tests/ui/consts/const-eval/raw-bytes.rs b/tests/ui/consts/const-eval/raw-bytes.rs
index 96903b322e4..e5dfd5ca293 100644
--- a/tests/ui/consts/const-eval/raw-bytes.rs
+++ b/tests/ui/consts/const-eval/raw-bytes.rs
@@ -2,14 +2,13 @@
 //@ ignore-endian-big
 // ignore-tidy-linelength
 //@ normalize-stderr-test "╾─*ALLOC[0-9]+(\+[a-z0-9]+)?(<imm>)?─*╼" -> "╾ALLOC_ID$1╼"
-
-#![feature(never_type, rustc_attrs, ptr_metadata, slice_from_ptr_range, const_slice_from_ptr_range)]
 #![allow(invalid_value)]
+#![feature(generic_nonzero, never_type, rustc_attrs, ptr_metadata, slice_from_ptr_range, const_slice_from_ptr_range)]
 
 use std::mem;
 use std::alloc::Layout;
 use std::ptr::NonNull;
-use std::num::{NonZeroU8, NonZeroUsize};
+use std::num::NonZero;
 use std::slice::{from_ptr_range, from_raw_parts};
 
 // # Bad enums and chars
@@ -57,9 +56,9 @@ const BAD_OPTION_CHAR: Option<(char, char)> = Some(('x', unsafe { mem::transmute
 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) };
+const NULL_U8: NonZero<u8> = unsafe { mem::transmute(0u8) };
 //~^ ERROR it is undefined behavior to use this value
-const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) };
+const NULL_USIZE: NonZero<usize> = unsafe { mem::transmute(0usize) };
 //~^ ERROR it is undefined behavior to use this value
 
 #[rustc_layout_scalar_valid_range_start(10)]
diff --git a/tests/ui/consts/const-eval/ub-nonnull.rs b/tests/ui/consts/const-eval/ub-nonnull.rs
index 229ce9a7df3..76bd5248ffd 100644
--- a/tests/ui/consts/const-eval/ub-nonnull.rs
+++ b/tests/ui/consts/const-eval/ub-nonnull.rs
@@ -1,12 +1,12 @@
 // Strip out raw byte dumps to make comparison platform-independent:
 //@ normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
 //@ normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP"
-#![feature(rustc_attrs, ptr_metadata)]
 #![allow(invalid_value)] // make sure we cannot allow away the errors tested here
+#![feature(generic_nonzero, rustc_attrs, ptr_metadata)]
 
 use std::mem;
 use std::ptr::NonNull;
-use std::num::{NonZeroU8, NonZeroUsize};
+use std::num::NonZero;
 
 const NON_NULL: NonNull<u8> = unsafe { mem::transmute(1usize) };
 const NON_NULL_PTR: NonNull<u8> = unsafe { mem::transmute(&1) };
@@ -21,9 +21,9 @@ const OUT_OF_BOUNDS_PTR: NonNull<u8> = { unsafe {
     mem::transmute(out_of_bounds_ptr)
 } };
 
-const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) };
+const NULL_U8: NonZero<u8> = unsafe { mem::transmute(0u8) };
 //~^ ERROR it is undefined behavior to use this value
-const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) };
+const NULL_USIZE: NonZero<usize> = unsafe { mem::transmute(0usize) };
 //~^ ERROR it is undefined behavior to use this value
 
 #[repr(C)]
@@ -31,7 +31,7 @@ union MaybeUninit<T: Copy> {
     uninit: (),
     init: T,
 }
-const UNINIT: NonZeroU8 = unsafe { MaybeUninit { uninit: () }.init };
+const UNINIT: NonZero<u8> = unsafe { MaybeUninit { uninit: () }.init };
 //~^ ERROR evaluation of constant value failed
 //~| uninitialized
 
diff --git a/tests/ui/consts/const-eval/ub-nonnull.stderr b/tests/ui/consts/const-eval/ub-nonnull.stderr
index 7822306b654..70b961fe1cd 100644
--- a/tests/ui/consts/const-eval/ub-nonnull.stderr
+++ b/tests/ui/consts/const-eval/ub-nonnull.stderr
@@ -18,8 +18,8 @@ LL |     let out_of_bounds_ptr = &ptr[255];
 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
+LL | const NULL_U8: NonZero<u8> = 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) {
@@ -29,8 +29,8 @@ LL | const NULL_U8: NonZeroU8 = unsafe { mem::transmute(0u8) };
 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
+LL | const NULL_USIZE: NonZero<usize> = 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) {
@@ -38,10 +38,10 @@ LL | const NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(0usize) };
            }
 
 error[E0080]: evaluation of constant value failed
-  --> $DIR/ub-nonnull.rs:34:36
+  --> $DIR/ub-nonnull.rs:34:38
    |
-LL | const UNINIT: NonZeroU8 = unsafe { MaybeUninit { uninit: () }.init };
-   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory
+LL | const UNINIT: NonZero<u8> = 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
diff --git a/tests/ui/consts/const-eval/valid-const.rs b/tests/ui/consts/const-eval/valid-const.rs
index 1c8c048ae28..15d3e883456 100644
--- a/tests/ui/consts/const-eval/valid-const.rs
+++ b/tests/ui/consts/const-eval/valid-const.rs
@@ -1,16 +1,17 @@
 //@ check-pass
-
+//
 // Some constants that *are* valid
+#![feature(generic_nonzero)]
 
 use std::mem;
 use std::ptr::NonNull;
-use std::num::{NonZeroU8, NonZeroUsize};
+use std::num::NonZero;
 
 const NON_NULL_PTR1: NonNull<u8> = unsafe { mem::transmute(1usize) };
 const NON_NULL_PTR2: NonNull<u8> = unsafe { mem::transmute(&0) };
 
-const NON_NULL_U8: NonZeroU8 = unsafe { mem::transmute(1u8) };
-const NON_NULL_USIZE: NonZeroUsize = unsafe { mem::transmute(1usize) };
+const NON_NULL_U8: NonZero<u8> = unsafe { mem::transmute(1u8) };
+const NON_NULL_USIZE: NonZero<usize> = unsafe { mem::transmute(1usize) };
 
 const UNIT: () = ();
 
diff --git a/tests/ui/consts/const_in_pattern/accept_structural.rs b/tests/ui/consts/const_in_pattern/accept_structural.rs
index 09142c56157..31d3b6e7331 100644
--- a/tests/ui/consts/const_in_pattern/accept_structural.rs
+++ b/tests/ui/consts/const_in_pattern/accept_structural.rs
@@ -1,5 +1,6 @@
 //@ run-pass
 
+#![allow(non_local_definitions)]
 #![warn(indirect_structural_match)]
 
 // This test is checking our logic for structural match checking by enumerating
diff --git a/tests/ui/consts/const_in_pattern/issue-65466.rs b/tests/ui/consts/const_in_pattern/issue-65466.rs
index 048fca762d5..62efce64876 100644
--- a/tests/ui/consts/const_in_pattern/issue-65466.rs
+++ b/tests/ui/consts/const_in_pattern/issue-65466.rs
@@ -1,7 +1,3 @@
-#![deny(indirect_structural_match)]
-
-//@ check-pass
-
 #[derive(PartialEq, Eq)]
 enum O<T> {
     Some(*const T), // Can also use PhantomData<T>
@@ -15,8 +11,7 @@ const C: &[O<B>] = &[O::None];
 fn main() {
     let x = O::None;
     match &[x][..] {
-        C => (), //~WARN: the type must implement `PartialEq`
-        //~| previously accepted
+        C => (), //~ERROR: the type must implement `PartialEq`
         _ => (),
     }
 }
diff --git a/tests/ui/consts/const_in_pattern/issue-65466.stderr b/tests/ui/consts/const_in_pattern/issue-65466.stderr
index 9c80cb3a849..7d5e5b5b0c6 100644
--- a/tests/ui/consts/const_in_pattern/issue-65466.stderr
+++ b/tests/ui/consts/const_in_pattern/issue-65466.stderr
@@ -1,23 +1,8 @@
-warning: to use a constant of type `&[O<B>]` in a pattern, the type must implement `PartialEq`
-  --> $DIR/issue-65466.rs:18:9
+error: to use a constant of type `&[O<B>]` in a pattern, the type must implement `PartialEq`
+  --> $DIR/issue-65466.rs:14:9
    |
 LL |         C => (),
    |         ^
-   |
-   = 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 #116122 <https://github.com/rust-lang/rust/issues/116122>
-   = note: `#[warn(const_patterns_without_partial_eq)]` on by default
-
-warning: 1 warning emitted
 
-Future incompatibility report: Future breakage diagnostic:
-warning: to use a constant of type `&[O<B>]` in a pattern, the type must implement `PartialEq`
-  --> $DIR/issue-65466.rs:18:9
-   |
-LL |         C => (),
-   |         ^
-   |
-   = 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 #116122 <https://github.com/rust-lang/rust/issues/116122>
-   = note: `#[warn(const_patterns_without_partial_eq)]` on by default
+error: aborting due to 1 previous error
 
diff --git a/tests/ui/consts/ice-48279.rs b/tests/ui/consts/ice-48279.rs
index 5316974b80a..a4f687a3e9c 100644
--- a/tests/ui/consts/ice-48279.rs
+++ b/tests/ui/consts/ice-48279.rs
@@ -15,7 +15,7 @@ impl NonZeroU32 {
     }
 }
 
-//pub const FOO_ATOM: NonZeroU32 = unsafe { NonZeroU32::new_unchecked(7) };
+// pub const FOO_ATOM: NonZeroU32 = unsafe { NonZeroU32::new_unchecked(7) };
 pub const FOO_ATOM: NonZeroU32 = unsafe { NonZeroU32 { value: 7 } };
 
 fn main() {
diff --git a/tests/ui/consts/tuple-struct-constructors.rs b/tests/ui/consts/tuple-struct-constructors.rs
index 8472a09844b..d2f25aeec9b 100644
--- a/tests/ui/consts/tuple-struct-constructors.rs
+++ b/tests/ui/consts/tuple-struct-constructors.rs
@@ -1,10 +1,11 @@
 //@ run-pass
-
+//
 // https://github.com/rust-lang/rust/issues/41898
+#![feature(generic_nonzero)]
 
-use std::num::NonZeroU64;
+use std::num::NonZero;
 
 fn main() {
-    const FOO: NonZeroU64 = unsafe { NonZeroU64::new_unchecked(2) };
+    const FOO: NonZero<u64> = unsafe { NonZero::new_unchecked(2) };
     if let FOO = FOO {}
 }
diff --git a/tests/ui/drop/dropck-eyepatch-reorder.rs b/tests/ui/drop/dropck-eyepatch-reorder.rs
index 6b394414bae..b985beee9ec 100644
--- a/tests/ui/drop/dropck-eyepatch-reorder.rs
+++ b/tests/ui/drop/dropck-eyepatch-reorder.rs
@@ -1,5 +1,6 @@
 //@ run-pass
 #![feature(dropck_eyepatch)]
+#![allow(non_local_definitions)]
 
 // The point of this test is to test uses of `#[may_dangle]` attribute
 // where the formal declaration order (in the impl generics) does not
diff --git a/tests/ui/drop/dropck-eyepatch.rs b/tests/ui/drop/dropck-eyepatch.rs
index 2f27b72da5a..2dffe6aba17 100644
--- a/tests/ui/drop/dropck-eyepatch.rs
+++ b/tests/ui/drop/dropck-eyepatch.rs
@@ -1,5 +1,6 @@
 //@ run-pass
 #![feature(dropck_eyepatch)]
+#![allow(non_local_definitions)]
 
 // The point of this test is to illustrate that the `#[may_dangle]`
 // attribute specifically allows, in the context of a type
diff --git a/tests/ui/feature-gates/feature-gate-cfg-target-abi.rs b/tests/ui/feature-gates/feature-gate-cfg-target-abi.rs
deleted file mode 100644
index d005dc3ad45..00000000000
--- a/tests/ui/feature-gates/feature-gate-cfg-target-abi.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-#[cfg(target_abi = "x")] //~ ERROR `cfg(target_abi)` is experimental
-struct Foo(u64, u64);
-
-#[cfg_attr(target_abi = "x", x)] //~ ERROR `cfg(target_abi)` is experimental
-struct Bar(u64, u64);
-
-#[cfg(not(any(all(target_abi = "x"))))] //~ ERROR `cfg(target_abi)` is experimental
-fn foo() {}
-
-fn main() {
-    cfg!(target_abi = "x");
-    //~^ ERROR `cfg(target_abi)` is experimental and subject to change
-}
diff --git a/tests/ui/feature-gates/feature-gate-cfg-target-abi.stderr b/tests/ui/feature-gates/feature-gate-cfg-target-abi.stderr
deleted file mode 100644
index 4829f8572cc..00000000000
--- a/tests/ui/feature-gates/feature-gate-cfg-target-abi.stderr
+++ /dev/null
@@ -1,43 +0,0 @@
-error[E0658]: `cfg(target_abi)` is experimental and subject to change
-  --> $DIR/feature-gate-cfg-target-abi.rs:1:7
-   |
-LL | #[cfg(target_abi = "x")]
-   |       ^^^^^^^^^^^^^^^^
-   |
-   = note: see issue #80970 <https://github.com/rust-lang/rust/issues/80970> for more information
-   = help: add `#![feature(cfg_target_abi)]` to the crate attributes to enable
-   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
-
-error[E0658]: `cfg(target_abi)` is experimental and subject to change
-  --> $DIR/feature-gate-cfg-target-abi.rs:4:12
-   |
-LL | #[cfg_attr(target_abi = "x", x)]
-   |            ^^^^^^^^^^^^^^^^
-   |
-   = note: see issue #80970 <https://github.com/rust-lang/rust/issues/80970> for more information
-   = help: add `#![feature(cfg_target_abi)]` to the crate attributes to enable
-   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
-
-error[E0658]: `cfg(target_abi)` is experimental and subject to change
-  --> $DIR/feature-gate-cfg-target-abi.rs:7:19
-   |
-LL | #[cfg(not(any(all(target_abi = "x"))))]
-   |                   ^^^^^^^^^^^^^^^^
-   |
-   = note: see issue #80970 <https://github.com/rust-lang/rust/issues/80970> for more information
-   = help: add `#![feature(cfg_target_abi)]` to the crate attributes to enable
-   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
-
-error[E0658]: `cfg(target_abi)` is experimental and subject to change
-  --> $DIR/feature-gate-cfg-target-abi.rs:11:10
-   |
-LL |     cfg!(target_abi = "x");
-   |          ^^^^^^^^^^^^^^^^
-   |
-   = note: see issue #80970 <https://github.com/rust-lang/rust/issues/80970> for more information
-   = help: add `#![feature(cfg_target_abi)]` to the crate attributes to enable
-   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/imports/local-modularized-tricky-pass-2.rs b/tests/ui/imports/local-modularized-tricky-pass-2.rs
index 581bab467f5..1cf97c5aa06 100644
--- a/tests/ui/imports/local-modularized-tricky-pass-2.rs
+++ b/tests/ui/imports/local-modularized-tricky-pass-2.rs
@@ -4,6 +4,7 @@
 // into the root module soon enough to act as usual items and shadow globs and preludes.
 
 #![feature(decl_macro)]
+#![allow(non_local_definitions)]
 
 // `macro_export` shadows globs
 use inner1::*;
diff --git a/tests/ui/intrinsics/panic-uninitialized-zeroed.rs b/tests/ui/intrinsics/panic-uninitialized-zeroed.rs
index 2420aec5058..fb3b0652ddb 100644
--- a/tests/ui/intrinsics/panic-uninitialized-zeroed.rs
+++ b/tests/ui/intrinsics/panic-uninitialized-zeroed.rs
@@ -4,11 +4,11 @@
 // ignore-tidy-linelength
 //@ ignore-emscripten spawning processes is not supported
 //@ ignore-sgx no processes
-
+//
 // This test checks panic emitted from `mem::{uninitialized,zeroed}`.
-
-#![feature(never_type)]
 #![allow(deprecated, invalid_value)]
+#![feature(generic_nonzero)]
+#![feature(never_type)]
 
 use std::{
     mem::{self, MaybeUninit, ManuallyDrop},
@@ -29,7 +29,7 @@ enum OneVariant { Variant(i32) }
 
 #[allow(dead_code, non_camel_case_types)]
 enum OneVariant_NonZero {
-    Variant(i32, i32, num::NonZeroI32),
+    Variant(i32, i32, num::NonZero<i32>),
     DeadVariant(Bar),
 }
 
@@ -55,8 +55,8 @@ enum LR {
 }
 #[allow(dead_code, non_camel_case_types)]
 enum LR_NonZero {
-    Left(num::NonZeroI64),
-    Right(num::NonZeroI64),
+    Left(num::NonZero<i64>),
+    Right(num::NonZero<i64>),
 }
 
 struct ZeroSized;
diff --git a/tests/ui/issues/issue-31776.rs b/tests/ui/issues/issue-31776.rs
index 632defbcf27..4b342a0e3b2 100644
--- a/tests/ui/issues/issue-31776.rs
+++ b/tests/ui/issues/issue-31776.rs
@@ -1,6 +1,7 @@
 //@ run-pass
 #![allow(dead_code)]
 #![allow(unused_variables)]
+#![allow(non_local_definitions)]
 // Various scenarios in which `pub` is required in blocks
 
 struct S;
diff --git a/tests/ui/issues/issue-41053.rs b/tests/ui/issues/issue-41053.rs
index f46bf6b4aa1..18f9e209c33 100644
--- a/tests/ui/issues/issue-41053.rs
+++ b/tests/ui/issues/issue-41053.rs
@@ -1,6 +1,8 @@
 //@ run-pass
 //@ aux-build:issue-41053.rs
 
+#![allow(non_local_definitions)]
+
 pub trait Trait { fn foo(&self) {} }
 
 pub struct Foo;
diff --git a/tests/ui/issues/issue-64593.rs b/tests/ui/issues/issue-64593.rs
index e5535381006..091c3a2f316 100644
--- a/tests/ui/issues/issue-64593.rs
+++ b/tests/ui/issues/issue-64593.rs
@@ -1,7 +1,8 @@
 //@ check-pass
 #![deny(improper_ctypes)]
+#![feature(generic_nonzero)]
 
-pub struct Error(std::num::NonZeroU32);
+pub struct Error(std::num::NonZero<u32>);
 
 extern "Rust" {
     fn foo(dest: &mut [u8]) -> Result<(), Error>;
diff --git a/tests/ui/layout/unsafe-cell-hides-niche.rs b/tests/ui/layout/unsafe-cell-hides-niche.rs
index b3158839de0..568eb819be2 100644
--- a/tests/ui/layout/unsafe-cell-hides-niche.rs
+++ b/tests/ui/layout/unsafe-cell-hides-niche.rs
@@ -1,17 +1,17 @@
 // For rust-lang/rust#68303: the contents of `UnsafeCell<T>` cannot
 // participate in the niche-optimization for enum discriminants. This
-// test checks that an `Option<UnsafeCell<NonZeroU32>>` has the same
+// test checks that an `Option<UnsafeCell<NonZero<u32>>>` has the same
 // size in memory as an `Option<UnsafeCell<u32>>` (namely, 8 bytes).
-
+//
 //@ check-pass
 //@ compile-flags: --crate-type=lib
 //@ only-x86
-
+#![feature(generic_nonzero)]
 #![feature(repr_simd)]
 
 use std::cell::{UnsafeCell, RefCell, Cell};
 use std::mem::size_of;
-use std::num::NonZeroU32 as N32;
+use std::num::NonZero;
 use std::sync::{Mutex, RwLock};
 
 struct Wrapper<T>(#[allow(dead_code)] T);
@@ -54,15 +54,17 @@ macro_rules! check_sizes {
 
 const PTR_SIZE: usize = std::mem::size_of::<*const ()>();
 
-check_sizes!(Wrapper<u32>:     4 => 8);
-check_sizes!(Wrapper<N32>:     4 => 4); // (✓ niche opt)
-check_sizes!(Transparent<u32>: 4 => 8);
-check_sizes!(Transparent<N32>: 4 => 4); // (✓ niche opt)
-check_sizes!(NoNiche<u32>:     4 => 8);
-check_sizes!(NoNiche<N32>:     4 => 8);
+check_sizes!(Wrapper<u32>:              4 => 8);
+check_sizes!(Wrapper<NonZero<u32>>:     4 => 4); // (✓ niche opt)
+
+check_sizes!(Transparent<u32>:          4 => 8);
+check_sizes!(Transparent<NonZero<u32>>: 4 => 4); // (✓ niche opt)
+
+check_sizes!(NoNiche<u32>:              4 => 8);
+check_sizes!(NoNiche<NonZero<u32>>:     4 => 8);
 
-check_sizes!(UnsafeCell<u32>:  4 => 8);
-check_sizes!(UnsafeCell<N32>:  4 => 8);
+check_sizes!(UnsafeCell<u32>:           4 => 8);
+check_sizes!(UnsafeCell<NonZero<u32>>:  4 => 8);
 
 check_sizes!(UnsafeCell<&()>: PTR_SIZE => PTR_SIZE * 2);
 check_sizes!(   RefCell<&()>: PTR_SIZE * 2 => PTR_SIZE * 3);
@@ -79,4 +81,4 @@ check_sizes!(UnsafeCell<&dyn Trait>: PTR_SIZE * 2 => PTR_SIZE * 3);
 #[repr(simd)]
 pub struct Vec4<T>([T; 4]);
 
-check_sizes!(UnsafeCell<Vec4<N32>>: 16 => 32);
+check_sizes!(UnsafeCell<Vec4<NonZero<u32>>>: 16 => 32);
diff --git a/tests/ui/layout/zero-sized-array-enum-niche.rs b/tests/ui/layout/zero-sized-array-enum-niche.rs
index 095afc4337a..058f5923487 100644
--- a/tests/ui/layout/zero-sized-array-enum-niche.rs
+++ b/tests/ui/layout/zero-sized-array-enum-niche.rs
@@ -1,6 +1,7 @@
 //@ normalize-stderr-test "pref: Align\([1-8] bytes\)" -> "pref: $$PREF_ALIGN"
-#![feature(rustc_attrs)]
 #![crate_type = "lib"]
+#![feature(generic_nonzero)]
+#![feature(rustc_attrs)]
 
 // Various tests around the behavior of zero-sized arrays and
 // enum niches, especially that they have coherent size and alignment.
@@ -34,7 +35,7 @@ enum MultipleAlignments { //~ ERROR: layout_of
 struct Packed<T>(T);
 
 #[rustc_layout(debug)]
-type NicheLosesToTagged = Result<[u32; 0], Packed<std::num::NonZeroU16>>; //~ ERROR: layout_of
+type NicheLosesToTagged = Result<[u32; 0], Packed<std::num::NonZero<u16>>>; //~ ERROR: layout_of
 // Should get tag_encoding: Direct, size == align == 4.
 
 #[repr(u16)]
diff --git a/tests/ui/layout/zero-sized-array-enum-niche.stderr b/tests/ui/layout/zero-sized-array-enum-niche.stderr
index 0ed743818c5..af049125de4 100644
--- a/tests/ui/layout/zero-sized-array-enum-niche.stderr
+++ b/tests/ui/layout/zero-sized-array-enum-niche.stderr
@@ -98,7 +98,7 @@ error: layout_of(Result<[u32; 0], bool>) = Layout {
            max_repr_align: None,
            unadjusted_abi_align: Align(4 bytes),
        }
-  --> $DIR/zero-sized-array-enum-niche.rs:13:1
+  --> $DIR/zero-sized-array-enum-niche.rs:14:1
    |
 LL | type AlignedResult = Result<[u32; 0], bool>;
    | ^^^^^^^^^^^^^^^^^^
@@ -227,7 +227,7 @@ error: layout_of(MultipleAlignments) = Layout {
            max_repr_align: None,
            unadjusted_abi_align: Align(4 bytes),
        }
-  --> $DIR/zero-sized-array-enum-niche.rs:21:1
+  --> $DIR/zero-sized-array-enum-niche.rs:22:1
    |
 LL | enum MultipleAlignments {
    | ^^^^^^^^^^^^^^^^^^^^^^^
@@ -332,9 +332,9 @@ error: layout_of(Result<[u32; 0], Packed<NonZero<u16>>>) = Layout {
            max_repr_align: None,
            unadjusted_abi_align: Align(4 bytes),
        }
-  --> $DIR/zero-sized-array-enum-niche.rs:37:1
+  --> $DIR/zero-sized-array-enum-niche.rs:38:1
    |
-LL | type NicheLosesToTagged = Result<[u32; 0], Packed<std::num::NonZeroU16>>;
+LL | type NicheLosesToTagged = Result<[u32; 0], Packed<std::num::NonZero<u16>>>;
    | ^^^^^^^^^^^^^^^^^^^^^^^
 
 error: layout_of(Result<[u32; 0], Packed<U16IsZero>>) = Layout {
@@ -441,7 +441,7 @@ error: layout_of(Result<[u32; 0], Packed<U16IsZero>>) = Layout {
            max_repr_align: None,
            unadjusted_abi_align: Align(4 bytes),
        }
-  --> $DIR/zero-sized-array-enum-niche.rs:44:1
+  --> $DIR/zero-sized-array-enum-niche.rs:45:1
    |
 LL | type NicheWinsOverTagged = Result<[u32; 0], Packed<U16IsZero>>;
    | ^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/lint/auxiliary/non_local_macro.rs b/tests/ui/lint/auxiliary/non_local_macro.rs
new file mode 100644
index 00000000000..8c0ff8adda1
--- /dev/null
+++ b/tests/ui/lint/auxiliary/non_local_macro.rs
@@ -0,0 +1,26 @@
+#[macro_export]
+macro_rules! non_local_impl {
+    ($a:ident) => {
+        const _IMPL_DEBUG: () = {
+            impl ::std::fmt::Debug for $a {
+                fn fmt(&self, _: &mut ::std::fmt::Formatter<'_>)
+                    -> ::std::result::Result<(), ::std::fmt::Error>
+                {
+                    todo!()
+                }
+            }
+        };
+    }
+}
+
+#[macro_export]
+macro_rules! non_local_macro_rules {
+    ($a:ident) => {
+        const _MACRO_EXPORT: () = {
+            #[macro_export]
+            macro_rules! $a {
+                () => {}
+            }
+        };
+    }
+}
diff --git a/tests/ui/lint/clashing-extern-fn.rs b/tests/ui/lint/clashing-extern-fn.rs
index ce027c82554..cb63af0ea42 100644
--- a/tests/ui/lint/clashing-extern-fn.rs
+++ b/tests/ui/lint/clashing-extern-fn.rs
@@ -2,6 +2,7 @@
 //@ aux-build:external_extern_fn.rs
 #![crate_type = "lib"]
 #![warn(clashing_extern_declarations)]
+#![feature(generic_nonzero)]
 
 mod redeclared_different_signature {
     mod a {
@@ -265,7 +266,7 @@ mod missing_return_type {
 mod non_zero_and_non_null {
     mod a {
         extern "C" {
-            fn non_zero_usize() -> core::num::NonZeroUsize;
+            fn non_zero_usize() -> core::num::NonZero<usize>;
             fn non_null_ptr() -> core::ptr::NonNull<usize>;
         }
     }
@@ -285,36 +286,33 @@ mod non_zero_and_non_null {
 // See #75739
 mod non_zero_transparent {
     mod a1 {
-        use std::num::NonZeroUsize;
         extern "C" {
-            fn f1() -> NonZeroUsize;
+            fn f1() -> std::num::NonZero<usize>;
         }
     }
 
     mod b1 {
         #[repr(transparent)]
-        struct X(NonZeroUsize);
-        use std::num::NonZeroUsize;
+        struct X(std::num::NonZero<usize>);
+
         extern "C" {
             fn f1() -> X;
         }
     }
 
     mod a2 {
-        use std::num::NonZeroUsize;
         extern "C" {
-            fn f2() -> NonZeroUsize;
+            fn f2() -> std::num::NonZero<usize>;
         }
     }
 
     mod b2 {
         #[repr(transparent)]
-        struct X1(NonZeroUsize);
+        struct X1(std::num::NonZero<usize>);
 
         #[repr(transparent)]
         struct X(X1);
 
-        use std::num::NonZeroUsize;
         extern "C" {
             // Same case as above, but with two layers of newtyping.
             fn f2() -> X;
@@ -325,7 +323,6 @@ mod non_zero_transparent {
         #[repr(transparent)]
         struct X(core::ptr::NonNull<i32>);
 
-        use std::num::NonZeroUsize;
         extern "C" {
             fn f3() -> X;
         }
@@ -340,7 +337,7 @@ mod non_zero_transparent {
     mod a4 {
         #[repr(transparent)]
         enum E {
-            X(std::num::NonZeroUsize),
+            X(std::num::NonZero<usize>),
         }
         extern "C" {
             fn f4() -> E;
@@ -349,7 +346,7 @@ mod non_zero_transparent {
 
     mod b4 {
         extern "C" {
-            fn f4() -> std::num::NonZeroUsize;
+            fn f4() -> std::num::NonZero<usize>;
         }
     }
 }
@@ -369,8 +366,8 @@ mod null_optimised_enums {
         extern "C" {
             // This should be allowed, because these conversions are guaranteed to be FFI-safe (see
             // #60300)
-            fn option_non_zero_usize() -> Option<core::num::NonZeroUsize>;
-            fn option_non_zero_isize() -> Option<core::num::NonZeroIsize>;
+            fn option_non_zero_usize() -> Option<core::num::NonZero<usize>>;
+            fn option_non_zero_isize() -> Option<core::num::NonZero<isize>>;
             fn option_non_null_ptr() -> Option<core::ptr::NonNull<usize>>;
 
             // However, these should be incorrect (note isize instead of usize)
@@ -415,16 +412,16 @@ mod hidden_niche {
     }
     mod b {
         use std::cell::UnsafeCell;
-        use std::num::NonZeroUsize;
+        use std::num::NonZero;
 
         #[repr(transparent)]
         struct Transparent {
-            x: NonZeroUsize,
+            x: NonZero<usize>,
         }
 
         #[repr(transparent)]
         struct TransparentNoNiche {
-            y: UnsafeCell<NonZeroUsize>,
+            y: UnsafeCell<NonZero<usize>>,
         }
 
         extern "C" {
@@ -434,7 +431,7 @@ mod hidden_niche {
             //~^ WARN redeclared with a different signature
             //~| WARN block uses type `Option<TransparentNoNiche>`, which is not FFI-safe
 
-            fn hidden_niche_unsafe_cell() -> Option<UnsafeCell<NonZeroUsize>>;
+            fn hidden_niche_unsafe_cell() -> Option<UnsafeCell<NonZero<usize>>>;
             //~^ WARN redeclared with a different signature
             //~| WARN block uses type `Option<UnsafeCell<NonZero<usize>>>`, which is not FFI-safe
         }
diff --git a/tests/ui/lint/clashing-extern-fn.stderr b/tests/ui/lint/clashing-extern-fn.stderr
index 5b9244b6993..86ee789aeb2 100644
--- a/tests/ui/lint/clashing-extern-fn.stderr
+++ b/tests/ui/lint/clashing-extern-fn.stderr
@@ -1,5 +1,5 @@
 warning: `extern` block uses type `Option<TransparentNoNiche>`, which is not FFI-safe
-  --> $DIR/clashing-extern-fn.rs:433:55
+  --> $DIR/clashing-extern-fn.rs:430:55
    |
 LL |             fn hidden_niche_transparent_no_niche() -> Option<TransparentNoNiche>;
    |                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
@@ -9,16 +9,16 @@ LL |             fn hidden_niche_transparent_no_niche() -> Option<TransparentNoN
    = note: `#[warn(improper_ctypes)]` on by default
 
 warning: `extern` block uses type `Option<UnsafeCell<NonZero<usize>>>`, which is not FFI-safe
-  --> $DIR/clashing-extern-fn.rs:437:46
+  --> $DIR/clashing-extern-fn.rs:434:46
    |
-LL |             fn hidden_niche_unsafe_cell() -> Option<UnsafeCell<NonZeroUsize>>;
-   |                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
+LL |             fn hidden_niche_unsafe_cell() -> Option<UnsafeCell<NonZero<usize>>>;
+   |                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
    |
    = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
    = note: enum has no representation hint
 
 warning: `clash` redeclared with a different signature
-  --> $DIR/clashing-extern-fn.rs:14:13
+  --> $DIR/clashing-extern-fn.rs:15:13
    |
 LL |             fn clash(x: u8);
    |             --------------- `clash` previously declared here
@@ -35,7 +35,7 @@ LL | #![warn(clashing_extern_declarations)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 warning: `extern_link_name` redeclared with a different signature
-  --> $DIR/clashing-extern-fn.rs:52:9
+  --> $DIR/clashing-extern-fn.rs:53:9
    |
 LL |     #[link_name = "extern_link_name"]
    |     --------------------------------- `extern_link_name` previously declared here
@@ -47,7 +47,7 @@ LL |         fn extern_link_name(x: u32);
               found `unsafe extern "C" fn(u32)`
 
 warning: `some_other_extern_link_name` redeclares `some_other_new_name` with a different signature
-  --> $DIR/clashing-extern-fn.rs:55:9
+  --> $DIR/clashing-extern-fn.rs:56:9
    |
 LL |     fn some_other_new_name(x: i16);
    |     ------------------------------ `some_other_new_name` previously declared here
@@ -59,7 +59,7 @@ LL |         #[link_name = "some_other_new_name"]
               found `unsafe extern "C" fn(u32)`
 
 warning: `other_both_names_different` redeclares `link_name_same` with a different signature
-  --> $DIR/clashing-extern-fn.rs:59:9
+  --> $DIR/clashing-extern-fn.rs:60:9
    |
 LL |     #[link_name = "link_name_same"]
    |     ------------------------------- `link_name_same` previously declared here
@@ -71,7 +71,7 @@ LL |         #[link_name = "link_name_same"]
               found `unsafe extern "C" fn(u32)`
 
 warning: `different_mod` redeclared with a different signature
-  --> $DIR/clashing-extern-fn.rs:72:9
+  --> $DIR/clashing-extern-fn.rs:73:9
    |
 LL |         fn different_mod(x: u8);
    |         ----------------------- `different_mod` previously declared here
@@ -83,7 +83,7 @@ LL |         fn different_mod(x: u64);
               found `unsafe extern "C" fn(u64)`
 
 warning: `variadic_decl` redeclared with a different signature
-  --> $DIR/clashing-extern-fn.rs:82:9
+  --> $DIR/clashing-extern-fn.rs:83:9
    |
 LL |     fn variadic_decl(x: u8, ...);
    |     ---------------------------- `variadic_decl` previously declared here
@@ -95,7 +95,7 @@ LL |         fn variadic_decl(x: u8);
               found `unsafe extern "C" fn(u8)`
 
 warning: `weigh_banana` redeclared with a different signature
-  --> $DIR/clashing-extern-fn.rs:142:13
+  --> $DIR/clashing-extern-fn.rs:143:13
    |
 LL |             fn weigh_banana(count: *const Banana) -> u64;
    |             -------------------------------------------- `weigh_banana` previously declared here
@@ -107,7 +107,7 @@ LL |             fn weigh_banana(count: *const Banana) -> u64;
               found `unsafe extern "C" fn(*const three::Banana) -> u64`
 
 warning: `draw_point` redeclared with a different signature
-  --> $DIR/clashing-extern-fn.rs:171:13
+  --> $DIR/clashing-extern-fn.rs:172:13
    |
 LL |             fn draw_point(p: Point);
    |             ----------------------- `draw_point` previously declared here
@@ -119,7 +119,7 @@ LL |             fn draw_point(p: Point);
               found `unsafe extern "C" fn(sameish_members::b::Point)`
 
 warning: `origin` redeclared with a different signature
-  --> $DIR/clashing-extern-fn.rs:197:13
+  --> $DIR/clashing-extern-fn.rs:198:13
    |
 LL |             fn origin() -> Point3;
    |             --------------------- `origin` previously declared here
@@ -131,7 +131,7 @@ LL |             fn origin() -> Point3;
               found `unsafe extern "C" fn() -> same_sized_members_clash::b::Point3`
 
 warning: `transparent_incorrect` redeclared with a different signature
-  --> $DIR/clashing-extern-fn.rs:220:13
+  --> $DIR/clashing-extern-fn.rs:221:13
    |
 LL |             fn transparent_incorrect() -> T;
    |             ------------------------------- `transparent_incorrect` previously declared here
@@ -143,7 +143,7 @@ LL |             fn transparent_incorrect() -> isize;
               found `unsafe extern "C" fn() -> isize`
 
 warning: `missing_return_type` redeclared with a different signature
-  --> $DIR/clashing-extern-fn.rs:259:13
+  --> $DIR/clashing-extern-fn.rs:260:13
    |
 LL |             fn missing_return_type() -> usize;
    |             --------------------------------- `missing_return_type` previously declared here
@@ -155,10 +155,10 @@ LL |             fn missing_return_type();
               found `unsafe extern "C" fn()`
 
 warning: `non_zero_usize` redeclared with a different signature
-  --> $DIR/clashing-extern-fn.rs:277:13
+  --> $DIR/clashing-extern-fn.rs:278:13
    |
-LL |             fn non_zero_usize() -> core::num::NonZeroUsize;
-   |             ---------------------------------------------- `non_zero_usize` previously declared here
+LL |             fn non_zero_usize() -> core::num::NonZero<usize>;
+   |             ------------------------------------------------ `non_zero_usize` previously declared here
 ...
 LL |             fn non_zero_usize() -> usize;
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
@@ -167,7 +167,7 @@ LL |             fn non_zero_usize() -> usize;
               found `unsafe extern "C" fn() -> usize`
 
 warning: `non_null_ptr` redeclared with a different signature
-  --> $DIR/clashing-extern-fn.rs:279:13
+  --> $DIR/clashing-extern-fn.rs:280:13
    |
 LL |             fn non_null_ptr() -> core::ptr::NonNull<usize>;
    |             ---------------------------------------------- `non_null_ptr` previously declared here
@@ -179,7 +179,7 @@ LL |             fn non_null_ptr() -> *const usize;
               found `unsafe extern "C" fn() -> *const usize`
 
 warning: `option_non_zero_usize_incorrect` redeclared with a different signature
-  --> $DIR/clashing-extern-fn.rs:377:13
+  --> $DIR/clashing-extern-fn.rs:374:13
    |
 LL |             fn option_non_zero_usize_incorrect() -> usize;
    |             --------------------------------------------- `option_non_zero_usize_incorrect` previously declared here
@@ -191,7 +191,7 @@ LL |             fn option_non_zero_usize_incorrect() -> isize;
               found `unsafe extern "C" fn() -> isize`
 
 warning: `option_non_null_ptr_incorrect` redeclared with a different signature
-  --> $DIR/clashing-extern-fn.rs:379:13
+  --> $DIR/clashing-extern-fn.rs:376:13
    |
 LL |             fn option_non_null_ptr_incorrect() -> *const usize;
    |             -------------------------------------------------- `option_non_null_ptr_incorrect` previously declared here
@@ -203,7 +203,7 @@ LL |             fn option_non_null_ptr_incorrect() -> *const isize;
               found `unsafe extern "C" fn() -> *const isize`
 
 warning: `hidden_niche_transparent_no_niche` redeclared with a different signature
-  --> $DIR/clashing-extern-fn.rs:433:13
+  --> $DIR/clashing-extern-fn.rs:430:13
    |
 LL |             fn hidden_niche_transparent_no_niche() -> usize;
    |             ----------------------------------------------- `hidden_niche_transparent_no_niche` previously declared here
@@ -215,13 +215,13 @@ LL |             fn hidden_niche_transparent_no_niche() -> Option<TransparentNoN
               found `unsafe extern "C" fn() -> Option<TransparentNoNiche>`
 
 warning: `hidden_niche_unsafe_cell` redeclared with a different signature
-  --> $DIR/clashing-extern-fn.rs:437:13
+  --> $DIR/clashing-extern-fn.rs:434:13
    |
 LL |             fn hidden_niche_unsafe_cell() -> usize;
    |             -------------------------------------- `hidden_niche_unsafe_cell` previously declared here
 ...
-LL |             fn hidden_niche_unsafe_cell() -> Option<UnsafeCell<NonZeroUsize>>;
-   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
+LL |             fn hidden_niche_unsafe_cell() -> Option<UnsafeCell<NonZero<usize>>>;
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this signature doesn't match the previous declaration
    |
    = note: expected `unsafe extern "C" fn() -> usize`
               found `unsafe extern "C" fn() -> Option<UnsafeCell<NonZero<usize>>>`
diff --git a/tests/ui/lint/ice-array-into-iter-lint-issue-121532.rs b/tests/ui/lint/ice-array-into-iter-lint-issue-121532.rs
new file mode 100644
index 00000000000..92cab01fe48
--- /dev/null
+++ b/tests/ui/lint/ice-array-into-iter-lint-issue-121532.rs
@@ -0,0 +1,11 @@
+// Regression test for #121532
+// Checks the we don't ICE in ArrayIntoIter
+// lint when typeck has failed
+
+ // Typeck fails for the arg type as
+ // `Self` makes no sense here
+fn func(a: Self::ItemsIterator) { //~ ERROR failed to resolve: `Self` is only available in impls, traits, and type definitions
+    a.into_iter();
+}
+
+fn main() {}
diff --git a/tests/ui/lint/ice-array-into-iter-lint-issue-121532.stderr b/tests/ui/lint/ice-array-into-iter-lint-issue-121532.stderr
new file mode 100644
index 00000000000..73ceddae940
--- /dev/null
+++ b/tests/ui/lint/ice-array-into-iter-lint-issue-121532.stderr
@@ -0,0 +1,9 @@
+error[E0433]: failed to resolve: `Self` is only available in impls, traits, and type definitions
+  --> $DIR/ice-array-into-iter-lint-issue-121532.rs:7:12
+   |
+LL | fn func(a: Self::ItemsIterator) {
+   |            ^^^^ `Self` is only available in impls, traits, and type definitions
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0433`.
diff --git a/tests/ui/lint/ice-unions-known-panics-lint-issue-121534.rs b/tests/ui/lint/ice-unions-known-panics-lint-issue-121534.rs
new file mode 100644
index 00000000000..9fadb828b3d
--- /dev/null
+++ b/tests/ui/lint/ice-unions-known-panics-lint-issue-121534.rs
@@ -0,0 +1,21 @@
+// Regression test for #121534
+// Tests that no ICE occurs in KnownPanicsLint when it
+// evaluates an operation whose operands have different
+// layout types even though they have the same type.
+// This situation can be contrived through the use of
+// unions as in this test
+
+//@ build-pass
+union Union {
+    u32_field: u32,
+    i32_field: i32,
+}
+
+pub fn main() {
+    let u32_variant = Union { u32_field: 2 };
+    let i32_variant = Union { i32_field: 3 };
+    let a = unsafe { u32_variant.u32_field };
+    let b = unsafe { i32_variant.u32_field };
+
+    let _diff = a - b;
+}
diff --git a/tests/ui/lint/invalid_value.rs b/tests/ui/lint/invalid_value.rs
index 57d8cbe7c93..1d2f23aaaf6 100644
--- a/tests/ui/lint/invalid_value.rs
+++ b/tests/ui/lint/invalid_value.rs
@@ -1,13 +1,12 @@
 // This test checks that calling `mem::{uninitialized,zeroed}` with certain types results
 // in a lint.
-
-#![feature(never_type, rustc_attrs)]
 #![allow(deprecated)]
 #![deny(invalid_value)]
+#![feature(generic_nonzero, never_type, rustc_attrs)]
 
 use std::mem::{self, MaybeUninit};
 use std::ptr::NonNull;
-use std::num::NonZeroU32;
+use std::num::NonZero;
 
 enum Void {}
 
@@ -36,7 +35,7 @@ enum OneFruit {
 
 enum OneFruitNonZero {
     Apple(!),
-    Banana(NonZeroU32),
+    Banana(NonZero<u32>),
 }
 
 enum TwoUninhabited {
@@ -92,8 +91,8 @@ fn main() {
         let _val: NonNull<i32> = mem::zeroed(); //~ ERROR: does not permit zero-initialization
         let _val: NonNull<i32> = mem::uninitialized(); //~ ERROR: does not permit being left uninitialized
 
-        let _val: (NonZeroU32, i32) = mem::zeroed(); //~ ERROR: does not permit zero-initialization
-        let _val: (NonZeroU32, i32) = mem::uninitialized(); //~ ERROR: does not permit being left uninitialized
+        let _val: (NonZero<u32>, i32) = mem::zeroed(); //~ ERROR: does not permit zero-initialization
+        let _val: (NonZero<u32>, i32) = mem::uninitialized(); //~ ERROR: does not permit being left uninitialized
 
         let _val: *const dyn Send = mem::zeroed(); //~ ERROR: does not permit zero-initialization
         let _val: *const dyn Send = mem::uninitialized(); //~ ERROR: does not permit being left uninitialized
@@ -151,7 +150,7 @@ fn main() {
         // Transmute-from-0
         let _val: &'static i32 = mem::transmute(0usize); //~ ERROR: does not permit zero-initialization
         let _val: &'static [i32] = mem::transmute((0usize, 0usize)); //~ ERROR: does not permit zero-initialization
-        let _val: NonZeroU32 = mem::transmute(0); //~ ERROR: does not permit zero-initialization
+        let _val: NonZero<u32> = mem::transmute(0); //~ ERROR: does not permit zero-initialization
 
         // `MaybeUninit` cases
         let _val: NonNull<i32> = MaybeUninit::zeroed().assume_init(); //~ ERROR: does not permit zero-initialization
diff --git a/tests/ui/lint/invalid_value.stderr b/tests/ui/lint/invalid_value.stderr
index bdf47343114..955d01bd5d9 100644
--- a/tests/ui/lint/invalid_value.stderr
+++ b/tests/ui/lint/invalid_value.stderr
@@ -1,5 +1,5 @@
 error: the type `&T` does not permit zero-initialization
-  --> $DIR/invalid_value.rs:54:32
+  --> $DIR/invalid_value.rs:53:32
    |
 LL |         let _val: &'static T = mem::zeroed();
    |                                ^^^^^^^^^^^^^
@@ -9,13 +9,13 @@ LL |         let _val: &'static T = mem::zeroed();
    |
    = note: references must be non-null
 note: the lint level is defined here
-  --> $DIR/invalid_value.rs:6:9
+  --> $DIR/invalid_value.rs:4:9
    |
 LL | #![deny(invalid_value)]
    |         ^^^^^^^^^^^^^
 
 error: the type `&T` does not permit being left uninitialized
-  --> $DIR/invalid_value.rs:55:32
+  --> $DIR/invalid_value.rs:54:32
    |
 LL |         let _val: &'static T = mem::uninitialized();
    |                                ^^^^^^^^^^^^^^^^^^^^
@@ -26,7 +26,7 @@ LL |         let _val: &'static T = mem::uninitialized();
    = note: references must be non-null
 
 error: the type `Wrap<&T>` does not permit zero-initialization
-  --> $DIR/invalid_value.rs:57:38
+  --> $DIR/invalid_value.rs:56:38
    |
 LL |         let _val: Wrap<&'static T> = mem::zeroed();
    |                                      ^^^^^^^^^^^^^
@@ -36,13 +36,13 @@ LL |         let _val: Wrap<&'static T> = mem::zeroed();
    |
    = note: `Wrap<&T>` must be non-null
 note: because references must be non-null (in this struct field)
-  --> $DIR/invalid_value.rs:17:18
+  --> $DIR/invalid_value.rs:16:18
    |
 LL | struct Wrap<T> { wrapped: T }
    |                  ^^^^^^^^^^
 
 error: the type `Wrap<&T>` does not permit being left uninitialized
-  --> $DIR/invalid_value.rs:58:38
+  --> $DIR/invalid_value.rs:57:38
    |
 LL |         let _val: Wrap<&'static T> = mem::uninitialized();
    |                                      ^^^^^^^^^^^^^^^^^^^^
@@ -52,13 +52,13 @@ LL |         let _val: Wrap<&'static T> = mem::uninitialized();
    |
    = note: `Wrap<&T>` must be non-null
 note: because references must be non-null (in this struct field)
-  --> $DIR/invalid_value.rs:17:18
+  --> $DIR/invalid_value.rs:16:18
    |
 LL | struct Wrap<T> { wrapped: T }
    |                  ^^^^^^^^^^
 
 error: the type `!` does not permit zero-initialization
-  --> $DIR/invalid_value.rs:65:23
+  --> $DIR/invalid_value.rs:64:23
    |
 LL |         let _val: ! = mem::zeroed();
    |                       ^^^^^^^^^^^^^ this code causes undefined behavior when executed
@@ -66,7 +66,7 @@ LL |         let _val: ! = mem::zeroed();
    = note: the `!` type has no valid value
 
 error: the type `!` does not permit being left uninitialized
-  --> $DIR/invalid_value.rs:66:23
+  --> $DIR/invalid_value.rs:65:23
    |
 LL |         let _val: ! = mem::uninitialized();
    |                       ^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
@@ -74,7 +74,7 @@ LL |         let _val: ! = mem::uninitialized();
    = note: the `!` type has no valid value
 
 error: the type `(i32, !)` does not permit zero-initialization
-  --> $DIR/invalid_value.rs:68:30
+  --> $DIR/invalid_value.rs:67:30
    |
 LL |         let _val: (i32, !) = mem::zeroed();
    |                              ^^^^^^^^^^^^^ this code causes undefined behavior when executed
@@ -82,7 +82,7 @@ LL |         let _val: (i32, !) = mem::zeroed();
    = note: the `!` type has no valid value
 
 error: the type `(i32, !)` does not permit being left uninitialized
-  --> $DIR/invalid_value.rs:69:30
+  --> $DIR/invalid_value.rs:68:30
    |
 LL |         let _val: (i32, !) = mem::uninitialized();
    |                              ^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
@@ -90,31 +90,31 @@ LL |         let _val: (i32, !) = mem::uninitialized();
    = note: integers must be initialized
 
 error: the type `Void` does not permit zero-initialization
-  --> $DIR/invalid_value.rs:71:26
+  --> $DIR/invalid_value.rs:70:26
    |
 LL |         let _val: Void = mem::zeroed();
    |                          ^^^^^^^^^^^^^ this code causes undefined behavior when executed
    |
 note: enums with no inhabited variants have no valid value
-  --> $DIR/invalid_value.rs:12:1
+  --> $DIR/invalid_value.rs:11:1
    |
 LL | enum Void {}
    | ^^^^^^^^^
 
 error: the type `Void` does not permit being left uninitialized
-  --> $DIR/invalid_value.rs:72:26
+  --> $DIR/invalid_value.rs:71:26
    |
 LL |         let _val: Void = mem::uninitialized();
    |                          ^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
    |
 note: enums with no inhabited variants have no valid value
-  --> $DIR/invalid_value.rs:12:1
+  --> $DIR/invalid_value.rs:11:1
    |
 LL | enum Void {}
    | ^^^^^^^^^
 
 error: the type `&i32` does not permit zero-initialization
-  --> $DIR/invalid_value.rs:74:34
+  --> $DIR/invalid_value.rs:73:34
    |
 LL |         let _val: &'static i32 = mem::zeroed();
    |                                  ^^^^^^^^^^^^^
@@ -125,7 +125,7 @@ LL |         let _val: &'static i32 = mem::zeroed();
    = note: references must be non-null
 
 error: the type `&i32` does not permit being left uninitialized
-  --> $DIR/invalid_value.rs:75:34
+  --> $DIR/invalid_value.rs:74:34
    |
 LL |         let _val: &'static i32 = mem::uninitialized();
    |                                  ^^^^^^^^^^^^^^^^^^^^
@@ -136,7 +136,7 @@ LL |         let _val: &'static i32 = mem::uninitialized();
    = note: references must be non-null
 
 error: the type `Ref` does not permit zero-initialization
-  --> $DIR/invalid_value.rs:77:25
+  --> $DIR/invalid_value.rs:76:25
    |
 LL |         let _val: Ref = mem::zeroed();
    |                         ^^^^^^^^^^^^^
@@ -146,13 +146,13 @@ LL |         let _val: Ref = mem::zeroed();
    |
    = note: `Ref` must be non-null
 note: because references must be non-null (in this struct field)
-  --> $DIR/invalid_value.rs:14:12
+  --> $DIR/invalid_value.rs:13:12
    |
 LL | struct Ref(&'static i32);
    |            ^^^^^^^^^^^^
 
 error: the type `Ref` does not permit being left uninitialized
-  --> $DIR/invalid_value.rs:78:25
+  --> $DIR/invalid_value.rs:77:25
    |
 LL |         let _val: Ref = mem::uninitialized();
    |                         ^^^^^^^^^^^^^^^^^^^^
@@ -162,13 +162,13 @@ LL |         let _val: Ref = mem::uninitialized();
    |
    = note: `Ref` must be non-null
 note: because references must be non-null (in this struct field)
-  --> $DIR/invalid_value.rs:14:12
+  --> $DIR/invalid_value.rs:13:12
    |
 LL | struct Ref(&'static i32);
    |            ^^^^^^^^^^^^
 
 error: the type `fn()` does not permit zero-initialization
-  --> $DIR/invalid_value.rs:80:26
+  --> $DIR/invalid_value.rs:79:26
    |
 LL |         let _val: fn() = mem::zeroed();
    |                          ^^^^^^^^^^^^^
@@ -179,7 +179,7 @@ LL |         let _val: fn() = mem::zeroed();
    = note: function pointers must be non-null
 
 error: the type `fn()` does not permit being left uninitialized
-  --> $DIR/invalid_value.rs:81:26
+  --> $DIR/invalid_value.rs:80:26
    |
 LL |         let _val: fn() = mem::uninitialized();
    |                          ^^^^^^^^^^^^^^^^^^^^
@@ -190,7 +190,7 @@ LL |         let _val: fn() = mem::uninitialized();
    = note: function pointers must be non-null
 
 error: the type `Wrap<fn()>` does not permit zero-initialization
-  --> $DIR/invalid_value.rs:83:32
+  --> $DIR/invalid_value.rs:82:32
    |
 LL |         let _val: Wrap<fn()> = mem::zeroed();
    |                                ^^^^^^^^^^^^^
@@ -200,13 +200,13 @@ LL |         let _val: Wrap<fn()> = mem::zeroed();
    |
    = note: `Wrap<fn()>` must be non-null
 note: because function pointers must be non-null (in this struct field)
-  --> $DIR/invalid_value.rs:17:18
+  --> $DIR/invalid_value.rs:16:18
    |
 LL | struct Wrap<T> { wrapped: T }
    |                  ^^^^^^^^^^
 
 error: the type `Wrap<fn()>` does not permit being left uninitialized
-  --> $DIR/invalid_value.rs:84:32
+  --> $DIR/invalid_value.rs:83:32
    |
 LL |         let _val: Wrap<fn()> = mem::uninitialized();
    |                                ^^^^^^^^^^^^^^^^^^^^
@@ -216,13 +216,13 @@ LL |         let _val: Wrap<fn()> = mem::uninitialized();
    |
    = note: `Wrap<fn()>` must be non-null
 note: because function pointers must be non-null (in this struct field)
-  --> $DIR/invalid_value.rs:17:18
+  --> $DIR/invalid_value.rs:16:18
    |
 LL | struct Wrap<T> { wrapped: T }
    |                  ^^^^^^^^^^
 
 error: the type `WrapEnum<fn()>` does not permit zero-initialization
-  --> $DIR/invalid_value.rs:86:36
+  --> $DIR/invalid_value.rs:85:36
    |
 LL |         let _val: WrapEnum<fn()> = mem::zeroed();
    |                                    ^^^^^^^^^^^^^
@@ -232,13 +232,13 @@ LL |         let _val: WrapEnum<fn()> = mem::zeroed();
    |
    = note: `WrapEnum<fn()>` must be non-null
 note: because function pointers must be non-null (in this field of the only potentially inhabited enum variant)
-  --> $DIR/invalid_value.rs:18:28
+  --> $DIR/invalid_value.rs:17:28
    |
 LL | enum WrapEnum<T> { Wrapped(T) }
    |                            ^
 
 error: the type `WrapEnum<fn()>` does not permit being left uninitialized
-  --> $DIR/invalid_value.rs:87:36
+  --> $DIR/invalid_value.rs:86:36
    |
 LL |         let _val: WrapEnum<fn()> = mem::uninitialized();
    |                                    ^^^^^^^^^^^^^^^^^^^^
@@ -248,13 +248,13 @@ LL |         let _val: WrapEnum<fn()> = mem::uninitialized();
    |
    = note: `WrapEnum<fn()>` must be non-null
 note: because function pointers must be non-null (in this field of the only potentially inhabited enum variant)
-  --> $DIR/invalid_value.rs:18:28
+  --> $DIR/invalid_value.rs:17:28
    |
 LL | enum WrapEnum<T> { Wrapped(T) }
    |                            ^
 
 error: the type `Wrap<(RefPair, i32)>` does not permit zero-initialization
-  --> $DIR/invalid_value.rs:89:42
+  --> $DIR/invalid_value.rs:88:42
    |
 LL |         let _val: Wrap<(RefPair, i32)> = mem::zeroed();
    |                                          ^^^^^^^^^^^^^
@@ -263,18 +263,18 @@ LL |         let _val: Wrap<(RefPair, i32)> = mem::zeroed();
    |                                          help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
    |
 note: `RefPair` must be non-null (in this struct field)
-  --> $DIR/invalid_value.rs:17:18
+  --> $DIR/invalid_value.rs:16:18
    |
 LL | struct Wrap<T> { wrapped: T }
    |                  ^^^^^^^^^^
 note: because references must be non-null (in this struct field)
-  --> $DIR/invalid_value.rs:15:16
+  --> $DIR/invalid_value.rs:14:16
    |
 LL | struct RefPair((&'static i32, i32));
    |                ^^^^^^^^^^^^^^^^^^^
 
 error: the type `Wrap<(RefPair, i32)>` does not permit being left uninitialized
-  --> $DIR/invalid_value.rs:90:42
+  --> $DIR/invalid_value.rs:89:42
    |
 LL |         let _val: Wrap<(RefPair, i32)> = mem::uninitialized();
    |                                          ^^^^^^^^^^^^^^^^^^^^
@@ -283,18 +283,18 @@ LL |         let _val: Wrap<(RefPair, i32)> = mem::uninitialized();
    |                                          help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
    |
 note: `RefPair` must be non-null (in this struct field)
-  --> $DIR/invalid_value.rs:17:18
+  --> $DIR/invalid_value.rs:16:18
    |
 LL | struct Wrap<T> { wrapped: T }
    |                  ^^^^^^^^^^
 note: because references must be non-null (in this struct field)
-  --> $DIR/invalid_value.rs:15:16
+  --> $DIR/invalid_value.rs:14:16
    |
 LL | struct RefPair((&'static i32, i32));
    |                ^^^^^^^^^^^^^^^^^^^
 
 error: the type `NonNull<i32>` does not permit zero-initialization
-  --> $DIR/invalid_value.rs:92:34
+  --> $DIR/invalid_value.rs:91:34
    |
 LL |         let _val: NonNull<i32> = mem::zeroed();
    |                                  ^^^^^^^^^^^^^
@@ -305,7 +305,7 @@ LL |         let _val: NonNull<i32> = mem::zeroed();
    = note: `std::ptr::NonNull<i32>` must be non-null
 
 error: the type `NonNull<i32>` does not permit being left uninitialized
-  --> $DIR/invalid_value.rs:93:34
+  --> $DIR/invalid_value.rs:92:34
    |
 LL |         let _val: NonNull<i32> = mem::uninitialized();
    |                                  ^^^^^^^^^^^^^^^^^^^^
@@ -317,30 +317,30 @@ LL |         let _val: NonNull<i32> = mem::uninitialized();
    = note: raw pointers must be initialized
 
 error: the type `(NonZero<u32>, i32)` does not permit zero-initialization
-  --> $DIR/invalid_value.rs:95:39
+  --> $DIR/invalid_value.rs:94:41
    |
-LL |         let _val: (NonZeroU32, i32) = mem::zeroed();
-   |                                       ^^^^^^^^^^^^^
-   |                                       |
-   |                                       this code causes undefined behavior when executed
-   |                                       help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
+LL |         let _val: (NonZero<u32>, i32) = mem::zeroed();
+   |                                         ^^^^^^^^^^^^^
+   |                                         |
+   |                                         this code causes undefined behavior when executed
+   |                                         help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
    |
    = note: `std::num::NonZero<u32>` must be non-null
 
 error: the type `(NonZero<u32>, i32)` does not permit being left uninitialized
-  --> $DIR/invalid_value.rs:96:39
+  --> $DIR/invalid_value.rs:95:41
    |
-LL |         let _val: (NonZeroU32, i32) = mem::uninitialized();
-   |                                       ^^^^^^^^^^^^^^^^^^^^
-   |                                       |
-   |                                       this code causes undefined behavior when executed
-   |                                       help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
+LL |         let _val: (NonZero<u32>, i32) = mem::uninitialized();
+   |                                         ^^^^^^^^^^^^^^^^^^^^
+   |                                         |
+   |                                         this code causes undefined behavior when executed
+   |                                         help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
    |
    = note: `std::num::NonZero<u32>` must be non-null
    = note: integers must be initialized
 
 error: the type `*const dyn Send` does not permit zero-initialization
-  --> $DIR/invalid_value.rs:98:37
+  --> $DIR/invalid_value.rs:97:37
    |
 LL |         let _val: *const dyn Send = mem::zeroed();
    |                                     ^^^^^^^^^^^^^
@@ -351,7 +351,7 @@ LL |         let _val: *const dyn Send = mem::zeroed();
    = note: the vtable of a wide raw pointer must be non-null
 
 error: the type `*const dyn Send` does not permit being left uninitialized
-  --> $DIR/invalid_value.rs:99:37
+  --> $DIR/invalid_value.rs:98:37
    |
 LL |         let _val: *const dyn Send = mem::uninitialized();
    |                                     ^^^^^^^^^^^^^^^^^^^^
@@ -362,7 +362,7 @@ LL |         let _val: *const dyn Send = mem::uninitialized();
    = note: the vtable of a wide raw pointer must be non-null
 
 error: the type `[fn(); 2]` does not permit zero-initialization
-  --> $DIR/invalid_value.rs:101:31
+  --> $DIR/invalid_value.rs:100:31
    |
 LL |         let _val: [fn(); 2] = mem::zeroed();
    |                               ^^^^^^^^^^^^^
@@ -373,7 +373,7 @@ LL |         let _val: [fn(); 2] = mem::zeroed();
    = note: function pointers must be non-null
 
 error: the type `[fn(); 2]` does not permit being left uninitialized
-  --> $DIR/invalid_value.rs:102:31
+  --> $DIR/invalid_value.rs:101:31
    |
 LL |         let _val: [fn(); 2] = mem::uninitialized();
    |                               ^^^^^^^^^^^^^^^^^^^^
@@ -384,31 +384,31 @@ LL |         let _val: [fn(); 2] = mem::uninitialized();
    = note: function pointers must be non-null
 
 error: the type `TwoUninhabited` does not permit zero-initialization
-  --> $DIR/invalid_value.rs:104:36
+  --> $DIR/invalid_value.rs:103:36
    |
 LL |         let _val: TwoUninhabited = mem::zeroed();
    |                                    ^^^^^^^^^^^^^ this code causes undefined behavior when executed
    |
 note: enums with no inhabited variants have no valid value
-  --> $DIR/invalid_value.rs:42:1
+  --> $DIR/invalid_value.rs:41:1
    |
 LL | enum TwoUninhabited {
    | ^^^^^^^^^^^^^^^^^^^
 
 error: the type `TwoUninhabited` does not permit being left uninitialized
-  --> $DIR/invalid_value.rs:105:36
+  --> $DIR/invalid_value.rs:104:36
    |
 LL |         let _val: TwoUninhabited = mem::uninitialized();
    |                                    ^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
    |
 note: enums with no inhabited variants have no valid value
-  --> $DIR/invalid_value.rs:42:1
+  --> $DIR/invalid_value.rs:41:1
    |
 LL | enum TwoUninhabited {
    | ^^^^^^^^^^^^^^^^^^^
 
 error: the type `OneFruitNonZero` does not permit zero-initialization
-  --> $DIR/invalid_value.rs:107:37
+  --> $DIR/invalid_value.rs:106:37
    |
 LL |         let _val: OneFruitNonZero = mem::zeroed();
    |                                     ^^^^^^^^^^^^^
@@ -418,13 +418,13 @@ LL |         let _val: OneFruitNonZero = mem::zeroed();
    |
    = note: `OneFruitNonZero` must be non-null
 note: because `std::num::NonZero<u32>` must be non-null (in this field of the only potentially inhabited enum variant)
-  --> $DIR/invalid_value.rs:39:12
+  --> $DIR/invalid_value.rs:38:12
    |
-LL |     Banana(NonZeroU32),
-   |            ^^^^^^^^^^
+LL |     Banana(NonZero<u32>),
+   |            ^^^^^^^^^^^^
 
 error: the type `OneFruitNonZero` does not permit being left uninitialized
-  --> $DIR/invalid_value.rs:108:37
+  --> $DIR/invalid_value.rs:107:37
    |
 LL |         let _val: OneFruitNonZero = mem::uninitialized();
    |                                     ^^^^^^^^^^^^^^^^^^^^
@@ -434,14 +434,14 @@ LL |         let _val: OneFruitNonZero = mem::uninitialized();
    |
    = note: `OneFruitNonZero` must be non-null
 note: because `std::num::NonZero<u32>` must be non-null (in this field of the only potentially inhabited enum variant)
-  --> $DIR/invalid_value.rs:39:12
+  --> $DIR/invalid_value.rs:38:12
    |
-LL |     Banana(NonZeroU32),
-   |            ^^^^^^^^^^
+LL |     Banana(NonZero<u32>),
+   |            ^^^^^^^^^^^^
    = note: integers must be initialized
 
 error: the type `bool` does not permit being left uninitialized
-  --> $DIR/invalid_value.rs:112:26
+  --> $DIR/invalid_value.rs:111:26
    |
 LL |         let _val: bool = mem::uninitialized();
    |                          ^^^^^^^^^^^^^^^^^^^^
@@ -452,7 +452,7 @@ LL |         let _val: bool = mem::uninitialized();
    = note: booleans must be either `true` or `false`
 
 error: the type `Wrap<char>` does not permit being left uninitialized
-  --> $DIR/invalid_value.rs:115:32
+  --> $DIR/invalid_value.rs:114:32
    |
 LL |         let _val: Wrap<char> = mem::uninitialized();
    |                                ^^^^^^^^^^^^^^^^^^^^
@@ -462,13 +462,13 @@ LL |         let _val: Wrap<char> = mem::uninitialized();
    |
    = note: `Wrap<char>` must be initialized inside its custom valid range
 note: characters must be a valid Unicode codepoint (in this struct field)
-  --> $DIR/invalid_value.rs:17:18
+  --> $DIR/invalid_value.rs:16:18
    |
 LL | struct Wrap<T> { wrapped: T }
    |                  ^^^^^^^^^^
 
 error: the type `NonBig` does not permit being left uninitialized
-  --> $DIR/invalid_value.rs:118:28
+  --> $DIR/invalid_value.rs:117:28
    |
 LL |         let _val: NonBig = mem::uninitialized();
    |                            ^^^^^^^^^^^^^^^^^^^^
@@ -478,13 +478,13 @@ LL |         let _val: NonBig = mem::uninitialized();
    |
    = note: `NonBig` must be initialized inside its custom valid range
 note: integers must be initialized (in this struct field)
-  --> $DIR/invalid_value.rs:23:26
+  --> $DIR/invalid_value.rs:22:26
    |
 LL | pub(crate) struct NonBig(u64);
    |                          ^^^
 
 error: the type `Fruit` does not permit being left uninitialized
-  --> $DIR/invalid_value.rs:121:27
+  --> $DIR/invalid_value.rs:120:27
    |
 LL |         let _val: Fruit = mem::uninitialized();
    |                           ^^^^^^^^^^^^^^^^^^^^
@@ -493,13 +493,13 @@ LL |         let _val: Fruit = mem::uninitialized();
    |                           help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
    |
 note: enums with multiple inhabited variants have to be initialized to a variant
-  --> $DIR/invalid_value.rs:26:1
+  --> $DIR/invalid_value.rs:25:1
    |
 LL | enum Fruit {
    | ^^^^^^^^^^
 
 error: the type `[bool; 2]` does not permit being left uninitialized
-  --> $DIR/invalid_value.rs:124:31
+  --> $DIR/invalid_value.rs:123:31
    |
 LL |         let _val: [bool; 2] = mem::uninitialized();
    |                               ^^^^^^^^^^^^^^^^^^^^
@@ -510,7 +510,7 @@ LL |         let _val: [bool; 2] = mem::uninitialized();
    = note: booleans must be either `true` or `false`
 
 error: the type `i32` does not permit being left uninitialized
-  --> $DIR/invalid_value.rs:127:25
+  --> $DIR/invalid_value.rs:126:25
    |
 LL |         let _val: i32 = mem::uninitialized();
    |                         ^^^^^^^^^^^^^^^^^^^^
@@ -521,7 +521,7 @@ LL |         let _val: i32 = mem::uninitialized();
    = note: integers must be initialized
 
 error: the type `f32` does not permit being left uninitialized
-  --> $DIR/invalid_value.rs:130:25
+  --> $DIR/invalid_value.rs:129:25
    |
 LL |         let _val: f32 = mem::uninitialized();
    |                         ^^^^^^^^^^^^^^^^^^^^
@@ -532,7 +532,7 @@ LL |         let _val: f32 = mem::uninitialized();
    = note: floats must be initialized
 
 error: the type `*const ()` does not permit being left uninitialized
-  --> $DIR/invalid_value.rs:133:31
+  --> $DIR/invalid_value.rs:132:31
    |
 LL |         let _val: *const () = mem::uninitialized();
    |                               ^^^^^^^^^^^^^^^^^^^^
@@ -543,7 +543,7 @@ LL |         let _val: *const () = mem::uninitialized();
    = note: raw pointers must be initialized
 
 error: the type `*const [()]` does not permit being left uninitialized
-  --> $DIR/invalid_value.rs:136:33
+  --> $DIR/invalid_value.rs:135:33
    |
 LL |         let _val: *const [()] = mem::uninitialized();
    |                                 ^^^^^^^^^^^^^^^^^^^^
@@ -554,7 +554,7 @@ LL |         let _val: *const [()] = mem::uninitialized();
    = note: raw pointers must be initialized
 
 error: the type `WrapAroundRange` does not permit being left uninitialized
-  --> $DIR/invalid_value.rs:139:37
+  --> $DIR/invalid_value.rs:138:37
    |
 LL |         let _val: WrapAroundRange = mem::uninitialized();
    |                                     ^^^^^^^^^^^^^^^^^^^^
@@ -564,13 +564,13 @@ LL |         let _val: WrapAroundRange = mem::uninitialized();
    |
    = note: `WrapAroundRange` must be initialized inside its custom valid range
 note: integers must be initialized (in this struct field)
-  --> $DIR/invalid_value.rs:49:35
+  --> $DIR/invalid_value.rs:48:35
    |
 LL | pub(crate) struct WrapAroundRange(u8);
    |                                   ^^
 
 error: the type `Result<i32, i32>` does not permit being left uninitialized
-  --> $DIR/invalid_value.rs:144:38
+  --> $DIR/invalid_value.rs:143:38
    |
 LL |         let _val: Result<i32, i32> = mem::uninitialized();
    |                                      ^^^^^^^^^^^^^^^^^^^^
@@ -582,7 +582,7 @@ note: enums with multiple inhabited variants have to be initialized to a variant
   --> $SRC_DIR/core/src/result.rs:LL:COL
 
 error: the type `&i32` does not permit zero-initialization
-  --> $DIR/invalid_value.rs:152:34
+  --> $DIR/invalid_value.rs:151:34
    |
 LL |         let _val: &'static i32 = mem::transmute(0usize);
    |                                  ^^^^^^^^^^^^^^^^^^^^^^
@@ -593,7 +593,7 @@ LL |         let _val: &'static i32 = mem::transmute(0usize);
    = note: references must be non-null
 
 error: the type `&[i32]` does not permit zero-initialization
-  --> $DIR/invalid_value.rs:153:36
+  --> $DIR/invalid_value.rs:152:36
    |
 LL |         let _val: &'static [i32] = mem::transmute((0usize, 0usize));
    |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -604,18 +604,18 @@ LL |         let _val: &'static [i32] = mem::transmute((0usize, 0usize));
    = note: references must be non-null
 
 error: the type `NonZero<u32>` does not permit zero-initialization
-  --> $DIR/invalid_value.rs:154:32
+  --> $DIR/invalid_value.rs:153:34
    |
-LL |         let _val: NonZeroU32 = mem::transmute(0);
-   |                                ^^^^^^^^^^^^^^^^^
-   |                                |
-   |                                this code causes undefined behavior when executed
-   |                                help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
+LL |         let _val: NonZero<u32> = mem::transmute(0);
+   |                                  ^^^^^^^^^^^^^^^^^
+   |                                  |
+   |                                  this code causes undefined behavior when executed
+   |                                  help: use `MaybeUninit<T>` instead, and only call `assume_init` after initialization is done
    |
    = note: `std::num::NonZero<u32>` must be non-null
 
 error: the type `NonNull<i32>` does not permit zero-initialization
-  --> $DIR/invalid_value.rs:157:34
+  --> $DIR/invalid_value.rs:156:34
    |
 LL |         let _val: NonNull<i32> = MaybeUninit::zeroed().assume_init();
    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -626,7 +626,7 @@ LL |         let _val: NonNull<i32> = MaybeUninit::zeroed().assume_init();
    = note: `std::ptr::NonNull<i32>` must be non-null
 
 error: the type `NonNull<i32>` does not permit being left uninitialized
-  --> $DIR/invalid_value.rs:158:34
+  --> $DIR/invalid_value.rs:157:34
    |
 LL |         let _val: NonNull<i32> = MaybeUninit::uninit().assume_init();
    |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -638,7 +638,7 @@ LL |         let _val: NonNull<i32> = MaybeUninit::uninit().assume_init();
    = note: raw pointers must be initialized
 
 error: the type `bool` does not permit being left uninitialized
-  --> $DIR/invalid_value.rs:159:26
+  --> $DIR/invalid_value.rs:158:26
    |
 LL |         let _val: bool = MaybeUninit::uninit().assume_init();
    |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/lint/lint-ctypes-enum.rs b/tests/ui/lint/lint-ctypes-enum.rs
index 7c206080593..3157b6e240a 100644
--- a/tests/ui/lint/lint-ctypes-enum.rs
+++ b/tests/ui/lint/lint-ctypes-enum.rs
@@ -1,7 +1,8 @@
-#![feature(transparent_unions)]
-#![feature(ptr_internals)]
-#![deny(improper_ctypes)]
 #![allow(dead_code)]
+#![deny(improper_ctypes)]
+#![feature(generic_nonzero)]
+#![feature(ptr_internals)]
+#![feature(transparent_unions)]
 
 use std::num;
 
@@ -67,26 +68,26 @@ extern "C" {
    fn option_fn(x: Option<extern "C" fn()>);
    fn nonnull(x: Option<std::ptr::NonNull<u8>>);
    fn unique(x: Option<std::ptr::Unique<u8>>);
-   fn nonzero_u8(x: Option<num::NonZeroU8>);
-   fn nonzero_u16(x: Option<num::NonZeroU16>);
-   fn nonzero_u32(x: Option<num::NonZeroU32>);
-   fn nonzero_u64(x: Option<num::NonZeroU64>);
-   fn nonzero_u128(x: Option<num::NonZeroU128>);
+   fn nonzero_u8(x: Option<num::NonZero<u8>>);
+   fn nonzero_u16(x: Option<num::NonZero<u16>>);
+   fn nonzero_u32(x: Option<num::NonZero<u32>>);
+   fn nonzero_u64(x: Option<num::NonZero<u64>>);
+   fn nonzero_u128(x: Option<num::NonZero<u128>>);
    //~^ ERROR `extern` block uses type `u128`
-   fn nonzero_usize(x: Option<num::NonZeroUsize>);
-   fn nonzero_i8(x: Option<num::NonZeroI8>);
-   fn nonzero_i16(x: Option<num::NonZeroI16>);
-   fn nonzero_i32(x: Option<num::NonZeroI32>);
-   fn nonzero_i64(x: Option<num::NonZeroI64>);
-   fn nonzero_i128(x: Option<num::NonZeroI128>);
+   fn nonzero_usize(x: Option<num::NonZero<usize>>);
+   fn nonzero_i8(x: Option<num::NonZero<i8>>);
+   fn nonzero_i16(x: Option<num::NonZero<i16>>);
+   fn nonzero_i32(x: Option<num::NonZero<i32>>);
+   fn nonzero_i64(x: Option<num::NonZero<i64>>);
+   fn nonzero_i128(x: Option<num::NonZero<i128>>);
    //~^ ERROR `extern` block uses type `i128`
-   fn nonzero_isize(x: Option<num::NonZeroIsize>);
-   fn transparent_struct(x: Option<TransparentStruct<num::NonZeroU8>>);
-   fn transparent_enum(x: Option<TransparentEnum<num::NonZeroU8>>);
-   fn transparent_union(x: Option<TransparentUnion<num::NonZeroU8>>);
+   fn nonzero_isize(x: Option<num::NonZero<isize>>);
+   fn transparent_struct(x: Option<TransparentStruct<num::NonZero<u8>>>);
+   fn transparent_enum(x: Option<TransparentEnum<num::NonZero<u8>>>);
+   fn transparent_union(x: Option<TransparentUnion<num::NonZero<u8>>>);
    //~^ ERROR `extern` block uses type
-   fn repr_rust(x: Option<Rust<num::NonZeroU8>>); //~ ERROR `extern` block uses type
-   fn no_result(x: Result<(), num::NonZeroI32>); //~ ERROR `extern` block uses type
+   fn repr_rust(x: Option<Rust<num::NonZero<u8>>>); //~ ERROR `extern` block uses type
+   fn no_result(x: Result<(), num::NonZero<i32>>); //~ ERROR `extern` block uses type
 }
 
 pub fn main() {}
diff --git a/tests/ui/lint/lint-ctypes-enum.stderr b/tests/ui/lint/lint-ctypes-enum.stderr
index 64beefbb757..48be3eb5a56 100644
--- a/tests/ui/lint/lint-ctypes-enum.stderr
+++ b/tests/ui/lint/lint-ctypes-enum.stderr
@@ -1,5 +1,5 @@
 error: `extern` block uses type `U`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:60:13
+  --> $DIR/lint-ctypes-enum.rs:61:13
    |
 LL |    fn uf(x: U);
    |             ^ not FFI-safe
@@ -7,18 +7,18 @@ LL |    fn uf(x: U);
    = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
    = note: enum has no representation hint
 note: the type is defined here
-  --> $DIR/lint-ctypes-enum.rs:9:1
+  --> $DIR/lint-ctypes-enum.rs:10:1
    |
 LL | enum U {
    | ^^^^^^
 note: the lint level is defined here
-  --> $DIR/lint-ctypes-enum.rs:3:9
+  --> $DIR/lint-ctypes-enum.rs:2:9
    |
 LL | #![deny(improper_ctypes)]
    |         ^^^^^^^^^^^^^^^
 
 error: `extern` block uses type `B`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:61:13
+  --> $DIR/lint-ctypes-enum.rs:62:13
    |
 LL |    fn bf(x: B);
    |             ^ not FFI-safe
@@ -26,13 +26,13 @@ LL |    fn bf(x: B);
    = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
    = note: enum has no representation hint
 note: the type is defined here
-  --> $DIR/lint-ctypes-enum.rs:12:1
+  --> $DIR/lint-ctypes-enum.rs:13:1
    |
 LL | enum B {
    | ^^^^^^
 
 error: `extern` block uses type `T`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:62:13
+  --> $DIR/lint-ctypes-enum.rs:63:13
    |
 LL |    fn tf(x: T);
    |             ^ not FFI-safe
@@ -40,50 +40,50 @@ LL |    fn tf(x: T);
    = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
    = note: enum has no representation hint
 note: the type is defined here
-  --> $DIR/lint-ctypes-enum.rs:16:1
+  --> $DIR/lint-ctypes-enum.rs:17:1
    |
 LL | enum T {
    | ^^^^^^
 
 error: `extern` block uses type `u128`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:74:23
+  --> $DIR/lint-ctypes-enum.rs:75:23
    |
-LL |    fn nonzero_u128(x: Option<num::NonZeroU128>);
-   |                       ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
+LL |    fn nonzero_u128(x: Option<num::NonZero<u128>>);
+   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
    |
    = note: 128-bit integers don't currently have a known stable ABI
 
 error: `extern` block uses type `i128`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:81:23
+  --> $DIR/lint-ctypes-enum.rs:82:23
    |
-LL |    fn nonzero_i128(x: Option<num::NonZeroI128>);
-   |                       ^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
+LL |    fn nonzero_i128(x: Option<num::NonZero<i128>>);
+   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
    |
    = note: 128-bit integers don't currently have a known stable ABI
 
 error: `extern` block uses type `Option<TransparentUnion<NonZero<u8>>>`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:86:28
+  --> $DIR/lint-ctypes-enum.rs:87:28
    |
-LL |    fn transparent_union(x: Option<TransparentUnion<num::NonZeroU8>>);
-   |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
+LL |    fn transparent_union(x: Option<TransparentUnion<num::NonZero<u8>>>);
+   |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
    |
    = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
    = note: enum has no representation hint
 
 error: `extern` block uses type `Option<Rust<NonZero<u8>>>`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:88:20
+  --> $DIR/lint-ctypes-enum.rs:89:20
    |
-LL |    fn repr_rust(x: Option<Rust<num::NonZeroU8>>);
-   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
+LL |    fn repr_rust(x: Option<Rust<num::NonZero<u8>>>);
+   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
    |
    = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
    = note: enum has no representation hint
 
 error: `extern` block uses type `Result<(), NonZero<i32>>`, which is not FFI-safe
-  --> $DIR/lint-ctypes-enum.rs:89:20
+  --> $DIR/lint-ctypes-enum.rs:90:20
    |
-LL |    fn no_result(x: Result<(), num::NonZeroI32>);
-   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
+LL |    fn no_result(x: Result<(), num::NonZero<i32>>);
+   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not FFI-safe
    |
    = help: consider adding a `#[repr(C)]`, `#[repr(transparent)]`, or integer `#[repr(...)]` attribute to this enum
    = note: enum has no representation hint
diff --git a/tests/ui/lint/non_local_definitions.rs b/tests/ui/lint/non_local_definitions.rs
new file mode 100644
index 00000000000..c9aaa049346
--- /dev/null
+++ b/tests/ui/lint/non_local_definitions.rs
@@ -0,0 +1,385 @@
+//@ check-pass
+//@ edition:2021
+//@ aux-build:non_local_macro.rs
+//@ rustc-env:CARGO=/usr/bin/cargo
+
+#![feature(inline_const)]
+
+extern crate non_local_macro;
+
+use std::fmt::{Debug, Display};
+
+struct Test;
+
+impl Debug for Test {
+    fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        todo!()
+    }
+}
+
+mod do_not_lint_mod {
+    pub trait Tait {}
+
+    impl super::Test {
+        fn hugo() {}
+    }
+
+    impl Tait for super::Test {}
+}
+
+trait Uto {}
+const Z: () = {
+    trait Uto1 {}
+
+    impl Uto1 for Test {} // the trait is local, don't lint
+
+    impl Uto for &Test {}
+    //~^ WARN non-local `impl` definition
+};
+
+trait Ano {}
+const _: () = {
+    impl Ano for &Test {} // ignored since the parent is an anon-const
+};
+
+type A = [u32; {
+    impl Uto for *mut Test {}
+    //~^ WARN non-local `impl` definition
+
+    1
+}];
+
+enum Enum {
+    Discr = {
+        impl Uto for Test {}
+        //~^ WARN non-local `impl` definition
+
+        1
+    }
+}
+
+trait Uto2 {}
+static A: u32 = {
+    impl Uto2 for Test {}
+    //~^ WARN non-local `impl` definition
+
+    1
+};
+
+trait Uto3 {}
+const B: u32 = {
+    impl Uto3 for Test {}
+    //~^ WARN non-local `impl` definition
+
+    #[macro_export]
+    macro_rules! m0 { () => { } };
+    //~^ WARN non-local `macro_rules!` definition
+
+    trait Uto4 {}
+    impl Uto4 for Test {}
+
+    1
+};
+
+trait Uto5 {}
+fn main() {
+    #[macro_export]
+    macro_rules! m { () => { } };
+    //~^ WARN non-local `macro_rules!` definition
+
+    impl Test {
+    //~^ WARN non-local `impl` definition
+        fn foo() {}
+    }
+
+    let _array = [0i32; {
+        impl Test {
+        //~^ WARN non-local `impl` definition
+            fn bar() {}
+        }
+
+        1
+    }];
+
+    const {
+        impl Test {
+        //~^ WARN non-local `impl` definition
+            fn hoo() {}
+        }
+
+        1
+    };
+
+    const _: u32 = {
+        impl Test {
+        //~^ WARN non-local `impl` definition
+            fn foo2() {}
+        }
+
+        1
+    };
+
+    impl Display for Test {
+    //~^ WARN non-local `impl` definition
+        fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+            todo!()
+        }
+    }
+
+    impl dyn Uto5 {}
+    //~^ WARN non-local `impl` definition
+
+    impl<T: Uto5> Uto5 for Vec<T> { }
+    //~^ WARN non-local `impl` definition
+
+    impl Uto5 for &dyn Uto5 {}
+    //~^ WARN non-local `impl` definition
+
+    impl Uto5 for *mut Test {}
+    //~^ WARN non-local `impl` definition
+
+    impl Uto5 for *mut [Test] {}
+    //~^ WARN non-local `impl` definition
+
+    impl Uto5 for [Test; 8] {}
+    //~^ WARN non-local `impl` definition
+
+    impl Uto5 for (Test,) {}
+    //~^ WARN non-local `impl` definition
+
+    impl Uto5 for fn(Test) -> () {}
+    //~^ WARN non-local `impl` definition
+
+    impl Uto5 for fn() -> Test {}
+    //~^ WARN non-local `impl` definition
+
+    let _a = || {
+        impl Uto5 for Test {}
+        //~^ WARN non-local `impl` definition
+
+        1
+    };
+
+    type A = [u32; {
+        impl Uto5 for &Test {}
+        //~^ WARN non-local `impl` definition
+
+        1
+    }];
+
+    fn a(_: [u32; {
+        impl Uto5 for &(Test,) {}
+        //~^ WARN non-local `impl` definition
+
+        1
+    }]) {}
+
+    fn b() -> [u32; {
+        impl Uto5 for &(Test,Test) {}
+        //~^ WARN non-local `impl` definition
+
+        1
+    }] { todo!() }
+
+    struct InsideMain;
+
+    impl Uto5 for *mut InsideMain {}
+    //~^ WARN non-local `impl` definition
+    impl Uto5 for *mut [InsideMain] {}
+    //~^ WARN non-local `impl` definition
+    impl Uto5 for [InsideMain; 8] {}
+    //~^ WARN non-local `impl` definition
+    impl Uto5 for (InsideMain,) {}
+    //~^ WARN non-local `impl` definition
+    impl Uto5 for fn(InsideMain) -> () {}
+    //~^ WARN non-local `impl` definition
+    impl Uto5 for fn() -> InsideMain {}
+    //~^ WARN non-local `impl` definition
+
+    impl Debug for InsideMain {
+        fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+            todo!()
+        }
+    }
+
+    impl InsideMain {
+        fn foo() {}
+    }
+
+    fn inside_inside() {
+        impl Display for InsideMain {
+        //~^ WARN non-local `impl` definition
+            fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+                todo!()
+            }
+        }
+
+        impl InsideMain {
+        //~^ WARN non-local `impl` definition
+            fn bar() {
+                #[macro_export]
+                macro_rules! m2 { () => { } };
+                //~^ WARN non-local `macro_rules!` definition
+            }
+        }
+    }
+
+    trait Uto6 {}
+    impl dyn Uto6 {}
+    impl Uto5 for dyn Uto6 {}
+
+    impl<T: Uto6> Uto3 for Vec<T> { }
+    //~^ WARN non-local `impl` definition
+}
+
+trait Uto7 {}
+trait Uto8 {}
+
+fn bad() {
+    struct Local;
+    impl Uto7 for Test where Local: std::any::Any {}
+    //~^ WARN non-local `impl` definition
+
+    impl<T> Uto8 for T {}
+    //~^ WARN non-local `impl` definition
+}
+
+struct UwU<T>(T);
+
+fn fun() {
+    #[derive(Debug)]
+    struct OwO;
+    impl Default for UwU<OwO> {
+    //~^ WARN non-local `impl` definition
+        fn default() -> Self {
+            UwU(OwO)
+        }
+    }
+}
+
+struct Cat;
+
+fn meow() {
+    impl From<Cat> for () {
+    //~^ WARN non-local `impl` definition
+        fn from(_: Cat) -> () {
+            todo!()
+        }
+    }
+
+    #[derive(Debug)]
+    struct Cat;
+    impl AsRef<Cat> for () {
+    //~^ WARN non-local `impl` definition
+        fn as_ref(&self) -> &Cat { &Cat }
+    }
+}
+
+struct G;
+
+fn fun2() {
+    #[derive(Debug, Default)]
+    struct B;
+    impl PartialEq<B> for G {
+    //~^ WARN non-local `impl` definition
+        fn eq(&self, _: &B) -> bool {
+            true
+        }
+    }
+}
+
+fn side_effects() {
+    dbg!(().as_ref()); // prints `Cat`
+    dbg!(UwU::default().0);
+    let _ = G::eq(&G, dbg!(&<_>::default()));
+}
+
+struct Dog;
+
+fn woof() {
+    impl PartialEq<Dog> for &Dog {
+    //~^ WARN non-local `impl` definition
+        fn eq(&self, _: &Dog) -> bool {
+            todo!()
+        }
+    }
+
+    impl PartialEq<()> for Dog {
+    //~^ WARN non-local `impl` definition
+        fn eq(&self, _: &()) -> bool {
+            todo!()
+        }
+    }
+
+    impl PartialEq<()> for &Dog {
+    //~^ WARN non-local `impl` definition
+        fn eq(&self, _: &()) -> bool {
+            todo!()
+        }
+    }
+
+    impl PartialEq<Dog> for () {
+    //~^ WARN non-local `impl` definition
+        fn eq(&self, _: &Dog) -> bool {
+            todo!()
+        }
+    }
+
+    struct Test;
+    impl PartialEq<Dog> for Test {
+        fn eq(&self, _: &Dog) -> bool {
+            todo!()
+        }
+    }
+}
+
+struct Wrap<T>(T);
+
+impl Wrap<Wrap<Wrap<()>>> {}
+
+fn rawr() {
+    struct Lion;
+
+    impl From<Wrap<Wrap<Lion>>> for () {
+    //~^ WARN non-local `impl` definition
+        fn from(_: Wrap<Wrap<Lion>>) -> Self {
+            todo!()
+        }
+    }
+
+    impl From<()> for Wrap<Lion> {
+    //~^ WARN non-local `impl` definition
+        fn from(_: ()) -> Self {
+            todo!()
+        }
+    }
+}
+
+macro_rules! m {
+    () => {
+        trait MacroTrait {}
+        struct OutsideStruct;
+        fn my_func() {
+            impl MacroTrait for OutsideStruct {}
+            //~^ WARN non-local `impl` definition
+        }
+    }
+}
+
+m!();
+
+struct CargoUpdate;
+
+non_local_macro::non_local_impl!(CargoUpdate);
+//~^ WARN non-local `impl` definition
+
+non_local_macro::non_local_macro_rules!(my_macro);
+//~^ WARN non-local `macro_rules!` definition
+
+fn bitflags() {
+    struct Flags;
+
+    const _: () = {
+        impl Flags {}
+    };
+}
diff --git a/tests/ui/lint/non_local_definitions.stderr b/tests/ui/lint/non_local_definitions.stderr
new file mode 100644
index 00000000000..f9f29ec63a8
--- /dev/null
+++ b/tests/ui/lint/non_local_definitions.stderr
@@ -0,0 +1,640 @@
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:36:5
+   |
+LL | const Z: () = {
+   |       - help: use a const-anon item to suppress this lint: `_`
+...
+LL |     impl Uto for &Test {}
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: move this `impl` block outside the of the current constant `Z`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+   = note: `#[warn(non_local_definitions)]` on by default
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:46:5
+   |
+LL |     impl Uto for *mut Test {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: move this `impl` block outside the of the current constant expression `<unnameable>`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:54:9
+   |
+LL |         impl Uto for Test {}
+   |         ^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: move this `impl` block outside the of the current constant expression `<unnameable>`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:63:5
+   |
+LL |     impl Uto2 for Test {}
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: move this `impl` block outside the of the current static `A`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:71:5
+   |
+LL |     impl Uto3 for Test {}
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: move this `impl` block outside the of the current constant `B`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `macro_rules!` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:75:5
+   |
+LL |     macro_rules! m0 { () => { } };
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: remove the `#[macro_export]` or move this `macro_rules!` outside the of the current constant `B`
+   = note: a `macro_rules!` definition is non-local if it is nested inside an item and has a `#[macro_export]` attribute
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `macro_rules!` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:87:5
+   |
+LL |     macro_rules! m { () => { } };
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: remove the `#[macro_export]` or move this `macro_rules!` outside the of the current function `main`
+   = note: a `macro_rules!` definition is non-local if it is nested inside an item and has a `#[macro_export]` attribute
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:90:5
+   |
+LL | /     impl Test {
+LL | |
+LL | |         fn foo() {}
+LL | |     }
+   | |_____^
+   |
+   = help: move this `impl` block outside the of the current function `main`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:96:9
+   |
+LL | /         impl Test {
+LL | |
+LL | |             fn bar() {}
+LL | |         }
+   | |_________^
+   |
+   = help: move this `impl` block outside the of the current constant expression `<unnameable>` and up 2 bodies
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:105:9
+   |
+LL | /         impl Test {
+LL | |
+LL | |             fn hoo() {}
+LL | |         }
+   | |_________^
+   |
+   = help: move this `impl` block outside the of the current inline constant `<unnameable>` and up 2 bodies
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:114:9
+   |
+LL | /         impl Test {
+LL | |
+LL | |             fn foo2() {}
+LL | |         }
+   | |_________^
+   |
+   = help: move this `impl` block outside the of the current constant `_` and up 2 bodies
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:122:5
+   |
+LL | /     impl Display for Test {
+LL | |
+LL | |         fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+LL | |             todo!()
+LL | |         }
+LL | |     }
+   | |_____^
+   |
+   = help: move this `impl` block outside the of the current function `main`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:129:5
+   |
+LL |     impl dyn Uto5 {}
+   |     ^^^^^^^^^^^^^^^^
+   |
+   = help: move this `impl` block outside the of the current function `main`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:132:5
+   |
+LL |     impl<T: Uto5> Uto5 for Vec<T> { }
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: move this `impl` block outside the of the current function `main`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:135:5
+   |
+LL |     impl Uto5 for &dyn Uto5 {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: move this `impl` block outside the of the current function `main`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:138:5
+   |
+LL |     impl Uto5 for *mut Test {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: move this `impl` block outside the of the current function `main`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:141:5
+   |
+LL |     impl Uto5 for *mut [Test] {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: move this `impl` block outside the of the current function `main`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:144:5
+   |
+LL |     impl Uto5 for [Test; 8] {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: move this `impl` block outside the of the current function `main`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:147:5
+   |
+LL |     impl Uto5 for (Test,) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: move this `impl` block outside the of the current function `main`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:150:5
+   |
+LL |     impl Uto5 for fn(Test) -> () {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: move this `impl` block outside the of the current function `main`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:153:5
+   |
+LL |     impl Uto5 for fn() -> Test {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: move this `impl` block outside the of the current function `main`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:157:9
+   |
+LL |         impl Uto5 for Test {}
+   |         ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: move this `impl` block outside the of the current closure `<unnameable>` and up 2 bodies
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:164:9
+   |
+LL |         impl Uto5 for &Test {}
+   |         ^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: move this `impl` block outside the of the current constant expression `<unnameable>` and up 2 bodies
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:171:9
+   |
+LL |         impl Uto5 for &(Test,) {}
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: move this `impl` block outside the of the current constant expression `<unnameable>` and up 2 bodies
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:178:9
+   |
+LL |         impl Uto5 for &(Test,Test) {}
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: move this `impl` block outside the of the current constant expression `<unnameable>` and up 2 bodies
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:186:5
+   |
+LL |     impl Uto5 for *mut InsideMain {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: move this `impl` block outside the of the current function `main`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:188:5
+   |
+LL |     impl Uto5 for *mut [InsideMain] {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: move this `impl` block outside the of the current function `main`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:190:5
+   |
+LL |     impl Uto5 for [InsideMain; 8] {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: move this `impl` block outside the of the current function `main`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:192:5
+   |
+LL |     impl Uto5 for (InsideMain,) {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: move this `impl` block outside the of the current function `main`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:194:5
+   |
+LL |     impl Uto5 for fn(InsideMain) -> () {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: move this `impl` block outside the of the current function `main`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:196:5
+   |
+LL |     impl Uto5 for fn() -> InsideMain {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: move this `impl` block outside the of the current function `main`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:210:9
+   |
+LL | /         impl Display for InsideMain {
+LL | |
+LL | |             fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+LL | |                 todo!()
+LL | |             }
+LL | |         }
+   | |_________^
+   |
+   = help: move this `impl` block outside the of the current function `inside_inside` and up 2 bodies
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:217:9
+   |
+LL | /         impl InsideMain {
+LL | |
+LL | |             fn bar() {
+LL | |                 #[macro_export]
+...  |
+LL | |             }
+LL | |         }
+   | |_________^
+   |
+   = help: move this `impl` block outside the of the current function `inside_inside` and up 2 bodies
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `macro_rules!` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:221:17
+   |
+LL |                 macro_rules! m2 { () => { } };
+   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: remove the `#[macro_export]` or move this `macro_rules!` outside the of the current associated function `bar` and up 3 bodies
+   = note: a `macro_rules!` definition is non-local if it is nested inside an item and has a `#[macro_export]` attribute
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:231:5
+   |
+LL |     impl<T: Uto6> Uto3 for Vec<T> { }
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: move this `impl` block outside the of the current function `main`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:240:5
+   |
+LL |     impl Uto7 for Test where Local: std::any::Any {}
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: move this `impl` block outside the of the current function `bad`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:243:5
+   |
+LL |     impl<T> Uto8 for T {}
+   |     ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: move this `impl` block outside the of the current function `bad`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:252:5
+   |
+LL | /     impl Default for UwU<OwO> {
+LL | |
+LL | |         fn default() -> Self {
+LL | |             UwU(OwO)
+LL | |         }
+LL | |     }
+   | |_____^
+   |
+   = help: move this `impl` block outside the of the current function `fun`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:263:5
+   |
+LL | /     impl From<Cat> for () {
+LL | |
+LL | |         fn from(_: Cat) -> () {
+LL | |             todo!()
+LL | |         }
+LL | |     }
+   | |_____^
+   |
+   = help: move this `impl` block outside the of the current function `meow`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:272:5
+   |
+LL | /     impl AsRef<Cat> for () {
+LL | |
+LL | |         fn as_ref(&self) -> &Cat { &Cat }
+LL | |     }
+   | |_____^
+   |
+   = help: move this `impl` block outside the of the current function `meow`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:283:5
+   |
+LL | /     impl PartialEq<B> for G {
+LL | |
+LL | |         fn eq(&self, _: &B) -> bool {
+LL | |             true
+LL | |         }
+LL | |     }
+   | |_____^
+   |
+   = help: move this `impl` block outside the of the current function `fun2`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:300:5
+   |
+LL | /     impl PartialEq<Dog> for &Dog {
+LL | |
+LL | |         fn eq(&self, _: &Dog) -> bool {
+LL | |             todo!()
+LL | |         }
+LL | |     }
+   | |_____^
+   |
+   = help: move this `impl` block outside the of the current function `woof`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:307:5
+   |
+LL | /     impl PartialEq<()> for Dog {
+LL | |
+LL | |         fn eq(&self, _: &()) -> bool {
+LL | |             todo!()
+LL | |         }
+LL | |     }
+   | |_____^
+   |
+   = help: move this `impl` block outside the of the current function `woof`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:314:5
+   |
+LL | /     impl PartialEq<()> for &Dog {
+LL | |
+LL | |         fn eq(&self, _: &()) -> bool {
+LL | |             todo!()
+LL | |         }
+LL | |     }
+   | |_____^
+   |
+   = help: move this `impl` block outside the of the current function `woof`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:321:5
+   |
+LL | /     impl PartialEq<Dog> for () {
+LL | |
+LL | |         fn eq(&self, _: &Dog) -> bool {
+LL | |             todo!()
+LL | |         }
+LL | |     }
+   | |_____^
+   |
+   = help: move this `impl` block outside the of the current function `woof`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:343:5
+   |
+LL | /     impl From<Wrap<Wrap<Lion>>> for () {
+LL | |
+LL | |         fn from(_: Wrap<Wrap<Lion>>) -> Self {
+LL | |             todo!()
+LL | |         }
+LL | |     }
+   | |_____^
+   |
+   = help: move this `impl` block outside the of the current function `rawr`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:350:5
+   |
+LL | /     impl From<()> for Wrap<Lion> {
+LL | |
+LL | |         fn from(_: ()) -> Self {
+LL | |             todo!()
+LL | |         }
+LL | |     }
+   | |_____^
+   |
+   = help: move this `impl` block outside the of the current function `rawr`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:363:13
+   |
+LL |             impl MacroTrait for OutsideStruct {}
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | m!();
+   | ---- in this macro invocation
+   |
+   = help: move this `impl` block outside the of the current function `my_func`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+   = note: this warning originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+warning: non-local `impl` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:373:1
+   |
+LL | non_local_macro::non_local_impl!(CargoUpdate);
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: move this `impl` block outside the of the current constant `_IMPL_DEBUG`
+   = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+   = note: the macro `non_local_macro::non_local_impl` may come from an old version of the `non_local_macro` crate, try updating your dependency with `cargo update -p non_local_macro`
+   = note: this warning originates in the macro `non_local_macro::non_local_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+warning: non-local `macro_rules!` definition, they should be avoided as they go against expectation
+  --> $DIR/non_local_definitions.rs:376:1
+   |
+LL | non_local_macro::non_local_macro_rules!(my_macro);
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: remove the `#[macro_export]` or move this `macro_rules!` outside the of the current constant `_MACRO_EXPORT`
+   = note: a `macro_rules!` definition is non-local if it is nested inside an item and has a `#[macro_export]` attribute
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+   = note: the macro `non_local_macro::non_local_macro_rules` may come from an old version of the `non_local_macro` crate, try updating your dependency with `cargo update -p non_local_macro`
+   = note: this warning originates in the macro `non_local_macro::non_local_macro_rules` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+warning: 50 warnings emitted
+
diff --git a/tests/ui/macros/type-macros-simple.rs b/tests/ui/macros/type-macros-simple.rs
index 4d1001baf59..d189b881f7d 100644
--- a/tests/ui/macros/type-macros-simple.rs
+++ b/tests/ui/macros/type-macros-simple.rs
@@ -1,6 +1,8 @@
 //@ run-pass
 #![allow(dead_code)]
 #![allow(unused_variables)]
+#![allow(non_local_definitions)]
+
 macro_rules! Tuple {
     { $A:ty,$B:ty } => { ($A, $B) }
 }
diff --git a/tests/ui/match/issue-72896-non-partial-eq-const.rs b/tests/ui/match/issue-72896-non-partial-eq-const.rs
index d4972714608..f15eae83896 100644
--- a/tests/ui/match/issue-72896-non-partial-eq-const.rs
+++ b/tests/ui/match/issue-72896-non-partial-eq-const.rs
@@ -1,4 +1,3 @@
-//@ run-pass
 trait EnumSetType {
     type Repr;
 }
@@ -17,8 +16,7 @@ const CONST_SET: EnumSet<Enum8> = EnumSet { __enumset_underlying: 3 };
 
 fn main() {
     match CONST_SET {
-        CONST_SET => { /* ok */ } //~WARN: must implement `PartialEq`
-        //~| previously accepted
+        CONST_SET => { /* ok */ } //~ERROR: must implement `PartialEq`
         _ => panic!("match fell through?"),
     }
 }
diff --git a/tests/ui/match/issue-72896-non-partial-eq-const.stderr b/tests/ui/match/issue-72896-non-partial-eq-const.stderr
index a7fc0cfc054..4155586c160 100644
--- a/tests/ui/match/issue-72896-non-partial-eq-const.stderr
+++ b/tests/ui/match/issue-72896-non-partial-eq-const.stderr
@@ -1,23 +1,8 @@
-warning: to use a constant of type `EnumSet<Enum8>` in a pattern, the type must implement `PartialEq`
-  --> $DIR/issue-72896-non-partial-eq-const.rs:20:9
+error: to use a constant of type `EnumSet<Enum8>` in a pattern, the type must implement `PartialEq`
+  --> $DIR/issue-72896-non-partial-eq-const.rs:19:9
    |
 LL |         CONST_SET => { /* ok */ }
    |         ^^^^^^^^^
-   |
-   = 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 #116122 <https://github.com/rust-lang/rust/issues/116122>
-   = note: `#[warn(const_patterns_without_partial_eq)]` on by default
-
-warning: 1 warning emitted
 
-Future incompatibility report: Future breakage diagnostic:
-warning: to use a constant of type `EnumSet<Enum8>` in a pattern, the type must implement `PartialEq`
-  --> $DIR/issue-72896-non-partial-eq-const.rs:20:9
-   |
-LL |         CONST_SET => { /* ok */ }
-   |         ^^^^^^^^^
-   |
-   = 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 #116122 <https://github.com/rust-lang/rust/issues/116122>
-   = note: `#[warn(const_patterns_without_partial_eq)]` on by default
+error: aborting due to 1 previous error
 
diff --git a/tests/ui/numbers-arithmetic/overflowing-neg-nonzero.rs b/tests/ui/numbers-arithmetic/overflowing-neg-nonzero.rs
index dc3b6c280f3..bda5cef979e 100644
--- a/tests/ui/numbers-arithmetic/overflowing-neg-nonzero.rs
+++ b/tests/ui/numbers-arithmetic/overflowing-neg-nonzero.rs
@@ -2,11 +2,11 @@
 //@ error-pattern:attempt to negate with overflow
 //@ ignore-emscripten no processes
 //@ compile-flags: -C debug-assertions
-
 #![allow(arithmetic_overflow)]
+#![feature(generic_nonzero)]
 
-use std::num::NonZeroI8;
+use std::num::NonZero;
 
 fn main() {
-    let _x = -NonZeroI8::new(i8::MIN).unwrap();
+    let _x = -NonZero::new(i8::MIN).unwrap();
 }
diff --git a/tests/ui/packed/issue-46152.rs b/tests/ui/packed/issue-46152.rs
index e38b445107b..5b2e4bbfdf2 100644
--- a/tests/ui/packed/issue-46152.rs
+++ b/tests/ui/packed/issue-46152.rs
@@ -1,6 +1,7 @@
 //@ run-pass
 #![allow(dead_code)]
 #![allow(unused_variables)]
+#![allow(non_local_definitions)]
 #![feature(unsize, coerce_unsized)]
 
 #[repr(packed)]
diff --git a/tests/ui/print_type_sizes/niche-filling.rs b/tests/ui/print_type_sizes/niche-filling.rs
index da11f0c0121..07da1cff27a 100644
--- a/tests/ui/print_type_sizes/niche-filling.rs
+++ b/tests/ui/print_type_sizes/niche-filling.rs
@@ -1,24 +1,24 @@
+//! This file illustrates how niche-filling enums are handled,
+//! modelled after cases like `Option<&u32>`, `Option<bool>` and such.
+//!
+//! It uses `NonZero<u32>` rather than `&_` or `Unique<_>`, because
+//! the test is not set up to deal with target-dependent pointer width.
+//!
+//! It avoids using `u64`/`i64` because on some targets that is only 4-byte
+//! aligned (while on most it is 8-byte aligned) and so the resulting
+//! padding and overall computed sizes can be quite different.
+//!
 //@ compile-flags: -Z print-type-sizes --crate-type lib
 //@ ignore-debug: debug assertions will print more types
 //@ build-pass
 //@ ignore-pass
-// ^-- needed because `--pass check` does not emit the output needed.
-//     FIXME: consider using an attribute instead of side-effects.
-
-// This file illustrates how niche-filling enums are handled,
-// modelled after cases like `Option<&u32>`, `Option<bool>` and such.
-//
-// It uses NonZeroU32 rather than `&_` or `Unique<_>`, because
-// the test is not set up to deal with target-dependent pointer width.
-//
-// It avoids using u64/i64 because on some targets that is only 4-byte
-// aligned (while on most it is 8-byte aligned) and so the resulting
-// padding and overall computed sizes can be quite different.
-
-#![feature(rustc_attrs)]
+//  ^-- needed because `--pass check` does not emit the output needed.
+//      FIXME: consider using an attribute instead of side-effects.
 #![allow(dead_code)]
+#![feature(generic_nonzero)]
+#![feature(rustc_attrs)]
 
-use std::num::NonZeroU32;
+use std::num::NonZero;
 
 pub enum MyOption<T> { None, Some(T) }
 
@@ -34,7 +34,7 @@ impl<T> Default for MyOption<T> {
 
 pub enum EmbeddedDiscr {
     None,
-    Record { pre: u8, val: NonZeroU32, post: u16 },
+    Record { pre: u8, val: NonZero<u32>, post: u16 },
 }
 
 impl Default for EmbeddedDiscr {
@@ -50,13 +50,13 @@ pub struct IndirectNonZero {
 
 pub struct NestedNonZero {
     pre: u8,
-    val: NonZeroU32,
+    val: NonZero<u32>,
     post: u16,
 }
 
 impl Default for NestedNonZero {
     fn default() -> Self {
-        NestedNonZero { pre: 0, val: unsafe { NonZeroU32::new_unchecked(1) }, post: 0 }
+        NestedNonZero { pre: 0, val: unsafe { NonZero::new_unchecked(1) }, post: 0 }
     }
 }
 
@@ -77,7 +77,7 @@ pub union Union2<A: Copy, B: Copy> {
 }
 
 pub fn test() {
-    let _x: MyOption<NonZeroU32> = Default::default();
+    let _x: MyOption<NonZero<u32>> = Default::default();
     let _y: EmbeddedDiscr = Default::default();
     let _z: MyOption<IndirectNonZero> = Default::default();
     let _a: MyOption<bool> = Default::default();
@@ -90,9 +90,9 @@ pub fn test() {
     let _h: MyOption<MyNotNegativeOne> = Default::default();
 
     // Unions do not currently participate in niche filling.
-    let _i: MyOption<Union2<NonZeroU32, u32>> = Default::default();
+    let _i: MyOption<Union2<NonZero<u32>, u32>> = Default::default();
 
     // ...even when theoretically possible.
-    let _j: MyOption<Union1<NonZeroU32>> = Default::default();
-    let _k: MyOption<Union2<NonZeroU32, NonZeroU32>> = Default::default();
+    let _j: MyOption<Union1<NonZero<u32>>> = Default::default();
+    let _k: MyOption<Union2<NonZero<u32>, NonZero<u32>>> = Default::default();
 }
diff --git a/tests/ui/privacy/associated-item-privacy-trait.rs b/tests/ui/privacy/associated-item-privacy-trait.rs
index f038ae9e261..655d892e244 100644
--- a/tests/ui/privacy/associated-item-privacy-trait.rs
+++ b/tests/ui/privacy/associated-item-privacy-trait.rs
@@ -1,5 +1,5 @@
 #![feature(decl_macro, associated_type_defaults)]
-#![allow(private_interfaces, private_bounds)]
+#![allow(private_interfaces, private_bounds, non_local_definitions)]
 
 mod priv_trait {
     trait PrivTr {
diff --git a/tests/ui/privacy/private-in-public-non-principal.rs b/tests/ui/privacy/private-in-public-non-principal.rs
index e348a181651..8dc90919bc9 100644
--- a/tests/ui/privacy/private-in-public-non-principal.rs
+++ b/tests/ui/privacy/private-in-public-non-principal.rs
@@ -1,5 +1,6 @@
 #![feature(auto_traits)]
 #![feature(negative_impls)]
+#![allow(non_local_definitions)]
 
 pub trait PubPrincipal {}
 auto trait PrivNonPrincipal {}
diff --git a/tests/ui/privacy/private-in-public-non-principal.stderr b/tests/ui/privacy/private-in-public-non-principal.stderr
index 73f2249bc6c..5aa08d3f071 100644
--- a/tests/ui/privacy/private-in-public-non-principal.stderr
+++ b/tests/ui/privacy/private-in-public-non-principal.stderr
@@ -1,24 +1,24 @@
 warning: trait `PrivNonPrincipal` is more private than the item `leak_dyn_nonprincipal`
-  --> $DIR/private-in-public-non-principal.rs:7:1
+  --> $DIR/private-in-public-non-principal.rs:8:1
    |
 LL | pub fn leak_dyn_nonprincipal() -> Box<dyn PubPrincipal + PrivNonPrincipal> { loop {} }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function `leak_dyn_nonprincipal` is reachable at visibility `pub`
    |
 note: but trait `PrivNonPrincipal` is only usable at visibility `pub(crate)`
-  --> $DIR/private-in-public-non-principal.rs:5:1
+  --> $DIR/private-in-public-non-principal.rs:6:1
    |
 LL | auto trait PrivNonPrincipal {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: `#[warn(private_interfaces)]` on by default
 
 error: missing documentation for an associated function
-  --> $DIR/private-in-public-non-principal.rs:13:9
+  --> $DIR/private-in-public-non-principal.rs:14:9
    |
 LL |         pub fn check_doc_lint() {}
    |         ^^^^^^^^^^^^^^^^^^^^^^^
    |
 note: the lint level is defined here
-  --> $DIR/private-in-public-non-principal.rs:10:8
+  --> $DIR/private-in-public-non-principal.rs:11:8
    |
 LL | #[deny(missing_docs)]
    |        ^^^^^^^^^^^^
diff --git a/tests/ui/proc-macro/nested-macro-rules.rs b/tests/ui/proc-macro/nested-macro-rules.rs
index bb25b97df50..0dce3c408c2 100644
--- a/tests/ui/proc-macro/nested-macro-rules.rs
+++ b/tests/ui/proc-macro/nested-macro-rules.rs
@@ -19,5 +19,6 @@ fn main() {
     nested_macro_rules::inner_macro!(print_bang, print_attr);
 
     nested_macro_rules::outer_macro!(SecondStruct, SecondAttrStruct);
+    //~^ WARN non-local `macro_rules!` definition
     inner_macro!(print_bang, print_attr);
 }
diff --git a/tests/ui/proc-macro/nested-macro-rules.stderr b/tests/ui/proc-macro/nested-macro-rules.stderr
new file mode 100644
index 00000000000..111be882771
--- /dev/null
+++ b/tests/ui/proc-macro/nested-macro-rules.stderr
@@ -0,0 +1,27 @@
+warning: non-local `macro_rules!` definition, they should be avoided as they go against expectation
+  --> $DIR/auxiliary/nested-macro-rules.rs:7:9
+   |
+LL |   macro_rules! outer_macro {
+   |   ------------------------ in this expansion of `nested_macro_rules::outer_macro!`
+...
+LL | /         macro_rules! inner_macro {
+LL | |             ($bang_macro:ident, $attr_macro:ident) => {
+LL | |                 $bang_macro!($name);
+LL | |                 #[$attr_macro] struct $attr_struct_name {}
+LL | |             }
+LL | |         }
+   | |_________^
+   |
+  ::: $DIR/nested-macro-rules.rs:21:5
+   |
+LL |       nested_macro_rules::outer_macro!(SecondStruct, SecondAttrStruct);
+   |       ---------------------------------------------------------------- in this macro invocation
+   |
+   = help: remove the `#[macro_export]` or move this `macro_rules!` outside the of the current function `main`
+   = note: a `macro_rules!` definition is non-local if it is nested inside an item and has a `#[macro_export]` attribute
+   = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module
+   = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>
+   = note: `#[warn(non_local_definitions)]` on by default
+
+warning: 1 warning emitted
+
diff --git a/tests/ui/rust-2018/uniform-paths/issue-55779.rs b/tests/ui/rust-2018/uniform-paths/issue-55779.rs
index 350ab324682..246b8dd82c5 100644
--- a/tests/ui/rust-2018/uniform-paths/issue-55779.rs
+++ b/tests/ui/rust-2018/uniform-paths/issue-55779.rs
@@ -2,6 +2,8 @@
 //@ edition:2018
 //@ aux-crate:issue_55779_extern_trait=issue-55779-extern-trait.rs
 
+#![allow(non_local_definitions)]
+
 use issue_55779_extern_trait::Trait;
 
 struct Local;
diff --git a/tests/ui/structs-enums/enum-null-pointer-opt.rs b/tests/ui/structs-enums/enum-null-pointer-opt.rs
index 6f8c8168968..a8418943ba4 100644
--- a/tests/ui/structs-enums/enum-null-pointer-opt.rs
+++ b/tests/ui/structs-enums/enum-null-pointer-opt.rs
@@ -1,8 +1,9 @@
 //@ run-pass
+#![feature(generic_nonzero)]
 #![feature(transparent_unions)]
 
 use std::mem::size_of;
-use std::num::NonZeroUsize;
+use std::num::NonZero;
 use std::ptr::NonNull;
 use std::rc::Rc;
 use std::sync::Arc;
@@ -57,7 +58,7 @@ fn main() {
     assert_eq!(size_of::<[Box<isize>; 1]>(), size_of::<Option<[Box<isize>; 1]>>());
 
     // Should apply to NonZero
-    assert_eq!(size_of::<NonZeroUsize>(), size_of::<Option<NonZeroUsize>>());
+    assert_eq!(size_of::<NonZero<usize>>(), size_of::<Option<NonZero<usize>>>());
     assert_eq!(size_of::<NonNull<i8>>(), size_of::<Option<NonNull<i8>>>());
 
     // Should apply to types that use NonZero internally
diff --git a/tests/ui/structs-enums/enum-null-pointer-opt.stderr b/tests/ui/structs-enums/enum-null-pointer-opt.stderr
index 64e93ffaffd..fca62bd1c80 100644
--- a/tests/ui/structs-enums/enum-null-pointer-opt.stderr
+++ b/tests/ui/structs-enums/enum-null-pointer-opt.stderr
@@ -1,5 +1,5 @@
 warning: method `dummy` is never used
-  --> $DIR/enum-null-pointer-opt.rs:10:18
+  --> $DIR/enum-null-pointer-opt.rs:11:18
    |
 LL | trait Trait { fn dummy(&self) { } }
    |       -----      ^^^^^
diff --git a/tests/ui/structs-enums/type-sizes.rs b/tests/ui/structs-enums/type-sizes.rs
index 92060e3cade..66f663ce077 100644
--- a/tests/ui/structs-enums/type-sizes.rs
+++ b/tests/ui/structs-enums/type-sizes.rs
@@ -2,12 +2,13 @@
 
 #![allow(non_camel_case_types)]
 #![allow(dead_code)]
+#![feature(generic_nonzero)]
 #![feature(never_type)]
 #![feature(pointer_is_aligned)]
 #![feature(strict_provenance)]
 
 use std::mem::size_of;
-use std::num::{NonZeroU8, NonZeroU16};
+use std::num::NonZero;
 use std::ptr;
 use std::ptr::NonNull;
 use std::borrow::Cow;
@@ -110,14 +111,14 @@ enum Option2<A, B> {
 
 // Two layouts are considered for `CanBeNicheFilledButShouldnt`:
 //   Niche-filling:
-//     { u32 (4 bytes), NonZeroU8 + tag in niche (1 byte), padding (3 bytes) }
+//     { u32 (4 bytes), NonZero<u8> + tag in niche (1 byte), padding (3 bytes) }
 //   Tagged:
-//     { tag (1 byte), NonZeroU8 (1 byte), padding (2 bytes), u32 (4 bytes) }
+//     { tag (1 byte), NonZero<u8> (1 byte), padding (2 bytes), u32 (4 bytes) }
 // Both are the same size (due to padding),
 // but the tagged layout is better as the tag creates a niche with 254 invalid values,
 // allowing types like `Option<Option<CanBeNicheFilledButShouldnt>>` to fit into 8 bytes.
 pub enum CanBeNicheFilledButShouldnt {
-    A(NonZeroU8, u32),
+    A(NonZero<u8>, u32),
     B
 }
 pub enum AlwaysTaggedBecauseItHasNoNiche {
@@ -135,7 +136,7 @@ pub enum NicheFilledMultipleFields {
     G,
 }
 
-struct BoolInTheMiddle(std::num::NonZeroU16, bool, u8);
+struct BoolInTheMiddle(NonZero<u16>, bool, u8);
 
 enum NicheWithData {
     A,
@@ -275,7 +276,7 @@ pub fn main() {
     assert_eq!(size_of::<Option<NicheFilledMultipleFields>>(), 2);
     assert_eq!(size_of::<Option<Option<NicheFilledMultipleFields>>>(), 2);
 
-    struct S1{ a: u16, b: std::num::NonZeroU16, c: u16, d: u8, e: u32, f: u64, g:[u8;2] }
+    struct S1{ a: u16, b: NonZero<u16>, c: u16, d: u8, e: u32, f: u64, g:[u8;2] }
     assert_eq!(size_of::<S1>(), 24);
     assert_eq!(size_of::<Option<S1>>(), 24);
 
@@ -287,14 +288,14 @@ pub fn main() {
         size_of::<(&(), NicheWithData)>()
     );
 
-    pub enum FillPadding { A(std::num::NonZeroU8, u32), B }
+    pub enum FillPadding { A(NonZero<u8>, u32), B }
     assert_eq!(size_of::<FillPadding>(), 8);
     assert_eq!(size_of::<Option<FillPadding>>(), 8);
     assert_eq!(size_of::<Option<Option<FillPadding>>>(), 8);
 
-    assert_eq!(size_of::<Result<(std::num::NonZeroU8, u8, u8), u16>>(), 4);
-    assert_eq!(size_of::<Option<Result<(std::num::NonZeroU8, u8, u8), u16>>>(), 4);
-    assert_eq!(size_of::<Result<(std::num::NonZeroU8, u8, u8, u8), u16>>(), 4);
+    assert_eq!(size_of::<Result<(NonZero<u8>, u8, u8), u16>>(), 4);
+    assert_eq!(size_of::<Option<Result<(NonZero<u8>, u8, u8), u16>>>(), 4);
+    assert_eq!(size_of::<Result<(NonZero<u8>, u8, u8, u8), u16>>(), 4);
 
     assert_eq!(size_of::<EnumManyVariant<u16>>(), 6);
     assert_eq!(size_of::<EnumManyVariant<NicheU16>>(), 4);
@@ -314,10 +315,10 @@ pub fn main() {
     assert_eq!(ptr::from_ref(&v), ptr::from_ref(&v.r.ptr).cast(),
                "sort niches to the front where possible");
 
-    // Ideal layouts: (bool, u8, NonZeroU16) or (NonZeroU16, u8, bool)
+    // Ideal layouts: (bool, u8, NonZero<u16>) or (NonZero<u16>, u8, bool)
     // Currently the layout algorithm will choose the latter because it doesn't attempt
     // to aggregate multiple smaller fields to move a niche before a higher-alignment one.
-    let b = BoolInTheMiddle( NonZeroU16::new(1).unwrap(), true, 0);
+    let b = BoolInTheMiddle(NonZero::new(1).unwrap(), true, 0);
     assert!(ptr::from_ref(&b.1).addr() > ptr::from_ref(&b.2).addr());
 
     assert_eq!(size_of::<Cow<'static, str>>(), size_of::<String>());
diff --git a/tests/ui/suggestions/core-std-import-order-issue-83564.rs b/tests/ui/suggestions/core-std-import-order-issue-83564.rs
index 2cf1983858a..62b9b246cc8 100644
--- a/tests/ui/suggestions/core-std-import-order-issue-83564.rs
+++ b/tests/ui/suggestions/core-std-import-order-issue-83564.rs
@@ -1,10 +1,11 @@
 //@ edition:2018
-
+//
 // This is a regression test for #83564.
 // For some reason, Rust 2018 or higher is required to reproduce the bug.
+#![feature(generic_nonzero)]
 
 fn main() {
     //~^ HELP consider importing one of these items
-    let _x = NonZeroU32::new(5).unwrap();
-    //~^ ERROR failed to resolve: use of undeclared type `NonZeroU32`
+    let _x = NonZero::new(5u32).unwrap();
+    //~^ ERROR failed to resolve: use of undeclared type `NonZero`
 }
diff --git a/tests/ui/suggestions/core-std-import-order-issue-83564.stderr b/tests/ui/suggestions/core-std-import-order-issue-83564.stderr
index c2634e3070e..56e10b9340c 100644
--- a/tests/ui/suggestions/core-std-import-order-issue-83564.stderr
+++ b/tests/ui/suggestions/core-std-import-order-issue-83564.stderr
@@ -1,14 +1,14 @@
-error[E0433]: failed to resolve: use of undeclared type `NonZeroU32`
-  --> $DIR/core-std-import-order-issue-83564.rs:8:14
+error[E0433]: failed to resolve: use of undeclared type `NonZero`
+  --> $DIR/core-std-import-order-issue-83564.rs:9:14
    |
-LL |     let _x = NonZeroU32::new(5).unwrap();
-   |              ^^^^^^^^^^ use of undeclared type `NonZeroU32`
+LL |     let _x = NonZero::new(5u32).unwrap();
+   |              ^^^^^^^ use of undeclared type `NonZero`
    |
 help: consider importing one of these items
    |
-LL + use core::num::NonZeroU32;
+LL + use core::num::NonZero;
    |
-LL + use std::num::NonZeroU32;
+LL + use std::num::NonZero;
    |
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/traits/next-solver/specialization-transmute.rs b/tests/ui/traits/next-solver/specialization-transmute.rs
index 41c90322011..17c55fb4d49 100644
--- a/tests/ui/traits/next-solver/specialization-transmute.rs
+++ b/tests/ui/traits/next-solver/specialization-transmute.rs
@@ -1,6 +1,6 @@
 //@ compile-flags: -Znext-solver
 //~^ ERROR cannot normalize `<T as Default>::Id: '_`
-
+#![feature(generic_nonzero)]
 #![feature(specialization)]
 //~^ WARN the feature `specialization` is incomplete
 
@@ -23,8 +23,9 @@ fn transmute<T: Default<Id = U>, U: Copy>(t: T) -> U {
     *t.intu()
 }
 
-use std::num::NonZeroU8;
+use std::num::NonZero;
+
 fn main() {
-    let s = transmute::<u8, Option<NonZeroU8>>(0); //~ ERROR cannot satisfy
+    let s = transmute::<u8, Option<NonZero<u8>>>(0); //~ ERROR cannot satisfy
     assert_eq!(s, None);
 }
diff --git a/tests/ui/traits/next-solver/specialization-transmute.stderr b/tests/ui/traits/next-solver/specialization-transmute.stderr
index c87612d6a26..65e33700325 100644
--- a/tests/ui/traits/next-solver/specialization-transmute.stderr
+++ b/tests/ui/traits/next-solver/specialization-transmute.stderr
@@ -23,10 +23,10 @@ LL |         self
    |         ^^^^ cannot satisfy `T <: <T as Default>::Id`
 
 error[E0284]: type annotations needed: cannot satisfy `<u8 as Default>::Id == Option<NonZero<u8>>`
-  --> $DIR/specialization-transmute.rs:28:13
+  --> $DIR/specialization-transmute.rs:29:13
    |
-LL |     let s = transmute::<u8, Option<NonZeroU8>>(0);
-   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `<u8 as Default>::Id == Option<NonZero<u8>>`
+LL |     let s = transmute::<u8, Option<NonZero<u8>>>(0);
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot satisfy `<u8 as Default>::Id == Option<NonZero<u8>>`
    |
 note: required by a bound in `transmute`
   --> $DIR/specialization-transmute.rs:22:25