about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/assembly/option-nonzero-eq.rs27
-rw-r--r--tests/assembly/targets/targets-elf.rs3
-rw-r--r--tests/codegen/option-niche-eq.rs (renamed from tests/codegen/option-nonzero-eq.rs)43
-rw-r--r--tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-paths.rs50
-rw-r--r--tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-primitive-types.rs6
-rw-r--r--tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-repr-transparent-types.rs2
-rw-r--r--tests/codegen/sanitizer/cfi/normalize-integers.rs6
-rw-r--r--tests/mir-opt/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff56
-rw-r--r--tests/mir-opt/instrument_coverage_cleanup.main.InstrumentCoverage.diff53
-rw-r--r--tests/mir-opt/instrument_coverage_cleanup.rs22
-rw-r--r--tests/pretty/postfix-match.rs21
-rw-r--r--tests/run-make-fulldeps/obtain-borrowck/driver.rs2
-rw-r--r--tests/ui/associated-type-bounds/cant-see-copy-bound-from-child-rigid-2.rs18
-rw-r--r--tests/ui/associated-type-bounds/cant-see-copy-bound-from-child-rigid-2.stderr13
-rw-r--r--tests/ui/associated-type-bounds/cant-see-copy-bound-from-child-rigid.rs18
-rw-r--r--tests/ui/associated-type-bounds/cant-see-copy-bound-from-child-rigid.stderr14
-rw-r--r--tests/ui/async-await/send-bound-async-closure.rs3
-rw-r--r--tests/ui/borrowck/ice-mutability-error-slicing-121807.rs27
-rw-r--r--tests/ui/borrowck/ice-mutability-error-slicing-121807.stderr53
-rw-r--r--tests/ui/cfg/cfg-false-feature.stderr24
-rw-r--r--tests/ui/const-generics/ice-unexpected-inference-var-122549.rs29
-rw-r--r--tests/ui/const-generics/ice-unexpected-inference-var-122549.stderr67
-rw-r--r--tests/ui/consts/required-consts/collect-in-called-fn.noopt.stderr8
-rw-r--r--tests/ui/consts/required-consts/collect-in-called-fn.opt.stderr8
-rw-r--r--tests/ui/consts/required-consts/collect-in-called-fn.rs1
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-closure.noopt.stderr23
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-closure.opt.stderr23
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-closure.rs30
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-drop.noopt.stderr6
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-drop.opt.stderr20
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-drop.rs11
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.noopt.stderr20
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.opt.stderr20
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.rs49
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.noopt.stderr20
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.opt.stderr20
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.rs30
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.noopt.stderr20
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.opt.stderr20
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.rs37
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fn.noopt.stderr8
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fn.opt.stderr23
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fn.rs11
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.noopt.stderr20
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.opt.stderr20
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.rs34
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fnptr.noopt.stderr23
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fnptr.opt.stderr23
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-fnptr.rs33
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-forget.rs4
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-move.noopt.stderr6
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-move.opt.stderr20
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-move.rs11
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-vtable.noopt.stderr10
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-vtable.opt.stderr23
-rw-r--r--tests/ui/consts/required-consts/collect-in-dead-vtable.rs16
-rw-r--r--tests/ui/consts/required-consts/interpret-in-const-called-fn.noopt.stderr6
-rw-r--r--tests/ui/consts/required-consts/interpret-in-const-called-fn.opt.stderr6
-rw-r--r--tests/ui/consts/required-consts/interpret-in-const-called-fn.rs1
-rw-r--r--tests/ui/consts/required-consts/interpret-in-promoted.noopt.stderr6
-rw-r--r--tests/ui/consts/required-consts/interpret-in-promoted.opt.stderr6
-rw-r--r--tests/ui/consts/required-consts/interpret-in-promoted.rs1
-rw-r--r--tests/ui/consts/required-consts/interpret-in-static.noopt.stderr6
-rw-r--r--tests/ui/consts/required-consts/interpret-in-static.opt.stderr6
-rw-r--r--tests/ui/consts/required-consts/interpret-in-static.rs1
-rw-r--r--tests/ui/coroutine/gen_block_is_fused_iter.rs21
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/broken_format.rs45
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/broken_format.stderr193
-rw-r--r--tests/ui/feature-gates/feature-gate-deref_patterns.rs9
-rw-r--r--tests/ui/feature-gates/feature-gate-deref_patterns.stderr13
-rw-r--r--tests/ui/feature-gates/feature-gate-postfix_match.rs17
-rw-r--r--tests/ui/feature-gates/feature-gate-postfix_match.stderr23
-rw-r--r--tests/ui/inference/ice-cannot-relate-region-109178.rs14
-rw-r--r--tests/ui/inference/ice-cannot-relate-region-109178.stderr21
-rw-r--r--tests/ui/inference/ice-ifer-var-leaked-out-of-rollback-122098.rs25
-rw-r--r--tests/ui/inference/ice-ifer-var-leaked-out-of-rollback-122098.stderr72
-rw-r--r--tests/ui/issues/issue-27942.stderr24
-rw-r--r--tests/ui/match/postfix-match/pf-match-chain.rs16
-rw-r--r--tests/ui/match/postfix-match/pf-match-exhaustiveness.rs7
-rw-r--r--tests/ui/match/postfix-match/pf-match-exhaustiveness.stderr21
-rw-r--r--tests/ui/match/postfix-match/pf-match-types.rs15
-rw-r--r--tests/ui/match/postfix-match/pf-match-types.stderr21
-rw-r--r--tests/ui/match/postfix-match/postfix-match.rs62
-rw-r--r--tests/ui/parser/attribute/attr-bad-meta-4.rs12
-rw-r--r--tests/ui/parser/attribute/attr-bad-meta-4.stderr25
-rw-r--r--tests/ui/pattern/deref-patterns/typeck.rs31
-rw-r--r--tests/ui/raw-ref-op/raw-ref-temp.stderr8
-rw-r--r--tests/ui/reachable/expr_type.stderr1
-rw-r--r--tests/ui/sanitizer/cfi-closure-fn-ptr-cast.rs18
-rw-r--r--tests/ui/stable-mir-print/basic_function.rs13
-rw-r--r--tests/ui/stable-mir-print/basic_function.stdout266
-rw-r--r--tests/ui/suggestions/types/into-inference-needs-type.rs15
-rw-r--r--tests/ui/suggestions/types/into-inference-needs-type.stderr19
-rw-r--r--tests/ui/traits/impl-of-supertrait-has-wrong-lifetime-parameters.stderr12
-rw-r--r--tests/ui/traits/matching-lifetimes.stderr24
-rw-r--r--tests/ui/traits/suggest-fully-qualified-closure.rs2
-rw-r--r--tests/ui/traits/suggest-fully-qualified-closure.stderr8
-rw-r--r--tests/ui/type-alias-impl-trait/hkl_forbidden4.rs25
-rw-r--r--tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr34
-rw-r--r--tests/ui/typeck/issue-91267.stderr2
-rw-r--r--tests/ui/unboxed-closures/unboxed-closures-type-mismatch-closure-from-another-scope.stderr6
-rw-r--r--tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.rs12
-rw-r--r--tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr60
103 files changed, 2056 insertions, 403 deletions
diff --git a/tests/assembly/option-nonzero-eq.rs b/tests/assembly/option-nonzero-eq.rs
deleted file mode 100644
index b04cf63fd78..00000000000
--- a/tests/assembly/option-nonzero-eq.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-//@ revisions: WIN LIN
-//@ [WIN] only-windows
-//@ [LIN] only-linux
-//@ assembly-output: emit-asm
-//@ compile-flags: --crate-type=lib -O -C llvm-args=-x86-asm-syntax=intel
-//@ only-x86_64
-//@ ignore-sgx
-
-use std::cmp::Ordering;
-
-// CHECK-lABEL: ordering_eq:
-#[no_mangle]
-pub fn ordering_eq(l: Option<Ordering>, r: Option<Ordering>) -> bool {
-    // Linux (System V): first two arguments are rdi then rsi
-    // Windows: first two arguments are rcx then rdx
-    // Both use rax for the return value.
-
-    // CHECK-NOT: mov
-    // CHECK-NOT: test
-    // CHECK-NOT: cmp
-
-    // LIN: cmp dil, sil
-    // WIN: cmp cl, dl
-    // CHECK-NEXT: sete al
-    // CHECK-NEXT: ret
-    l == r
-}
diff --git a/tests/assembly/targets/targets-elf.rs b/tests/assembly/targets/targets-elf.rs
index bda77b5f09b..3563aec6d80 100644
--- a/tests/assembly/targets/targets-elf.rs
+++ b/tests/assembly/targets/targets-elf.rs
@@ -369,6 +369,9 @@
 //@ revisions: riscv32im_unknown_none_elf
 //@ [riscv32im_unknown_none_elf] compile-flags: --target riscv32im-unknown-none-elf
 //@ [riscv32im_unknown_none_elf] needs-llvm-components: riscv
+//@ revisions: riscv32ima_unknown_none_elf
+//@ [riscv32ima_unknown_none_elf] compile-flags: --target riscv32ima-unknown-none-elf
+//@ [riscv32ima_unknown_none_elf] needs-llvm-components: riscv
 //@ revisions: riscv32imac_esp_espidf
 //@ [riscv32imac_esp_espidf] compile-flags: --target riscv32imac-esp-espidf
 //@ [riscv32imac_esp_espidf] needs-llvm-components: riscv
diff --git a/tests/codegen/option-nonzero-eq.rs b/tests/codegen/option-niche-eq.rs
index f637b1aef97..8b8044e9b75 100644
--- a/tests/codegen/option-nonzero-eq.rs
+++ b/tests/codegen/option-niche-eq.rs
@@ -1,4 +1,5 @@
 //@ compile-flags: -O -Zmerge-functions=disabled
+//@ min-llvm-version: 18
 #![crate_type = "lib"]
 #![feature(generic_nonzero)]
 
@@ -7,9 +8,6 @@ use core::cmp::Ordering;
 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<NonZero<u32>>, r: Option<NonZero<u32>>) -> bool {
@@ -36,3 +34,42 @@ pub fn non_null_eq(l: Option<NonNull<u8>>, r: Option<NonNull<u8>>) -> bool {
     // CHECK-NEXT: ret i1
     l == r
 }
+
+// CHECK-lABEL: @ordering_eq
+#[no_mangle]
+pub fn ordering_eq(l: Option<Ordering>, r: Option<Ordering>) -> bool {
+    // CHECK: start:
+    // CHECK-NEXT: icmp eq i8
+    // CHECK-NEXT: ret i1
+    l == r
+}
+
+#[derive(PartialEq)]
+pub enum EnumWithNiche {
+    A,
+    B,
+    C,
+    D,
+    E,
+    F,
+    G,
+}
+
+// CHECK-lABEL: @niche_eq
+#[no_mangle]
+pub fn niche_eq(l: Option<EnumWithNiche>, r: Option<EnumWithNiche>) -> bool {
+    // CHECK: start:
+    // CHECK-NEXT: icmp eq i8
+    // CHECK-NEXT: ret i1
+    l == r
+}
+
+// FIXME: This should work too
+// // FIXME-CHECK-lABEL: @bool_eq
+// #[no_mangle]
+// pub fn bool_eq(l: Option<bool>, r: Option<bool>) -> bool {
+//     // FIXME-CHECK: start:
+//     // FIXME-CHECK-NEXT: icmp eq i8
+//     // FIXME-CHECK-NEXT: ret i1
+//     l == r
+// }
diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-paths.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-paths.rs
index c5d8e0f22a2..ca781a99296 100644
--- a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-paths.rs
+++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-paths.rs
@@ -47,40 +47,42 @@ pub fn foo() where
     let _: Type4 = <Foo>::bar;
 }
 
-pub fn foo1(_: Type1) { }
+// Force arguments to be passed by using a reference. Otherwise, they may end up PassMode::Ignore
+
+pub fn foo1(_: &Type1) { }
 // CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}}
-pub fn foo2(_: Type1, _: Type1) { }
+pub fn foo2(_: &Type1, _: &Type1) { }
 // CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}}
-pub fn foo3(_: Type1, _: Type1, _: Type1) { }
+pub fn foo3(_: &Type1, _: &Type1, _: &Type1) { }
 // CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}}
-pub fn foo4(_: Type2) { }
+pub fn foo4(_: &Type2) { }
 // CHECK: define{{.*}}4foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}}
-pub fn foo5(_: Type2, _: Type2) { }
+pub fn foo5(_: &Type2, _: &Type2) { }
 // CHECK: define{{.*}}4foo5{{.*}}!type ![[TYPE5:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}}
-pub fn foo6(_: Type2, _: Type2, _: Type2) { }
+pub fn foo6(_: &Type2, _: &Type2, _: &Type2) { }
 // CHECK: define{{.*}}4foo6{{.*}}!type ![[TYPE6:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}}
-pub fn foo7(_: Type3) { }
+pub fn foo7(_: &Type3) { }
 // CHECK: define{{.*}}4foo7{{.*}}!type ![[TYPE7:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}}
-pub fn foo8(_: Type3, _: Type3) { }
+pub fn foo8(_: &Type3, _: &Type3) { }
 // CHECK: define{{.*}}4foo8{{.*}}!type ![[TYPE8:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}}
-pub fn foo9(_: Type3, _: Type3, _: Type3) { }
+pub fn foo9(_: &Type3, _: &Type3, _: &Type3) { }
 // CHECK: define{{.*}}4foo9{{.*}}!type ![[TYPE9:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}}
-pub fn foo10(_: Type4) { }
+pub fn foo10(_: &Type4) { }
 // CHECK: define{{.*}}5foo10{{.*}}!type ![[TYPE10:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}}
-pub fn foo11(_: Type4, _: Type4) { }
+pub fn foo11(_: &Type4, _: &Type4) { }
 // CHECK: define{{.*}}5foo11{{.*}}!type ![[TYPE11:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}}
-pub fn foo12(_: Type4, _: Type4, _: Type4) { }
+pub fn foo12(_: &Type4, _: &Type4, _: &Type4) { }
 // CHECK: define{{.*}}5foo12{{.*}}!type ![[TYPE12:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}}
 
-// CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNFNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo10{{[{}][{}]}}extern{{[}][}]}}3barE"}
-// CHECK: ![[TYPE2]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNFNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo10{{[{}][{}]}}extern{{[}][}]}}3barS_E"}
-// CHECK: ![[TYPE3]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNFNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo10{{[{}][{}]}}extern{{[}][}]}}3barS_S_E"}
-// CHECK: ![[TYPE4]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNCNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo11{{[{}][{}]}}closure{{[}][}]}}3FooE"}
-// CHECK: ![[TYPE5]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNCNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo11{{[{}][{}]}}closure{{[}][}]}}3FooS_E"}
-// CHECK: ![[TYPE6]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNCNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo11{{[{}][{}]}}closure{{[}][}]}}3FooS_S_E"}
-// CHECK: ![[TYPE7]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNkNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo12{{[{}][{}]}}constant{{[}][}]}}3FooE"}
-// CHECK: ![[TYPE8]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNkNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo12{{[{}][{}]}}constant{{[}][}]}}3FooS_E"}
-// CHECK: ![[TYPE9]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NtNkNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo12{{[{}][{}]}}constant{{[}][}]}}3FooS_S_E"}
-// CHECK: ![[TYPE10]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNINvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo8{{[{}][{}]}}impl{{[}][}]}}3barE"}
-// CHECK: ![[TYPE11]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNINvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo8{{[{}][{}]}}impl{{[}][}]}}3barS_E"}
-// CHECK: ![[TYPE12]] = !{i64 0, !"_ZTSFvu{{[0-9]+}}NvNINvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo8{{[{}][{}]}}impl{{[}][}]}}3barS_S_E"}
+// CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NvNFNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo10{{[{}][{}]}}extern{{[}][}]}}3barEE"}
+// CHECK: ![[TYPE2]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NvNFNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo10{{[{}][{}]}}extern{{[}][}]}}3barES0_E"}
+// CHECK: ![[TYPE3]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NvNFNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo10{{[{}][{}]}}extern{{[}][}]}}3barES0_S0_E"}
+// CHECK: ![[TYPE4]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtNCNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo11{{[{}][{}]}}closure{{[}][}]}}3FooEE"}
+// CHECK: ![[TYPE5]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtNCNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo11{{[{}][{}]}}closure{{[}][}]}}3FooES0_E"}
+// CHECK: ![[TYPE6]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtNCNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo11{{[{}][{}]}}closure{{[}][}]}}3FooES0_S0_E"}
+// CHECK: ![[TYPE7]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtNkNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo12{{[{}][{}]}}constant{{[}][}]}}3FooEE"}
+// CHECK: ![[TYPE8]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtNkNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo12{{[{}][{}]}}constant{{[}][}]}}3FooES0_E"}
+// CHECK: ![[TYPE9]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NtNkNvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo12{{[{}][{}]}}constant{{[}][}]}}3FooES0_S0_E"}
+// CHECK: ![[TYPE10]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NvNINvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo8{{[{}][{}]}}impl{{[}][}]}}3barEE"}
+// CHECK: ![[TYPE11]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NvNINvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo8{{[{}][{}]}}impl{{[}][}]}}3barES0_E"}
+// CHECK: ![[TYPE12]] = !{i64 0, !"_ZTSFvu3refIu{{[0-9]+}}NvNINvC{{[[:print:]]+}}_{{[[:print:]]+}}3foo8{{[{}][{}]}}impl{{[}][}]}}3barES0_S0_E"}
diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-primitive-types.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-primitive-types.rs
index 3a1a09150ea..38f507856bd 100644
--- a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-primitive-types.rs
+++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-primitive-types.rs
@@ -12,9 +12,9 @@ use core::ffi::*;
 pub fn foo1(_: ()) { }
 // CHECK: define{{.*}}4foo1{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}}
 pub fn foo2(_: (), _: c_void) { }
-// CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}}
+// CHECK: define{{.*}}4foo2{{.*}}!type ![[TYPE1:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}}
 pub fn foo3(_: (), _: c_void, _: c_void) { }
-// CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE3:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}}
+// CHECK: define{{.*}}4foo3{{.*}}!type ![[TYPE2:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}}
 pub fn foo4(_: *mut ()) { }
 // CHECK: define{{.*}}4foo4{{.*}}!type ![[TYPE4:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}}
 pub fn foo5(_: *mut (), _: *mut c_void) { }
@@ -131,8 +131,6 @@ pub fn foo60(_: &str, _: &str, _: &str) { }
 // CHECK: define{{.*}}5foo60{{.*}}!type ![[TYPE60:[0-9]+]] !type !{{[0-9]+}} !type !{{[0-9]+}} !type !{{[0-9]+}}
 
 // CHECK: ![[TYPE1]] = !{i64 0, !"_ZTSFvvE"}
-// CHECK: ![[TYPE2]] = !{i64 0, !"_ZTSFvvvE"}
-// CHECK: ![[TYPE3]] = !{i64 0, !"_ZTSFvvvvE"}
 // CHECK: ![[TYPE4]] = !{i64 0, !"_ZTSFvPvE"}
 // CHECK: ![[TYPE5]] = !{i64 0, !"_ZTSFvPvS_E"}
 // CHECK: ![[TYPE6]] = !{i64 0, !"_ZTSFvPvS_S_E"}
diff --git a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-repr-transparent-types.rs b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-repr-transparent-types.rs
index 0deda029c4b..6f47f5e3355 100644
--- a/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-repr-transparent-types.rs
+++ b/tests/codegen/sanitizer/cfi/emit-type-metadata-id-itanium-cxx-abi-repr-transparent-types.rs
@@ -28,7 +28,7 @@ pub struct Type2<'a> {
     member3: &'a Type2<'a>,
 }
 
-pub struct Bar;
+pub struct Bar(i32);
 
 // repr(transparent) user-defined generic type
 #[repr(transparent)]
diff --git a/tests/codegen/sanitizer/cfi/normalize-integers.rs b/tests/codegen/sanitizer/cfi/normalize-integers.rs
index 210814eb9ae..801ed312be5 100644
--- a/tests/codegen/sanitizer/cfi/normalize-integers.rs
+++ b/tests/codegen/sanitizer/cfi/normalize-integers.rs
@@ -41,6 +41,6 @@ pub fn foo11(_: (), _: usize, _: usize, _: usize) { }
 // CHECK: ![[TYPE6]] = !{i64 0, !"_ZTSFv{{u3i16|u3i32|u3i64|u4i128}}E.normalized"}
 // CHECK: ![[TYPE7]] = !{i64 0, !"_ZTSFv{{u3i16|u3i32|u3i64|u4i128}}S_E.normalized"}
 // CHECK: ![[TYPE8]] = !{i64 0, !"_ZTSFv{{u3i16|u3i32|u3i64|u4i128}}S_S_E.normalized"}
-// CHECK: ![[TYPE9]] = !{i64 0, !"_ZTSFvv{{u3u16|u3u32|u3u64|u4u128}}E.normalized"}
-// CHECK: ![[TYPE10]] = !{i64 0, !"_ZTSFvv{{u3u16|u3u32|u3u64|u4u128}}S_E.normalized"}
-// CHECK: ![[TYPE11]] = !{i64 0, !"_ZTSFvv{{u3u16|u3u32|u3u64|u4u128}}S_S_E.normalized"}
+// CHECK: ![[TYPE9]] = !{i64 0, !"_ZTSFv{{u3u16|u3u32|u3u64|u4u128}}E.normalized"}
+// CHECK: ![[TYPE10]] = !{i64 0, !"_ZTSFv{{u3u16|u3u32|u3u64|u4u128}}S_E.normalized"}
+// CHECK: ![[TYPE11]] = !{i64 0, !"_ZTSFv{{u3u16|u3u32|u3u64|u4u128}}S_S_E.normalized"}
diff --git a/tests/mir-opt/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff b/tests/mir-opt/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff
new file mode 100644
index 00000000000..ff65ca77039
--- /dev/null
+++ b/tests/mir-opt/instrument_coverage_cleanup.main.CleanupPostBorrowck.diff
@@ -0,0 +1,56 @@
+- // MIR for `main` before CleanupPostBorrowck
++ // MIR for `main` after CleanupPostBorrowck
+  
+  fn main() -> () {
+      let mut _0: ();
+      let mut _1: bool;
+  
+      coverage branch { true: BlockMarkerId(0), false: BlockMarkerId(1) } => /the/src/instrument_coverage_cleanup.rs:15:8: 15:36 (#0)
+  
+      coverage ExpressionId(0) => Expression { lhs: Counter(0), op: Subtract, rhs: Counter(1) };
+      coverage ExpressionId(1) => Expression { lhs: Counter(1), op: Add, rhs: Expression(0) };
+      coverage Code(Counter(0)) => /the/src/instrument_coverage_cleanup.rs:14:1 - 15:36;
+      coverage Code(Expression(0)) => /the/src/instrument_coverage_cleanup.rs:15:37 - 15:39;
+      coverage Code(Counter(1)) => /the/src/instrument_coverage_cleanup.rs:15:39 - 15:40;
+      coverage Code(Expression(1)) => /the/src/instrument_coverage_cleanup.rs:16:1 - 16:2;
+      coverage Branch { true_term: Expression(0), false_term: Counter(1) } => /the/src/instrument_coverage_cleanup.rs:15:8 - 15:36;
+  
+      bb0: {
+          Coverage::CounterIncrement(0);
+-         Coverage::SpanMarker;
++         nop;
+          StorageLive(_1);
+          _1 = std::hint::black_box::<bool>(const true) -> [return: bb1, unwind: bb5];
+      }
+  
+      bb1: {
+          switchInt(move _1) -> [0: bb3, otherwise: bb2];
+      }
+  
+      bb2: {
+          Coverage::CounterIncrement(1);
+-         Coverage::BlockMarker(1);
++         nop;
+          _0 = const ();
+          goto -> bb4;
+      }
+  
+      bb3: {
+          Coverage::ExpressionUsed(0);
+-         Coverage::BlockMarker(0);
++         nop;
+          _0 = const ();
+          goto -> bb4;
+      }
+  
+      bb4: {
+          Coverage::ExpressionUsed(1);
+          StorageDead(_1);
+          return;
+      }
+  
+      bb5 (cleanup): {
+          resume;
+      }
+  }
+  
diff --git a/tests/mir-opt/instrument_coverage_cleanup.main.InstrumentCoverage.diff b/tests/mir-opt/instrument_coverage_cleanup.main.InstrumentCoverage.diff
new file mode 100644
index 00000000000..8757559149a
--- /dev/null
+++ b/tests/mir-opt/instrument_coverage_cleanup.main.InstrumentCoverage.diff
@@ -0,0 +1,53 @@
+- // MIR for `main` before InstrumentCoverage
++ // MIR for `main` after InstrumentCoverage
+  
+  fn main() -> () {
+      let mut _0: ();
+      let mut _1: bool;
+  
+      coverage branch { true: BlockMarkerId(0), false: BlockMarkerId(1) } => /the/src/instrument_coverage_cleanup.rs:15:8: 15:36 (#0)
+  
++     coverage ExpressionId(0) => Expression { lhs: Counter(0), op: Subtract, rhs: Counter(1) };
++     coverage ExpressionId(1) => Expression { lhs: Counter(1), op: Add, rhs: Expression(0) };
++     coverage Code(Counter(0)) => /the/src/instrument_coverage_cleanup.rs:14:1 - 15:36;
++     coverage Code(Expression(0)) => /the/src/instrument_coverage_cleanup.rs:15:37 - 15:39;
++     coverage Code(Counter(1)) => /the/src/instrument_coverage_cleanup.rs:15:39 - 15:40;
++     coverage Code(Expression(1)) => /the/src/instrument_coverage_cleanup.rs:16:1 - 16:2;
++     coverage Branch { true_term: Expression(0), false_term: Counter(1) } => /the/src/instrument_coverage_cleanup.rs:15:8 - 15:36;
++ 
+      bb0: {
++         Coverage::CounterIncrement(0);
+          Coverage::SpanMarker;
+          StorageLive(_1);
+          _1 = std::hint::black_box::<bool>(const true) -> [return: bb1, unwind: bb5];
+      }
+  
+      bb1: {
+          switchInt(move _1) -> [0: bb3, otherwise: bb2];
+      }
+  
+      bb2: {
++         Coverage::CounterIncrement(1);
+          Coverage::BlockMarker(1);
+          _0 = const ();
+          goto -> bb4;
+      }
+  
+      bb3: {
++         Coverage::ExpressionUsed(0);
+          Coverage::BlockMarker(0);
+          _0 = const ();
+          goto -> bb4;
+      }
+  
+      bb4: {
++         Coverage::ExpressionUsed(1);
+          StorageDead(_1);
+          return;
+      }
+  
+      bb5 (cleanup): {
+          resume;
+      }
+  }
+  
diff --git a/tests/mir-opt/instrument_coverage_cleanup.rs b/tests/mir-opt/instrument_coverage_cleanup.rs
new file mode 100644
index 00000000000..8a2fd67139b
--- /dev/null
+++ b/tests/mir-opt/instrument_coverage_cleanup.rs
@@ -0,0 +1,22 @@
+// Test that CleanupPostBorrowck cleans up the marker statements that are
+// inserted during MIR building (after InstrumentCoverage is done with them),
+// but leaves the statements that were added by InstrumentCoverage.
+//
+// Removed statement kinds: BlockMarker, SpanMarker
+// Retained statement kinds: CounterIncrement, ExpressionUsed
+
+//@ unit-test: InstrumentCoverage
+//@ compile-flags: -Cinstrument-coverage -Zcoverage-options=branch -Zno-profiler-runtime
+//@ compile-flags: --remap-path-prefix={{src-base}}=/the/src
+
+// EMIT_MIR instrument_coverage_cleanup.main.InstrumentCoverage.diff
+// EMIT_MIR instrument_coverage_cleanup.main.CleanupPostBorrowck.diff
+fn main() {
+    if !core::hint::black_box(true) {}
+}
+
+// CHECK-NOT: Coverage::BlockMarker
+// CHECK-NOT: Coverage::SpanMarker
+// CHECK:     Coverage::CounterIncrement
+// CHECK-NOT: Coverage::BlockMarker
+// CHECK-NOT: Coverage::SpanMarker
diff --git a/tests/pretty/postfix-match.rs b/tests/pretty/postfix-match.rs
new file mode 100644
index 00000000000..5bb54e15275
--- /dev/null
+++ b/tests/pretty/postfix-match.rs
@@ -0,0 +1,21 @@
+#![feature(postfix_match)]
+
+fn main() {
+    let val = Some(42);
+
+    val.match {
+        Some(_) => 2,
+        _ => 1
+    };
+
+
+    Some(2).match {
+        Some(_) => true,
+        None => false
+    }.match {
+        false => "ferris is cute",
+        true => "I turn cats in to petted cats",
+    }.match {
+        _ => (),
+    }
+}
diff --git a/tests/run-make-fulldeps/obtain-borrowck/driver.rs b/tests/run-make-fulldeps/obtain-borrowck/driver.rs
index 2e3bf70e144..e67ec8690f8 100644
--- a/tests/run-make-fulldeps/obtain-borrowck/driver.rs
+++ b/tests/run-make-fulldeps/obtain-borrowck/driver.rs
@@ -68,7 +68,7 @@ impl rustc_driver::Callbacks for CompilerCalls {
             let mut bodies = Vec::new();
 
             let crate_items = tcx.hir_crate_items(());
-            for id in crate_items.items() {
+            for id in crate_items.free_items() {
                 if matches!(tcx.def_kind(id.owner_id), DefKind::Fn) {
                     bodies.push(id.owner_id);
                 }
diff --git a/tests/ui/associated-type-bounds/cant-see-copy-bound-from-child-rigid-2.rs b/tests/ui/associated-type-bounds/cant-see-copy-bound-from-child-rigid-2.rs
new file mode 100644
index 00000000000..1768b006622
--- /dev/null
+++ b/tests/ui/associated-type-bounds/cant-see-copy-bound-from-child-rigid-2.rs
@@ -0,0 +1,18 @@
+trait Id {
+    type This: ?Sized;
+}
+impl<T: ?Sized> Id for T {
+    type This = T;
+}
+
+trait Trait {
+    type Assoc: Id<This: Copy>;
+}
+
+// We can't see use the `T::Assoc::This: Copy` bound to prove `T::Assoc: Copy`
+fn foo<T: Trait>(x: T::Assoc) -> (T::Assoc, T::Assoc) {
+    (x, x)
+    //~^ ERROR use of moved value
+}
+
+fn main() {}
diff --git a/tests/ui/associated-type-bounds/cant-see-copy-bound-from-child-rigid-2.stderr b/tests/ui/associated-type-bounds/cant-see-copy-bound-from-child-rigid-2.stderr
new file mode 100644
index 00000000000..cd0e026905c
--- /dev/null
+++ b/tests/ui/associated-type-bounds/cant-see-copy-bound-from-child-rigid-2.stderr
@@ -0,0 +1,13 @@
+error[E0382]: use of moved value: `x`
+  --> $DIR/cant-see-copy-bound-from-child-rigid-2.rs:14:9
+   |
+LL | fn foo<T: Trait>(x: T::Assoc) -> (T::Assoc, T::Assoc) {
+   |                  - move occurs because `x` has type `<T as Trait>::Assoc`, which does not implement the `Copy` trait
+LL |     (x, x)
+   |      -  ^ value used here after move
+   |      |
+   |      value moved here
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/tests/ui/associated-type-bounds/cant-see-copy-bound-from-child-rigid.rs b/tests/ui/associated-type-bounds/cant-see-copy-bound-from-child-rigid.rs
new file mode 100644
index 00000000000..6b3fd7e898d
--- /dev/null
+++ b/tests/ui/associated-type-bounds/cant-see-copy-bound-from-child-rigid.rs
@@ -0,0 +1,18 @@
+trait Id {
+    type This: ?Sized;
+}
+
+trait Trait {
+    type Assoc: Id<This: Copy>;
+}
+
+// We can't see use the `T::Assoc::This: Copy` bound to prove `T::Assoc: Copy`
+fn foo<T: Trait>(x: T::Assoc) -> (T::Assoc, T::Assoc)
+where
+    T::Assoc: Id<This = T::Assoc>,
+{
+    (x, x)
+    //~^ ERROR use of moved value
+}
+
+fn main() {}
diff --git a/tests/ui/associated-type-bounds/cant-see-copy-bound-from-child-rigid.stderr b/tests/ui/associated-type-bounds/cant-see-copy-bound-from-child-rigid.stderr
new file mode 100644
index 00000000000..3ed73918de3
--- /dev/null
+++ b/tests/ui/associated-type-bounds/cant-see-copy-bound-from-child-rigid.stderr
@@ -0,0 +1,14 @@
+error[E0382]: use of moved value: `x`
+  --> $DIR/cant-see-copy-bound-from-child-rigid.rs:14:9
+   |
+LL | fn foo<T: Trait>(x: T::Assoc) -> (T::Assoc, T::Assoc)
+   |                  - move occurs because `x` has type `<T as Trait>::Assoc`, which does not implement the `Copy` trait
+...
+LL |     (x, x)
+   |      -  ^ value used here after move
+   |      |
+   |      value moved here
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/tests/ui/async-await/send-bound-async-closure.rs b/tests/ui/async-await/send-bound-async-closure.rs
index 2732fa5d466..e4a9ae4cc75 100644
--- a/tests/ui/async-await/send-bound-async-closure.rs
+++ b/tests/ui/async-await/send-bound-async-closure.rs
@@ -1,5 +1,8 @@
 //@ edition: 2021
 //@ check-pass
+//@ revisions: current next
+//@ ignore-compare-mode-next-solver (explicit revisions)
+//@[next] compile-flags: -Znext-solver
 
 // This test verifies that we do not create a query cycle when typechecking has several inference
 // variables that point to the same coroutine interior type.
diff --git a/tests/ui/borrowck/ice-mutability-error-slicing-121807.rs b/tests/ui/borrowck/ice-mutability-error-slicing-121807.rs
new file mode 100644
index 00000000000..bbdd895d763
--- /dev/null
+++ b/tests/ui/borrowck/ice-mutability-error-slicing-121807.rs
@@ -0,0 +1,27 @@
+//@ edition:2015
+// test for ICE #121807 begin <= end (12 <= 11) when slicing 'Self::Assoc<'_>'
+// fixed by #122749
+
+trait MemoryUnit { // ERROR: not all trait items implemented, missing: `read_word`
+    extern "C" fn read_word(&mut self) -> u8;
+    extern "C" fn read_dword(Self::Assoc<'_>) -> u16;
+    //~^ WARN anonymous parameters are deprecated and will be removed in the next edition
+    //~^^ WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
+    //~^^^ ERROR associated type `Assoc` not found for `Self`
+}
+
+struct ROM {}
+
+impl MemoryUnit for ROM {
+//~^ ERROR not all trait items implemented, missing: `read_word`
+    extern "C" fn read_dword(&'s self) -> u16 {
+    //~^ ERROR use of undeclared lifetime name `'s`
+    //~^^ ERROR method `read_dword` has a `&self` declaration in the impl, but not in the trait
+        let a16 = self.read_word() as u16;
+        let b16 = self.read_word() as u16;
+
+        (b16 << 8) | a16
+    }
+}
+
+pub fn main() {}
diff --git a/tests/ui/borrowck/ice-mutability-error-slicing-121807.stderr b/tests/ui/borrowck/ice-mutability-error-slicing-121807.stderr
new file mode 100644
index 00000000000..3a6b8008fce
--- /dev/null
+++ b/tests/ui/borrowck/ice-mutability-error-slicing-121807.stderr
@@ -0,0 +1,53 @@
+error[E0261]: use of undeclared lifetime name `'s`
+  --> $DIR/ice-mutability-error-slicing-121807.rs:17:31
+   |
+LL |     extern "C" fn read_dword(&'s self) -> u16 {
+   |                               ^^ undeclared lifetime
+   |
+help: consider introducing lifetime `'s` here
+   |
+LL |     extern "C" fn read_dword<'s>(&'s self) -> u16 {
+   |                             ++++
+help: consider introducing lifetime `'s` here
+   |
+LL | impl<'s> MemoryUnit for ROM {
+   |     ++++
+
+warning: anonymous parameters are deprecated and will be removed in the next edition
+  --> $DIR/ice-mutability-error-slicing-121807.rs:7:30
+   |
+LL |     extern "C" fn read_dword(Self::Assoc<'_>) -> u16;
+   |                              ^^^^^^^^^^^^^^^ help: try naming the parameter or explicitly ignoring it: `_: Self::Assoc<'_>`
+   |
+   = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2018!
+   = note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686>
+   = note: `#[warn(anonymous_parameters)]` on by default
+
+error[E0220]: associated type `Assoc` not found for `Self`
+  --> $DIR/ice-mutability-error-slicing-121807.rs:7:36
+   |
+LL |     extern "C" fn read_dword(Self::Assoc<'_>) -> u16;
+   |                                    ^^^^^ associated type `Assoc` not found
+
+error[E0185]: method `read_dword` has a `&self` declaration in the impl, but not in the trait
+  --> $DIR/ice-mutability-error-slicing-121807.rs:17:5
+   |
+LL |     extern "C" fn read_dword(Self::Assoc<'_>) -> u16;
+   |     ------------------------------------------------- trait method declared without `&self`
+...
+LL |     extern "C" fn read_dword(&'s self) -> u16 {
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&self` used in impl
+
+error[E0046]: not all trait items implemented, missing: `read_word`
+  --> $DIR/ice-mutability-error-slicing-121807.rs:15:1
+   |
+LL |     extern "C" fn read_word(&mut self) -> u8;
+   |     ----------------------------------------- `read_word` from trait
+...
+LL | impl MemoryUnit for ROM {
+   | ^^^^^^^^^^^^^^^^^^^^^^^ missing `read_word` in implementation
+
+error: aborting due to 4 previous errors; 1 warning emitted
+
+Some errors have detailed explanations: E0046, E0185, E0220, E0261.
+For more information about an error, try `rustc --explain E0046`.
diff --git a/tests/ui/cfg/cfg-false-feature.stderr b/tests/ui/cfg/cfg-false-feature.stderr
index 9309b59ca59..542aeaf5caf 100644
--- a/tests/ui/cfg/cfg-false-feature.stderr
+++ b/tests/ui/cfg/cfg-false-feature.stderr
@@ -1,15 +1,3 @@
-warning: trait aliases are experimental
-  --> $DIR/cfg-false-feature.rs:12:1
-   |
-LL | trait A = Clone;
-   | ^^^^^^^^^^^^^^^^
-   |
-   = note: see issue #41517 <https://github.com/rust-lang/rust/issues/41517> for more information
-   = help: add `#![feature(trait_alias)]` to the crate attributes to enable
-   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
-   = warning: unstable syntax can change at any point in the future, causing a hard error!
-   = note: for more information, see issue #65860 <https://github.com/rust-lang/rust/issues/65860>
-
 warning: box pattern syntax is experimental
   --> $DIR/cfg-false-feature.rs:16:9
    |
@@ -22,5 +10,17 @@ LL |     let box _ = Box::new(0);
    = warning: unstable syntax can change at any point in the future, causing a hard error!
    = note: for more information, see issue #65860 <https://github.com/rust-lang/rust/issues/65860>
 
+warning: trait aliases are experimental
+  --> $DIR/cfg-false-feature.rs:12:1
+   |
+LL | trait A = Clone;
+   | ^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #41517 <https://github.com/rust-lang/rust/issues/41517> for more information
+   = help: add `#![feature(trait_alias)]` to the crate attributes to enable
+   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
+   = warning: unstable syntax can change at any point in the future, causing a hard error!
+   = note: for more information, see issue #65860 <https://github.com/rust-lang/rust/issues/65860>
+
 warning: 2 warnings emitted
 
diff --git a/tests/ui/const-generics/ice-unexpected-inference-var-122549.rs b/tests/ui/const-generics/ice-unexpected-inference-var-122549.rs
new file mode 100644
index 00000000000..126ea667290
--- /dev/null
+++ b/tests/ui/const-generics/ice-unexpected-inference-var-122549.rs
@@ -0,0 +1,29 @@
+// Regression test for https://github.com/rust-lang/rust/issues/122549
+// was fixed by https://github.com/rust-lang/rust/pull/122749
+
+trait ConstChunksExactTrait<T> {
+    fn const_chunks_exact<const N: usize>(&self) -> ConstChunksExact<'a, T, { N }>;
+    //~^ ERROR undeclared lifetime
+}
+
+impl<T> ConstChunksExactTrait<T> for [T] {}
+//~^ ERROR not all trait items implemented, missing: `const_chunks_exact`
+struct ConstChunksExact<'rem, T: 'a, const N: usize> {}
+//~^ ERROR use of undeclared lifetime name `'a`
+//~^^ ERROR lifetime parameter
+//~^^^ ERROR type parameter
+impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> {
+//~^ ERROR the const parameter `N` is not constrained by the impl trait, self type, or predicates
+//~^^ ERROR mismatched types
+    type Item = &'a [T; N];
+}
+
+fn main() {
+    let slice = &[1i32, 2, 3, 4, 5, 6, 7, 8, 9, 10];
+
+    let mut iter = [[1, 2, 3], [4, 5, 6], [7, 8, 9]].iter();
+
+    for a in slice.const_chunks_exact::<3>() {
+        assert_eq!(a, iter.next().unwrap());
+    }
+}
diff --git a/tests/ui/const-generics/ice-unexpected-inference-var-122549.stderr b/tests/ui/const-generics/ice-unexpected-inference-var-122549.stderr
new file mode 100644
index 00000000000..afad3388145
--- /dev/null
+++ b/tests/ui/const-generics/ice-unexpected-inference-var-122549.stderr
@@ -0,0 +1,67 @@
+error[E0261]: use of undeclared lifetime name `'a`
+  --> $DIR/ice-unexpected-inference-var-122549.rs:5:70
+   |
+LL |     fn const_chunks_exact<const N: usize>(&self) -> ConstChunksExact<'a, T, { N }>;
+   |                                                                      ^^ undeclared lifetime
+   |
+help: consider introducing lifetime `'a` here
+   |
+LL |     fn const_chunks_exact<'a, const N: usize>(&self) -> ConstChunksExact<'a, T, { N }>;
+   |                           +++
+help: consider introducing lifetime `'a` here
+   |
+LL | trait ConstChunksExactTrait<'a, T> {
+   |                             +++
+
+error[E0261]: use of undeclared lifetime name `'a`
+  --> $DIR/ice-unexpected-inference-var-122549.rs:11:34
+   |
+LL | struct ConstChunksExact<'rem, T: 'a, const N: usize> {}
+   |                         -        ^^ undeclared lifetime
+   |                         |
+   |                         help: consider introducing lifetime `'a` here: `'a,`
+
+error[E0046]: not all trait items implemented, missing: `const_chunks_exact`
+  --> $DIR/ice-unexpected-inference-var-122549.rs:9:1
+   |
+LL |     fn const_chunks_exact<const N: usize>(&self) -> ConstChunksExact<'a, T, { N }>;
+   |     ------------------------------------------------------------------------------- `const_chunks_exact` from trait
+...
+LL | impl<T> ConstChunksExactTrait<T> for [T] {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `const_chunks_exact` in implementation
+
+error[E0392]: lifetime parameter `'rem` is never used
+  --> $DIR/ice-unexpected-inference-var-122549.rs:11:25
+   |
+LL | struct ConstChunksExact<'rem, T: 'a, const N: usize> {}
+   |                         ^^^^ unused lifetime parameter
+   |
+   = help: consider removing `'rem`, referring to it in a field, or using a marker such as `PhantomData`
+
+error[E0392]: type parameter `T` is never used
+  --> $DIR/ice-unexpected-inference-var-122549.rs:11:31
+   |
+LL | struct ConstChunksExact<'rem, T: 'a, const N: usize> {}
+   |                               ^ unused type parameter
+   |
+   = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
+
+error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates
+  --> $DIR/ice-unexpected-inference-var-122549.rs:15:13
+   |
+LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> {
+   |             ^^^^^^^^^^^^^^ unconstrained const parameter
+   |
+   = note: expressions using a const parameter must map each value to a distinct output value
+   = note: proving the result of expressions other than the parameter are unique is not supported
+
+error[E0308]: mismatched types
+  --> $DIR/ice-unexpected-inference-var-122549.rs:15:66
+   |
+LL | impl<'a, T, const N: usize> Iterator for ConstChunksExact<'a, T, {}> {
+   |                                                                  ^^ expected `usize`, found `()`
+
+error: aborting due to 7 previous errors
+
+Some errors have detailed explanations: E0046, E0207, E0261, E0308, E0392.
+For more information about an error, try `rustc --explain E0046`.
diff --git a/tests/ui/consts/required-consts/collect-in-called-fn.noopt.stderr b/tests/ui/consts/required-consts/collect-in-called-fn.noopt.stderr
index 14a4cb0217f..c3b641a899a 100644
--- a/tests/ui/consts/required-consts/collect-in-called-fn.noopt.stderr
+++ b/tests/ui/consts/required-consts/collect-in-called-fn.noopt.stderr
@@ -1,19 +1,19 @@
 error[E0080]: evaluation of `Fail::<i32>::C` failed
-  --> $DIR/collect-in-called-fn.rs:9:19
+  --> $DIR/collect-in-called-fn.rs:10:19
    |
 LL |     const C: () = panic!();
-   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-called-fn.rs:9:19
+   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-called-fn.rs:10:19
    |
    = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
-  --> $DIR/collect-in-called-fn.rs:18:17
+  --> $DIR/collect-in-called-fn.rs:19:17
    |
 LL |         let _ = Fail::<T>::C;
    |                 ^^^^^^^^^^^^
 
 note: the above error was encountered while instantiating `fn called::<i32>`
-  --> $DIR/collect-in-called-fn.rs:23:5
+  --> $DIR/collect-in-called-fn.rs:24:5
    |
 LL |     called::<i32>();
    |     ^^^^^^^^^^^^^^^
diff --git a/tests/ui/consts/required-consts/collect-in-called-fn.opt.stderr b/tests/ui/consts/required-consts/collect-in-called-fn.opt.stderr
index 14a4cb0217f..c3b641a899a 100644
--- a/tests/ui/consts/required-consts/collect-in-called-fn.opt.stderr
+++ b/tests/ui/consts/required-consts/collect-in-called-fn.opt.stderr
@@ -1,19 +1,19 @@
 error[E0080]: evaluation of `Fail::<i32>::C` failed
-  --> $DIR/collect-in-called-fn.rs:9:19
+  --> $DIR/collect-in-called-fn.rs:10:19
    |
 LL |     const C: () = panic!();
-   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-called-fn.rs:9:19
+   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-called-fn.rs:10:19
    |
    = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
-  --> $DIR/collect-in-called-fn.rs:18:17
+  --> $DIR/collect-in-called-fn.rs:19:17
    |
 LL |         let _ = Fail::<T>::C;
    |                 ^^^^^^^^^^^^
 
 note: the above error was encountered while instantiating `fn called::<i32>`
-  --> $DIR/collect-in-called-fn.rs:23:5
+  --> $DIR/collect-in-called-fn.rs:24:5
    |
 LL |     called::<i32>();
    |     ^^^^^^^^^^^^^^^
diff --git a/tests/ui/consts/required-consts/collect-in-called-fn.rs b/tests/ui/consts/required-consts/collect-in-called-fn.rs
index 55133a10cd9..93947950af2 100644
--- a/tests/ui/consts/required-consts/collect-in-called-fn.rs
+++ b/tests/ui/consts/required-consts/collect-in-called-fn.rs
@@ -1,5 +1,6 @@
 //@revisions: noopt opt
 //@ build-fail
+//@[noopt] compile-flags: -Copt-level=0
 //@[opt] compile-flags: -O
 //! Make sure we detect erroneous constants post-monomorphization even when they are unused. This is
 //! crucial, people rely on it for soundness. (https://github.com/rust-lang/rust/issues/112090)
diff --git a/tests/ui/consts/required-consts/collect-in-dead-closure.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-closure.noopt.stderr
new file mode 100644
index 00000000000..75c3575a110
--- /dev/null
+++ b/tests/ui/consts/required-consts/collect-in-dead-closure.noopt.stderr
@@ -0,0 +1,23 @@
+error[E0080]: evaluation of `Fail::<i32>::C` failed
+  --> $DIR/collect-in-dead-closure.rs:9:19
+   |
+LL |     const C: () = panic!();
+   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-closure.rs:9:19
+   |
+   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+note: erroneous constant encountered
+  --> $DIR/collect-in-dead-closure.rs:17:17
+   |
+LL |         let _ = Fail::<T>::C;
+   |                 ^^^^^^^^^^^^
+
+note: the above error was encountered while instantiating `fn not_called::<i32>`
+  --> $DIR/collect-in-dead-closure.rs:24:33
+   |
+LL |         let _closure: fn() = || not_called::<T>();
+   |                                 ^^^^^^^^^^^^^^^^^
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/required-consts/collect-in-dead-closure.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-closure.opt.stderr
new file mode 100644
index 00000000000..75c3575a110
--- /dev/null
+++ b/tests/ui/consts/required-consts/collect-in-dead-closure.opt.stderr
@@ -0,0 +1,23 @@
+error[E0080]: evaluation of `Fail::<i32>::C` failed
+  --> $DIR/collect-in-dead-closure.rs:9:19
+   |
+LL |     const C: () = panic!();
+   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-closure.rs:9:19
+   |
+   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+note: erroneous constant encountered
+  --> $DIR/collect-in-dead-closure.rs:17:17
+   |
+LL |         let _ = Fail::<T>::C;
+   |                 ^^^^^^^^^^^^
+
+note: the above error was encountered while instantiating `fn not_called::<i32>`
+  --> $DIR/collect-in-dead-closure.rs:24:33
+   |
+LL |         let _closure: fn() = || not_called::<T>();
+   |                                 ^^^^^^^^^^^^^^^^^
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/required-consts/collect-in-dead-closure.rs b/tests/ui/consts/required-consts/collect-in-dead-closure.rs
new file mode 100644
index 00000000000..a00214c62db
--- /dev/null
+++ b/tests/ui/consts/required-consts/collect-in-dead-closure.rs
@@ -0,0 +1,30 @@
+//@revisions: noopt opt
+//@ build-fail
+//@[noopt] compile-flags: -Copt-level=0
+//@[opt] compile-flags: -O
+//! This fails without optimizations, so it should also fail with optimizations.
+
+struct Fail<T>(T);
+impl<T> Fail<T> {
+    const C: () = panic!(); //~ERROR evaluation of `Fail::<i32>::C` failed
+}
+
+// This function is not actually called, but it is mentioned in a closure that is coerced to a
+// function pointer in dead code in a function that is called. Make sure we still find this error.
+#[inline(never)]
+fn not_called<T>() {
+    if false {
+        let _ = Fail::<T>::C;
+    }
+}
+
+#[inline(never)]
+fn called<T>() {
+    if false {
+        let _closure: fn() = || not_called::<T>();
+    }
+}
+
+pub fn main() {
+    called::<i32>();
+}
diff --git a/tests/ui/consts/required-consts/collect-in-dead-drop.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-drop.noopt.stderr
index 0bf231d09f1..73790f7517d 100644
--- a/tests/ui/consts/required-consts/collect-in-dead-drop.noopt.stderr
+++ b/tests/ui/consts/required-consts/collect-in-dead-drop.noopt.stderr
@@ -1,13 +1,13 @@
 error[E0080]: evaluation of `Fail::<i32>::C` failed
-  --> $DIR/collect-in-dead-drop.rs:12:19
+  --> $DIR/collect-in-dead-drop.rs:9:19
    |
 LL |     const C: () = panic!();
-   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-drop.rs:12:19
+   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-drop.rs:9:19
    |
    = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
-  --> $DIR/collect-in-dead-drop.rs:19:17
+  --> $DIR/collect-in-dead-drop.rs:16:17
    |
 LL |         let _ = Fail::<T>::C;
    |                 ^^^^^^^^^^^^
diff --git a/tests/ui/consts/required-consts/collect-in-dead-drop.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-drop.opt.stderr
new file mode 100644
index 00000000000..73790f7517d
--- /dev/null
+++ b/tests/ui/consts/required-consts/collect-in-dead-drop.opt.stderr
@@ -0,0 +1,20 @@
+error[E0080]: evaluation of `Fail::<i32>::C` failed
+  --> $DIR/collect-in-dead-drop.rs:9:19
+   |
+LL |     const C: () = panic!();
+   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-drop.rs:9:19
+   |
+   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+note: erroneous constant encountered
+  --> $DIR/collect-in-dead-drop.rs:16:17
+   |
+LL |         let _ = Fail::<T>::C;
+   |                 ^^^^^^^^^^^^
+
+note: the above error was encountered while instantiating `fn <Fail<i32> as std::ops::Drop>::drop`
+  --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/required-consts/collect-in-dead-drop.rs b/tests/ui/consts/required-consts/collect-in-dead-drop.rs
index c9ffcec6903..389fcf5dfc9 100644
--- a/tests/ui/consts/required-consts/collect-in-dead-drop.rs
+++ b/tests/ui/consts/required-consts/collect-in-dead-drop.rs
@@ -1,15 +1,12 @@
 //@revisions: noopt opt
-//@[noopt] build-fail
+//@ build-fail
+//@[noopt] compile-flags: -Copt-level=0
 //@[opt] compile-flags: -O
-//FIXME: `opt` revision currently does not stop with an error due to
-//<https://github.com/rust-lang/rust/issues/107503>.
-//@[opt] build-pass
-//! Make sure we detect erroneous constants post-monomorphization even when they are unused. This is
-//! crucial, people rely on it for soundness. (https://github.com/rust-lang/rust/issues/112090)
+//! This fails without optimizations, so it should also fail with optimizations.
 
 struct Fail<T>(T);
 impl<T> Fail<T> {
-    const C: () = panic!(); //[noopt]~ERROR evaluation of `Fail::<i32>::C` failed
+    const C: () = panic!(); //~ERROR evaluation of `Fail::<i32>::C` failed
 }
 
 // This function is not actually called, but is mentioned implicitly as destructor in dead code in a
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.noopt.stderr
new file mode 100644
index 00000000000..706c0d55b62
--- /dev/null
+++ b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.noopt.stderr
@@ -0,0 +1,20 @@
+error[E0080]: evaluation of `Fail::<i32>::C` failed
+  --> $DIR/collect-in-dead-fn-behind-assoc-type.rs:10:19
+   |
+LL |     const C: () = panic!();
+   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-fn-behind-assoc-type.rs:10:19
+   |
+   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+note: erroneous constant encountered
+  --> $DIR/collect-in-dead-fn-behind-assoc-type.rs:16:17
+   |
+LL |         let _ = Fail::<T>::C;
+   |                 ^^^^^^^^^^^^
+
+note: the above error was encountered while instantiating `fn not_called::<i32>`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.opt.stderr
new file mode 100644
index 00000000000..706c0d55b62
--- /dev/null
+++ b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.opt.stderr
@@ -0,0 +1,20 @@
+error[E0080]: evaluation of `Fail::<i32>::C` failed
+  --> $DIR/collect-in-dead-fn-behind-assoc-type.rs:10:19
+   |
+LL |     const C: () = panic!();
+   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-fn-behind-assoc-type.rs:10:19
+   |
+   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+note: erroneous constant encountered
+  --> $DIR/collect-in-dead-fn-behind-assoc-type.rs:16:17
+   |
+LL |         let _ = Fail::<T>::C;
+   |                 ^^^^^^^^^^^^
+
+note: the above error was encountered while instantiating `fn not_called::<i32>`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.rs b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.rs
new file mode 100644
index 00000000000..9c36af50bb7
--- /dev/null
+++ b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-assoc-type.rs
@@ -0,0 +1,49 @@
+#![feature(impl_trait_in_assoc_type)]
+//@revisions: noopt opt
+//@ build-fail
+//@[noopt] compile-flags: -Copt-level=0
+//@[opt] compile-flags: -O
+//! This fails without optimizations, so it should also fail with optimizations.
+
+struct Fail<T>(T);
+impl<T> Fail<T> {
+    const C: () = panic!(); //~ERROR evaluation of `Fail::<i32>::C` failed
+}
+
+#[inline(never)]
+fn not_called<T>() {
+    if false {
+        let _ = Fail::<T>::C;
+    }
+}
+
+#[inline(never)]
+fn callit_not(f: impl Fn()) {
+    if false {
+        f();
+    }
+}
+
+// Using `Fn` here is important; with `FnOnce` another shim gets involved which somehow makes this
+// easier to collect properly.
+trait Hideaway {
+    type T: Fn();
+    const C: Self::T;
+}
+impl Hideaway for () {
+    type T = impl Fn();
+    const C: Self::T = not_called::<i32>;
+}
+
+#[inline(never)]
+fn reveal<T: Hideaway>() {
+    if false {
+        callit_not(T::C);
+    }
+}
+
+fn main() {
+    if false {
+        reveal::<()>()
+    }
+}
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.noopt.stderr
new file mode 100644
index 00000000000..581edd2b7b8
--- /dev/null
+++ b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.noopt.stderr
@@ -0,0 +1,20 @@
+error[E0080]: evaluation of `Fail::<i32>::C` failed
+  --> $DIR/collect-in-dead-fn-behind-generic.rs:9:19
+   |
+LL |     const C: () = panic!();
+   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-fn-behind-generic.rs:9:19
+   |
+   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+note: erroneous constant encountered
+  --> $DIR/collect-in-dead-fn-behind-generic.rs:15:17
+   |
+LL |         let _ = Fail::<T>::C;
+   |                 ^^^^^^^^^^^^
+
+note: the above error was encountered while instantiating `fn not_called::<i32>`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.opt.stderr
new file mode 100644
index 00000000000..581edd2b7b8
--- /dev/null
+++ b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.opt.stderr
@@ -0,0 +1,20 @@
+error[E0080]: evaluation of `Fail::<i32>::C` failed
+  --> $DIR/collect-in-dead-fn-behind-generic.rs:9:19
+   |
+LL |     const C: () = panic!();
+   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-fn-behind-generic.rs:9:19
+   |
+   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+note: erroneous constant encountered
+  --> $DIR/collect-in-dead-fn-behind-generic.rs:15:17
+   |
+LL |         let _ = Fail::<T>::C;
+   |                 ^^^^^^^^^^^^
+
+note: the above error was encountered while instantiating `fn not_called::<i32>`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.rs b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.rs
new file mode 100644
index 00000000000..5829d914ee1
--- /dev/null
+++ b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-generic.rs
@@ -0,0 +1,30 @@
+//@revisions: noopt opt
+//@ build-fail
+//@[noopt] compile-flags: -Copt-level=0
+//@[opt] compile-flags: -O
+//! This fails without optimizations, so it should also fail with optimizations.
+
+struct Fail<T>(T);
+impl<T> Fail<T> {
+    const C: () = panic!(); //~ERROR evaluation of `Fail::<i32>::C` failed
+}
+
+#[inline(never)]
+fn not_called<T>() {
+    if false {
+        let _ = Fail::<T>::C;
+    }
+}
+
+#[inline(never)]
+fn callit_not(f: impl Fn()) {
+    if false {
+        f();
+    }
+}
+
+fn main() {
+    if false {
+        callit_not(not_called::<i32>)
+    }
+}
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.noopt.stderr
new file mode 100644
index 00000000000..07e46b8a816
--- /dev/null
+++ b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.noopt.stderr
@@ -0,0 +1,20 @@
+error[E0080]: evaluation of `m::Fail::<i32>::C` failed
+  --> $DIR/collect-in-dead-fn-behind-opaque-type.rs:11:23
+   |
+LL |         const C: () = panic!();
+   |                       ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-fn-behind-opaque-type.rs:11:23
+   |
+   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+note: erroneous constant encountered
+  --> $DIR/collect-in-dead-fn-behind-opaque-type.rs:19:21
+   |
+LL |             let _ = Fail::<T>::C;
+   |                     ^^^^^^^^^^^^
+
+note: the above error was encountered while instantiating `fn m::not_called::<i32>`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.opt.stderr
new file mode 100644
index 00000000000..07e46b8a816
--- /dev/null
+++ b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.opt.stderr
@@ -0,0 +1,20 @@
+error[E0080]: evaluation of `m::Fail::<i32>::C` failed
+  --> $DIR/collect-in-dead-fn-behind-opaque-type.rs:11:23
+   |
+LL |         const C: () = panic!();
+   |                       ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-fn-behind-opaque-type.rs:11:23
+   |
+   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+note: erroneous constant encountered
+  --> $DIR/collect-in-dead-fn-behind-opaque-type.rs:19:21
+   |
+LL |             let _ = Fail::<T>::C;
+   |                     ^^^^^^^^^^^^
+
+note: the above error was encountered while instantiating `fn m::not_called::<i32>`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.rs b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.rs
new file mode 100644
index 00000000000..795e021ceb0
--- /dev/null
+++ b/tests/ui/consts/required-consts/collect-in-dead-fn-behind-opaque-type.rs
@@ -0,0 +1,37 @@
+//@revisions: noopt opt
+//@ build-fail
+//@[noopt] compile-flags: -Copt-level=0
+//@[opt] compile-flags: -O
+//! This fails without optimizations, so it should also fail with optimizations.
+#![feature(type_alias_impl_trait)]
+
+mod m {
+    struct Fail<T>(T);
+    impl<T> Fail<T> {
+        const C: () = panic!(); //~ERROR evaluation of `m::Fail::<i32>::C` failed
+    }
+
+    pub type NotCalledFn = impl Fn();
+
+    #[inline(never)]
+    fn not_called<T>() {
+        if false {
+            let _ = Fail::<T>::C;
+        }
+    }
+
+    fn mk_not_called() -> NotCalledFn {
+        not_called::<i32>
+    }
+}
+
+fn main() {
+    // This does not involve a constant of `FnDef` type, it generates the value via unsafe
+    // shenanigans instead. This ensures that we check all `FnDef` types that occur in a function,
+    // not just those of constants. Furthermore the `FnDef` is behind an opaque type which bust be
+    // normalized away to reveal the function type.
+    if false {
+        let x: m::NotCalledFn = unsafe { std::mem::transmute(()) };
+        x();
+    }
+}
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fn.noopt.stderr
index 8bb99efe8e4..52462076ff9 100644
--- a/tests/ui/consts/required-consts/collect-in-dead-fn.noopt.stderr
+++ b/tests/ui/consts/required-consts/collect-in-dead-fn.noopt.stderr
@@ -1,19 +1,19 @@
 error[E0080]: evaluation of `Fail::<i32>::C` failed
-  --> $DIR/collect-in-dead-fn.rs:12:19
+  --> $DIR/collect-in-dead-fn.rs:9:19
    |
 LL |     const C: () = panic!();
-   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-fn.rs:12:19
+   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-fn.rs:9:19
    |
    = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
-  --> $DIR/collect-in-dead-fn.rs:22:17
+  --> $DIR/collect-in-dead-fn.rs:19:17
    |
 LL |         let _ = Fail::<T>::C;
    |                 ^^^^^^^^^^^^
 
 note: the above error was encountered while instantiating `fn not_called::<i32>`
-  --> $DIR/collect-in-dead-fn.rs:29:9
+  --> $DIR/collect-in-dead-fn.rs:26:9
    |
 LL |         not_called::<T>();
    |         ^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fn.opt.stderr
new file mode 100644
index 00000000000..52462076ff9
--- /dev/null
+++ b/tests/ui/consts/required-consts/collect-in-dead-fn.opt.stderr
@@ -0,0 +1,23 @@
+error[E0080]: evaluation of `Fail::<i32>::C` failed
+  --> $DIR/collect-in-dead-fn.rs:9:19
+   |
+LL |     const C: () = panic!();
+   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-fn.rs:9:19
+   |
+   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+note: erroneous constant encountered
+  --> $DIR/collect-in-dead-fn.rs:19:17
+   |
+LL |         let _ = Fail::<T>::C;
+   |                 ^^^^^^^^^^^^
+
+note: the above error was encountered while instantiating `fn not_called::<i32>`
+  --> $DIR/collect-in-dead-fn.rs:26:9
+   |
+LL |         not_called::<T>();
+   |         ^^^^^^^^^^^^^^^^^
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fn.rs b/tests/ui/consts/required-consts/collect-in-dead-fn.rs
index 9e6b1519153..1c95e0c303f 100644
--- a/tests/ui/consts/required-consts/collect-in-dead-fn.rs
+++ b/tests/ui/consts/required-consts/collect-in-dead-fn.rs
@@ -1,15 +1,12 @@
 //@revisions: noopt opt
-//@[noopt] build-fail
+//@ build-fail
+//@[noopt] compile-flags: -Copt-level=0
 //@[opt] compile-flags: -O
-//FIXME: `opt` revision currently does not stop with an error due to
-//<https://github.com/rust-lang/rust/issues/107503>.
-//@[opt] build-pass
-//! Make sure we detect erroneous constants post-monomorphization even when they are unused. This is
-//! crucial, people rely on it for soundness. (https://github.com/rust-lang/rust/issues/112090)
+//! This fails without optimizations, so it should also fail with optimizations.
 
 struct Fail<T>(T);
 impl<T> Fail<T> {
-    const C: () = panic!(); //[noopt]~ERROR evaluation of `Fail::<i32>::C` failed
+    const C: () = panic!(); //~ERROR evaluation of `Fail::<i32>::C` failed
 }
 
 // This function is not actually called, but it is mentioned in dead code in a function that is
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.noopt.stderr
new file mode 100644
index 00000000000..dea2a342383
--- /dev/null
+++ b/tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.noopt.stderr
@@ -0,0 +1,20 @@
+error[E0080]: evaluation of `Late::<i32>::FAIL` failed
+  --> $DIR/collect-in-dead-fnptr-in-const.rs:9:22
+   |
+LL |     const FAIL: () = panic!();
+   |                      ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-fnptr-in-const.rs:9:22
+   |
+   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+note: erroneous constant encountered
+  --> $DIR/collect-in-dead-fnptr-in-const.rs:10:28
+   |
+LL |     const FNPTR: fn() = || Self::FAIL;
+   |                            ^^^^^^^^^^
+
+note: the above error was encountered while instantiating `fn Late::<i32>::FNPTR::{closure#0}`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.opt.stderr
new file mode 100644
index 00000000000..dea2a342383
--- /dev/null
+++ b/tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.opt.stderr
@@ -0,0 +1,20 @@
+error[E0080]: evaluation of `Late::<i32>::FAIL` failed
+  --> $DIR/collect-in-dead-fnptr-in-const.rs:9:22
+   |
+LL |     const FAIL: () = panic!();
+   |                      ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-fnptr-in-const.rs:9:22
+   |
+   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+note: erroneous constant encountered
+  --> $DIR/collect-in-dead-fnptr-in-const.rs:10:28
+   |
+LL |     const FNPTR: fn() = || Self::FAIL;
+   |                            ^^^^^^^^^^
+
+note: the above error was encountered while instantiating `fn Late::<i32>::FNPTR::{closure#0}`
+  --> $SRC_DIR/core/src/ops/function.rs:LL:COL
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.rs b/tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.rs
new file mode 100644
index 00000000000..8b6344c93f3
--- /dev/null
+++ b/tests/ui/consts/required-consts/collect-in-dead-fnptr-in-const.rs
@@ -0,0 +1,34 @@
+//@revisions: noopt opt
+//@ build-fail
+//@[noopt] compile-flags: -Copt-level=0
+//@[opt] compile-flags: -O
+//! This fails without optimizations, so it should also fail with optimizations.
+
+struct Late<T>(T);
+impl<T> Late<T> {
+    const FAIL: () = panic!(); //~ERROR evaluation of `Late::<i32>::FAIL` failed
+    const FNPTR: fn() = || Self::FAIL;
+}
+
+// This function is not actually called, but it is mentioned in dead code in a function that is
+// called. The function then mentions a const that evaluates to a fnptr that points to a function
+// that used a const that fails to evaluate.
+// This tests that when processing mentioned items, we also check the fnptrs in the final values
+// of consts that we encounter.
+#[inline(never)]
+fn not_called<T>() {
+    if false {
+        let _ = Late::<T>::FNPTR;
+    }
+}
+
+#[inline(never)]
+fn called<T>() {
+    if false {
+        not_called::<T>();
+    }
+}
+
+pub fn main() {
+    called::<i32>();
+}
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fnptr.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fnptr.noopt.stderr
new file mode 100644
index 00000000000..51c68782687
--- /dev/null
+++ b/tests/ui/consts/required-consts/collect-in-dead-fnptr.noopt.stderr
@@ -0,0 +1,23 @@
+error[E0080]: evaluation of `Fail::<i32>::C` failed
+  --> $DIR/collect-in-dead-fnptr.rs:9:19
+   |
+LL |     const C: () = panic!();
+   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-fnptr.rs:9:19
+   |
+   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+note: erroneous constant encountered
+  --> $DIR/collect-in-dead-fnptr.rs:18:17
+   |
+LL |         let _ = Fail::<T>::C;
+   |                 ^^^^^^^^^^^^
+
+note: the above error was encountered while instantiating `fn not_called::<i32>`
+  --> $DIR/collect-in-dead-fnptr.rs:27:28
+   |
+LL |         let _fnptr: fn() = not_called::<T>;
+   |                            ^^^^^^^^^^^^^^^
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fnptr.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-fnptr.opt.stderr
new file mode 100644
index 00000000000..51c68782687
--- /dev/null
+++ b/tests/ui/consts/required-consts/collect-in-dead-fnptr.opt.stderr
@@ -0,0 +1,23 @@
+error[E0080]: evaluation of `Fail::<i32>::C` failed
+  --> $DIR/collect-in-dead-fnptr.rs:9:19
+   |
+LL |     const C: () = panic!();
+   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-fnptr.rs:9:19
+   |
+   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+note: erroneous constant encountered
+  --> $DIR/collect-in-dead-fnptr.rs:18:17
+   |
+LL |         let _ = Fail::<T>::C;
+   |                 ^^^^^^^^^^^^
+
+note: the above error was encountered while instantiating `fn not_called::<i32>`
+  --> $DIR/collect-in-dead-fnptr.rs:27:28
+   |
+LL |         let _fnptr: fn() = not_called::<T>;
+   |                            ^^^^^^^^^^^^^^^
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/required-consts/collect-in-dead-fnptr.rs b/tests/ui/consts/required-consts/collect-in-dead-fnptr.rs
new file mode 100644
index 00000000000..acbe34829e8
--- /dev/null
+++ b/tests/ui/consts/required-consts/collect-in-dead-fnptr.rs
@@ -0,0 +1,33 @@
+//@revisions: noopt opt
+//@ build-fail
+//@[noopt] compile-flags: -Copt-level=0
+//@[opt] compile-flags: -O
+//! This fails without optimizations, so it should also fail with optimizations.
+
+struct Fail<T>(T);
+impl<T> Fail<T> {
+    const C: () = panic!(); //~ERROR evaluation of `Fail::<i32>::C` failed
+}
+
+// This function is not actually called, but it is mentioned in dead code in a function that is
+// called. Make sure we still find this error.
+// This ensures that we consider ReifyFnPointer coercions when gathering "mentioned" items.
+#[inline(never)]
+fn not_called<T>() {
+    if false {
+        let _ = Fail::<T>::C;
+    }
+}
+
+#[inline(never)]
+fn called<T>() {
+    if false {
+        // We don't call the function, but turn it to a function pointer.
+        // Make sure it still gest added to `mentioned_items`.
+        let _fnptr: fn() = not_called::<T>;
+    }
+}
+
+pub fn main() {
+    called::<i32>();
+}
diff --git a/tests/ui/consts/required-consts/collect-in-dead-forget.rs b/tests/ui/consts/required-consts/collect-in-dead-forget.rs
index 720b7a499f7..7586004116c 100644
--- a/tests/ui/consts/required-consts/collect-in-dead-forget.rs
+++ b/tests/ui/consts/required-consts/collect-in-dead-forget.rs
@@ -1,8 +1,8 @@
 //@revisions: noopt opt
 //@build-pass
+//@[noopt] compile-flags: -Copt-level=0
 //@[opt] compile-flags: -O
-//! Make sure we detect erroneous constants post-monomorphization even when they are unused. This is
-//! crucial, people rely on it for soundness. (https://github.com/rust-lang/rust/issues/112090)
+//! This passes without optimizations, so it can (and should) also pass with optimizations.
 
 struct Fail<T>(T);
 impl<T> Fail<T> {
diff --git a/tests/ui/consts/required-consts/collect-in-dead-move.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-move.noopt.stderr
index 5b1df78b232..2ab1f80e2d3 100644
--- a/tests/ui/consts/required-consts/collect-in-dead-move.noopt.stderr
+++ b/tests/ui/consts/required-consts/collect-in-dead-move.noopt.stderr
@@ -1,13 +1,13 @@
 error[E0080]: evaluation of `Fail::<i32>::C` failed
-  --> $DIR/collect-in-dead-move.rs:12:19
+  --> $DIR/collect-in-dead-move.rs:9:19
    |
 LL |     const C: () = panic!();
-   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-move.rs:12:19
+   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-move.rs:9:19
    |
    = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
-  --> $DIR/collect-in-dead-move.rs:19:17
+  --> $DIR/collect-in-dead-move.rs:16:17
    |
 LL |         let _ = Fail::<T>::C;
    |                 ^^^^^^^^^^^^
diff --git a/tests/ui/consts/required-consts/collect-in-dead-move.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-move.opt.stderr
new file mode 100644
index 00000000000..2ab1f80e2d3
--- /dev/null
+++ b/tests/ui/consts/required-consts/collect-in-dead-move.opt.stderr
@@ -0,0 +1,20 @@
+error[E0080]: evaluation of `Fail::<i32>::C` failed
+  --> $DIR/collect-in-dead-move.rs:9:19
+   |
+LL |     const C: () = panic!();
+   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-move.rs:9:19
+   |
+   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+note: erroneous constant encountered
+  --> $DIR/collect-in-dead-move.rs:16:17
+   |
+LL |         let _ = Fail::<T>::C;
+   |                 ^^^^^^^^^^^^
+
+note: the above error was encountered while instantiating `fn <Fail<i32> as std::ops::Drop>::drop`
+  --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/required-consts/collect-in-dead-move.rs b/tests/ui/consts/required-consts/collect-in-dead-move.rs
index f3a6ba8a657..6a224a375cf 100644
--- a/tests/ui/consts/required-consts/collect-in-dead-move.rs
+++ b/tests/ui/consts/required-consts/collect-in-dead-move.rs
@@ -1,15 +1,12 @@
 //@revisions: noopt opt
-//@[noopt] build-fail
+//@ build-fail
+//@[noopt] compile-flags: -Copt-level=0
 //@[opt] compile-flags: -O
-//FIXME: `opt` revision currently does not stop with an error due to
-//<https://github.com/rust-lang/rust/issues/107503>.
-//@[opt] build-pass
-//! Make sure we detect erroneous constants post-monomorphization even when they are unused. This is
-//! crucial, people rely on it for soundness. (https://github.com/rust-lang/rust/issues/112090)
+//! This fails without optimizations, so it should also fail with optimizations.
 
 struct Fail<T>(T);
 impl<T> Fail<T> {
-    const C: () = panic!(); //[noopt]~ERROR evaluation of `Fail::<i32>::C` failed
+    const C: () = panic!(); //~ERROR evaluation of `Fail::<i32>::C` failed
 }
 
 // This function is not actually called, but is mentioned implicitly as destructor in dead code in a
diff --git a/tests/ui/consts/required-consts/collect-in-dead-vtable.noopt.stderr b/tests/ui/consts/required-consts/collect-in-dead-vtable.noopt.stderr
index 56b6989b441..b4e18706489 100644
--- a/tests/ui/consts/required-consts/collect-in-dead-vtable.noopt.stderr
+++ b/tests/ui/consts/required-consts/collect-in-dead-vtable.noopt.stderr
@@ -1,21 +1,21 @@
 error[E0080]: evaluation of `Fail::<i32>::C` failed
-  --> $DIR/collect-in-dead-vtable.rs:12:19
+  --> $DIR/collect-in-dead-vtable.rs:9:19
    |
 LL |     const C: () = panic!();
-   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-vtable.rs:12:19
+   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-vtable.rs:9:19
    |
    = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
-  --> $DIR/collect-in-dead-vtable.rs:26:21
+  --> $DIR/collect-in-dead-vtable.rs:22:21
    |
 LL |             let _ = Fail::<T>::C;
    |                     ^^^^^^^^^^^^
 
 note: the above error was encountered while instantiating `fn <std::vec::Vec<i32> as MyTrait>::not_called`
-  --> $DIR/collect-in-dead-vtable.rs:35:40
+  --> $DIR/collect-in-dead-vtable.rs:31:40
    |
-LL |         let gen_vtable: &dyn MyTrait = &v; // vtable "appears" here
+LL |         let gen_vtable: &dyn MyTrait = &v; // vtable is "mentioned" here
    |                                        ^^
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/consts/required-consts/collect-in-dead-vtable.opt.stderr b/tests/ui/consts/required-consts/collect-in-dead-vtable.opt.stderr
new file mode 100644
index 00000000000..b4e18706489
--- /dev/null
+++ b/tests/ui/consts/required-consts/collect-in-dead-vtable.opt.stderr
@@ -0,0 +1,23 @@
+error[E0080]: evaluation of `Fail::<i32>::C` failed
+  --> $DIR/collect-in-dead-vtable.rs:9:19
+   |
+LL |     const C: () = panic!();
+   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/collect-in-dead-vtable.rs:9:19
+   |
+   = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+note: erroneous constant encountered
+  --> $DIR/collect-in-dead-vtable.rs:22:21
+   |
+LL |             let _ = Fail::<T>::C;
+   |                     ^^^^^^^^^^^^
+
+note: the above error was encountered while instantiating `fn <std::vec::Vec<i32> as MyTrait>::not_called`
+  --> $DIR/collect-in-dead-vtable.rs:31:40
+   |
+LL |         let gen_vtable: &dyn MyTrait = &v; // vtable is "mentioned" here
+   |                                        ^^
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/tests/ui/consts/required-consts/collect-in-dead-vtable.rs b/tests/ui/consts/required-consts/collect-in-dead-vtable.rs
index f21a1cc1fc2..f63207eafec 100644
--- a/tests/ui/consts/required-consts/collect-in-dead-vtable.rs
+++ b/tests/ui/consts/required-consts/collect-in-dead-vtable.rs
@@ -1,15 +1,12 @@
 //@revisions: noopt opt
-//@[noopt] build-fail
+//@ build-fail
+//@[noopt] compile-flags: -Copt-level=0
 //@[opt] compile-flags: -O
-//FIXME: `opt` revision currently does not stop with an error due to
-//<https://github.com/rust-lang/rust/issues/107503>.
-//@[opt] build-pass
-//! Make sure we detect erroneous constants post-monomorphization even when they are unused. This is
-//! crucial, people rely on it for soundness. (https://github.com/rust-lang/rust/issues/112090)
+//! This fails without optimizations, so it should also fail with optimizations.
 
 struct Fail<T>(T);
 impl<T> Fail<T> {
-    const C: () = panic!(); //[noopt]~ERROR evaluation of `Fail::<i32>::C` failed
+    const C: () = panic!(); //~ERROR evaluation of `Fail::<i32>::C` failed
 }
 
 trait MyTrait {
@@ -18,8 +15,7 @@ trait MyTrait {
 
 // This function is not actually called, but it is mentioned in a vtable in a function that is
 // called. Make sure we still find this error.
-// This relies on mono-item collection checking `required_consts` in functions that are referenced
-// in vtables that syntactically appear in collected functions (even inside dead code).
+// This ensures that we are properly considering vtables when gathering "mentioned" items.
 impl<T> MyTrait for Vec<T> {
     fn not_called(&self) {
         if false {
@@ -32,7 +28,7 @@ impl<T> MyTrait for Vec<T> {
 fn called<T>() {
     if false {
         let v: Vec<T> = Vec::new();
-        let gen_vtable: &dyn MyTrait = &v; // vtable "appears" here
+        let gen_vtable: &dyn MyTrait = &v; // vtable is "mentioned" here
     }
 }
 
diff --git a/tests/ui/consts/required-consts/interpret-in-const-called-fn.noopt.stderr b/tests/ui/consts/required-consts/interpret-in-const-called-fn.noopt.stderr
index 75304591b9f..0e3bbbcc2ec 100644
--- a/tests/ui/consts/required-consts/interpret-in-const-called-fn.noopt.stderr
+++ b/tests/ui/consts/required-consts/interpret-in-const-called-fn.noopt.stderr
@@ -1,13 +1,13 @@
 error[E0080]: evaluation of `Fail::<i32>::C` failed
-  --> $DIR/interpret-in-const-called-fn.rs:7:19
+  --> $DIR/interpret-in-const-called-fn.rs:8:19
    |
 LL |     const C: () = panic!();
-   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/interpret-in-const-called-fn.rs:7:19
+   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/interpret-in-const-called-fn.rs:8:19
    |
    = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
-  --> $DIR/interpret-in-const-called-fn.rs:16:9
+  --> $DIR/interpret-in-const-called-fn.rs:17:9
    |
 LL |         Fail::<T>::C;
    |         ^^^^^^^^^^^^
diff --git a/tests/ui/consts/required-consts/interpret-in-const-called-fn.opt.stderr b/tests/ui/consts/required-consts/interpret-in-const-called-fn.opt.stderr
index 75304591b9f..0e3bbbcc2ec 100644
--- a/tests/ui/consts/required-consts/interpret-in-const-called-fn.opt.stderr
+++ b/tests/ui/consts/required-consts/interpret-in-const-called-fn.opt.stderr
@@ -1,13 +1,13 @@
 error[E0080]: evaluation of `Fail::<i32>::C` failed
-  --> $DIR/interpret-in-const-called-fn.rs:7:19
+  --> $DIR/interpret-in-const-called-fn.rs:8:19
    |
 LL |     const C: () = panic!();
-   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/interpret-in-const-called-fn.rs:7:19
+   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/interpret-in-const-called-fn.rs:8:19
    |
    = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
-  --> $DIR/interpret-in-const-called-fn.rs:16:9
+  --> $DIR/interpret-in-const-called-fn.rs:17:9
    |
 LL |         Fail::<T>::C;
    |         ^^^^^^^^^^^^
diff --git a/tests/ui/consts/required-consts/interpret-in-const-called-fn.rs b/tests/ui/consts/required-consts/interpret-in-const-called-fn.rs
index c409fae0bb9..f2e83f56f37 100644
--- a/tests/ui/consts/required-consts/interpret-in-const-called-fn.rs
+++ b/tests/ui/consts/required-consts/interpret-in-const-called-fn.rs
@@ -1,4 +1,5 @@
 //@revisions: noopt opt
+//@[noopt] compile-flags: -Copt-level=0
 //@[opt] compile-flags: -O
 //! Make sure we error on erroneous consts even if they are unused.
 
diff --git a/tests/ui/consts/required-consts/interpret-in-promoted.noopt.stderr b/tests/ui/consts/required-consts/interpret-in-promoted.noopt.stderr
index 491131daf8d..6ab991b6471 100644
--- a/tests/ui/consts/required-consts/interpret-in-promoted.noopt.stderr
+++ b/tests/ui/consts/required-consts/interpret-in-promoted.noopt.stderr
@@ -6,18 +6,18 @@ error[E0080]: evaluation of constant value failed
 note: inside `unreachable_unchecked`
   --> $SRC_DIR/core/src/hint.rs:LL:COL
 note: inside `ub`
-  --> $DIR/interpret-in-promoted.rs:6:5
+  --> $DIR/interpret-in-promoted.rs:7:5
    |
 LL |     std::hint::unreachable_unchecked();
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 note: inside `FOO`
-  --> $DIR/interpret-in-promoted.rs:12:28
+  --> $DIR/interpret-in-promoted.rs:13:28
    |
 LL |     let _x: &'static () = &ub();
    |                            ^^^^
 
 note: erroneous constant encountered
-  --> $DIR/interpret-in-promoted.rs:12:27
+  --> $DIR/interpret-in-promoted.rs:13:27
    |
 LL |     let _x: &'static () = &ub();
    |                           ^^^^^
diff --git a/tests/ui/consts/required-consts/interpret-in-promoted.opt.stderr b/tests/ui/consts/required-consts/interpret-in-promoted.opt.stderr
index 491131daf8d..6ab991b6471 100644
--- a/tests/ui/consts/required-consts/interpret-in-promoted.opt.stderr
+++ b/tests/ui/consts/required-consts/interpret-in-promoted.opt.stderr
@@ -6,18 +6,18 @@ error[E0080]: evaluation of constant value failed
 note: inside `unreachable_unchecked`
   --> $SRC_DIR/core/src/hint.rs:LL:COL
 note: inside `ub`
-  --> $DIR/interpret-in-promoted.rs:6:5
+  --> $DIR/interpret-in-promoted.rs:7:5
    |
 LL |     std::hint::unreachable_unchecked();
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 note: inside `FOO`
-  --> $DIR/interpret-in-promoted.rs:12:28
+  --> $DIR/interpret-in-promoted.rs:13:28
    |
 LL |     let _x: &'static () = &ub();
    |                            ^^^^
 
 note: erroneous constant encountered
-  --> $DIR/interpret-in-promoted.rs:12:27
+  --> $DIR/interpret-in-promoted.rs:13:27
    |
 LL |     let _x: &'static () = &ub();
    |                           ^^^^^
diff --git a/tests/ui/consts/required-consts/interpret-in-promoted.rs b/tests/ui/consts/required-consts/interpret-in-promoted.rs
index 9c2cf4e70d3..187494180ad 100644
--- a/tests/ui/consts/required-consts/interpret-in-promoted.rs
+++ b/tests/ui/consts/required-consts/interpret-in-promoted.rs
@@ -1,4 +1,5 @@
 //@revisions: noopt opt
+//@[noopt] compile-flags: -Copt-level=0
 //@[opt] compile-flags: -O
 //! Make sure we error on erroneous consts even if they are unused.
 
diff --git a/tests/ui/consts/required-consts/interpret-in-static.noopt.stderr b/tests/ui/consts/required-consts/interpret-in-static.noopt.stderr
index 159c9449fc0..5e8da609e76 100644
--- a/tests/ui/consts/required-consts/interpret-in-static.noopt.stderr
+++ b/tests/ui/consts/required-consts/interpret-in-static.noopt.stderr
@@ -1,13 +1,13 @@
 error[E0080]: evaluation of `Fail::<i32>::C` failed
-  --> $DIR/interpret-in-static.rs:7:19
+  --> $DIR/interpret-in-static.rs:8:19
    |
 LL |     const C: () = panic!();
-   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/interpret-in-static.rs:7:19
+   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/interpret-in-static.rs:8:19
    |
    = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
-  --> $DIR/interpret-in-static.rs:15:9
+  --> $DIR/interpret-in-static.rs:16:9
    |
 LL |         Fail::<i32>::C;
    |         ^^^^^^^^^^^^^^
diff --git a/tests/ui/consts/required-consts/interpret-in-static.opt.stderr b/tests/ui/consts/required-consts/interpret-in-static.opt.stderr
index 159c9449fc0..5e8da609e76 100644
--- a/tests/ui/consts/required-consts/interpret-in-static.opt.stderr
+++ b/tests/ui/consts/required-consts/interpret-in-static.opt.stderr
@@ -1,13 +1,13 @@
 error[E0080]: evaluation of `Fail::<i32>::C` failed
-  --> $DIR/interpret-in-static.rs:7:19
+  --> $DIR/interpret-in-static.rs:8:19
    |
 LL |     const C: () = panic!();
-   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/interpret-in-static.rs:7:19
+   |                   ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/interpret-in-static.rs:8:19
    |
    = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 note: erroneous constant encountered
-  --> $DIR/interpret-in-static.rs:15:9
+  --> $DIR/interpret-in-static.rs:16:9
    |
 LL |         Fail::<i32>::C;
    |         ^^^^^^^^^^^^^^
diff --git a/tests/ui/consts/required-consts/interpret-in-static.rs b/tests/ui/consts/required-consts/interpret-in-static.rs
index 559e281b2b0..8bacd030440 100644
--- a/tests/ui/consts/required-consts/interpret-in-static.rs
+++ b/tests/ui/consts/required-consts/interpret-in-static.rs
@@ -1,4 +1,5 @@
 //@revisions: noopt opt
+//@[noopt] compile-flags: -Copt-level=0
 //@[opt] compile-flags: -O
 //! Make sure we error on erroneous consts even if they are unused.
 
diff --git a/tests/ui/coroutine/gen_block_is_fused_iter.rs b/tests/ui/coroutine/gen_block_is_fused_iter.rs
new file mode 100644
index 00000000000..f3e19a7f54f
--- /dev/null
+++ b/tests/ui/coroutine/gen_block_is_fused_iter.rs
@@ -0,0 +1,21 @@
+//@ revisions: next old
+//@compile-flags: --edition 2024 -Zunstable-options
+//@[next] compile-flags: -Znext-solver
+//@ check-pass
+#![feature(gen_blocks)]
+
+use std::iter::FusedIterator;
+
+fn foo() -> impl FusedIterator {
+    gen { yield 42 }
+}
+
+fn bar() -> impl FusedIterator<Item = u16> {
+    gen { yield 42 }
+}
+
+fn baz() -> impl FusedIterator + Iterator<Item = i64> {
+    gen { yield 42 }
+}
+
+fn main() {}
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/broken_format.rs b/tests/ui/diagnostic_namespace/on_unimplemented/broken_format.rs
new file mode 100644
index 00000000000..8d8917fd319
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/broken_format.rs
@@ -0,0 +1,45 @@
+#[diagnostic::on_unimplemented(message = "{{Test } thing")]
+//~^WARN unmatched `}` found
+//~|WARN unmatched `}` found
+trait ImportantTrait1 {}
+
+#[diagnostic::on_unimplemented(message = "Test {}")]
+//~^WARN positional format arguments are not allowed here
+//~|WARN positional format arguments are not allowed here
+trait ImportantTrait2 {}
+
+#[diagnostic::on_unimplemented(message = "Test {1:}")]
+//~^WARN positional format arguments are not allowed here
+//~|WARN positional format arguments are not allowed here
+trait ImportantTrait3 {}
+
+#[diagnostic::on_unimplemented(message = "Test {Self:123}")]
+//~^WARN invalid format specifier
+//~|WARN invalid format specifier
+trait ImportantTrait4 {}
+
+#[diagnostic::on_unimplemented(message = "Test {Self:!}")]
+//~^WARN expected `'}'`, found `'!'`
+//~|WARN expected `'}'`, found `'!'`
+//~|WARN unmatched `}` found
+//~|WARN unmatched `}` found
+trait ImportantTrait5 {}
+
+fn check_1(_: impl ImportantTrait1) {}
+fn check_2(_: impl ImportantTrait2) {}
+fn check_3(_: impl ImportantTrait3) {}
+fn check_4(_: impl ImportantTrait4) {}
+fn check_5(_: impl ImportantTrait5) {}
+
+fn main() {
+    check_1(());
+    //~^ERROR {{Test } thing
+    check_2(());
+    //~^ERROR Test {}
+    check_3(());
+    //~^ERROR Test {1}
+    check_4(());
+    //~^ERROR Test ()
+    check_5(());
+    //~^ERROR Test {Self:!}
+}
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/broken_format.stderr b/tests/ui/diagnostic_namespace/on_unimplemented/broken_format.stderr
new file mode 100644
index 00000000000..932e81ca48e
--- /dev/null
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/broken_format.stderr
@@ -0,0 +1,193 @@
+warning: unmatched `}` found
+  --> $DIR/broken_format.rs:1:32
+   |
+LL | #[diagnostic::on_unimplemented(message = "{{Test } thing")]
+   |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default
+
+warning: positional format arguments are not allowed here
+  --> $DIR/broken_format.rs:6:32
+   |
+LL | #[diagnostic::on_unimplemented(message = "Test {}")]
+   |                                ^^^^^^^^^^^^^^^^^^^
+   |
+   = help: only named format arguments with the name of one of the generic types are allowed in this context
+
+warning: positional format arguments are not allowed here
+  --> $DIR/broken_format.rs:11:32
+   |
+LL | #[diagnostic::on_unimplemented(message = "Test {1:}")]
+   |                                ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: only named format arguments with the name of one of the generic types are allowed in this context
+
+warning: invalid format specifier
+  --> $DIR/broken_format.rs:16:32
+   |
+LL | #[diagnostic::on_unimplemented(message = "Test {Self:123}")]
+   |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: no format specifier are supported in this position
+
+warning: expected `'}'`, found `'!'`
+  --> $DIR/broken_format.rs:21:32
+   |
+LL | #[diagnostic::on_unimplemented(message = "Test {Self:!}")]
+   |                                ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: unmatched `}` found
+  --> $DIR/broken_format.rs:21:32
+   |
+LL | #[diagnostic::on_unimplemented(message = "Test {Self:!}")]
+   |                                ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: unmatched `}` found
+  --> $DIR/broken_format.rs:1:32
+   |
+LL | #[diagnostic::on_unimplemented(message = "{{Test } thing")]
+   |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0277]: {{Test } thing
+  --> $DIR/broken_format.rs:35:13
+   |
+LL |     check_1(());
+   |     ------- ^^ the trait `ImportantTrait1` is not implemented for `()`
+   |     |
+   |     required by a bound introduced by this call
+   |
+help: this trait has no implementations, consider adding one
+  --> $DIR/broken_format.rs:4:1
+   |
+LL | trait ImportantTrait1 {}
+   | ^^^^^^^^^^^^^^^^^^^^^
+note: required by a bound in `check_1`
+  --> $DIR/broken_format.rs:28:20
+   |
+LL | fn check_1(_: impl ImportantTrait1) {}
+   |                    ^^^^^^^^^^^^^^^ required by this bound in `check_1`
+
+warning: positional format arguments are not allowed here
+  --> $DIR/broken_format.rs:6:32
+   |
+LL | #[diagnostic::on_unimplemented(message = "Test {}")]
+   |                                ^^^^^^^^^^^^^^^^^^^
+   |
+   = help: only named format arguments with the name of one of the generic types are allowed in this context
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0277]: Test {}
+  --> $DIR/broken_format.rs:37:13
+   |
+LL |     check_2(());
+   |     ------- ^^ the trait `ImportantTrait2` is not implemented for `()`
+   |     |
+   |     required by a bound introduced by this call
+   |
+help: this trait has no implementations, consider adding one
+  --> $DIR/broken_format.rs:9:1
+   |
+LL | trait ImportantTrait2 {}
+   | ^^^^^^^^^^^^^^^^^^^^^
+note: required by a bound in `check_2`
+  --> $DIR/broken_format.rs:29:20
+   |
+LL | fn check_2(_: impl ImportantTrait2) {}
+   |                    ^^^^^^^^^^^^^^^ required by this bound in `check_2`
+
+warning: positional format arguments are not allowed here
+  --> $DIR/broken_format.rs:11:32
+   |
+LL | #[diagnostic::on_unimplemented(message = "Test {1:}")]
+   |                                ^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: only named format arguments with the name of one of the generic types are allowed in this context
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0277]: Test {1}
+  --> $DIR/broken_format.rs:39:13
+   |
+LL |     check_3(());
+   |     ------- ^^ the trait `ImportantTrait3` is not implemented for `()`
+   |     |
+   |     required by a bound introduced by this call
+   |
+help: this trait has no implementations, consider adding one
+  --> $DIR/broken_format.rs:14:1
+   |
+LL | trait ImportantTrait3 {}
+   | ^^^^^^^^^^^^^^^^^^^^^
+note: required by a bound in `check_3`
+  --> $DIR/broken_format.rs:30:20
+   |
+LL | fn check_3(_: impl ImportantTrait3) {}
+   |                    ^^^^^^^^^^^^^^^ required by this bound in `check_3`
+
+warning: invalid format specifier
+  --> $DIR/broken_format.rs:16:32
+   |
+LL | #[diagnostic::on_unimplemented(message = "Test {Self:123}")]
+   |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: no format specifier are supported in this position
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0277]: Test ()
+  --> $DIR/broken_format.rs:41:13
+   |
+LL |     check_4(());
+   |     ------- ^^ the trait `ImportantTrait4` is not implemented for `()`
+   |     |
+   |     required by a bound introduced by this call
+   |
+help: this trait has no implementations, consider adding one
+  --> $DIR/broken_format.rs:19:1
+   |
+LL | trait ImportantTrait4 {}
+   | ^^^^^^^^^^^^^^^^^^^^^
+note: required by a bound in `check_4`
+  --> $DIR/broken_format.rs:31:20
+   |
+LL | fn check_4(_: impl ImportantTrait4) {}
+   |                    ^^^^^^^^^^^^^^^ required by this bound in `check_4`
+
+warning: expected `'}'`, found `'!'`
+  --> $DIR/broken_format.rs:21:32
+   |
+LL | #[diagnostic::on_unimplemented(message = "Test {Self:!}")]
+   |                                ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+warning: unmatched `}` found
+  --> $DIR/broken_format.rs:21:32
+   |
+LL | #[diagnostic::on_unimplemented(message = "Test {Self:!}")]
+   |                                ^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
+error[E0277]: Test {Self:!}
+  --> $DIR/broken_format.rs:43:13
+   |
+LL |     check_5(());
+   |     ------- ^^ the trait `ImportantTrait5` is not implemented for `()`
+   |     |
+   |     required by a bound introduced by this call
+   |
+help: this trait has no implementations, consider adding one
+  --> $DIR/broken_format.rs:26:1
+   |
+LL | trait ImportantTrait5 {}
+   | ^^^^^^^^^^^^^^^^^^^^^
+note: required by a bound in `check_5`
+  --> $DIR/broken_format.rs:32:20
+   |
+LL | fn check_5(_: impl ImportantTrait5) {}
+   |                    ^^^^^^^^^^^^^^^ required by this bound in `check_5`
+
+error: aborting due to 5 previous errors; 12 warnings emitted
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/feature-gates/feature-gate-deref_patterns.rs b/tests/ui/feature-gates/feature-gate-deref_patterns.rs
new file mode 100644
index 00000000000..b43001f2d53
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-deref_patterns.rs
@@ -0,0 +1,9 @@
+fn main() {
+    // We reuse the `box` syntax so this doesn't actually test the feature gate but eh.
+    let box x = Box::new('c'); //~ ERROR box pattern syntax is experimental
+    println!("x: {}", x);
+
+    // `box` syntax is allowed to be cfg-ed out for historical reasons (#65742).
+    #[cfg(FALSE)]
+    let box _x = Box::new('c');
+}
diff --git a/tests/ui/feature-gates/feature-gate-deref_patterns.stderr b/tests/ui/feature-gates/feature-gate-deref_patterns.stderr
new file mode 100644
index 00000000000..48426b50d89
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-deref_patterns.stderr
@@ -0,0 +1,13 @@
+error[E0658]: box pattern syntax is experimental
+  --> $DIR/feature-gate-deref_patterns.rs:3:9
+   |
+LL |     let box x = Box::new('c');
+   |         ^^^^^
+   |
+   = note: see issue #29641 <https://github.com/rust-lang/rust/issues/29641> for more information
+   = help: add `#![feature(box_patterns)]` 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 1 previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/feature-gates/feature-gate-postfix_match.rs b/tests/ui/feature-gates/feature-gate-postfix_match.rs
new file mode 100644
index 00000000000..dce7e81a9ae
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-postfix_match.rs
@@ -0,0 +1,17 @@
+// Testing that postfix match doesn't work without enabling the feature
+
+fn main() {
+    let val = Some(42);
+
+    val.match { //~ ERROR postfix match is experimental
+        Some(42) => "the answer to life, the universe, and everything",
+        _ => "might be the answer to something"
+    };
+
+    // Test that the gate works behind a cfg
+    #[cfg(FALSE)]
+    val.match { //~ ERROR postfix match is experimental
+        Some(42) => "the answer to life, the universe, and everything",
+        _ => "might be the answer to something"
+    };
+}
diff --git a/tests/ui/feature-gates/feature-gate-postfix_match.stderr b/tests/ui/feature-gates/feature-gate-postfix_match.stderr
new file mode 100644
index 00000000000..136838788dd
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-postfix_match.stderr
@@ -0,0 +1,23 @@
+error[E0658]: postfix match is experimental
+  --> $DIR/feature-gate-postfix_match.rs:6:9
+   |
+LL |     val.match {
+   |         ^^^^^
+   |
+   = note: see issue #121618 <https://github.com/rust-lang/rust/issues/121618> for more information
+   = help: add `#![feature(postfix_match)]` 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]: postfix match is experimental
+  --> $DIR/feature-gate-postfix_match.rs:13:9
+   |
+LL |     val.match {
+   |         ^^^^^
+   |
+   = note: see issue #121618 <https://github.com/rust-lang/rust/issues/121618> for more information
+   = help: add `#![feature(postfix_match)]` 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 2 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/inference/ice-cannot-relate-region-109178.rs b/tests/ui/inference/ice-cannot-relate-region-109178.rs
new file mode 100644
index 00000000000..3282f95a992
--- /dev/null
+++ b/tests/ui/inference/ice-cannot-relate-region-109178.rs
@@ -0,0 +1,14 @@
+// test for ice #109178  cannot relate region: LUB(ReErased, ReError)
+
+#![allow(incomplete_features)]
+#![crate_type = "lib"]
+#![feature(adt_const_params, generic_const_exprs)]
+
+struct Changes<const CHANGES: &[&'static str]>
+//~^ ERROR `&` without an explicit lifetime name cannot be used here
+where
+    [(); CHANGES.len()]:, {}
+
+impl<const CHANGES: &[&str]> Changes<CHANGES> where [(); CHANGES.len()]: {}
+//~^ ERROR `&` without an explicit lifetime name cannot be used here
+//~^^ ERROR `&` without an explicit lifetime name cannot be used here
diff --git a/tests/ui/inference/ice-cannot-relate-region-109178.stderr b/tests/ui/inference/ice-cannot-relate-region-109178.stderr
new file mode 100644
index 00000000000..0ac924452c0
--- /dev/null
+++ b/tests/ui/inference/ice-cannot-relate-region-109178.stderr
@@ -0,0 +1,21 @@
+error[E0637]: `&` without an explicit lifetime name cannot be used here
+  --> $DIR/ice-cannot-relate-region-109178.rs:7:31
+   |
+LL | struct Changes<const CHANGES: &[&'static str]>
+   |                               ^ explicit lifetime name needed here
+
+error[E0637]: `&` without an explicit lifetime name cannot be used here
+  --> $DIR/ice-cannot-relate-region-109178.rs:12:21
+   |
+LL | impl<const CHANGES: &[&str]> Changes<CHANGES> where [(); CHANGES.len()]: {}
+   |                     ^ explicit lifetime name needed here
+
+error[E0637]: `&` without an explicit lifetime name cannot be used here
+  --> $DIR/ice-cannot-relate-region-109178.rs:12:23
+   |
+LL | impl<const CHANGES: &[&str]> Changes<CHANGES> where [(); CHANGES.len()]: {}
+   |                       ^ explicit lifetime name needed here
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0637`.
diff --git a/tests/ui/inference/ice-ifer-var-leaked-out-of-rollback-122098.rs b/tests/ui/inference/ice-ifer-var-leaked-out-of-rollback-122098.rs
new file mode 100644
index 00000000000..3c2aa176c0f
--- /dev/null
+++ b/tests/ui/inference/ice-ifer-var-leaked-out-of-rollback-122098.rs
@@ -0,0 +1,25 @@
+// test for #122098 ICE snapshot_vec.rs: index out of bounds: the len is 4 but the index is 4
+
+trait LendingIterator {
+    type Item<'q>: 'a;
+    //~^ ERROR use of undeclared lifetime name `'a`
+
+    fn for_each(mut self, mut f: Box<dyn FnMut(Self::Item<'_>) + 'static>) {}
+    //~^ ERROR the size for values of type `Self` cannot be known at compilation time
+}
+
+struct Query<'q> {}
+//~^ ERROR lifetime parameter `'q` is never used
+
+impl<'static> Query<'q> {
+//~^ ERROR invalid lifetime parameter name: `'static`
+//~^^ ERROR use of undeclared lifetime name `'q`
+    pub fn new() -> Self {}
+}
+
+fn data() {
+    LendingIterator::for_each(Query::new(&data), Box::new);
+    //~^ ERROR this function takes 0 arguments but 1 argument was supplied
+}
+
+pub fn main() {}
diff --git a/tests/ui/inference/ice-ifer-var-leaked-out-of-rollback-122098.stderr b/tests/ui/inference/ice-ifer-var-leaked-out-of-rollback-122098.stderr
new file mode 100644
index 00000000000..e2ddf474c4a
--- /dev/null
+++ b/tests/ui/inference/ice-ifer-var-leaked-out-of-rollback-122098.stderr
@@ -0,0 +1,72 @@
+error[E0261]: use of undeclared lifetime name `'a`
+  --> $DIR/ice-ifer-var-leaked-out-of-rollback-122098.rs:4:20
+   |
+LL |     type Item<'q>: 'a;
+   |                    ^^ undeclared lifetime
+   |
+help: consider introducing lifetime `'a` here
+   |
+LL |     type Item<'a, 'q>: 'a;
+   |               +++
+help: consider introducing lifetime `'a` here
+   |
+LL | trait LendingIterator<'a> {
+   |                      ++++
+
+error[E0262]: invalid lifetime parameter name: `'static`
+  --> $DIR/ice-ifer-var-leaked-out-of-rollback-122098.rs:14:6
+   |
+LL | impl<'static> Query<'q> {
+   |      ^^^^^^^ 'static is a reserved lifetime name
+
+error[E0261]: use of undeclared lifetime name `'q`
+  --> $DIR/ice-ifer-var-leaked-out-of-rollback-122098.rs:14:21
+   |
+LL | impl<'static> Query<'q> {
+   |      -              ^^ undeclared lifetime
+   |      |
+   |      help: consider introducing lifetime `'q` here: `'q,`
+
+error[E0392]: lifetime parameter `'q` is never used
+  --> $DIR/ice-ifer-var-leaked-out-of-rollback-122098.rs:11:14
+   |
+LL | struct Query<'q> {}
+   |              ^^ unused lifetime parameter
+   |
+   = help: consider removing `'q`, referring to it in a field, or using a marker such as `PhantomData`
+
+error[E0277]: the size for values of type `Self` cannot be known at compilation time
+  --> $DIR/ice-ifer-var-leaked-out-of-rollback-122098.rs:7:17
+   |
+LL |     fn for_each(mut self, mut f: Box<dyn FnMut(Self::Item<'_>) + 'static>) {}
+   |                 ^^^^^^^^ doesn't have a size known at compile-time
+   |
+   = help: unsized fn params are gated as an unstable feature
+help: consider further restricting `Self`
+   |
+LL |     fn for_each(mut self, mut f: Box<dyn FnMut(Self::Item<'_>) + 'static>) where Self: Sized {}
+   |                                                                            +++++++++++++++++
+help: function arguments must have a statically known size, borrowed types always have a known size
+   |
+LL |     fn for_each(mut &self, mut f: Box<dyn FnMut(Self::Item<'_>) + 'static>) {}
+   |                     +
+
+error[E0061]: this function takes 0 arguments but 1 argument was supplied
+  --> $DIR/ice-ifer-var-leaked-out-of-rollback-122098.rs:21:31
+   |
+LL |     LendingIterator::for_each(Query::new(&data), Box::new);
+   |                               ^^^^^^^^^^ -----
+   |                                          |
+   |                                          unexpected argument of type `&fn() {data}`
+   |                                          help: remove the extra argument
+   |
+note: associated function defined here
+  --> $DIR/ice-ifer-var-leaked-out-of-rollback-122098.rs:17:12
+   |
+LL |     pub fn new() -> Self {}
+   |            ^^^
+
+error: aborting due to 6 previous errors
+
+Some errors have detailed explanations: E0061, E0261, E0262, E0277, E0392.
+For more information about an error, try `rustc --explain E0061`.
diff --git a/tests/ui/issues/issue-27942.stderr b/tests/ui/issues/issue-27942.stderr
index 7ea9345a668..8ea46bae26d 100644
--- a/tests/ui/issues/issue-27942.stderr
+++ b/tests/ui/issues/issue-27942.stderr
@@ -6,16 +6,16 @@ LL |     fn select(&self) -> BufferViewHandle<R>;
    |
    = note: expected trait `Resources<'_>`
               found trait `Resources<'a>`
-note: the anonymous lifetime defined here...
-  --> $DIR/issue-27942.rs:5:15
-   |
-LL |     fn select(&self) -> BufferViewHandle<R>;
-   |               ^^^^^
-note: ...does not necessarily outlive the lifetime `'a` as defined here
+note: the lifetime `'a` as defined here...
   --> $DIR/issue-27942.rs:3:18
    |
 LL | pub trait Buffer<'a, R: Resources<'a>> {
    |                  ^^
+note: ...does not necessarily outlive the anonymous lifetime defined here
+  --> $DIR/issue-27942.rs:5:15
+   |
+LL |     fn select(&self) -> BufferViewHandle<R>;
+   |               ^^^^^
 
 error[E0308]: mismatched types
   --> $DIR/issue-27942.rs:5:25
@@ -25,16 +25,16 @@ LL |     fn select(&self) -> BufferViewHandle<R>;
    |
    = note: expected trait `Resources<'_>`
               found trait `Resources<'a>`
-note: the lifetime `'a` as defined here...
-  --> $DIR/issue-27942.rs:3:18
-   |
-LL | pub trait Buffer<'a, R: Resources<'a>> {
-   |                  ^^
-note: ...does not necessarily outlive the anonymous lifetime defined here
+note: the anonymous lifetime defined here...
   --> $DIR/issue-27942.rs:5:15
    |
 LL |     fn select(&self) -> BufferViewHandle<R>;
    |               ^^^^^
+note: ...does not necessarily outlive the lifetime `'a` as defined here
+  --> $DIR/issue-27942.rs:3:18
+   |
+LL | pub trait Buffer<'a, R: Resources<'a>> {
+   |                  ^^
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/match/postfix-match/pf-match-chain.rs b/tests/ui/match/postfix-match/pf-match-chain.rs
new file mode 100644
index 00000000000..80546e1963b
--- /dev/null
+++ b/tests/ui/match/postfix-match/pf-match-chain.rs
@@ -0,0 +1,16 @@
+//@ run-pass
+
+#![feature(postfix_match)]
+
+fn main() {
+    1.match {
+        2 => Some(0),
+        _ => None,
+    }.match {
+        None => Ok(true),
+        Some(_) => Err("nope")
+    }.match {
+        Ok(_) => (),
+        Err(_) => panic!()
+    }
+}
diff --git a/tests/ui/match/postfix-match/pf-match-exhaustiveness.rs b/tests/ui/match/postfix-match/pf-match-exhaustiveness.rs
new file mode 100644
index 00000000000..f4cac46f7cd
--- /dev/null
+++ b/tests/ui/match/postfix-match/pf-match-exhaustiveness.rs
@@ -0,0 +1,7 @@
+#![feature(postfix_match)]
+
+fn main() {
+    Some(1).match { //~ non-exhaustive patterns
+        None => {},
+    }
+}
diff --git a/tests/ui/match/postfix-match/pf-match-exhaustiveness.stderr b/tests/ui/match/postfix-match/pf-match-exhaustiveness.stderr
new file mode 100644
index 00000000000..f458218bb5d
--- /dev/null
+++ b/tests/ui/match/postfix-match/pf-match-exhaustiveness.stderr
@@ -0,0 +1,21 @@
+error[E0004]: non-exhaustive patterns: `Some(_)` not covered
+  --> $DIR/pf-match-exhaustiveness.rs:4:5
+   |
+LL |     Some(1).match {
+   |     ^^^^^^^ pattern `Some(_)` not covered
+   |
+note: `Option<i32>` defined here
+  --> $SRC_DIR/core/src/option.rs:LL:COL
+  ::: $SRC_DIR/core/src/option.rs:LL:COL
+   |
+   = note: not covered
+   = note: the matched value is of type `Option<i32>`
+help: ensure that all possible cases are being handled by adding a match arm with a wildcard pattern or an explicit pattern as shown
+   |
+LL ~         None => {},
+LL ~         Some(_) => todo!(),
+   |
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/match/postfix-match/pf-match-types.rs b/tests/ui/match/postfix-match/pf-match-types.rs
new file mode 100644
index 00000000000..af205926fb6
--- /dev/null
+++ b/tests/ui/match/postfix-match/pf-match-types.rs
@@ -0,0 +1,15 @@
+#![feature(postfix_match)]
+
+fn main() {
+    Some(10).match {
+    //~^ NOTE `match` arms have incompatible types
+        Some(5) => false,
+        //~^ NOTE this is found to be of type `bool`
+        Some(2) => true,
+        //~^ NOTE this is found to be of type `bool`
+        None    => (),
+        //~^ ERROR `match` arms have incompatible types
+        //~| NOTE expected `bool`, found `()`
+        _       => true
+    }
+}
diff --git a/tests/ui/match/postfix-match/pf-match-types.stderr b/tests/ui/match/postfix-match/pf-match-types.stderr
new file mode 100644
index 00000000000..0cfc1363d5f
--- /dev/null
+++ b/tests/ui/match/postfix-match/pf-match-types.stderr
@@ -0,0 +1,21 @@
+error[E0308]: `match` arms have incompatible types
+  --> $DIR/pf-match-types.rs:10:20
+   |
+LL | /     Some(10).match {
+LL | |
+LL | |         Some(5) => false,
+   | |                    ----- this is found to be of type `bool`
+LL | |
+LL | |         Some(2) => true,
+   | |                    ---- this is found to be of type `bool`
+LL | |
+LL | |         None    => (),
+   | |                    ^^ expected `bool`, found `()`
+...  |
+LL | |         _       => true
+LL | |     }
+   | |_____- `match` arms have incompatible types
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/match/postfix-match/postfix-match.rs b/tests/ui/match/postfix-match/postfix-match.rs
new file mode 100644
index 00000000000..03c4e8ab545
--- /dev/null
+++ b/tests/ui/match/postfix-match/postfix-match.rs
@@ -0,0 +1,62 @@
+//@ run-pass
+
+#![feature(postfix_match)]
+
+struct Bar {
+    foo: u8,
+    baz: u8,
+}
+
+pub fn main() {
+    let thing = Some("thing");
+
+    thing.match {
+        Some("nothing") => {},
+        Some(text) if text.eq_ignore_ascii_case("tapir")  => {},
+        Some("true") | Some("false") => {},
+        Some("thing") => {},
+        Some(_) => {},
+        None => {}
+    };
+
+    let num = 2u8;
+
+    num.match {
+        0 => {},
+        1..=5 => {},
+        _ => {},
+    };
+
+    let slic = &[1, 2, 3, 4][..];
+
+    slic.match {
+        [1] => {},
+        [2, _tail @ ..] => {},
+        [1, _] => {},
+        _ => {},
+    };
+
+    slic[0].match {
+        1 => 0,
+        i => i,
+    };
+
+    let out = (1, 2).match {
+        (1, 3) => 0,
+        (_, 1) => 0,
+        (1, i) => i,
+        _ => 3,
+    };
+    assert!(out == 2);
+
+    let strct = Bar {
+        foo: 3,
+        baz: 4
+    };
+
+    strct.match {
+        Bar { foo: 1, .. } => {},
+        Bar { baz: 2, .. } => {},
+        _ => (),
+    };
+}
diff --git a/tests/ui/parser/attribute/attr-bad-meta-4.rs b/tests/ui/parser/attribute/attr-bad-meta-4.rs
new file mode 100644
index 00000000000..cedbd1d6686
--- /dev/null
+++ b/tests/ui/parser/attribute/attr-bad-meta-4.rs
@@ -0,0 +1,12 @@
+macro_rules! mac {
+    ($attr_item: meta) => {
+        #[cfg($attr_item)]
+        //~^ ERROR expected unsuffixed literal or identifier, found `an(arbitrary token stream)`
+        //~| ERROR expected unsuffixed literal or identifier, found `an(arbitrary token stream)`
+        struct S;
+    }
+}
+
+mac!(an(arbitrary token stream));
+
+fn main() {}
diff --git a/tests/ui/parser/attribute/attr-bad-meta-4.stderr b/tests/ui/parser/attribute/attr-bad-meta-4.stderr
new file mode 100644
index 00000000000..a543bcb692e
--- /dev/null
+++ b/tests/ui/parser/attribute/attr-bad-meta-4.stderr
@@ -0,0 +1,25 @@
+error: expected unsuffixed literal or identifier, found `an(arbitrary token stream)`
+  --> $DIR/attr-bad-meta-4.rs:3:15
+   |
+LL |         #[cfg($attr_item)]
+   |               ^^^^^^^^^^
+...
+LL | mac!(an(arbitrary token stream));
+   | -------------------------------- in this macro invocation
+   |
+   = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: expected unsuffixed literal or identifier, found `an(arbitrary token stream)`
+  --> $DIR/attr-bad-meta-4.rs:3:15
+   |
+LL |         #[cfg($attr_item)]
+   |               ^^^^^^^^^^
+...
+LL | mac!(an(arbitrary token stream));
+   | -------------------------------- in this macro invocation
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+   = note: this error originates in the macro `mac` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/pattern/deref-patterns/typeck.rs b/tests/ui/pattern/deref-patterns/typeck.rs
new file mode 100644
index 00000000000..ead6dcdbaf0
--- /dev/null
+++ b/tests/ui/pattern/deref-patterns/typeck.rs
@@ -0,0 +1,31 @@
+//@ check-pass
+#![feature(deref_patterns)]
+#![allow(incomplete_features)]
+
+use std::rc::Rc;
+
+fn main() {
+    let vec: Vec<u32> = Vec::new();
+    match vec {
+        deref!([..]) => {}
+        _ => {}
+    }
+    match Box::new(true) {
+        deref!(true) => {}
+        _ => {}
+    }
+    match &Box::new(true) {
+        deref!(true) => {}
+        _ => {}
+    }
+    match &Rc::new(0) {
+        deref!(1..) => {}
+        _ => {}
+    }
+    // FIXME(deref_patterns): fails to typecheck because `"foo"` has type &str but deref creates a
+    // place of type `str`.
+    // match "foo".to_string() {
+    //     box "foo" => {}
+    //     _ => {}
+    // }
+}
diff --git a/tests/ui/raw-ref-op/raw-ref-temp.stderr b/tests/ui/raw-ref-op/raw-ref-temp.stderr
index b9666162517..1f6d85e4a7e 100644
--- a/tests/ui/raw-ref-op/raw-ref-temp.stderr
+++ b/tests/ui/raw-ref-op/raw-ref-temp.stderr
@@ -75,24 +75,32 @@ error[E0745]: cannot take address of a temporary
    |
 LL |     let ref_ascribe = &raw const type_ascribe!(2, i32);
    |                                  ^^^^^^^^^^^^^^^^^^^^^ temporary value
+   |
+   = note: this error originates in the macro `type_ascribe` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0745]: cannot take address of a temporary
   --> $DIR/raw-ref-temp.rs:27:36
    |
 LL |     let mut_ref_ascribe = &raw mut type_ascribe!(3, i32);
    |                                    ^^^^^^^^^^^^^^^^^^^^^ temporary value
+   |
+   = note: this error originates in the macro `type_ascribe` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0745]: cannot take address of a temporary
   --> $DIR/raw-ref-temp.rs:29:40
    |
 LL |     let ascribe_field_ref = &raw const type_ascribe!(PAIR.0, i32);
    |                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value
+   |
+   = note: this error originates in the macro `type_ascribe` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0745]: cannot take address of a temporary
   --> $DIR/raw-ref-temp.rs:30:38
    |
 LL |     let ascribe_index_ref = &raw mut type_ascribe!(ARRAY[0], i32);
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value
+   |
+   = note: this error originates in the macro `type_ascribe` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 16 previous errors
 
diff --git a/tests/ui/reachable/expr_type.stderr b/tests/ui/reachable/expr_type.stderr
index 70536326fd8..008b867e230 100644
--- a/tests/ui/reachable/expr_type.stderr
+++ b/tests/ui/reachable/expr_type.stderr
@@ -12,6 +12,7 @@ note: the lint level is defined here
    |
 LL | #![deny(unreachable_code)]
    |         ^^^^^^^^^^^^^^^^
+   = note: this error originates in the macro `type_ascribe` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/sanitizer/cfi-closure-fn-ptr-cast.rs b/tests/ui/sanitizer/cfi-closure-fn-ptr-cast.rs
new file mode 100644
index 00000000000..a46a3afd734
--- /dev/null
+++ b/tests/ui/sanitizer/cfi-closure-fn-ptr-cast.rs
@@ -0,0 +1,18 @@
+// Tests that converting a closure to a function pointer works
+// The notable thing being tested here is that when the closure does not capture anything,
+// the call method from its Fn trait takes a ZST representing its environment. The compiler then
+// uses the assumption that the ZST is non-passed to reify this into a function pointer.
+//
+// This checks that the reified function pointer will have the expected alias set at its call-site.
+
+//@ needs-sanitizer-cfi
+// FIXME(#122848) Remove only-linux once OSX CFI binaries work
+//@ only-linux
+//@ compile-flags: --crate-type=bin -Cprefer-dynamic=off -Clto -Zsanitizer=cfi
+//@ compile-flags: -C target-feature=-crt-static -C codegen-units=1 -C opt-level=0
+//@ run-pass
+
+pub fn main() {
+    let f: &fn() = &((|| ()) as _);
+    f();
+}
diff --git a/tests/ui/stable-mir-print/basic_function.rs b/tests/ui/stable-mir-print/basic_function.rs
index 9b27a56dab1..deefef63bdb 100644
--- a/tests/ui/stable-mir-print/basic_function.rs
+++ b/tests/ui/stable-mir-print/basic_function.rs
@@ -2,7 +2,7 @@
 //@ check-pass
 //@ only-x86_64
 
-fn foo(i:i32) -> i32 {
+fn foo(i: i32) -> i32 {
     i + 1
 }
 
@@ -12,4 +12,13 @@ fn bar(vec: &mut Vec<i32>) -> Vec<i32> {
     new_vec
 }
 
-fn main(){}
+pub fn demux(input: u8) -> u8 {
+    match input {
+        0 => 10,
+        1 => 6,
+        2 => 8,
+        _ => 0,
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/stable-mir-print/basic_function.stdout b/tests/ui/stable-mir-print/basic_function.stdout
index d9b33a4257c..3926c1048f5 100644
--- a/tests/ui/stable-mir-print/basic_function.stdout
+++ b/tests/ui/stable-mir-print/basic_function.stdout
@@ -1,234 +1,74 @@
 // WARNING: This is highly experimental output it's intended for stable-mir developers only.
 // If you find a bug or want to improve the output open a issue at https://github.com/rust-lang/project-stable-mir.
-fn foo(_0: i32) -> i32 {
-    let mut _0: (i32, bool);
+fn foo(_1: i32) -> i32 {
+    let mut _0: i32;
+    let mut _2: (i32, bool);
+    debug i => _1;
+    bb0: {
+        _2 = CheckedAdd(_1, 1_i32);
+        assert(!move (_2.1: bool), "attempt to compute `{} + {}`, which would overflow", _1, 1_i32) -> [success: bb1, unwind continue];
+    }
+    bb1: {
+        _0 = move (_2.0: i32);
+        return;
+    }
 }
+fn bar(_1: &mut Vec<i32>) -> Vec<i32> {
+    let mut _0: Vec<i32>;
+    let mut _2: Vec<i32>;
+    let mut _3: &Vec<i32>;
+    let  _4: ();
+    let mut _5: &mut Vec<i32>;
+    debug vec => _1;
+    debug new_vec => _2;
     bb0: {
-        _2 = 1 Add const 1_i32
-        assert(!move _2 bool),"attempt to compute `{} + {}`, which would overflow", 1, const 1_i32) -> [success: bb1, unwind continue]
+        _3 = &(*_1);
+        _2 = <Vec<i32> as Clone>::clone(move _3) -> [return: bb1, unwind continue];
     }
     bb1: {
-        _0 = move _2
-        return
+        _5 = &mut _2;
+        _4 = Vec::<i32>::push(move _5, 1_i32) -> [return: bb2, unwind: bb3];
+    }
+    bb2: {
+        _0 = move _2;
+        return;
+    }
+    bb3: {
+        drop(_2) -> [return: bb4, unwind terminate];
+    }
+    bb4: {
+        resume;
     }
-fn bar(_0: &mut Ty {
-    id: 10,
-    kind: RigidTy(
-        Adt(
-            AdtDef(
-                DefId {
-                    id: 3,
-                    name: "std::vec::Vec",
-                },
-            ),
-            GenericArgs(
-                [
-                    Type(
-                        Ty {
-                            id: 11,
-                            kind: Param(
-                                ParamTy {
-                                    index: 0,
-                                    name: "T",
-                                },
-                            ),
-                        },
-                    ),
-                    Type(
-                        Ty {
-                            id: 12,
-                            kind: Param(
-                                ParamTy {
-                                    index: 1,
-                                    name: "A",
-                                },
-                            ),
-                        },
-                    ),
-                ],
-            ),
-        ),
-    ),
-}) -> Ty {
-    id: 10,
-    kind: RigidTy(
-        Adt(
-            AdtDef(
-                DefId {
-                    id: 3,
-                    name: "std::vec::Vec",
-                },
-            ),
-            GenericArgs(
-                [
-                    Type(
-                        Ty {
-                            id: 11,
-                            kind: Param(
-                                ParamTy {
-                                    index: 0,
-                                    name: "T",
-                                },
-                            ),
-                        },
-                    ),
-                    Type(
-                        Ty {
-                            id: 12,
-                            kind: Param(
-                                ParamTy {
-                                    index: 1,
-                                    name: "A",
-                                },
-                            ),
-                        },
-                    ),
-                ],
-            ),
-        ),
-    ),
-} {
-    let mut _0: Ty {
-    id: 10,
-    kind: RigidTy(
-        Adt(
-            AdtDef(
-                DefId {
-                    id: 3,
-                    name: "std::vec::Vec",
-                },
-            ),
-            GenericArgs(
-                [
-                    Type(
-                        Ty {
-                            id: 11,
-                            kind: Param(
-                                ParamTy {
-                                    index: 0,
-                                    name: "T",
-                                },
-                            ),
-                        },
-                    ),
-                    Type(
-                        Ty {
-                            id: 12,
-                            kind: Param(
-                                ParamTy {
-                                    index: 1,
-                                    name: "A",
-                                },
-                            ),
-                        },
-                    ),
-                ],
-            ),
-        ),
-    ),
-};
-    let mut _1: &Ty {
-    id: 10,
-    kind: RigidTy(
-        Adt(
-            AdtDef(
-                DefId {
-                    id: 3,
-                    name: "std::vec::Vec",
-                },
-            ),
-            GenericArgs(
-                [
-                    Type(
-                        Ty {
-                            id: 11,
-                            kind: Param(
-                                ParamTy {
-                                    index: 0,
-                                    name: "T",
-                                },
-                            ),
-                        },
-                    ),
-                    Type(
-                        Ty {
-                            id: 12,
-                            kind: Param(
-                                ParamTy {
-                                    index: 1,
-                                    name: "A",
-                                },
-                            ),
-                        },
-                    ),
-                ],
-            ),
-        ),
-    ),
-};
-    let _2: ();
-    let mut _3: &mut Ty {
-    id: 10,
-    kind: RigidTy(
-        Adt(
-            AdtDef(
-                DefId {
-                    id: 3,
-                    name: "std::vec::Vec",
-                },
-            ),
-            GenericArgs(
-                [
-                    Type(
-                        Ty {
-                            id: 11,
-                            kind: Param(
-                                ParamTy {
-                                    index: 0,
-                                    name: "T",
-                                },
-                            ),
-                        },
-                    ),
-                    Type(
-                        Ty {
-                            id: 12,
-                            kind: Param(
-                                ParamTy {
-                                    index: 1,
-                                    name: "A",
-                                },
-                            ),
-                        },
-                    ),
-                ],
-            ),
-        ),
-    ),
-};
 }
+fn demux(_1: u8) -> u8 {
+    let mut _0: u8;
+    debug input => _1;
     bb0: {
-        _3 = refShared1
-        _2 = const <Vec<i32> as Clone>::clone(move _3) -> [return: bb1, unwind continue]
+        switchInt(_1) -> [0: bb2, 1: bb3, 2: bb4, otherwise: bb1];
     }
     bb1: {
-        _5 = refMut {
-    kind: TwoPhaseBorrow,
-}2
-        _4 = const Vec::<i32>::push(move _5, const 1_i32) -> [return: bb2, unwind: bb3]
+        _0 = 0_u8;
+        goto -> bb5;
     }
     bb2: {
-        _0 = move _2
-        return
+        _0 = 10_u8;
+        goto -> bb5;
     }
     bb3: {
-        drop(_2) -> [return: bb4, unwind terminate]
+        _0 = 6_u8;
+        goto -> bb5;
     }
     bb4: {
-        resume
+        _0 = 8_u8;
+        goto -> bb5;
+    }
+    bb5: {
+        return;
     }
-fn main() -> () {
 }
+fn main() -> () {
+    let mut _0: ();
     bb0: {
-        return
+        return;
     }
+}
diff --git a/tests/ui/suggestions/types/into-inference-needs-type.rs b/tests/ui/suggestions/types/into-inference-needs-type.rs
new file mode 100644
index 00000000000..4c8b6ec2113
--- /dev/null
+++ b/tests/ui/suggestions/types/into-inference-needs-type.rs
@@ -0,0 +1,15 @@
+#[derive(Debug)]
+enum MyError {
+    MainError
+}
+
+fn main() -> Result<(), MyError> {
+    let vec = vec!["one", "two", "three"];
+    let list = vec
+        .iter()
+        .map(|s| s.strip_prefix("t"))
+        .filter_map(Option::Some)
+        .into()?; //~ ERROR type annotations needed
+
+    return Ok(());
+}
diff --git a/tests/ui/suggestions/types/into-inference-needs-type.stderr b/tests/ui/suggestions/types/into-inference-needs-type.stderr
new file mode 100644
index 00000000000..dd688f90289
--- /dev/null
+++ b/tests/ui/suggestions/types/into-inference-needs-type.stderr
@@ -0,0 +1,19 @@
+error[E0283]: type annotations needed
+  --> $DIR/into-inference-needs-type.rs:12:10
+   |
+LL |         .into()?;
+   |          ^^^^
+   |
+   = note: cannot satisfy `_: From<FilterMap<Map<std::slice::Iter<'_, &str>, {closure@$DIR/into-inference-needs-type.rs:10:14: 10:17}>, fn(Option<&str>) -> Option<Option<&str>> {Option::<Option<&str>>::Some}>>`
+   = note: required for `FilterMap<Map<std::slice::Iter<'_, &str>, {closure@$DIR/into-inference-needs-type.rs:10:14: 10:17}>, fn(Option<&str>) -> Option<Option<&str>> {Option::<Option<&str>>::Some}>` to implement `Into<_>`
+help: try using a fully qualified path to specify the expected types
+   |
+LL ~     let list = <FilterMap<Map<std::slice::Iter<'_, &str>, _>, _> as Into<T>>::into(vec
+LL |         .iter()
+LL |         .map(|s| s.strip_prefix("t"))
+LL ~         .filter_map(Option::Some))?;
+   |
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0283`.
diff --git a/tests/ui/traits/impl-of-supertrait-has-wrong-lifetime-parameters.stderr b/tests/ui/traits/impl-of-supertrait-has-wrong-lifetime-parameters.stderr
index 092776edea7..8bf8536c74e 100644
--- a/tests/ui/traits/impl-of-supertrait-has-wrong-lifetime-parameters.stderr
+++ b/tests/ui/traits/impl-of-supertrait-has-wrong-lifetime-parameters.stderr
@@ -4,16 +4,16 @@ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'b` d
 LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> {
    |                            ^^^^^^^^^
    |
-note: first, the lifetime cannot outlive the lifetime `'a` as defined here...
-  --> $DIR/impl-of-supertrait-has-wrong-lifetime-parameters.rs:24:6
-   |
-LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> {
-   |      ^^
-note: ...but the lifetime must also be valid for the lifetime `'b` as defined here...
+note: first, the lifetime cannot outlive the lifetime `'b` as defined here...
   --> $DIR/impl-of-supertrait-has-wrong-lifetime-parameters.rs:24:9
    |
 LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> {
    |         ^^
+note: ...but the lifetime must also be valid for the lifetime `'a` as defined here...
+  --> $DIR/impl-of-supertrait-has-wrong-lifetime-parameters.rs:24:6
+   |
+LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> {
+   |      ^^
 note: ...so that the types are compatible
   --> $DIR/impl-of-supertrait-has-wrong-lifetime-parameters.rs:24:28
    |
diff --git a/tests/ui/traits/matching-lifetimes.stderr b/tests/ui/traits/matching-lifetimes.stderr
index f8119ed415d..8a802d57f5c 100644
--- a/tests/ui/traits/matching-lifetimes.stderr
+++ b/tests/ui/traits/matching-lifetimes.stderr
@@ -6,16 +6,16 @@ LL |     fn foo(x: Foo<'b,'a>) {
    |
    = note: expected signature `fn(Foo<'a, 'b>)`
               found signature `fn(Foo<'b, 'a>)`
-note: the lifetime `'b` as defined here...
-  --> $DIR/matching-lifetimes.rs:13:9
-   |
-LL | impl<'a,'b> Tr for Foo<'a,'b> {
-   |         ^^
-note: ...does not necessarily outlive the lifetime `'a` as defined here
+note: the lifetime `'a` as defined here...
   --> $DIR/matching-lifetimes.rs:13:6
    |
 LL | impl<'a,'b> Tr for Foo<'a,'b> {
    |      ^^
+note: ...does not necessarily outlive the lifetime `'b` as defined here
+  --> $DIR/matching-lifetimes.rs:13:9
+   |
+LL | impl<'a,'b> Tr for Foo<'a,'b> {
+   |         ^^
 
 error[E0308]: method not compatible with trait
   --> $DIR/matching-lifetimes.rs:14:5
@@ -25,16 +25,16 @@ LL |     fn foo(x: Foo<'b,'a>) {
    |
    = note: expected signature `fn(Foo<'a, 'b>)`
               found signature `fn(Foo<'b, 'a>)`
-note: the lifetime `'a` as defined here...
-  --> $DIR/matching-lifetimes.rs:13:6
-   |
-LL | impl<'a,'b> Tr for Foo<'a,'b> {
-   |      ^^
-note: ...does not necessarily outlive the lifetime `'b` as defined here
+note: the lifetime `'b` as defined here...
   --> $DIR/matching-lifetimes.rs:13:9
    |
 LL | impl<'a,'b> Tr for Foo<'a,'b> {
    |         ^^
+note: ...does not necessarily outlive the lifetime `'a` as defined here
+  --> $DIR/matching-lifetimes.rs:13:6
+   |
+LL | impl<'a,'b> Tr for Foo<'a,'b> {
+   |      ^^
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/traits/suggest-fully-qualified-closure.rs b/tests/ui/traits/suggest-fully-qualified-closure.rs
index f401a3012da..3d28a4e6bf5 100644
--- a/tests/ui/traits/suggest-fully-qualified-closure.rs
+++ b/tests/ui/traits/suggest-fully-qualified-closure.rs
@@ -1,7 +1,5 @@
 //@ check-fail
 //@ known-bug: #103705
-//@ normalize-stderr-test "\{closure@.*\}" -> "{closure@}"
-//@ normalize-stderr-test "\+* ~" -> "+++ ~"
 
 // The output of this currently suggests writing a closure in the qualified path.
 
diff --git a/tests/ui/traits/suggest-fully-qualified-closure.stderr b/tests/ui/traits/suggest-fully-qualified-closure.stderr
index e077bd7ac2a..a2c1115e673 100644
--- a/tests/ui/traits/suggest-fully-qualified-closure.stderr
+++ b/tests/ui/traits/suggest-fully-qualified-closure.stderr
@@ -1,11 +1,11 @@
 error[E0283]: type annotations needed
-  --> $DIR/suggest-fully-qualified-closure.rs:23:7
+  --> $DIR/suggest-fully-qualified-closure.rs:21:7
    |
 LL |     q.lol(||());
    |       ^^^
    |
 note: multiple `impl`s satisfying `Qqq: MyTrait<_>` found
-  --> $DIR/suggest-fully-qualified-closure.rs:14:1
+  --> $DIR/suggest-fully-qualified-closure.rs:12:1
    |
 LL | impl MyTrait<u32> for Qqq{
    | ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -14,8 +14,8 @@ LL | impl MyTrait<u64> for Qqq{
    | ^^^^^^^^^^^^^^^^^^^^^^^^^
 help: try using a fully qualified path to specify the expected types
    |
-LL |     <Qqq as MyTrait<T>>::lol::<{closure@}>(&q, ||());
-   |     +++ ~
+LL |     <Qqq as MyTrait<T>>::lol::<_>(&q, ||());
+   |     +++++++++++++++++++++++++++++++ ~
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/type-alias-impl-trait/hkl_forbidden4.rs b/tests/ui/type-alias-impl-trait/hkl_forbidden4.rs
new file mode 100644
index 00000000000..ef9fe604ea7
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/hkl_forbidden4.rs
@@ -0,0 +1,25 @@
+//! This test used to ICE because, while an error was emitted,
+//! we still tried to remap generic params used in the hidden type
+//! to the ones of the opaque type definition.
+
+//@ edition: 2021
+
+#![feature(type_alias_impl_trait)]
+use std::future::Future;
+
+type FutNothing<'a> = impl 'a + Future<Output = ()>;
+//~^ ERROR: unconstrained opaque type
+
+async fn operation(_: &mut ()) -> () {
+    //~^ ERROR: concrete type differs from previous
+    call(operation).await
+}
+
+async fn call<F>(_f: F)
+where
+    for<'any> F: FnMut(&'any mut ()) -> FutNothing<'any>,
+{
+    //~^ ERROR: expected generic lifetime parameter, found `'any`
+}
+
+fn main() {}
diff --git a/tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr b/tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr
new file mode 100644
index 00000000000..d7a0452727e
--- /dev/null
+++ b/tests/ui/type-alias-impl-trait/hkl_forbidden4.stderr
@@ -0,0 +1,34 @@
+error: unconstrained opaque type
+  --> $DIR/hkl_forbidden4.rs:10:23
+   |
+LL | type FutNothing<'a> = impl 'a + Future<Output = ()>;
+   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: `FutNothing` must be used in combination with a concrete type within the same module
+
+error: concrete type differs from previous defining opaque type use
+  --> $DIR/hkl_forbidden4.rs:13:1
+   |
+LL | async fn operation(_: &mut ()) -> () {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `FutNothing<'_>`, got `{async fn body@$DIR/hkl_forbidden4.rs:13:38: 16:2}`
+   |
+note: previous use here
+  --> $DIR/hkl_forbidden4.rs:15:5
+   |
+LL |     call(operation).await
+   |     ^^^^^^^^^^^^^^^
+
+error[E0792]: expected generic lifetime parameter, found `'any`
+  --> $DIR/hkl_forbidden4.rs:21:1
+   |
+LL |   type FutNothing<'a> = impl 'a + Future<Output = ()>;
+   |                   -- this generic parameter must be used with a generic lifetime parameter
+...
+LL | / {
+LL | |
+LL | | }
+   | |_^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0792`.
diff --git a/tests/ui/typeck/issue-91267.stderr b/tests/ui/typeck/issue-91267.stderr
index 7e48b251980..399309d0ec4 100644
--- a/tests/ui/typeck/issue-91267.stderr
+++ b/tests/ui/typeck/issue-91267.stderr
@@ -17,6 +17,8 @@ LL | fn main() {
    |          - expected `()` because of default return type
 LL |     type_ascribe!(0, u8<e<5>=e>)
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `u8`
+   |
+   = note: this error originates in the macro `type_ascribe` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/unboxed-closures/unboxed-closures-type-mismatch-closure-from-another-scope.stderr b/tests/ui/unboxed-closures/unboxed-closures-type-mismatch-closure-from-another-scope.stderr
index 1470c32d7de..5f22c781345 100644
--- a/tests/ui/unboxed-closures/unboxed-closures-type-mismatch-closure-from-another-scope.stderr
+++ b/tests/ui/unboxed-closures/unboxed-closures-type-mismatch-closure-from-another-scope.stderr
@@ -26,11 +26,11 @@ note: closure parameter defined here
 LL |         let mut closure = expect_sig(|p, y| *p = y);
    |                                       ^
 
-error[E0425]: cannot find function `deref` in this scope
+error[E0423]: expected function, found macro `deref`
   --> $DIR/unboxed-closures-type-mismatch-closure-from-another-scope.rs:13:5
    |
 LL |     deref(p);
-   |     ^^^^^ not found in this scope
+   |     ^^^^^ not a function
    |
 help: use the `.` operator to call the method `Deref::deref` on `&&()`
    |
@@ -40,5 +40,5 @@ LL +     p.deref();
 
 error: aborting due to 4 previous errors
 
-Some errors have detailed explanations: E0308, E0425.
+Some errors have detailed explanations: E0308, E0423, E0425.
 For more information about an error, try `rustc --explain E0308`.
diff --git a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.rs b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.rs
new file mode 100644
index 00000000000..107cfbb9ff6
--- /dev/null
+++ b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.rs
@@ -0,0 +1,12 @@
+trait Trait<const N: Trait = bar> {
+//~^ ERROR cannot find value `bar` in this scope
+//~| ERROR cycle detected when computing type of `Trait::N`
+//~| ERROR cycle detected when computing type of `Trait::N`
+//~| ERROR `(dyn Trait<{const error}> + 'static)` is forbidden as the type of a const generic parameter
+//~| WARN trait objects without an explicit `dyn` are deprecated
+//~| WARN this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+    fn fnc(&self) {
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr
new file mode 100644
index 00000000000..2d5a0ede962
--- /dev/null
+++ b/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122199.stderr
@@ -0,0 +1,60 @@
+error[E0425]: cannot find value `bar` in this scope
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:30
+   |
+LL | trait Trait<const N: Trait = bar> {
+   |                              ^^^ not found in this scope
+
+warning: trait objects without an explicit `dyn` are deprecated
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:22
+   |
+LL | trait Trait<const N: Trait = bar> {
+   |                      ^^^^^
+   |
+   = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
+   = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/warnings-promoted-to-error.html>
+   = note: `#[warn(bare_trait_objects)]` on by default
+help: if this is an object-safe trait, use `dyn`
+   |
+LL | trait Trait<const N: dyn Trait = bar> {
+   |                      +++
+
+error[E0391]: cycle detected when computing type of `Trait::N`
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:22
+   |
+LL | trait Trait<const N: Trait = bar> {
+   |                      ^^^^^
+   |
+   = note: ...which immediately requires computing type of `Trait::N` again
+note: cycle used when computing explicit predicates of trait `Trait`
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:1
+   |
+LL | trait Trait<const N: Trait = bar> {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   = 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[E0391]: cycle detected when computing type of `Trait::N`
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:13
+   |
+LL | trait Trait<const N: Trait = bar> {
+   |             ^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: ...which immediately requires computing type of `Trait::N` again
+note: cycle used when computing explicit predicates of trait `Trait`
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:1
+   |
+LL | trait Trait<const N: Trait = bar> {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   = 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: `(dyn Trait<{const error}> + 'static)` is forbidden as the type of a const generic parameter
+  --> $DIR/ice-hir-wf-check-anon-const-issue-122199.rs:1:22
+   |
+LL | trait Trait<const N: Trait = bar> {
+   |                      ^^^^^
+   |
+   = note: the only supported types are integers, `bool` and `char`
+
+error: aborting due to 4 previous errors; 1 warning emitted
+
+Some errors have detailed explanations: E0391, E0425.
+For more information about an error, try `rustc --explain E0391`.