about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/codegen/align-struct.rs6
-rw-r--r--tests/codegen/common_prim_int_ptr.rs6
-rw-r--r--tests/codegen/enum/enum-aggregate.rs129
-rw-r--r--tests/codegen/intrinsics/transmute-x64.rs11
-rw-r--r--tests/codegen/intrinsics/transmute.rs14
-rw-r--r--tests/codegen/set-discriminant-invalid.rs5
-rw-r--r--tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs6
-rw-r--r--tests/codegen/transmute-scalar.rs14
-rw-r--r--tests/codegen/union-aggregate.rs85
-rw-r--r--tests/codegen/vec-in-place.rs31
-rw-r--r--tests/mir-opt/gvn_const_eval_polymorphic.no_optimize.GVN.diff12
-rw-r--r--tests/mir-opt/gvn_const_eval_polymorphic.optimize_false.GVN.diff13
-rw-r--r--tests/mir-opt/gvn_const_eval_polymorphic.optimize_true.GVN.diff13
-rw-r--r--tests/mir-opt/gvn_const_eval_polymorphic.rs57
-rw-r--r--tests/mir-opt/gvn_type_id_polymorphic.cursed_is_i32.GVN.diff12
-rw-r--r--tests/mir-opt/gvn_type_id_polymorphic.rs22
-rw-r--r--tests/pretty/hir-lifetimes.pp2
-rw-r--r--tests/pretty/hir-pretty-attr.pp2
-rw-r--r--tests/run-make/c-link-to-rust-va-list-fn/checkrust.rs62
-rw-r--r--tests/run-make/c-link-to-rust-va-list-fn/test.c53
-rw-r--r--tests/ui/allocator/alloc-shrink-oob-read.rs (renamed from tests/ui/realloc-16687.rs)10
-rw-r--r--tests/ui/async-await/impl-future-escaping-bound-vars-ice.rs (renamed from tests/ui/issues-71798.rs)4
-rw-r--r--tests/ui/async-await/impl-future-escaping-bound-vars-ice.stderr (renamed from tests/ui/issues-71798.stderr)4
-rw-r--r--tests/ui/attributes/malformed-attrs.rs8
-rw-r--r--tests/ui/attributes/malformed-attrs.stderr184
-rw-r--r--tests/ui/attributes/reexport-test-harness-entry-point.rs (renamed from tests/ui/reexport-test-harness-main.rs)3
-rw-r--r--tests/ui/auto-traits/auto-trait-phantom-data-bounds.rs (renamed from tests/ui/phantom-auto-trait.rs)6
-rw-r--r--tests/ui/auto-traits/auto-trait-phantom-data-bounds.stderr (renamed from tests/ui/phantom-auto-trait.stderr)18
-rw-r--r--tests/ui/binop/binop-evaluation-order-primitive.rs15
-rw-r--r--tests/ui/binop/compound-assign-by-ref.rs (renamed from tests/ui/op-assign-builtins-by-ref.rs)5
-rw-r--r--tests/ui/cfg/nested-cfg-attr-conditional-compilation.rs18
-rw-r--r--tests/ui/cfg/nested-cfg-attr-conditional-compilation.stderr (renamed from tests/ui/nested-cfg-attrs.stderr)6
-rw-r--r--tests/ui/closures/closure-capture-after-clone.rs39
-rw-r--r--tests/ui/closures/closure-last-use-move.rs33
-rw-r--r--tests/ui/closures/closure-no-copy-mut-env.rs (renamed from tests/ui/not-copy-closure.rs)2
-rw-r--r--tests/ui/closures/closure-no-copy-mut-env.stderr (renamed from tests/ui/not-copy-closure.stderr)4
-rw-r--r--tests/ui/closures/closure-upvar-last-use-analysis.rs32
-rw-r--r--tests/ui/closures/fnonce-call-twice-error.rs (renamed from tests/ui/once-cant-call-twice-on-heap.rs)7
-rw-r--r--tests/ui/closures/fnonce-call-twice-error.stderr (renamed from tests/ui/once-cant-call-twice-on-heap.stderr)12
-rw-r--r--tests/ui/closures/many-closures.rs47
-rw-r--r--tests/ui/coercion/basic-ptr-coercions.rs24
-rw-r--r--tests/ui/coercion/ptr-mutability-errors.rs (renamed from tests/ui/ptr-coercion.rs)3
-rw-r--r--tests/ui/coercion/ptr-mutability-errors.stderr (renamed from tests/ui/ptr-coercion.stderr)6
-rw-r--r--tests/ui/coherence/occurs-check/associated-type.next.stderr4
-rw-r--r--tests/ui/coherence/occurs-check/associated-type.old.stderr4
-rw-r--r--tests/ui/const-ptr/pointer-address-stability.rs11
-rw-r--r--tests/ui/cross-crate/auxiliary/cross-crate-refcell-match.rs (renamed from tests/ui/auxiliary/issue-16822.rs)0
-rw-r--r--tests/ui/cross-crate/auxiliary/kinds_in_metadata.rs (renamed from tests/ui/auxiliary/kinds_in_metadata.rs)0
-rw-r--r--tests/ui/cross-crate/cross-crate-refcell-match.rs36
-rw-r--r--tests/ui/cross-crate/metadata-trait-serialization.rs (renamed from tests/ui/kinds-in-metadata.rs)5
-rw-r--r--tests/ui/darwin-ld64.rs24
-rw-r--r--tests/ui/diagnostic-flags/error-format-short.rs (renamed from tests/ui/short-error-format.rs)3
-rw-r--r--tests/ui/diagnostic-flags/error-format-short.stderr3
-rw-r--r--tests/ui/drop/drop-once-on-move.rs (renamed from tests/ui/resource-assign-is-not-copy.rs)8
-rw-r--r--tests/ui/drop/drop-scope-exit.rs (renamed from tests/ui/resource-destruct.rs)20
-rw-r--r--tests/ui/empty/empty-attributes.stderr36
-rw-r--r--tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr12
-rw-r--r--tests/ui/fn/auxiliary/delegate_macro.rs (renamed from tests/ui/auxiliary/delegate_macro.rs)0
-rw-r--r--tests/ui/fn/fn-arg-count-mismatch-diagnostics.rs (renamed from tests/ui/not-enough-arguments.rs)9
-rw-r--r--tests/ui/fn/fn-arg-count-mismatch-diagnostics.stderr (renamed from tests/ui/not-enough-arguments.stderr)20
-rw-r--r--tests/ui/fn/mutable-function-parameters.rs24
-rw-r--r--tests/ui/generics/generic-params-nested-fn-scope-error.rs14
-rw-r--r--tests/ui/generics/generic-params-nested-fn-scope-error.stderr (renamed from tests/ui/nested-ty-params.stderr)16
-rw-r--r--tests/ui/generics/trait-incorrect-generic-args.rs (renamed from tests/ui/seq-args.rs)4
-rw-r--r--tests/ui/generics/trait-incorrect-generic-args.stderr (renamed from tests/ui/seq-args.stderr)12
-rw-r--r--tests/ui/higher-ranked/higher-ranked-encoding.rs (renamed from tests/ui/issue-15924.rs)15
-rw-r--r--tests/ui/higher-ranked/structually-relate-aliases.stderr2
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn.rs30
-rw-r--r--tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn.stderr53
-rw-r--r--tests/ui/io-checks/io-stdout-blocking-writes.rs (renamed from tests/ui/stdio-is-blocking.rs)24
-rw-r--r--tests/ui/io-checks/stdout-stderr-separation.rs (renamed from tests/ui/print-stdout-eprint-stderr.rs)3
-rw-r--r--tests/ui/issue-16822.rs22
-rw-r--r--tests/ui/item-name-overload.rs16
-rw-r--r--tests/ui/kinds-of-primitive-impl.rs26
-rw-r--r--tests/ui/last-use-in-block.rs21
-rw-r--r--tests/ui/last-use-in-cap-clause.rs17
-rw-r--r--tests/ui/last-use-is-capture.rs13
-rw-r--r--tests/ui/layout/null-pointer-optimization-sizes.rs (renamed from tests/ui/nullable-pointer-size.rs)18
-rw-r--r--tests/ui/layout/null-pointer-optimization.rs (renamed from tests/ui/nullable-pointer-iotareduction.rs)44
-rw-r--r--tests/ui/lint/lint_map_unit_fn.stderr25
-rw-r--r--tests/ui/lint/unused/unused-attr-duplicate.stderr48
-rw-r--r--tests/ui/malformed/malformed-regressions.stderr18
-rw-r--r--tests/ui/mismatched_types/closure-parameter-type-inference-mismatch.rs25
-rw-r--r--tests/ui/mismatched_types/closure-parameter-type-inference-mismatch.stderr31
-rw-r--r--tests/ui/mismatched_types/type-error-diagnostic-in-complex-return.rs (renamed from tests/ui/point-to-type-err-cause-on-impl-trait-return-2.rs)6
-rw-r--r--tests/ui/mismatched_types/type-error-diagnostic-in-complex-return.stderr (renamed from tests/ui/point-to-type-err-cause-on-impl-trait-return-2.stderr)2
-rw-r--r--tests/ui/modules/mod-same-item-names.rs15
-rw-r--r--tests/ui/mut-function-arguments.rs19
-rw-r--r--tests/ui/mutual-recursion-group.rs15
-rw-r--r--tests/ui/myriad-closures.rs39
-rw-r--r--tests/ui/nested-block-comment.rs11
-rw-r--r--tests/ui/nested-cfg-attrs.rs4
-rw-r--r--tests/ui/nested-class.rs25
-rw-r--r--tests/ui/nested-ty-params.rs9
-rw-r--r--tests/ui/nll/ty-outlives/impl-trait-captures.stderr8
-rw-r--r--tests/ui/occurs-check-2.rs9
-rw-r--r--tests/ui/occurs-check-3.rs11
-rw-r--r--tests/ui/occurs-check.rs5
-rw-r--r--tests/ui/opeq.rs17
-rw-r--r--tests/ui/panics/oom-panic-unwind.rs (renamed from tests/ui/oom_unwind.rs)2
-rw-r--r--tests/ui/parser/doc-comment-in-generic.rs13
-rw-r--r--tests/ui/parser/macro/bad-macro-definition.rs22
-rw-r--r--tests/ui/parser/macro/bad-macro-definition.stderr56
-rw-r--r--tests/ui/parser/nested-block-comments.rs34
-rw-r--r--tests/ui/parser/raw/raw-string-literals.rsbin0 -> 998 bytes
-rw-r--r--tests/ui/pattern/move-ref-patterns/pattern-ref-bindings-reassignment.rs24
-rw-r--r--tests/ui/pattern/move-ref-patterns/pattern-ref-bindings-reassignment.stderr (renamed from tests/ui/reassign-ref-mut.stderr)5
-rw-r--r--tests/ui/pptypedef.rs13
-rw-r--r--tests/ui/pptypedef.stderr31
-rw-r--r--tests/ui/primitive-binop-lhs-mut.rs6
-rw-r--r--tests/ui/print-calling-conventions.rs2
-rw-r--r--tests/ui/print-request/print-calling-conventions.rs4
-rw-r--r--tests/ui/print-request/print-calling-conventions.stdout (renamed from tests/ui/print-calling-conventions.stdout)0
-rw-r--r--tests/ui/project-cache-issue-31849.rs65
-rw-r--r--tests/ui/ptr-coercion-rpass.rs29
-rw-r--r--tests/ui/query-visibility.rs9
-rw-r--r--tests/ui/raw-str.rsbin848 -> 0 bytes
-rw-r--r--tests/ui/reassign-ref-mut.rs16
-rw-r--r--tests/ui/repr/repr-empty-packed.stderr23
-rw-r--r--tests/ui/resolve/resolve-same-name-struct.rs29
-rw-r--r--tests/ui/rfcs/rfc-2008-non-exhaustive/invalid-attribute.stderr10
-rw-r--r--tests/ui/sanitizer/memory-eager.rs10
-rw-r--r--tests/ui/shadowed/primitive-type-shadowing.rs (renamed from tests/ui/shadow-bool.rs)3
-rw-r--r--tests/ui/shadowed/use-shadows-reexport.rs (renamed from tests/ui/shadowed-use-visibility.rs)2
-rw-r--r--tests/ui/short-error-format.stderr3
-rw-r--r--tests/ui/sized-borrowed-pointer.rs9
-rw-r--r--tests/ui/sized-cycle-note.rs7
-rw-r--r--tests/ui/sized-cycle-note.stderr19
-rw-r--r--tests/ui/sized-owned-pointer.rs10
-rw-r--r--tests/ui/sized/recursive-type-infinite-size.rs16
-rw-r--r--tests/ui/sized/recursive-type-infinite-size.stderr25
-rw-r--r--tests/ui/sized/sized-box-unsized-content.rs11
-rw-r--r--tests/ui/sized/sized-reference-to-unsized.rs11
-rw-r--r--tests/ui/stable-addr-of.rs8
-rw-r--r--tests/ui/std/fs-nul-byte-paths.rs (renamed from tests/ui/paths-containing-nul.rs)20
-rw-r--r--tests/ui/str/nul-char-equivalence.rs (renamed from tests/ui/nul-characters.rs)13
-rw-r--r--tests/ui/sync/atomic-types-not-copyable.rs (renamed from tests/ui/std-uncopyable-atomics.rs)8
-rw-r--r--tests/ui/sync/atomic-types-not-copyable.stderr (renamed from tests/ui/std-uncopyable-atomics.stderr)8
-rw-r--r--tests/ui/target-feature/target-feature-detection.rs (renamed from tests/ui/sse2.rs)19
-rw-r--r--tests/ui/traits/copy-requires-all-fields-copy.rs (renamed from tests/ui/opt-in-copy.rs)2
-rw-r--r--tests/ui/traits/copy-requires-all-fields-copy.stderr (renamed from tests/ui/opt-in-copy.stderr)4
-rw-r--r--tests/ui/traits/error-trait-object-from-string.rs (renamed from tests/ui/string-box-error.rs)5
-rw-r--r--tests/ui/traits/next-solver/issue-118950-root-region.stderr2
-rw-r--r--tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.bad.stderr8
-rw-r--r--tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.good.stderr8
-rw-r--r--tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.rs2
-rw-r--r--tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr25
-rw-r--r--tests/ui/traits/trait-object-method-receiver-rules.rs (renamed from tests/ui/object-pointer-types.rs)5
-rw-r--r--tests/ui/traits/trait-object-method-receiver-rules.stderr (renamed from tests/ui/object-pointer-types.stderr)6
-rw-r--r--tests/ui/traits/trait-object-mut-to-shared-coercion.rs (renamed from tests/ui/objects-coerce-freeze-borrored.rs)4
-rw-r--r--tests/ui/type-inference/direct-self-reference-occurs-check.rs9
-rw-r--r--tests/ui/type-inference/direct-self-reference-occurs-check.stderr (renamed from tests/ui/occurs-check.stderr)2
-rw-r--r--tests/ui/type-inference/enum-self-reference-occurs-check.rs16
-rw-r--r--tests/ui/type-inference/enum-self-reference-occurs-check.stderr (renamed from tests/ui/occurs-check-3.stderr)2
-rw-r--r--tests/ui/type-inference/infinite-type-occurs-check.rs12
-rw-r--r--tests/ui/type-inference/infinite-type-occurs-check.stderr (renamed from tests/ui/occurs-check-2.stderr)2
-rw-r--r--tests/ui/type/inherent-impl-primitive-types-error.rs28
-rw-r--r--tests/ui/type/inherent-impl-primitive-types-error.stderr (renamed from tests/ui/kinds-of-primitive-impl.stderr)10
-rw-r--r--tests/ui/type/mutually-recursive-types.rs47
-rw-r--r--tests/ui/typeck/nested-generic-traits-performance.rs82
-rw-r--r--tests/ui/uninhabited/uninhabited-patterns.rs6
-rw-r--r--tests/ui/uninhabited/uninhabited-patterns.stderr36
-rw-r--r--tests/ui/unpretty/deprecated-attr.stdout12
-rw-r--r--tests/ui/unpretty/exhaustive.hir.stdout2
-rw-r--r--tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr4
165 files changed, 1881 insertions, 1011 deletions
diff --git a/tests/codegen/align-struct.rs b/tests/codegen/align-struct.rs
index 402a184d4c0..d4cc65e9158 100644
--- a/tests/codegen/align-struct.rs
+++ b/tests/codegen/align-struct.rs
@@ -15,9 +15,11 @@ pub struct Nested64 {
     d: i8,
 }
 
+// This has the extra field in B to ensure it's not ScalarPair,
+// and thus that the test actually emits it via memory, not `insertvalue`.
 pub enum Enum4 {
     A(i32),
-    B(i32),
+    B(i32, i32),
 }
 
 pub enum Enum64 {
@@ -54,7 +56,7 @@ pub fn nested64(a: Align64, b: i32, c: i32, d: i8) -> Nested64 {
 // CHECK-LABEL: @enum4
 #[no_mangle]
 pub fn enum4(a: i32) -> Enum4 {
-    // CHECK: %e4 = alloca [8 x i8], align 4
+    // CHECK: %e4 = alloca [12 x i8], align 4
     let e4 = Enum4::A(a);
     e4
 }
diff --git a/tests/codegen/common_prim_int_ptr.rs b/tests/codegen/common_prim_int_ptr.rs
index a1d7a125f32..53716adccbf 100644
--- a/tests/codegen/common_prim_int_ptr.rs
+++ b/tests/codegen/common_prim_int_ptr.rs
@@ -11,9 +11,9 @@
 #[no_mangle]
 pub fn insert_int(x: usize) -> Result<usize, Box<()>> {
     // CHECK: start:
-    // CHECK-NEXT: inttoptr i{{[0-9]+}} %x to ptr
-    // CHECK-NEXT: insertvalue
-    // CHECK-NEXT: ret { i{{[0-9]+}}, ptr }
+    // CHECK-NEXT: %[[WO_PROV:.+]] = getelementptr i8, ptr null, [[USIZE:i[0-9]+]] %x
+    // CHECK-NEXT: %[[R:.+]] = insertvalue { [[USIZE]], ptr } { [[USIZE]] 0, ptr poison }, ptr %[[WO_PROV]], 1
+    // CHECK-NEXT: ret { [[USIZE]], ptr } %[[R]]
     Ok(x)
 }
 
diff --git a/tests/codegen/enum/enum-aggregate.rs b/tests/codegen/enum/enum-aggregate.rs
new file mode 100644
index 00000000000..b6a9b8dd814
--- /dev/null
+++ b/tests/codegen/enum/enum-aggregate.rs
@@ -0,0 +1,129 @@
+//@ compile-flags: -Copt-level=0 -Cno-prepopulate-passes
+//@ min-llvm-version: 19
+//@ only-64bit
+
+#![crate_type = "lib"]
+
+use std::cmp::Ordering;
+use std::num::NonZero;
+use std::ptr::NonNull;
+
+#[no_mangle]
+fn make_some_bool(x: bool) -> Option<bool> {
+    // CHECK-LABEL: i8 @make_some_bool(i1 zeroext %x)
+    // CHECK-NEXT: start:
+    // CHECK-NEXT: %[[WIDER:.+]] = zext i1 %x to i8
+    // CHECK-NEXT: ret i8 %[[WIDER]]
+    Some(x)
+}
+
+#[no_mangle]
+fn make_none_bool() -> Option<bool> {
+    // CHECK-LABEL: i8 @make_none_bool()
+    // CHECK-NEXT: start:
+    // CHECK-NEXT: ret i8 2
+    None
+}
+
+#[no_mangle]
+fn make_some_ordering(x: Ordering) -> Option<Ordering> {
+    // CHECK-LABEL: i8 @make_some_ordering(i8 %x)
+    // CHECK-NEXT: start:
+    // CHECK-NEXT: ret i8 %x
+    Some(x)
+}
+
+#[no_mangle]
+fn make_some_u16(x: u16) -> Option<u16> {
+    // CHECK-LABEL: { i16, i16 } @make_some_u16(i16 %x)
+    // CHECK-NEXT: start:
+    // CHECK-NEXT: %0 = insertvalue { i16, i16 } { i16 1, i16 poison }, i16 %x, 1
+    // CHECK-NEXT: ret { i16, i16 } %0
+    Some(x)
+}
+
+#[no_mangle]
+fn make_none_u16() -> Option<u16> {
+    // CHECK-LABEL: { i16, i16 } @make_none_u16()
+    // CHECK-NEXT: start:
+    // CHECK-NEXT: ret { i16, i16 } { i16 0, i16 undef }
+    None
+}
+
+#[no_mangle]
+fn make_some_nzu32(x: NonZero<u32>) -> Option<NonZero<u32>> {
+    // CHECK-LABEL: i32 @make_some_nzu32(i32 %x)
+    // CHECK-NEXT: start:
+    // CHECK-NEXT: ret i32 %x
+    Some(x)
+}
+
+#[no_mangle]
+fn make_ok_ptr(x: NonNull<u16>) -> Result<NonNull<u16>, usize> {
+    // CHECK-LABEL: { i64, ptr } @make_ok_ptr(ptr %x)
+    // CHECK-NEXT: start:
+    // CHECK-NEXT: %0 = insertvalue { i64, ptr } { i64 0, ptr poison }, ptr %x, 1
+    // CHECK-NEXT: ret { i64, ptr } %0
+    Ok(x)
+}
+
+#[no_mangle]
+fn make_ok_int(x: usize) -> Result<usize, NonNull<u16>> {
+    // CHECK-LABEL: { i64, ptr } @make_ok_int(i64 %x)
+    // CHECK-NEXT: start:
+    // CHECK-NEXT: %[[NOPROV:.+]] = getelementptr i8, ptr null, i64 %x
+    // CHECK-NEXT: %[[R:.+]] = insertvalue { i64, ptr } { i64 0, ptr poison }, ptr %[[NOPROV]], 1
+    // CHECK-NEXT: ret { i64, ptr } %[[R]]
+    Ok(x)
+}
+
+#[no_mangle]
+fn make_some_ref(x: &u16) -> Option<&u16> {
+    // CHECK-LABEL: ptr @make_some_ref(ptr align 2 %x)
+    // CHECK-NEXT: start:
+    // CHECK-NEXT: ret ptr %x
+    Some(x)
+}
+
+#[no_mangle]
+fn make_none_ref<'a>() -> Option<&'a u16> {
+    // CHECK-LABEL: ptr @make_none_ref()
+    // CHECK-NEXT: start:
+    // CHECK-NEXT: ret ptr null
+    None
+}
+
+#[inline(never)]
+fn make_err_generic<E>(e: E) -> Result<u32, E> {
+    // CHECK-LABEL: define{{.+}}make_err_generic
+    // CHECK-NEXT: start:
+    // CHECK-NEXT: call void @llvm.trap()
+    // CHECK-NEXT: ret i32 poison
+    Err(e)
+}
+
+#[no_mangle]
+fn make_uninhabited_err_indirectly(n: Never) -> Result<u32, Never> {
+    // CHECK-LABEL: i32 @make_uninhabited_err_indirectly()
+    // CHECK-NEXT: start:
+    // CHECK-NEXT: call{{.+}}make_err_generic
+    make_err_generic(n)
+}
+
+#[no_mangle]
+fn make_fully_uninhabited_result(v: u32, n: Never) -> Result<(u32, Never), (Never, u32)> {
+    // We don't try to do this in SSA form since the whole type is uninhabited.
+
+    // CHECK-LABEL: { i32, i32 } @make_fully_uninhabited_result(i32 %v)
+    // CHECK: %[[ALLOC_V:.+]] = alloca [4 x i8]
+    // CHECK: %[[RET:.+]] = alloca [8 x i8]
+    // CHECK: store i32 %v, ptr %[[ALLOC_V]]
+    // CHECK: %[[TEMP_V:.+]] = load i32, ptr %[[ALLOC_V]]
+    // CHECK: %[[INNER:.+]] = getelementptr inbounds i8, ptr %[[RET]]
+    // CHECK: store i32 %[[TEMP_V]], ptr %[[INNER]]
+    // CHECK: call void @llvm.trap()
+    // CHECK: unreachable
+    Ok((v, n))
+}
+
+enum Never {}
diff --git a/tests/codegen/intrinsics/transmute-x64.rs b/tests/codegen/intrinsics/transmute-x64.rs
index be45e4db90f..8c9480ab091 100644
--- a/tests/codegen/intrinsics/transmute-x64.rs
+++ b/tests/codegen/intrinsics/transmute-x64.rs
@@ -9,17 +9,20 @@ use std::mem::transmute;
 // CHECK-LABEL: @check_sse_pair_to_avx(
 #[no_mangle]
 pub unsafe fn check_sse_pair_to_avx(x: (__m128i, __m128i)) -> __m256i {
+    // CHECK: start:
     // CHECK-NOT: alloca
-    // CHECK: %0 = load <4 x i64>, ptr %x, align 16
-    // CHECK: store <4 x i64> %0, ptr %_0, align 32
+    // CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr align 32 %_0, ptr align 16 %x, i64 32, i1 false)
+    // CHECK-NEXT: ret void
     transmute(x)
 }
 
 // CHECK-LABEL: @check_sse_pair_from_avx(
 #[no_mangle]
 pub unsafe fn check_sse_pair_from_avx(x: __m256i) -> (__m128i, __m128i) {
+    // CHECK: start:
     // CHECK-NOT: alloca
-    // CHECK: %0 = load <4 x i64>, ptr %x, align 32
-    // CHECK: store <4 x i64> %0, ptr %_0, align 16
+    // CHECK-NEXT: %[[TEMP:.+]] = load <4 x i64>, ptr %x, align 32
+    // CHECK-NEXT: store <4 x i64> %[[TEMP]], ptr %_0, align 16
+    // CHECK-NEXT: ret void
     transmute(x)
 }
diff --git a/tests/codegen/intrinsics/transmute.rs b/tests/codegen/intrinsics/transmute.rs
index 560ebcccdd0..e375724bc1b 100644
--- a/tests/codegen/intrinsics/transmute.rs
+++ b/tests/codegen/intrinsics/transmute.rs
@@ -29,28 +29,28 @@ pub struct Aggregate8(u8);
 // CHECK-LABEL: @check_bigger_size(
 #[no_mangle]
 pub unsafe fn check_bigger_size(x: u16) -> u32 {
-    // CHECK: call void @llvm.trap
+    // CHECK: call void @llvm.assume(i1 false)
     transmute_unchecked(x)
 }
 
 // CHECK-LABEL: @check_smaller_size(
 #[no_mangle]
 pub unsafe fn check_smaller_size(x: u32) -> u16 {
-    // CHECK: call void @llvm.trap
+    // CHECK: call void @llvm.assume(i1 false)
     transmute_unchecked(x)
 }
 
 // CHECK-LABEL: @check_smaller_array(
 #[no_mangle]
 pub unsafe fn check_smaller_array(x: [u32; 7]) -> [u32; 3] {
-    // CHECK: call void @llvm.trap
+    // CHECK: call void @llvm.assume(i1 false)
     transmute_unchecked(x)
 }
 
 // CHECK-LABEL: @check_bigger_array(
 #[no_mangle]
 pub unsafe fn check_bigger_array(x: [u32; 3]) -> [u32; 7] {
-    // CHECK: call void @llvm.trap
+    // CHECK: call void @llvm.assume(i1 false)
     transmute_unchecked(x)
 }
 
@@ -73,9 +73,9 @@ pub unsafe fn check_to_empty_array(x: [u32; 5]) -> [u32; 0] {
 #[no_mangle]
 #[custom_mir(dialect = "runtime", phase = "optimized")]
 pub unsafe fn check_from_empty_array(x: [u32; 0]) -> [u32; 5] {
-    // CHECK-NOT: trap
-    // CHECK: call void @llvm.trap
-    // CHECK-NOT: trap
+    // CHECK-NOT: call
+    // CHECK: call void @llvm.assume(i1 false)
+    // CHECK-NOT: call
     mir! {
         {
             RET = CastTransmute(x);
diff --git a/tests/codegen/set-discriminant-invalid.rs b/tests/codegen/set-discriminant-invalid.rs
index 0b7cb14880c..dd584ef1c14 100644
--- a/tests/codegen/set-discriminant-invalid.rs
+++ b/tests/codegen/set-discriminant-invalid.rs
@@ -16,10 +16,9 @@ impl IntoError<Error> for Api {
     type Source = ApiError;
     // CHECK-LABEL: @into_error
     // CHECK: llvm.trap()
-    // Also check the next two instructions to make sure we do not match against `trap`
+    // Also check the next instruction to make sure we do not match against `trap`
     // elsewhere in the code.
-    // CHECK-NEXT: load
-    // CHECK-NEXT: ret
+    // CHECK-NEXT: ret i8 poison
     #[no_mangle]
     fn into_error(self, error: Self::Source) -> Error {
         Error::Api { source: error }
diff --git a/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs b/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs
index 977bf3379b7..301f06c2d74 100644
--- a/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs
+++ b/tests/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs
@@ -40,8 +40,7 @@ pub fn build_array_s(x: [f32; 4]) -> S<4> {
 // CHECK-LABEL: @build_array_transmute_s
 #[no_mangle]
 pub fn build_array_transmute_s(x: [f32; 4]) -> S<4> {
-    // CHECK: %[[VAL:.+]] = load <4 x float>, ptr %x, align [[ARRAY_ALIGN]]
-    // CHECK: store <4 x float> %[[VAL:.+]], ptr %_0, align [[VECTOR_ALIGN]]
+    // CHECK: call void @llvm.memcpy.{{.+}}({{.*}} align [[VECTOR_ALIGN]] {{.*}} align [[ARRAY_ALIGN]] {{.*}}, [[USIZE]] 16, i1 false)
     unsafe { std::mem::transmute(x) }
 }
 
@@ -55,7 +54,6 @@ pub fn build_array_t(x: [f32; 4]) -> T {
 // CHECK-LABEL: @build_array_transmute_t
 #[no_mangle]
 pub fn build_array_transmute_t(x: [f32; 4]) -> T {
-    // CHECK: %[[VAL:.+]] = load <4 x float>, ptr %x, align [[ARRAY_ALIGN]]
-    // CHECK: store <4 x float> %[[VAL:.+]], ptr %_0, align [[VECTOR_ALIGN]]
+    // CHECK: call void @llvm.memcpy.{{.+}}({{.*}} align [[VECTOR_ALIGN]] {{.*}} align [[ARRAY_ALIGN]] {{.*}}, [[USIZE]] 16, i1 false)
     unsafe { std::mem::transmute(x) }
 }
diff --git a/tests/codegen/transmute-scalar.rs b/tests/codegen/transmute-scalar.rs
index 3ac6ba3beb1..ce1b0558b2e 100644
--- a/tests/codegen/transmute-scalar.rs
+++ b/tests/codegen/transmute-scalar.rs
@@ -111,8 +111,11 @@ pub fn fake_bool_unsigned_to_bool(b: FakeBoolUnsigned) -> bool {
 struct S([i64; 1]);
 
 // CHECK-LABEL: define{{.*}}i64 @single_element_simd_to_scalar(<1 x i64> %b)
-// CHECK: bitcast <1 x i64> %b to i64
-// CHECK: ret i64
+// CHECK-NEXT: start:
+// CHECK-NEXT: %[[RET:.+]] = alloca [8 x i8]
+// CHECK-NEXT: store <1 x i64> %b, ptr %[[RET]]
+// CHECK-NEXT: %[[TEMP:.+]] = load i64, ptr %[[RET]]
+// CHECK-NEXT: ret i64 %[[TEMP]]
 #[no_mangle]
 #[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))]
 #[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))]
@@ -124,8 +127,11 @@ pub extern "C" fn single_element_simd_to_scalar(b: S) -> i64 {
 }
 
 // CHECK-LABEL: define{{.*}}<1 x i64> @scalar_to_single_element_simd(i64 %b)
-// CHECK: bitcast i64 %b to <1 x i64>
-// CHECK: ret <1 x i64>
+// CHECK-NEXT: start:
+// CHECK-NEXT: %[[RET:.+]] = alloca [8 x i8]
+// CHECK-NEXT: store i64 %b, ptr %[[RET]]
+// CHECK-NEXT: %[[TEMP:.+]] = load <1 x i64>, ptr %[[RET]]
+// CHECK-NEXT: ret <1 x i64> %[[TEMP]]
 #[no_mangle]
 #[cfg_attr(target_family = "wasm", target_feature(enable = "simd128"))]
 #[cfg_attr(target_arch = "arm", target_feature(enable = "neon"))]
diff --git a/tests/codegen/union-aggregate.rs b/tests/codegen/union-aggregate.rs
new file mode 100644
index 00000000000..3c6053379fa
--- /dev/null
+++ b/tests/codegen/union-aggregate.rs
@@ -0,0 +1,85 @@
+//@ compile-flags: -Copt-level=0 -Cno-prepopulate-passes
+//@ min-llvm-version: 19
+//@ only-64bit
+
+#![crate_type = "lib"]
+#![feature(transparent_unions)]
+
+#[repr(transparent)]
+union MU<T: Copy> {
+    uninit: (),
+    value: T,
+}
+
+use std::cmp::Ordering;
+use std::num::NonZero;
+use std::ptr::NonNull;
+
+#[no_mangle]
+fn make_mu_bool(x: bool) -> MU<bool> {
+    // CHECK-LABEL: i8 @make_mu_bool(i1 zeroext %x)
+    // CHECK-NEXT: start:
+    // CHECK-NEXT: %[[WIDER:.+]] = zext i1 %x to i8
+    // CHECK-NEXT: ret i8 %[[WIDER]]
+    MU { value: x }
+}
+
+#[no_mangle]
+fn make_mu_bool_uninit() -> MU<bool> {
+    // CHECK-LABEL: i8 @make_mu_bool_uninit()
+    // CHECK-NEXT: start:
+    // CHECK-NEXT: ret i8 undef
+    MU { uninit: () }
+}
+
+#[no_mangle]
+fn make_mu_ref(x: &u16) -> MU<&u16> {
+    // CHECK-LABEL: ptr @make_mu_ref(ptr align 2 %x)
+    // CHECK-NEXT: start:
+    // CHECK-NEXT: ret ptr %x
+    MU { value: x }
+}
+
+#[no_mangle]
+fn make_mu_ref_uninit<'a>() -> MU<&'a u16> {
+    // CHECK-LABEL: ptr @make_mu_ref_uninit()
+    // CHECK-NEXT: start:
+    // CHECK-NEXT: ret ptr undef
+    MU { uninit: () }
+}
+
+#[no_mangle]
+fn make_mu_str(x: &str) -> MU<&str> {
+    // CHECK-LABEL: { ptr, i64 } @make_mu_str(ptr align 1 %x.0, i64 %x.1)
+    // CHECK-NEXT: start:
+    // CHECK-NEXT: %0 = insertvalue { ptr, i64 } poison, ptr %x.0, 0
+    // CHECK-NEXT: %1 = insertvalue { ptr, i64 } %0, i64 %x.1, 1
+    // CHECK-NEXT: ret { ptr, i64 } %1
+    MU { value: x }
+}
+
+#[no_mangle]
+fn make_mu_str_uninit<'a>() -> MU<&'a str> {
+    // CHECK-LABEL: { ptr, i64 } @make_mu_str_uninit()
+    // CHECK-NEXT: start:
+    // CHECK-NEXT: ret { ptr, i64 } undef
+    MU { uninit: () }
+}
+
+#[no_mangle]
+fn make_mu_pair(x: (u8, u32)) -> MU<(u8, u32)> {
+    // CHECK-LABEL: { i8, i32 } @make_mu_pair(i8 %x.0, i32 %x.1)
+    // CHECK-NEXT: start:
+    // CHECK-NEXT: %0 = insertvalue { i8, i32 } poison, i8 %x.0, 0
+    // CHECK-NEXT: %1 = insertvalue { i8, i32 } %0, i32 %x.1, 1
+    // CHECK-NEXT: ret { i8, i32 } %1
+    MU { value: x }
+}
+
+#[no_mangle]
+fn make_mu_pair_uninit() -> MU<(u8, u32)> {
+    // CHECK-LABEL: { i8, i32 } @make_mu_pair_uninit()
+    // CHECK-NEXT: start:
+    // CHECK-NEXT: ret { i8, i32 } undef
+    MU { uninit: () }
+}
diff --git a/tests/codegen/vec-in-place.rs b/tests/codegen/vec-in-place.rs
index 1f6836f6dfa..a5ef8653b99 100644
--- a/tests/codegen/vec-in-place.rs
+++ b/tests/codegen/vec-in-place.rs
@@ -41,9 +41,6 @@ pub fn vec_iterator_cast_primitive(vec: Vec<i8>) -> Vec<u8> {
     // CHECK: call{{.+}}void @llvm.assume(i1 %{{.+}})
     // CHECK-NOT: loop
     // CHECK-NOT: call
-    // CHECK: call{{.+}}void @llvm.assume(i1 %{{.+}})
-    // CHECK-NOT: loop
-    // CHECK-NOT: call
     vec.into_iter().map(|e| e as u8).collect()
 }
 
@@ -55,9 +52,6 @@ pub fn vec_iterator_cast_wrapper(vec: Vec<u8>) -> Vec<Wrapper<u8>> {
     // CHECK: call{{.+}}void @llvm.assume(i1 %{{.+}})
     // CHECK-NOT: loop
     // CHECK-NOT: call
-    // CHECK: call{{.+}}void @llvm.assume(i1 %{{.+}})
-    // CHECK-NOT: loop
-    // CHECK-NOT: call
     vec.into_iter().map(|e| Wrapper(e)).collect()
 }
 
@@ -86,9 +80,6 @@ pub fn vec_iterator_cast_unwrap(vec: Vec<Wrapper<u8>>) -> Vec<u8> {
     // CHECK: call{{.+}}void @llvm.assume(i1 %{{.+}})
     // CHECK-NOT: loop
     // CHECK-NOT: call
-    // CHECK: call{{.+}}void @llvm.assume(i1 %{{.+}})
-    // CHECK-NOT: loop
-    // CHECK-NOT: call
     vec.into_iter().map(|e| e.0).collect()
 }
 
@@ -100,9 +91,6 @@ pub fn vec_iterator_cast_aggregate(vec: Vec<[u64; 4]>) -> Vec<Foo> {
     // CHECK: call{{.+}}void @llvm.assume(i1 %{{.+}})
     // CHECK-NOT: loop
     // CHECK-NOT: call
-    // CHECK: call{{.+}}void @llvm.assume(i1 %{{.+}})
-    // CHECK-NOT: loop
-    // CHECK-NOT: call
     vec.into_iter().map(|e| unsafe { std::mem::transmute(e) }).collect()
 }
 
@@ -114,9 +102,6 @@ pub fn vec_iterator_cast_deaggregate_tra(vec: Vec<Bar>) -> Vec<[u64; 4]> {
     // CHECK: call{{.+}}void @llvm.assume(i1 %{{.+}})
     // CHECK-NOT: loop
     // CHECK-NOT: call
-    // CHECK: call{{.+}}void @llvm.assume(i1 %{{.+}})
-    // CHECK-NOT: loop
-    // CHECK-NOT: call
 
     // Safety: For the purpose of this test we assume that Bar layout matches [u64; 4].
     // This currently is not guaranteed for repr(Rust) types, but it happens to work here and
@@ -133,9 +118,6 @@ pub fn vec_iterator_cast_deaggregate_fold(vec: Vec<Baz>) -> Vec<[u64; 4]> {
     // CHECK: call{{.+}}void @llvm.assume(i1 %{{.+}})
     // CHECK-NOT: loop
     // CHECK-NOT: call
-    // CHECK: call{{.+}}void @llvm.assume(i1 %{{.+}})
-    // CHECK-NOT: loop
-    // CHECK-NOT: call
 
     // Safety: For the purpose of this test we assume that Bar layout matches [u64; 4].
     // This currently is not guaranteed for repr(Rust) types, but it happens to work here and
@@ -156,12 +138,7 @@ pub fn vec_iterator_cast_unwrap_drop(vec: Vec<Wrapper<String>>) -> Vec<String> {
     // CHECK-NOT: call
     // CHECK-NOT: %{{.*}} = mul
     // CHECK-NOT: %{{.*}} = udiv
-    // CHECK: call
-    // CHECK-SAME: void @llvm.assume(i1 %{{.+}})
-    // CHECK-NOT: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}
-    // CHECK-NOT: call
-    // CHECK-NOT: %{{.*}} = mul
-    // CHECK-NOT: %{{.*}} = udiv
+    // CHECK: ret void
 
     vec.into_iter().map(|Wrapper(e)| e).collect()
 }
@@ -178,12 +155,6 @@ pub fn vec_iterator_cast_wrap_drop(vec: Vec<String>) -> Vec<Wrapper<String>> {
     // CHECK-NOT: call
     // CHECK-NOT: %{{.*}} = mul
     // CHECK-NOT: %{{.*}} = udiv
-    // CHECK: call
-    // CHECK-SAME: void @llvm.assume(i1 %{{.+}})
-    // CHECK-NOT: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}
-    // CHECK-NOT: call
-    // CHECK-NOT: %{{.*}} = mul
-    // CHECK-NOT: %{{.*}} = udiv
     // CHECK: ret void
 
     vec.into_iter().map(Wrapper).collect()
diff --git a/tests/mir-opt/gvn_const_eval_polymorphic.no_optimize.GVN.diff b/tests/mir-opt/gvn_const_eval_polymorphic.no_optimize.GVN.diff
new file mode 100644
index 00000000000..a91561ba304
--- /dev/null
+++ b/tests/mir-opt/gvn_const_eval_polymorphic.no_optimize.GVN.diff
@@ -0,0 +1,12 @@
+- // MIR for `no_optimize` before GVN
++ // MIR for `no_optimize` after GVN
+  
+  fn no_optimize() -> bool {
+      let mut _0: bool;
+  
+      bb0: {
+          _0 = Eq(const no_optimize::<T>::{constant#0}, const no_optimize::<T>::{constant#1});
+          return;
+      }
+  }
+  
diff --git a/tests/mir-opt/gvn_const_eval_polymorphic.optimize_false.GVN.diff b/tests/mir-opt/gvn_const_eval_polymorphic.optimize_false.GVN.diff
new file mode 100644
index 00000000000..bdfa2987b23
--- /dev/null
+++ b/tests/mir-opt/gvn_const_eval_polymorphic.optimize_false.GVN.diff
@@ -0,0 +1,13 @@
+- // MIR for `optimize_false` before GVN
++ // MIR for `optimize_false` after GVN
+  
+  fn optimize_false() -> bool {
+      let mut _0: bool;
+  
+      bb0: {
+-         _0 = Eq(const optimize_false::<T>::{constant#0}, const optimize_false::<T>::{constant#1});
++         _0 = const false;
+          return;
+      }
+  }
+  
diff --git a/tests/mir-opt/gvn_const_eval_polymorphic.optimize_true.GVN.diff b/tests/mir-opt/gvn_const_eval_polymorphic.optimize_true.GVN.diff
new file mode 100644
index 00000000000..dc337d43fb0
--- /dev/null
+++ b/tests/mir-opt/gvn_const_eval_polymorphic.optimize_true.GVN.diff
@@ -0,0 +1,13 @@
+- // MIR for `optimize_true` before GVN
++ // MIR for `optimize_true` after GVN
+  
+  fn optimize_true() -> bool {
+      let mut _0: bool;
+  
+      bb0: {
+-         _0 = Eq(const optimize_true::<T>::{constant#0}, const optimize_true::<T>::{constant#1});
++         _0 = const true;
+          return;
+      }
+  }
+  
diff --git a/tests/mir-opt/gvn_const_eval_polymorphic.rs b/tests/mir-opt/gvn_const_eval_polymorphic.rs
new file mode 100644
index 00000000000..7320ad947ff
--- /dev/null
+++ b/tests/mir-opt/gvn_const_eval_polymorphic.rs
@@ -0,0 +1,57 @@
+//@ test-mir-pass: GVN
+//@ compile-flags: --crate-type lib
+
+//! Regressions test for a mis-optimization where some functions
+//! (`type_id` / `type_name` / `needs_drop`) could be evaluated in
+//! a generic context, even though their value depends on some type
+//! parameter `T`.
+//!
+//! In particular, `type_name_of_val(&generic::<T>)` was incorrectly
+//! evaluated to the string "crate_name::generic::<T>", and
+//! `no_optimize` was incorrectly optimized to `false`.
+
+#![feature(const_type_name)]
+
+fn generic<T>() {}
+
+const fn type_name_contains_i32<T>(_: &T) -> bool {
+    let pattern = b"i32";
+    let name = std::any::type_name::<T>().as_bytes();
+    let mut i = 0;
+    'outer: while i < name.len() - pattern.len() + 1 {
+        let mut j = 0;
+        while j < pattern.len() {
+            if name[i + j] != pattern[j] {
+                i += 1;
+                continue 'outer;
+            }
+            j += 1;
+        }
+        return true;
+    }
+    false
+}
+
+// EMIT_MIR gvn_const_eval_polymorphic.optimize_true.GVN.diff
+fn optimize_true<T>() -> bool {
+    // CHECK-LABEL: fn optimize_true(
+    // CHECK: _0 = const true;
+    // CHECK-NEXT: return;
+    (const { type_name_contains_i32(&generic::<i32>) }) == const { true }
+}
+
+// EMIT_MIR gvn_const_eval_polymorphic.optimize_false.GVN.diff
+fn optimize_false<T>() -> bool {
+    // CHECK-LABEL: fn optimize_false(
+    // CHECK: _0 = const false;
+    // CHECK-NEXT: return;
+    (const { type_name_contains_i32(&generic::<i64>) }) == const { true }
+}
+
+// EMIT_MIR gvn_const_eval_polymorphic.no_optimize.GVN.diff
+fn no_optimize<T>() -> bool {
+    // CHECK-LABEL: fn no_optimize(
+    // CHECK: _0 = Eq(const no_optimize::<T>::{constant#0}, const no_optimize::<T>::{constant#1});
+    // CHECK-NEXT: return;
+    (const { type_name_contains_i32(&generic::<T>) }) == const { true }
+}
diff --git a/tests/mir-opt/gvn_type_id_polymorphic.cursed_is_i32.GVN.diff b/tests/mir-opt/gvn_type_id_polymorphic.cursed_is_i32.GVN.diff
deleted file mode 100644
index 2f83f54d2af..00000000000
--- a/tests/mir-opt/gvn_type_id_polymorphic.cursed_is_i32.GVN.diff
+++ /dev/null
@@ -1,12 +0,0 @@
-- // MIR for `cursed_is_i32` before GVN
-+ // MIR for `cursed_is_i32` after GVN
-  
-  fn cursed_is_i32() -> bool {
-      let mut _0: bool;
-  
-      bb0: {
-          _0 = Eq(const cursed_is_i32::<T>::{constant#0}, const cursed_is_i32::<T>::{constant#1});
-          return;
-      }
-  }
-  
diff --git a/tests/mir-opt/gvn_type_id_polymorphic.rs b/tests/mir-opt/gvn_type_id_polymorphic.rs
deleted file mode 100644
index 39bc5c24ecc..00000000000
--- a/tests/mir-opt/gvn_type_id_polymorphic.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-//@ test-mir-pass: GVN
-//@ compile-flags: -C opt-level=2
-
-#![feature(core_intrinsics)]
-
-fn generic<T>() {}
-
-const fn type_id_of_val<T: 'static>(_: &T) -> u128 {
-    std::intrinsics::type_id::<T>()
-}
-
-// EMIT_MIR gvn_type_id_polymorphic.cursed_is_i32.GVN.diff
-fn cursed_is_i32<T: 'static>() -> bool {
-    // CHECK-LABEL: fn cursed_is_i32(
-    // CHECK: _0 = Eq(const cursed_is_i32::<T>::{constant#0}, const cursed_is_i32::<T>::{constant#1});
-    // CHECK-NEXT: return;
-    (const { type_id_of_val(&generic::<T>) } == const { type_id_of_val(&generic::<i32>) })
-}
-
-fn main() {
-    dbg!(cursed_is_i32::<i32>());
-}
diff --git a/tests/pretty/hir-lifetimes.pp b/tests/pretty/hir-lifetimes.pp
index 4d1ab9d383b..58de6d81915 100644
--- a/tests/pretty/hir-lifetimes.pp
+++ b/tests/pretty/hir-lifetimes.pp
@@ -69,7 +69,7 @@ type Q<'a> = dyn MyTrait<'a, 'a> + 'a;
 fn h<'b, F>(f: F, y: Foo<'b>) where F: for<'d> MyTrait<'d, 'b> { }
 
 // FIXME(?): attr printing is weird
-#[attr = Repr([ReprC])]
+#[attr = Repr {reprs: [ReprC]}]
 struct S<'a>(&'a u32);
 
 extern "C" {
diff --git a/tests/pretty/hir-pretty-attr.pp b/tests/pretty/hir-pretty-attr.pp
index d8cc8c424ca..db7489c1264 100644
--- a/tests/pretty/hir-pretty-attr.pp
+++ b/tests/pretty/hir-pretty-attr.pp
@@ -6,6 +6,6 @@ extern crate std;
 //@ pretty-mode:hir
 //@ pp-exact:hir-pretty-attr.pp
 
-#[attr = Repr([ReprC, ReprPacked(Align(4 bytes)), ReprTransparent])]
+#[attr = Repr {reprs: [ReprC, ReprPacked(Align(4 bytes)), ReprTransparent]}]
 struct Example {
 }
diff --git a/tests/run-make/c-link-to-rust-va-list-fn/checkrust.rs b/tests/run-make/c-link-to-rust-va-list-fn/checkrust.rs
index 36c9db106ec..63d8d713d62 100644
--- a/tests/run-make/c-link-to-rust-va-list-fn/checkrust.rs
+++ b/tests/run-make/c-link-to-rust-va-list-fn/checkrust.rs
@@ -1,7 +1,8 @@
 #![crate_type = "staticlib"]
 #![feature(c_variadic)]
+#![feature(cfg_select)]
 
-use std::ffi::{CStr, CString, VaList, c_char, c_double, c_int, c_long, c_longlong};
+use std::ffi::{CStr, CString, VaList, VaListImpl, c_char, c_double, c_int, c_long, c_longlong};
 
 macro_rules! continue_if {
     ($cond:expr) => {
@@ -19,7 +20,7 @@ unsafe fn compare_c_str(ptr: *const c_char, val: &str) -> bool {
     }
 }
 
-#[no_mangle]
+#[unsafe(no_mangle)]
 pub unsafe extern "C" fn check_list_0(mut ap: VaList) -> usize {
     continue_if!(ap.arg::<c_longlong>() == 1);
     continue_if!(ap.arg::<c_int>() == 2);
@@ -27,7 +28,7 @@ pub unsafe extern "C" fn check_list_0(mut ap: VaList) -> usize {
     0
 }
 
-#[no_mangle]
+#[unsafe(no_mangle)]
 pub unsafe extern "C" fn check_list_1(mut ap: VaList) -> usize {
     continue_if!(ap.arg::<c_int>() == -1);
     continue_if!(ap.arg::<c_int>() == 'A' as c_int);
@@ -39,7 +40,7 @@ pub unsafe extern "C" fn check_list_1(mut ap: VaList) -> usize {
     0
 }
 
-#[no_mangle]
+#[unsafe(no_mangle)]
 pub unsafe extern "C" fn check_list_2(mut ap: VaList) -> usize {
     continue_if!(ap.arg::<c_double>().floor() == 3.14f64.floor());
     continue_if!(ap.arg::<c_long>() == 12);
@@ -51,7 +52,7 @@ pub unsafe extern "C" fn check_list_2(mut ap: VaList) -> usize {
     0
 }
 
-#[no_mangle]
+#[unsafe(no_mangle)]
 pub unsafe extern "C" fn check_list_copy_0(mut ap: VaList) -> usize {
     continue_if!(ap.arg::<c_double>().floor() == 6.28f64.floor());
     continue_if!(ap.arg::<c_int>() == 16);
@@ -64,14 +65,14 @@ pub unsafe extern "C" fn check_list_copy_0(mut ap: VaList) -> usize {
     )
 }
 
-#[no_mangle]
+#[unsafe(no_mangle)]
 pub unsafe extern "C" fn check_varargs_0(_: c_int, mut ap: ...) -> usize {
     continue_if!(ap.arg::<c_int>() == 42);
     continue_if!(compare_c_str(ap.arg::<*const c_char>(), "Hello, World!"));
     0
 }
 
-#[no_mangle]
+#[unsafe(no_mangle)]
 pub unsafe extern "C" fn check_varargs_1(_: c_int, mut ap: ...) -> usize {
     continue_if!(ap.arg::<c_double>().floor() == 3.14f64.floor());
     continue_if!(ap.arg::<c_long>() == 12);
@@ -80,12 +81,12 @@ pub unsafe extern "C" fn check_varargs_1(_: c_int, mut ap: ...) -> usize {
     0
 }
 
-#[no_mangle]
+#[unsafe(no_mangle)]
 pub unsafe extern "C" fn check_varargs_2(_: c_int, _ap: ...) -> usize {
     0
 }
 
-#[no_mangle]
+#[unsafe(no_mangle)]
 pub unsafe extern "C" fn check_varargs_3(_: c_int, mut ap: ...) -> usize {
     continue_if!(ap.arg::<c_int>() == 1);
     continue_if!(ap.arg::<c_int>() == 2);
@@ -100,7 +101,7 @@ pub unsafe extern "C" fn check_varargs_3(_: c_int, mut ap: ...) -> usize {
     0
 }
 
-#[no_mangle]
+#[unsafe(no_mangle)]
 pub unsafe extern "C" fn check_varargs_4(_: c_double, mut ap: ...) -> usize {
     continue_if!(ap.arg::<c_double>() == 1.0);
     continue_if!(ap.arg::<c_double>() == 2.0);
@@ -118,7 +119,7 @@ pub unsafe extern "C" fn check_varargs_4(_: c_double, mut ap: ...) -> usize {
     0
 }
 
-#[no_mangle]
+#[unsafe(no_mangle)]
 pub unsafe extern "C" fn check_varargs_5(_: c_int, mut ap: ...) -> usize {
     continue_if!(ap.arg::<c_double>() == 1.0);
     continue_if!(ap.arg::<c_int>() == 1);
@@ -148,3 +149,42 @@ pub unsafe extern "C" fn check_varargs_5(_: c_int, mut ap: ...) -> usize {
     continue_if!(ap.arg::<c_double>() == 13.0);
     0
 }
+
+unsafe extern "C" {
+    fn test_variadic(_: c_int, ...) -> usize;
+    fn test_va_list_by_value(_: VaList) -> usize;
+    fn test_va_list_by_pointer(_: *mut VaListImpl) -> usize;
+    fn test_va_list_by_pointer_pointer(_: *mut *mut VaListImpl) -> usize;
+}
+
+#[unsafe(no_mangle)]
+extern "C" fn run_test_variadic() -> usize {
+    return unsafe { test_variadic(0, 1 as c_longlong, 2 as c_int, 3 as c_longlong) };
+}
+
+#[unsafe(no_mangle)]
+extern "C" fn run_test_va_list_by_value() -> usize {
+    unsafe extern "C" fn helper(mut ap: ...) -> usize {
+        unsafe { test_va_list_by_value(ap.as_va_list()) }
+    }
+
+    unsafe { helper(1 as c_longlong, 2 as c_int, 3 as c_longlong) }
+}
+
+#[unsafe(no_mangle)]
+extern "C" fn run_test_va_list_by_pointer() -> usize {
+    unsafe extern "C" fn helper(mut ap: ...) -> usize {
+        unsafe { test_va_list_by_pointer(&mut ap) }
+    }
+
+    unsafe { helper(1 as c_longlong, 2 as c_int, 3 as c_longlong) }
+}
+
+#[unsafe(no_mangle)]
+extern "C" fn run_test_va_list_by_pointer_pointer() -> usize {
+    unsafe extern "C" fn helper(mut ap: ...) -> usize {
+        unsafe { test_va_list_by_pointer_pointer(&mut (&mut ap as *mut _)) }
+    }
+
+    unsafe { helper(1 as c_longlong, 2 as c_int, 3 as c_longlong) }
+}
diff --git a/tests/run-make/c-link-to-rust-va-list-fn/test.c b/tests/run-make/c-link-to-rust-va-list-fn/test.c
index b47a9357880..2bb93c0b5d0 100644
--- a/tests/run-make/c-link-to-rust-va-list-fn/test.c
+++ b/tests/run-make/c-link-to-rust-va-list-fn/test.c
@@ -15,6 +15,11 @@ extern size_t check_varargs_3(int fixed, ...);
 extern size_t check_varargs_4(double fixed, ...);
 extern size_t check_varargs_5(int fixed, ...);
 
+extern size_t run_test_variadic();
+extern size_t run_test_va_list_by_value();
+extern size_t run_test_va_list_by_pointer();
+extern size_t run_test_va_list_by_pointer_pointer();
+
 int test_rust(size_t (*fn)(va_list), ...) {
     size_t ret = 0;
     va_list ap;
@@ -47,5 +52,53 @@ int main(int argc, char* argv[]) {
     assert(check_varargs_5(0, 1.0, 1, 2.0, 2, 3.0, 3, 4.0, 4, 5, 5.0, 6, 6.0, 7, 7.0, 8, 8.0,
                            9, 9.0, 10, 10.0, 11, 11.0, 12, 12.0, 13, 13.0) == 0);
 
+    assert(run_test_variadic() == 0);
+    assert(run_test_va_list_by_value() == 0);
+    assert(run_test_va_list_by_pointer() == 0);
+    assert(run_test_va_list_by_pointer_pointer() == 0);
+
+    return 0;
+}
+
+#define continue_if_else_end(cond) \
+    do { if (!(cond)) { va_end(ap); return 0xff; } } while (0)
+
+size_t test_variadic(int unused, ...) {
+    va_list ap;
+    va_start(ap, unused);
+
+    continue_if_else_end(va_arg(ap, long long) == 1);
+    continue_if_else_end(va_arg(ap, int) == 2);
+    continue_if_else_end(va_arg(ap, long long) == 3);
+
+    va_end(ap);
+
+    return 0;
+}
+
+#define continue_if(cond) \
+    do { if (!(cond)) { return 0xff; } } while (0)
+
+size_t test_va_list_by_value(va_list ap) {
+    continue_if(va_arg(ap, long long) == 1);
+    continue_if(va_arg(ap, int) == 2);
+    continue_if(va_arg(ap, long long) == 3);
+
+    return 0;
+}
+
+size_t test_va_list_by_pointer(va_list *ap) {
+    continue_if(va_arg(*ap, long long) == 1);
+    continue_if(va_arg(*ap, int) == 2);
+    continue_if(va_arg(*ap, long long) == 3);
+
+    return 0;
+}
+
+size_t test_va_list_by_pointer_pointer(va_list **ap) {
+    continue_if(va_arg(**ap, long long) == 1);
+    continue_if(va_arg(**ap, int) == 2);
+    continue_if(va_arg(**ap, long long) == 3);
+
     return 0;
 }
diff --git a/tests/ui/realloc-16687.rs b/tests/ui/allocator/alloc-shrink-oob-read.rs
index 43810a469df..b9edfca3b7b 100644
--- a/tests/ui/realloc-16687.rs
+++ b/tests/ui/allocator/alloc-shrink-oob-read.rs
@@ -1,13 +1,13 @@
+//! Sanity check for out-of-bounds read caused by copying the entire original buffer on shrink.
+//!
+//! Regression test for: <https://github.com/rust-lang/rust/issues/16687>
+
 //@ run-pass
-// alloc::heap::reallocate test.
-//
-// Ideally this would be revised to use no_std, but for now it serves
-// well enough to reproduce (and illustrate) the bug from #16687.
 
 #![feature(allocator_api)]
 #![feature(slice_ptr_get)]
 
-use std::alloc::{handle_alloc_error, Allocator, Global, Layout};
+use std::alloc::{Allocator, Global, Layout, handle_alloc_error};
 use std::ptr::{self, NonNull};
 
 fn main() {
diff --git a/tests/ui/issues-71798.rs b/tests/ui/async-await/impl-future-escaping-bound-vars-ice.rs
index 14b6c0f3581..ea30e8c839f 100644
--- a/tests/ui/issues-71798.rs
+++ b/tests/ui/async-await/impl-future-escaping-bound-vars-ice.rs
@@ -1,3 +1,7 @@
+//! Regression test for issue https://github.com/rust-lang/rust/issues/71798
+// ICE with escaping bound variables when impl Future + '_
+// returns non-Future type combined with syntax errors
+
 fn test_ref(x: &u32) -> impl std::future::Future<Output = u32> + '_ {
     //~^ ERROR `u32` is not a future
     *x
diff --git a/tests/ui/issues-71798.stderr b/tests/ui/async-await/impl-future-escaping-bound-vars-ice.stderr
index 52dd14ccb0a..5beca58e13c 100644
--- a/tests/ui/issues-71798.stderr
+++ b/tests/ui/async-await/impl-future-escaping-bound-vars-ice.stderr
@@ -1,11 +1,11 @@
 error[E0425]: cannot find value `u` in this scope
-  --> $DIR/issues-71798.rs:7:24
+  --> $DIR/impl-future-escaping-bound-vars-ice.rs:11:24
    |
 LL |     let _ = test_ref & u;
    |                        ^ not found in this scope
 
 error[E0277]: `u32` is not a future
-  --> $DIR/issues-71798.rs:1:25
+  --> $DIR/impl-future-escaping-bound-vars-ice.rs:5:25
    |
 LL | fn test_ref(x: &u32) -> impl std::future::Future<Output = u32> + '_ {
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `u32` is not a future
diff --git a/tests/ui/attributes/malformed-attrs.rs b/tests/ui/attributes/malformed-attrs.rs
index dbe9c35b0a4..aa52de63a60 100644
--- a/tests/ui/attributes/malformed-attrs.rs
+++ b/tests/ui/attributes/malformed-attrs.rs
@@ -47,6 +47,7 @@
 //~^ ERROR malformed
 #[repr]
 //~^ ERROR malformed
+//~| ERROR is not supported on function items
 #[rustc_as_ptr = 5]
 //~^ ERROR malformed
 #[inline = 5]
@@ -219,4 +220,11 @@ macro_rules! slump {
     () => {}
 }
 
+#[ignore = 1]
+//~^ ERROR valid forms for the attribute are
+//~| WARN this was previously accepted by the compiler
+fn thing() {
+
+}
+
 fn main() {}
diff --git a/tests/ui/attributes/malformed-attrs.stderr b/tests/ui/attributes/malformed-attrs.stderr
index bdebe155aba..2f7bf50ead5 100644
--- a/tests/ui/attributes/malformed-attrs.stderr
+++ b/tests/ui/attributes/malformed-attrs.stderr
@@ -1,11 +1,11 @@
 error: `cfg` is not followed by parentheses
-  --> $DIR/malformed-attrs.rs:101:1
+  --> $DIR/malformed-attrs.rs:102:1
    |
 LL | #[cfg]
    | ^^^^^^ help: expected syntax is: `cfg(/* predicate */)`
 
 error: malformed `cfg_attr` attribute input
-  --> $DIR/malformed-attrs.rs:103:1
+  --> $DIR/malformed-attrs.rs:104:1
    |
 LL | #[cfg_attr]
    | ^^^^^^^^^^^
@@ -17,7 +17,7 @@ LL | #[cfg_attr(condition, attribute, other_attribute, ...)]
    |           ++++++++++++++++++++++++++++++++++++++++++++
 
 error[E0463]: can't find crate for `wloop`
-  --> $DIR/malformed-attrs.rs:210:1
+  --> $DIR/malformed-attrs.rs:211:1
    |
 LL | extern crate wloop;
    | ^^^^^^^^^^^^^^^^^^^ can't find crate
@@ -35,19 +35,19 @@ LL | #![windows_subsystem]
    | ^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#![windows_subsystem = "windows|console"]`
 
 error: malformed `crate_name` attribute input
-  --> $DIR/malformed-attrs.rs:73:1
+  --> $DIR/malformed-attrs.rs:74:1
    |
 LL | #[crate_name]
    | ^^^^^^^^^^^^^ help: must be of the form: `#[crate_name = "name"]`
 
 error: malformed `export_stable` attribute input
-  --> $DIR/malformed-attrs.rs:80:1
+  --> $DIR/malformed-attrs.rs:81:1
    |
 LL | #[export_stable = 1]
    | ^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[export_stable]`
 
 error: malformed `coverage` attribute input
-  --> $DIR/malformed-attrs.rs:89:1
+  --> $DIR/malformed-attrs.rs:90:1
    |
 LL | #[coverage]
    | ^^^^^^^^^^^
@@ -60,49 +60,49 @@ LL | #[coverage(on)]
    |           ++++
 
 error: malformed `no_sanitize` attribute input
-  --> $DIR/malformed-attrs.rs:91:1
+  --> $DIR/malformed-attrs.rs:92:1
    |
 LL | #[no_sanitize]
    | ^^^^^^^^^^^^^^ help: must be of the form: `#[no_sanitize(address, kcfi, memory, thread)]`
 
 error: malformed `proc_macro` attribute input
-  --> $DIR/malformed-attrs.rs:98:1
+  --> $DIR/malformed-attrs.rs:99:1
    |
 LL | #[proc_macro = 18]
    | ^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[proc_macro]`
 
 error: malformed `instruction_set` attribute input
-  --> $DIR/malformed-attrs.rs:105:1
+  --> $DIR/malformed-attrs.rs:106:1
    |
 LL | #[instruction_set]
    | ^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[instruction_set(set)]`
 
 error: malformed `patchable_function_entry` attribute input
-  --> $DIR/malformed-attrs.rs:107:1
+  --> $DIR/malformed-attrs.rs:108:1
    |
 LL | #[patchable_function_entry]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[patchable_function_entry(prefix_nops = m, entry_nops = n)]`
 
 error: malformed `coroutine` attribute input
-  --> $DIR/malformed-attrs.rs:110:5
+  --> $DIR/malformed-attrs.rs:111:5
    |
 LL |     #[coroutine = 63] || {}
    |     ^^^^^^^^^^^^^^^^^ help: must be of the form: `#[coroutine]`
 
 error: malformed `proc_macro_attribute` attribute input
-  --> $DIR/malformed-attrs.rs:115:1
+  --> $DIR/malformed-attrs.rs:116:1
    |
 LL | #[proc_macro_attribute = 19]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[proc_macro_attribute]`
 
 error: malformed `proc_macro_derive` attribute input
-  --> $DIR/malformed-attrs.rs:122:1
+  --> $DIR/malformed-attrs.rs:123:1
    |
 LL | #[proc_macro_derive]
    | ^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[proc_macro_derive(TraitName, /*opt*/ attributes(name1, name2, ...))]`
 
 error: malformed `must_not_suspend` attribute input
-  --> $DIR/malformed-attrs.rs:131:1
+  --> $DIR/malformed-attrs.rs:132:1
    |
 LL | #[must_not_suspend()]
    | ^^^^^^^^^^^^^^^^^^^^^
@@ -117,115 +117,109 @@ LL + #[must_not_suspend]
    |
 
 error: malformed `cfi_encoding` attribute input
-  --> $DIR/malformed-attrs.rs:133:1
+  --> $DIR/malformed-attrs.rs:134:1
    |
 LL | #[cfi_encoding]
    | ^^^^^^^^^^^^^^^ help: must be of the form: `#[cfi_encoding = "encoding"]`
 
 error: malformed `type_const` attribute input
-  --> $DIR/malformed-attrs.rs:142:5
+  --> $DIR/malformed-attrs.rs:143:5
    |
 LL |     #[type_const = 1]
    |     ^^^^^^^^^^^^^^^^^ help: must be of the form: `#[type_const]`
 
 error: malformed `marker` attribute input
-  --> $DIR/malformed-attrs.rs:154:1
+  --> $DIR/malformed-attrs.rs:155:1
    |
 LL | #[marker = 3]
    | ^^^^^^^^^^^^^ help: must be of the form: `#[marker]`
 
 error: malformed `fundamental` attribute input
-  --> $DIR/malformed-attrs.rs:156:1
+  --> $DIR/malformed-attrs.rs:157:1
    |
 LL | #[fundamental()]
    | ^^^^^^^^^^^^^^^^ help: must be of the form: `#[fundamental]`
 
 error: malformed `ffi_pure` attribute input
-  --> $DIR/malformed-attrs.rs:164:5
+  --> $DIR/malformed-attrs.rs:165:5
    |
 LL |     #[unsafe(ffi_pure = 1)]
    |     ^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[ffi_pure]`
 
 error: malformed `link_ordinal` attribute input
-  --> $DIR/malformed-attrs.rs:166:5
+  --> $DIR/malformed-attrs.rs:167:5
    |
 LL |     #[link_ordinal]
    |     ^^^^^^^^^^^^^^^ help: must be of the form: `#[link_ordinal(ordinal)]`
 
 error: malformed `ffi_const` attribute input
-  --> $DIR/malformed-attrs.rs:170:5
+  --> $DIR/malformed-attrs.rs:171:5
    |
 LL |     #[unsafe(ffi_const = 1)]
    |     ^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[ffi_const]`
 
 error: malformed `linkage` attribute input
-  --> $DIR/malformed-attrs.rs:172:5
+  --> $DIR/malformed-attrs.rs:173:5
    |
 LL |     #[linkage]
    |     ^^^^^^^^^^ help: must be of the form: `#[linkage = "external|internal|..."]`
 
 error: malformed `allow` attribute input
-  --> $DIR/malformed-attrs.rs:177:1
+  --> $DIR/malformed-attrs.rs:178:1
    |
 LL | #[allow]
    | ^^^^^^^^ help: must be of the form: `#[allow(lint1, lint2, ..., /*opt*/ reason = "...")]`
 
 error: malformed `expect` attribute input
-  --> $DIR/malformed-attrs.rs:179:1
+  --> $DIR/malformed-attrs.rs:180:1
    |
 LL | #[expect]
    | ^^^^^^^^^ help: must be of the form: `#[expect(lint1, lint2, ..., /*opt*/ reason = "...")]`
 
 error: malformed `warn` attribute input
-  --> $DIR/malformed-attrs.rs:181:1
+  --> $DIR/malformed-attrs.rs:182:1
    |
 LL | #[warn]
    | ^^^^^^^ help: must be of the form: `#[warn(lint1, lint2, ..., /*opt*/ reason = "...")]`
 
 error: malformed `deny` attribute input
-  --> $DIR/malformed-attrs.rs:183:1
+  --> $DIR/malformed-attrs.rs:184:1
    |
 LL | #[deny]
    | ^^^^^^^ help: must be of the form: `#[deny(lint1, lint2, ..., /*opt*/ reason = "...")]`
 
 error: malformed `forbid` attribute input
-  --> $DIR/malformed-attrs.rs:185:1
+  --> $DIR/malformed-attrs.rs:186:1
    |
 LL | #[forbid]
    | ^^^^^^^^^ help: must be of the form: `#[forbid(lint1, lint2, ..., /*opt*/ reason = "...")]`
 
 error: malformed `debugger_visualizer` attribute input
-  --> $DIR/malformed-attrs.rs:187:1
+  --> $DIR/malformed-attrs.rs:188:1
    |
 LL | #[debugger_visualizer]
    | ^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[debugger_visualizer(natvis_file = "...", gdb_script_file = "...")]`
 
 error: malformed `automatically_derived` attribute input
-  --> $DIR/malformed-attrs.rs:190:1
+  --> $DIR/malformed-attrs.rs:191:1
    |
 LL | #[automatically_derived = 18]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[automatically_derived]`
 
-error: malformed `non_exhaustive` attribute input
-  --> $DIR/malformed-attrs.rs:196:1
-   |
-LL | #[non_exhaustive = 1]
-   | ^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[non_exhaustive]`
-
 error: malformed `thread_local` attribute input
-  --> $DIR/malformed-attrs.rs:202:1
+  --> $DIR/malformed-attrs.rs:203:1
    |
 LL | #[thread_local()]
    | ^^^^^^^^^^^^^^^^^ help: must be of the form: `#[thread_local]`
 
 error: malformed `no_link` attribute input
-  --> $DIR/malformed-attrs.rs:206:1
+  --> $DIR/malformed-attrs.rs:207:1
    |
 LL | #[no_link()]
    | ^^^^^^^^^^^^ help: must be of the form: `#[no_link]`
 
 error: malformed `macro_use` attribute input
-  --> $DIR/malformed-attrs.rs:208:1
+  --> $DIR/malformed-attrs.rs:209:1
    |
 LL | #[macro_use = 1]
    | ^^^^^^^^^^^^^^^^
@@ -240,7 +234,7 @@ LL + #[macro_use]
    |
 
 error: malformed `macro_export` attribute input
-  --> $DIR/malformed-attrs.rs:213:1
+  --> $DIR/malformed-attrs.rs:214:1
    |
 LL | #[macro_export = 18]
    | ^^^^^^^^^^^^^^^^^^^^
@@ -255,31 +249,31 @@ LL + #[macro_export]
    |
 
 error: malformed `allow_internal_unsafe` attribute input
-  --> $DIR/malformed-attrs.rs:215:1
+  --> $DIR/malformed-attrs.rs:216:1
    |
 LL | #[allow_internal_unsafe = 1]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[allow_internal_unsafe]`
 
 error: the `#[proc_macro]` attribute is only usable with crates of the `proc-macro` crate type
-  --> $DIR/malformed-attrs.rs:98:1
+  --> $DIR/malformed-attrs.rs:99:1
    |
 LL | #[proc_macro = 18]
    | ^^^^^^^^^^^^^^^^^^
 
 error: the `#[proc_macro_attribute]` attribute is only usable with crates of the `proc-macro` crate type
-  --> $DIR/malformed-attrs.rs:115:1
+  --> $DIR/malformed-attrs.rs:116:1
    |
 LL | #[proc_macro_attribute = 19]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: the `#[proc_macro_derive]` attribute is only usable with crates of the `proc-macro` crate type
-  --> $DIR/malformed-attrs.rs:122:1
+  --> $DIR/malformed-attrs.rs:123:1
    |
 LL | #[proc_macro_derive]
    | ^^^^^^^^^^^^^^^^^^^^
 
 error[E0658]: allow_internal_unsafe side-steps the unsafe_code lint
-  --> $DIR/malformed-attrs.rs:215:1
+  --> $DIR/malformed-attrs.rs:216:1
    |
 LL | #[allow_internal_unsafe = 1]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -298,7 +292,7 @@ LL | #[doc]
    = note: `#[deny(ill_formed_attribute_input)]` on by default
 
 error: valid forms for the attribute are `#[doc(hidden|inline|...)]` and `#[doc = "string"]`
-  --> $DIR/malformed-attrs.rs:75:1
+  --> $DIR/malformed-attrs.rs:76:1
    |
 LL | #[doc]
    | ^^^^^^
@@ -307,7 +301,7 @@ LL | #[doc]
    = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
 
 error: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ wasm_import_module = "...", /*opt*/ import_name_type = "decorated|noprefix|undecorated")]`
-  --> $DIR/malformed-attrs.rs:82:1
+  --> $DIR/malformed-attrs.rs:83:1
    |
 LL | #[link]
    | ^^^^^^^
@@ -315,17 +309,8 @@ LL | #[link]
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
 
-error: valid forms for the attribute are `#[ignore]` and `#[ignore = "reason"]`
-  --> $DIR/malformed-attrs.rs:93:1
-   |
-LL | #[ignore()]
-   | ^^^^^^^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
-
 error: invalid argument
-  --> $DIR/malformed-attrs.rs:187:1
+  --> $DIR/malformed-attrs.rs:188:1
    |
 LL | #[debugger_visualizer]
    | ^^^^^^^^^^^^^^^^^^^^^^
@@ -397,7 +382,7 @@ LL | #[repr]
    | help: must be of the form: `#[repr(C | Rust | align(...) | packed(...) | <integer type> | transparent)]`
 
 error[E0565]: malformed `rustc_as_ptr` attribute input
-  --> $DIR/malformed-attrs.rs:50:1
+  --> $DIR/malformed-attrs.rs:51:1
    |
 LL | #[rustc_as_ptr = 5]
    | ^^^^^^^^^^^^^^^---^
@@ -406,7 +391,7 @@ LL | #[rustc_as_ptr = 5]
    | help: must be of the form: `#[rustc_as_ptr]`
 
 error[E0539]: malformed `align` attribute input
-  --> $DIR/malformed-attrs.rs:55:1
+  --> $DIR/malformed-attrs.rs:56:1
    |
 LL | #[align]
    | ^^^^^^^^
@@ -415,7 +400,7 @@ LL | #[align]
    | help: must be of the form: `#[align(<alignment in bytes>)]`
 
 error[E0539]: malformed `optimize` attribute input
-  --> $DIR/malformed-attrs.rs:57:1
+  --> $DIR/malformed-attrs.rs:58:1
    |
 LL | #[optimize]
    | ^^^^^^^^^^^
@@ -424,7 +409,7 @@ LL | #[optimize]
    | help: must be of the form: `#[optimize(size|speed|none)]`
 
 error[E0565]: malformed `cold` attribute input
-  --> $DIR/malformed-attrs.rs:59:1
+  --> $DIR/malformed-attrs.rs:60:1
    |
 LL | #[cold = 1]
    | ^^^^^^^---^
@@ -433,13 +418,13 @@ LL | #[cold = 1]
    | help: must be of the form: `#[cold]`
 
 error: valid forms for the attribute are `#[must_use = "reason"]` and `#[must_use]`
-  --> $DIR/malformed-attrs.rs:61:1
+  --> $DIR/malformed-attrs.rs:62:1
    |
 LL | #[must_use()]
    | ^^^^^^^^^^^^^
 
 error[E0565]: malformed `no_mangle` attribute input
-  --> $DIR/malformed-attrs.rs:63:1
+  --> $DIR/malformed-attrs.rs:64:1
    |
 LL | #[no_mangle = 1]
    | ^^^^^^^^^^^^---^
@@ -448,7 +433,7 @@ LL | #[no_mangle = 1]
    | help: must be of the form: `#[no_mangle]`
 
 error[E0565]: malformed `naked` attribute input
-  --> $DIR/malformed-attrs.rs:65:1
+  --> $DIR/malformed-attrs.rs:66:1
    |
 LL | #[unsafe(naked())]
    | ^^^^^^^^^^^^^^--^^
@@ -457,7 +442,7 @@ LL | #[unsafe(naked())]
    | help: must be of the form: `#[naked]`
 
 error[E0565]: malformed `track_caller` attribute input
-  --> $DIR/malformed-attrs.rs:67:1
+  --> $DIR/malformed-attrs.rs:68:1
    |
 LL | #[track_caller()]
    | ^^^^^^^^^^^^^^--^
@@ -466,13 +451,13 @@ LL | #[track_caller()]
    | help: must be of the form: `#[track_caller]`
 
 error[E0539]: malformed `export_name` attribute input
-  --> $DIR/malformed-attrs.rs:69:1
+  --> $DIR/malformed-attrs.rs:70:1
    |
 LL | #[export_name()]
    | ^^^^^^^^^^^^^^^^ help: must be of the form: `#[export_name = "name"]`
 
 error[E0805]: malformed `used` attribute input
-  --> $DIR/malformed-attrs.rs:71:1
+  --> $DIR/malformed-attrs.rs:72:1
    |
 LL | #[used()]
    | ^^^^^^--^
@@ -488,7 +473,7 @@ LL + #[used]
    |
 
 error[E0539]: malformed `target_feature` attribute input
-  --> $DIR/malformed-attrs.rs:78:1
+  --> $DIR/malformed-attrs.rs:79:1
    |
 LL | #[target_feature]
    | ^^^^^^^^^^^^^^^^^
@@ -497,19 +482,19 @@ LL | #[target_feature]
    | help: must be of the form: `#[target_feature(enable = "feat1, feat2")]`
 
 error[E0539]: malformed `link_name` attribute input
-  --> $DIR/malformed-attrs.rs:85:1
+  --> $DIR/malformed-attrs.rs:86:1
    |
 LL | #[link_name]
    | ^^^^^^^^^^^^ help: must be of the form: `#[link_name = "name"]`
 
 error[E0539]: malformed `link_section` attribute input
-  --> $DIR/malformed-attrs.rs:87:1
+  --> $DIR/malformed-attrs.rs:88:1
    |
 LL | #[link_section]
    | ^^^^^^^^^^^^^^^ help: must be of the form: `#[link_section = "name"]`
 
 error[E0565]: malformed `no_implicit_prelude` attribute input
-  --> $DIR/malformed-attrs.rs:96:1
+  --> $DIR/malformed-attrs.rs:97:1
    |
 LL | #[no_implicit_prelude = 23]
    | ^^^^^^^^^^^^^^^^^^^^^^----^
@@ -518,7 +503,7 @@ LL | #[no_implicit_prelude = 23]
    | help: must be of the form: `#[no_implicit_prelude]`
 
 error[E0539]: malformed `must_use` attribute input
-  --> $DIR/malformed-attrs.rs:118:1
+  --> $DIR/malformed-attrs.rs:119:1
    |
 LL | #[must_use = 1]
    | ^^^^^^^^^^^^^-^
@@ -535,7 +520,7 @@ LL + #[must_use]
    |
 
 error[E0539]: malformed `rustc_layout_scalar_valid_range_start` attribute input
-  --> $DIR/malformed-attrs.rs:127:1
+  --> $DIR/malformed-attrs.rs:128:1
    |
 LL | #[rustc_layout_scalar_valid_range_start]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -544,7 +529,7 @@ LL | #[rustc_layout_scalar_valid_range_start]
    | help: must be of the form: `#[rustc_layout_scalar_valid_range_start(start)]`
 
 error[E0539]: malformed `rustc_layout_scalar_valid_range_end` attribute input
-  --> $DIR/malformed-attrs.rs:129:1
+  --> $DIR/malformed-attrs.rs:130:1
    |
 LL | #[rustc_layout_scalar_valid_range_end]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -552,6 +537,15 @@ LL | #[rustc_layout_scalar_valid_range_end]
    | expected this to be a list
    | help: must be of the form: `#[rustc_layout_scalar_valid_range_end(end)]`
 
+error[E0565]: malformed `non_exhaustive` attribute input
+  --> $DIR/malformed-attrs.rs:197:1
+   |
+LL | #[non_exhaustive = 1]
+   | ^^^^^^^^^^^^^^^^^---^
+   | |                |
+   | |                didn't expect any arguments here
+   | help: must be of the form: `#[non_exhaustive]`
+
 error: attribute should be applied to `const fn`
   --> $DIR/malformed-attrs.rs:34:1
    |
@@ -564,8 +558,20 @@ LL | |     #[coroutine = 63] || {}
 LL | | }
    | |_- not a `const fn`
 
+error: `#[repr(align(...))]` is not supported on function items
+  --> $DIR/malformed-attrs.rs:48:1
+   |
+LL | #[repr]
+   | ^^^^^^^
+   |
+help: use `#[align(...)]` instead
+  --> $DIR/malformed-attrs.rs:48:1
+   |
+LL | #[repr]
+   | ^^^^^^^
+
 warning: `#[diagnostic::do_not_recommend]` does not expect any arguments
-  --> $DIR/malformed-attrs.rs:148:1
+  --> $DIR/malformed-attrs.rs:149:1
    |
 LL | #[diagnostic::do_not_recommend()]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -573,7 +579,7 @@ LL | #[diagnostic::do_not_recommend()]
    = note: `#[warn(unknown_or_malformed_diagnostic_attributes)]` on by default
 
 warning: missing options for `on_unimplemented` attribute
-  --> $DIR/malformed-attrs.rs:137:1
+  --> $DIR/malformed-attrs.rs:138:1
    |
 LL | #[diagnostic::on_unimplemented]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -581,7 +587,7 @@ LL | #[diagnostic::on_unimplemented]
    = help: at least one of the `message`, `note` and `label` options are expected
 
 warning: malformed `on_unimplemented` attribute
-  --> $DIR/malformed-attrs.rs:139:1
+  --> $DIR/malformed-attrs.rs:140:1
    |
 LL | #[diagnostic::on_unimplemented = 1]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid option found here
@@ -589,7 +595,7 @@ LL | #[diagnostic::on_unimplemented = 1]
    = help: only `message`, `note` and `label` are allowed as options
 
 error: valid forms for the attribute are `#[inline(always|never)]` and `#[inline]`
-  --> $DIR/malformed-attrs.rs:52:1
+  --> $DIR/malformed-attrs.rs:53:1
    |
 LL | #[inline = 5]
    | ^^^^^^^^^^^^^
@@ -597,8 +603,26 @@ LL | #[inline = 5]
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
 
+error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
+  --> $DIR/malformed-attrs.rs:94:1
+   |
+LL | #[ignore()]
+   | ^^^^^^^^^^^
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
+
+error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
+  --> $DIR/malformed-attrs.rs:223:1
+   |
+LL | #[ignore = 1]
+   | ^^^^^^^^^^^^^
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
+
 error[E0308]: mismatched types
-  --> $DIR/malformed-attrs.rs:110:23
+  --> $DIR/malformed-attrs.rs:111:23
    |
 LL | fn test() {
    |          - help: a return type might be missing here: `-> _`
@@ -606,9 +630,9 @@ LL |     #[coroutine = 63] || {}
    |                       ^^^^^ expected `()`, found coroutine
    |
    = note: expected unit type `()`
-              found coroutine `{coroutine@$DIR/malformed-attrs.rs:110:23: 110:25}`
+              found coroutine `{coroutine@$DIR/malformed-attrs.rs:111:23: 111:25}`
 
-error: aborting due to 73 previous errors; 3 warnings emitted
+error: aborting due to 75 previous errors; 3 warnings emitted
 
 Some errors have detailed explanations: E0308, E0463, E0539, E0565, E0658, E0805.
 For more information about an error, try `rustc --explain E0308`.
diff --git a/tests/ui/reexport-test-harness-main.rs b/tests/ui/attributes/reexport-test-harness-entry-point.rs
index f79828fc7d6..95765a719ed 100644
--- a/tests/ui/reexport-test-harness-main.rs
+++ b/tests/ui/attributes/reexport-test-harness-entry-point.rs
@@ -1,3 +1,6 @@
+//! Check that `#[reexport_test_harness_main]` correctly reexports the test harness entry point
+//! and allows it to be called from within the code.
+
 //@ run-pass
 //@ compile-flags:--test
 
diff --git a/tests/ui/phantom-auto-trait.rs b/tests/ui/auto-traits/auto-trait-phantom-data-bounds.rs
index 0172ca335c3..6d1c4c87fad 100644
--- a/tests/ui/phantom-auto-trait.rs
+++ b/tests/ui/auto-traits/auto-trait-phantom-data-bounds.rs
@@ -1,9 +1,9 @@
-// Ensure that auto trait checks `T` when it encounters a `PhantomData<T>` field, instead of
-// checking the `PhantomData<T>` type itself (which almost always implements an auto trait).
+//! Ensure that auto trait checks `T` when it encounters a `PhantomData<T>` field, instead of
+//! checking the `PhantomData<T>` type itself (which almost always implements an auto trait).
 
 #![feature(auto_traits)]
 
-use std::marker::{PhantomData};
+use std::marker::PhantomData;
 
 unsafe auto trait Zen {}
 
diff --git a/tests/ui/phantom-auto-trait.stderr b/tests/ui/auto-traits/auto-trait-phantom-data-bounds.stderr
index ffd4c3a0e1a..56c2e8ff257 100644
--- a/tests/ui/phantom-auto-trait.stderr
+++ b/tests/ui/auto-traits/auto-trait-phantom-data-bounds.stderr
@@ -1,5 +1,5 @@
 error[E0277]: `T` cannot be shared between threads safely
-  --> $DIR/phantom-auto-trait.rs:21:12
+  --> $DIR/auto-trait-phantom-data-bounds.rs:21:12
    |
 LL |     is_zen(x)
    |     ------ ^ `T` cannot be shared between threads safely
@@ -7,19 +7,19 @@ LL |     is_zen(x)
    |     required by a bound introduced by this call
    |
 note: required for `&T` to implement `Zen`
-  --> $DIR/phantom-auto-trait.rs:10:24
+  --> $DIR/auto-trait-phantom-data-bounds.rs:10:24
    |
 LL | unsafe impl<'a, T: 'a> Zen for &'a T where T: Sync {}
    |                        ^^^     ^^^^^          ---- unsatisfied trait bound introduced here
 note: required because it appears within the type `PhantomData<&T>`
   --> $SRC_DIR/core/src/marker.rs:LL:COL
 note: required because it appears within the type `Guard<'_, T>`
-  --> $DIR/phantom-auto-trait.rs:12:8
+  --> $DIR/auto-trait-phantom-data-bounds.rs:12:8
    |
 LL | struct Guard<'a, T: 'a> {
    |        ^^^^^
 note: required by a bound in `is_zen`
-  --> $DIR/phantom-auto-trait.rs:18:14
+  --> $DIR/auto-trait-phantom-data-bounds.rs:18:14
    |
 LL | fn is_zen<T: Zen>(_: T) {}
    |              ^^^ required by this bound in `is_zen`
@@ -29,7 +29,7 @@ LL | fn not_sync<T: std::marker::Sync>(x: Guard<T>) {
    |              +++++++++++++++++++
 
 error[E0277]: `T` cannot be shared between threads safely
-  --> $DIR/phantom-auto-trait.rs:26:12
+  --> $DIR/auto-trait-phantom-data-bounds.rs:26:12
    |
 LL |     is_zen(x)
    |     ------ ^ `T` cannot be shared between threads safely
@@ -37,24 +37,24 @@ LL |     is_zen(x)
    |     required by a bound introduced by this call
    |
 note: required for `&T` to implement `Zen`
-  --> $DIR/phantom-auto-trait.rs:10:24
+  --> $DIR/auto-trait-phantom-data-bounds.rs:10:24
    |
 LL | unsafe impl<'a, T: 'a> Zen for &'a T where T: Sync {}
    |                        ^^^     ^^^^^          ---- unsatisfied trait bound introduced here
 note: required because it appears within the type `PhantomData<&T>`
   --> $SRC_DIR/core/src/marker.rs:LL:COL
 note: required because it appears within the type `Guard<'_, T>`
-  --> $DIR/phantom-auto-trait.rs:12:8
+  --> $DIR/auto-trait-phantom-data-bounds.rs:12:8
    |
 LL | struct Guard<'a, T: 'a> {
    |        ^^^^^
 note: required because it appears within the type `Nested<Guard<'_, T>>`
-  --> $DIR/phantom-auto-trait.rs:16:8
+  --> $DIR/auto-trait-phantom-data-bounds.rs:16:8
    |
 LL | struct Nested<T>(T);
    |        ^^^^^^
 note: required by a bound in `is_zen`
-  --> $DIR/phantom-auto-trait.rs:18:14
+  --> $DIR/auto-trait-phantom-data-bounds.rs:18:14
    |
 LL | fn is_zen<T: Zen>(_: T) {}
    |              ^^^ required by this bound in `is_zen`
diff --git a/tests/ui/binop/binop-evaluation-order-primitive.rs b/tests/ui/binop/binop-evaluation-order-primitive.rs
new file mode 100644
index 00000000000..33266d1c047
--- /dev/null
+++ b/tests/ui/binop/binop-evaluation-order-primitive.rs
@@ -0,0 +1,15 @@
+//! Test evaluation order in binary operations with primitive types.
+
+//@ run-pass
+
+fn main() {
+    let x = Box::new(0);
+    assert_eq!(
+        0,
+        *x + {
+            drop(x);
+            let _ = Box::new(main);
+            0
+        }
+    );
+}
diff --git a/tests/ui/op-assign-builtins-by-ref.rs b/tests/ui/binop/compound-assign-by-ref.rs
index 73788da9232..e1f519a137f 100644
--- a/tests/ui/op-assign-builtins-by-ref.rs
+++ b/tests/ui/binop/compound-assign-by-ref.rs
@@ -1,9 +1,8 @@
+//! Test compound assignment operators with reference right-hand side.
+
 //@ run-pass
 
 fn main() {
-    // test compound assignment operators with ref as right-hand side,
-    // for each operator, with various types as operands.
-
     // test AddAssign
     {
         let mut x = 3i8;
diff --git a/tests/ui/cfg/nested-cfg-attr-conditional-compilation.rs b/tests/ui/cfg/nested-cfg-attr-conditional-compilation.rs
new file mode 100644
index 00000000000..7618e83a642
--- /dev/null
+++ b/tests/ui/cfg/nested-cfg-attr-conditional-compilation.rs
@@ -0,0 +1,18 @@
+//! Test that nested `cfg_attr` attributes work correctly for conditional compilation.
+//! This checks that `cfg_attr` can be arbitrarily deeply nested and that the
+//! expansion works from outside to inside, eventually applying the innermost
+//! conditional compilation directive.
+//!
+//! In this test, `cfg_attr(all(), cfg_attr(all(), cfg(false)))` should expand to:
+//! 1. `cfg_attr(all(), cfg(false))` (outer cfg_attr applied)
+//! 2. `cfg(false)` (inner cfg_attr applied)
+//! 3. Function `f` is excluded from compilation
+//!
+//! Added in <https://github.com/rust-lang/rust/pull/34216>.
+
+#[cfg_attr(all(), cfg_attr(all(), cfg(false)))]
+fn f() {}
+
+fn main() {
+    f() //~ ERROR cannot find function `f` in this scope
+}
diff --git a/tests/ui/nested-cfg-attrs.stderr b/tests/ui/cfg/nested-cfg-attr-conditional-compilation.stderr
index 16c29307143..ddb8ea1e13a 100644
--- a/tests/ui/nested-cfg-attrs.stderr
+++ b/tests/ui/cfg/nested-cfg-attr-conditional-compilation.stderr
@@ -1,8 +1,8 @@
 error[E0425]: cannot find function `f` in this scope
-  --> $DIR/nested-cfg-attrs.rs:4:13
+  --> $DIR/nested-cfg-attr-conditional-compilation.rs:17:5
    |
-LL | fn main() { f() }
-   |             ^ not found in this scope
+LL |     f()
+   |     ^ not found in this scope
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/closures/closure-capture-after-clone.rs b/tests/ui/closures/closure-capture-after-clone.rs
new file mode 100644
index 00000000000..29fba147909
--- /dev/null
+++ b/tests/ui/closures/closure-capture-after-clone.rs
@@ -0,0 +1,39 @@
+//! Regression test for issue #1399
+//!
+//! This tests that when a variable is used (via clone) and then later
+//! captured by a closure, the last-use analysis doesn't incorrectly optimize
+//! the earlier use as a "last use" and perform an invalid move.
+//!
+//! The sequence being tested:
+//! 1. Create variable `k`
+//! 2. Use `k.clone()` for some purpose
+//! 3. Later capture `k` in a closure
+//!
+//! The analysis must not treat step 2 as the "last use" since step 3 needs `k`.
+//!
+//! See: https://github.com/rust-lang/rust/issues/1399
+
+//@ run-pass
+
+struct A {
+    _a: Box<isize>,
+}
+
+pub fn main() {
+    fn invoke<F>(f: F)
+    where
+        F: FnOnce(),
+    {
+        f();
+    }
+
+    let k: Box<_> = 22.into();
+
+    // This clone should NOT be treated as "last use" of k
+    // even though k is not used again until the closure
+    let _u = A { _a: k.clone() };
+
+    // Here k is actually captured by the closure
+    // The last-use analyzer must have accounted for this when processing the clone above
+    invoke(|| println!("{}", k.clone()));
+}
diff --git a/tests/ui/closures/closure-last-use-move.rs b/tests/ui/closures/closure-last-use-move.rs
new file mode 100644
index 00000000000..f5b99d87f09
--- /dev/null
+++ b/tests/ui/closures/closure-last-use-move.rs
@@ -0,0 +1,33 @@
+//! Regression test for issue #1818
+//! last-use analysis in closures should allow moves instead of requiring copies.
+//!
+//! The original issue was that the compiler incorrectly flagged certain return values
+//! in anonymous functions/closures as requiring copies of non-copyable values, when
+//! they should have been treated as moves (since they were the last use of the value).
+//!
+//! See: https://github.com/rust-lang/rust/issues/1818
+
+//@ run-pass
+
+fn apply<T, F>(s: String, mut f: F) -> T
+where
+    F: FnMut(String) -> T
+{
+    fn g<T, F>(s: String, mut f: F) -> T
+    where
+        F: FnMut(String) -> T
+    {
+        f(s)
+    }
+
+    g(s, |v| {
+        let r = f(v);
+        r // This should be a move, not requiring copy
+    })
+}
+
+pub fn main() {
+    // Actually test the functionality
+    let result = apply(String::from("test"), |s| s.len());
+    assert_eq!(result, 4);
+}
diff --git a/tests/ui/not-copy-closure.rs b/tests/ui/closures/closure-no-copy-mut-env.rs
index f6530f9a410..890e99c1ac7 100644
--- a/tests/ui/not-copy-closure.rs
+++ b/tests/ui/closures/closure-no-copy-mut-env.rs
@@ -1,4 +1,4 @@
-// Check that closures do not implement `Copy` if their environment is not `Copy`.
+//! Checks that closures do not implement `Copy` when they capture mutable references.
 
 fn main() {
     let mut a = 5;
diff --git a/tests/ui/not-copy-closure.stderr b/tests/ui/closures/closure-no-copy-mut-env.stderr
index 60cb1352313..1443366a477 100644
--- a/tests/ui/not-copy-closure.stderr
+++ b/tests/ui/closures/closure-no-copy-mut-env.stderr
@@ -1,5 +1,5 @@
 error[E0382]: use of moved value: `hello`
-  --> $DIR/not-copy-closure.rs:10:13
+  --> $DIR/closure-no-copy-mut-env.rs:10:13
    |
 LL |     let b = hello;
    |             ----- value moved here
@@ -7,7 +7,7 @@ LL |     let c = hello;
    |             ^^^^^ value used here after move
    |
 note: closure cannot be moved more than once as it is not `Copy` due to moving the variable `a` out of its environment
-  --> $DIR/not-copy-closure.rs:6:9
+  --> $DIR/closure-no-copy-mut-env.rs:6:9
    |
 LL |         a += 1;
    |         ^
diff --git a/tests/ui/closures/closure-upvar-last-use-analysis.rs b/tests/ui/closures/closure-upvar-last-use-analysis.rs
new file mode 100644
index 00000000000..2c3e349437d
--- /dev/null
+++ b/tests/ui/closures/closure-upvar-last-use-analysis.rs
@@ -0,0 +1,32 @@
+//! Regression test for issue #1399
+//!
+//! This tests that the compiler's last-use analysis correctly handles variables
+//! that are captured by closures (upvars). The original issue was that the analysis
+//! would incorrectly optimize variable usage as "last use" and perform moves, even when
+//! the variable was later needed by a closure that captured it.
+//!
+//! See: https://github.com/rust-lang/rust/issues/1399
+
+//@ run-pass
+
+struct A {
+    _a: Box<isize>,
+}
+
+fn foo() -> Box<dyn FnMut() -> isize + 'static> {
+    let k: Box<_> = Box::new(22);
+
+    // This use of k.clone() should not be treated as a "last use"
+    // even though the closure below doesn't actually capture k
+    let _u = A { _a: k.clone() };
+
+    // The closure doesn't actually use k, but the analyzer needs to handle
+    // the potential capture scenario correctly
+    let result = || 22;
+
+    Box::new(result)
+}
+
+pub fn main() {
+    assert_eq!(foo()(), 22);
+}
diff --git a/tests/ui/once-cant-call-twice-on-heap.rs b/tests/ui/closures/fnonce-call-twice-error.rs
index 3fd8c5cadca..1662b7bddaa 100644
--- a/tests/ui/once-cant-call-twice-on-heap.rs
+++ b/tests/ui/closures/fnonce-call-twice-error.rs
@@ -1,16 +1,15 @@
-// Testing guarantees provided by once functions.
-// This program would segfault if it were legal.
+//! Test that `FnOnce` closures cannot be called twice.
 
 use std::sync::Arc;
 
-fn foo<F:FnOnce()>(blk: F) {
+fn foo<F: FnOnce()>(blk: F) {
     blk();
     blk(); //~ ERROR use of moved value
 }
 
 fn main() {
     let x = Arc::new(true);
-    foo(move|| {
+    foo(move || {
         assert!(*x);
         drop(x);
     });
diff --git a/tests/ui/once-cant-call-twice-on-heap.stderr b/tests/ui/closures/fnonce-call-twice-error.stderr
index 42697374115..51d8a33dcd7 100644
--- a/tests/ui/once-cant-call-twice-on-heap.stderr
+++ b/tests/ui/closures/fnonce-call-twice-error.stderr
@@ -1,18 +1,18 @@
 error[E0382]: use of moved value: `blk`
-  --> $DIR/once-cant-call-twice-on-heap.rs:8:5
+  --> $DIR/fnonce-call-twice-error.rs:7:5
    |
-LL | fn foo<F:FnOnce()>(blk: F) {
-   |                    --- move occurs because `blk` has type `F`, which does not implement the `Copy` trait
+LL | fn foo<F: FnOnce()>(blk: F) {
+   |                     --- move occurs because `blk` has type `F`, which does not implement the `Copy` trait
 LL |     blk();
    |     ----- `blk` moved due to this call
 LL |     blk();
    |     ^^^ value used here after move
    |
 note: `FnOnce` closures can only be called once
-  --> $DIR/once-cant-call-twice-on-heap.rs:6:10
+  --> $DIR/fnonce-call-twice-error.rs:5:11
    |
-LL | fn foo<F:FnOnce()>(blk: F) {
-   |          ^^^^^^^^ `F` is made to be an `FnOnce` closure here
+LL | fn foo<F: FnOnce()>(blk: F) {
+   |           ^^^^^^^^ `F` is made to be an `FnOnce` closure here
 LL |     blk();
    |     ----- this value implements `FnOnce`, which causes it to be moved when called
 
diff --git a/tests/ui/closures/many-closures.rs b/tests/ui/closures/many-closures.rs
new file mode 100644
index 00000000000..c96ef5544c2
--- /dev/null
+++ b/tests/ui/closures/many-closures.rs
@@ -0,0 +1,47 @@
+//! Test that the compiler can handle code bases with a high number of closures.
+//! This is particularly important for the MinGW toolchain which has a limit of
+//! 2^15 weak symbols per binary. This test creates 2^12 closures (256 functions
+//! with 16 closures each) to check the compiler handles this correctly.
+//!
+//! Regression test for <https://github.com/rust-lang/rust/issues/34793>.
+//! See also <https://github.com/rust-lang/rust/pull/34830>.
+
+//@ run-pass
+
+// Make sure we don't optimize anything away:
+//@ compile-flags: -C no-prepopulate-passes -Cpasses=name-anon-globals
+
+/// Macro for exponential expansion - creates 2^n copies of the given macro call
+macro_rules! go_bacterial {
+    ($mac:ident) => ($mac!());
+    ($mac:ident 1 $($t:tt)*) => (
+        go_bacterial!($mac $($t)*);
+        go_bacterial!($mac $($t)*);
+    )
+}
+
+/// Creates and immediately calls a closure
+macro_rules! create_closure {
+    () => {
+        (move || {})()
+    };
+}
+
+/// Creates a function containing 16 closures (2^4)
+macro_rules! create_function_with_closures {
+    () => {
+        {
+            fn function_with_closures() {
+                // Create 16 closures using exponential expansion: 2^4 = 16
+                go_bacterial!(create_closure 1 1 1 1);
+            }
+            let _ = function_with_closures();
+        }
+    }
+}
+
+fn main() {
+    // Create 2^8 = 256 functions, each containing 16 closures,
+    // resulting in 2^12 = 4096 closures total.
+    go_bacterial!(create_function_with_closures 1 1 1 1  1 1 1 1);
+}
diff --git a/tests/ui/coercion/basic-ptr-coercions.rs b/tests/ui/coercion/basic-ptr-coercions.rs
new file mode 100644
index 00000000000..4229d1fb274
--- /dev/null
+++ b/tests/ui/coercion/basic-ptr-coercions.rs
@@ -0,0 +1,24 @@
+//! Tests basic pointer coercions
+
+//@ run-pass
+
+pub fn main() {
+    // &mut -> &
+    let x: &mut isize = &mut 42;
+    let _x: &isize = x;
+    let _x: &isize = &mut 42;
+
+    // & -> *const
+    let x: &isize = &42;
+    let _x: *const isize = x;
+    let _x: *const isize = &42;
+
+    // &mut -> *const
+    let x: &mut isize = &mut 42;
+    let _x: *const isize = x;
+    let _x: *const isize = &mut 42;
+
+    // *mut -> *const
+    let _x: *mut isize = &mut 42;
+    let _x: *const isize = x;
+}
diff --git a/tests/ui/ptr-coercion.rs b/tests/ui/coercion/ptr-mutability-errors.rs
index 2549bd6f134..391eaf0b913 100644
--- a/tests/ui/ptr-coercion.rs
+++ b/tests/ui/coercion/ptr-mutability-errors.rs
@@ -1,5 +1,4 @@
-// Test coercions between pointers which don't do anything fancy like unsizing.
-// These are testing that we don't lose mutability when converting to raw pointers.
+//! Tests that pointer coercions preserving mutability are enforced:
 
 //@ dont-require-annotations: NOTE
 
diff --git a/tests/ui/ptr-coercion.stderr b/tests/ui/coercion/ptr-mutability-errors.stderr
index 8de41d2c382..b4ded821c79 100644
--- a/tests/ui/ptr-coercion.stderr
+++ b/tests/ui/coercion/ptr-mutability-errors.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/ptr-coercion.rs:9:25
+  --> $DIR/ptr-mutability-errors.rs:8:25
    |
 LL |     let x: *mut isize = x;
    |            ----------   ^ types differ in mutability
@@ -10,7 +10,7 @@ LL |     let x: *mut isize = x;
               found raw pointer `*const isize`
 
 error[E0308]: mismatched types
-  --> $DIR/ptr-coercion.rs:15:25
+  --> $DIR/ptr-mutability-errors.rs:14:25
    |
 LL |     let x: *mut isize = &42;
    |            ----------   ^^^ types differ in mutability
@@ -21,7 +21,7 @@ LL |     let x: *mut isize = &42;
                 found reference `&isize`
 
 error[E0308]: mismatched types
-  --> $DIR/ptr-coercion.rs:21:25
+  --> $DIR/ptr-mutability-errors.rs:20:25
    |
 LL |     let x: *mut isize = x;
    |            ----------   ^ types differ in mutability
diff --git a/tests/ui/coherence/occurs-check/associated-type.next.stderr b/tests/ui/coherence/occurs-check/associated-type.next.stderr
index 25f9523f4e4..52794b19945 100644
--- a/tests/ui/coherence/occurs-check/associated-type.next.stderr
+++ b/tests/ui/coherence/occurs-check/associated-type.next.stderr
@@ -1,5 +1,5 @@
- WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. }
- WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. }
+ WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1))], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. }
+ WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1))], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. }
 error[E0119]: conflicting implementations of trait `Overlap<for<'a> fn(&'a (), ())>` for type `for<'a> fn(&'a (), ())`
   --> $DIR/associated-type.rs:32:1
    |
diff --git a/tests/ui/coherence/occurs-check/associated-type.old.stderr b/tests/ui/coherence/occurs-check/associated-type.old.stderr
index e091ddcacb2..9fa443eefb3 100644
--- a/tests/ui/coherence/occurs-check/associated-type.old.stderr
+++ b/tests/ui/coherence/occurs-check/associated-type.old.stderr
@@ -1,5 +1,5 @@
- WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. }
- WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), "'a")], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. }
+ WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1))], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. }
+ WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, '^0.Named(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1))], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit), .. }
 error[E0119]: conflicting implementations of trait `Overlap<for<'a> fn(&'a (), ())>` for type `for<'a> fn(&'a (), ())`
   --> $DIR/associated-type.rs:32:1
    |
diff --git a/tests/ui/const-ptr/pointer-address-stability.rs b/tests/ui/const-ptr/pointer-address-stability.rs
new file mode 100644
index 00000000000..84a36e1ddf5
--- /dev/null
+++ b/tests/ui/const-ptr/pointer-address-stability.rs
@@ -0,0 +1,11 @@
+//! Check that taking the address of a stack variable with `&`
+//! yields a stable and comparable pointer.
+//!
+//! Regression test for <https://github.com/rust-lang/rust/issues/2040>.
+
+//@ run-pass
+
+pub fn main() {
+    let foo: isize = 1;
+    assert_eq!(&foo as *const isize, &foo as *const isize);
+}
diff --git a/tests/ui/auxiliary/issue-16822.rs b/tests/ui/cross-crate/auxiliary/cross-crate-refcell-match.rs
index 9042dd39117..9042dd39117 100644
--- a/tests/ui/auxiliary/issue-16822.rs
+++ b/tests/ui/cross-crate/auxiliary/cross-crate-refcell-match.rs
diff --git a/tests/ui/auxiliary/kinds_in_metadata.rs b/tests/ui/cross-crate/auxiliary/kinds_in_metadata.rs
index 2a2106ff70a..2a2106ff70a 100644
--- a/tests/ui/auxiliary/kinds_in_metadata.rs
+++ b/tests/ui/cross-crate/auxiliary/kinds_in_metadata.rs
diff --git a/tests/ui/cross-crate/cross-crate-refcell-match.rs b/tests/ui/cross-crate/cross-crate-refcell-match.rs
new file mode 100644
index 00000000000..7e46425612f
--- /dev/null
+++ b/tests/ui/cross-crate/cross-crate-refcell-match.rs
@@ -0,0 +1,36 @@
+//! Regression test for https://github.com/rust-lang/rust/issues/16822
+//
+//! ICE when using RefCell::borrow_mut()
+//! inside match statement with cross-crate generics.
+//!
+//! The bug occurred when:
+//! - A library defines a generic struct with RefCell<T> and uses borrow_mut() in match
+//! - Main crate implements the library trait for its own type
+//! - Cross-crate generic constraint causes type inference issues
+//!
+//! The problematic match statement is in the auxiliary file, this file triggers it.
+
+//@ run-pass
+//@ aux-build:cross-crate-refcell-match.rs
+
+extern crate cross_crate_refcell_match as lib;
+
+use std::cell::RefCell;
+
+struct App {
+    i: isize,
+}
+
+impl lib::Update for App {
+    fn update(&mut self) {
+        self.i += 1;
+    }
+}
+
+fn main() {
+    let app = App { i: 5 };
+    let window = lib::Window { data: RefCell::new(app) };
+    // This specific pattern (RefCell::borrow_mut in match with cross-crate generics)
+    // caused the ICE in the original issue
+    window.update(1);
+}
diff --git a/tests/ui/kinds-in-metadata.rs b/tests/ui/cross-crate/metadata-trait-serialization.rs
index 58dffba861d..a6645018da4 100644
--- a/tests/ui/kinds-in-metadata.rs
+++ b/tests/ui/cross-crate/metadata-trait-serialization.rs
@@ -1,12 +1,11 @@
+//! Test that trait information (like Copy) is correctly serialized in crate metadata
+
 //@ run-pass
 //@ aux-build:kinds_in_metadata.rs
 
-
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
-// Tests that metadata serialization works for the `Copy` kind.
-
 extern crate kinds_in_metadata;
 
 use kinds_in_metadata::f;
diff --git a/tests/ui/darwin-ld64.rs b/tests/ui/darwin-ld64.rs
new file mode 100644
index 00000000000..75acc07a002
--- /dev/null
+++ b/tests/ui/darwin-ld64.rs
@@ -0,0 +1,24 @@
+//@ compile-flags: -Copt-level=3 -Ccodegen-units=256 -Clink-arg=-ld_classic
+//@ run-pass
+//@ only-x86_64-apple-darwin
+
+// This is a regression test for https://github.com/rust-lang/rust/issues/140686.
+// Although this is a ld64(ld-classic) bug, we still need to support it
+// due to cross-compilation and support for older Xcode.
+
+fn main() {
+    let dst: Vec<u8> = Vec::new();
+    let len = broken_func(std::hint::black_box(2), dst);
+    assert_eq!(len, 8);
+}
+
+#[inline(never)]
+pub fn broken_func(version: usize, mut dst: Vec<u8>) -> usize {
+    match version {
+        1 => dst.extend_from_slice(b"aaaaaaaa"),
+        2 => dst.extend_from_slice(b"bbbbbbbb"),
+        3 => dst.extend_from_slice(b"bbbbbbbb"),
+        _ => panic!(),
+    }
+    dst.len()
+}
diff --git a/tests/ui/short-error-format.rs b/tests/ui/diagnostic-flags/error-format-short.rs
index 719870a04fb..4c793cd1b18 100644
--- a/tests/ui/short-error-format.rs
+++ b/tests/ui/diagnostic-flags/error-format-short.rs
@@ -1,3 +1,6 @@
+//! Check that compile errors are formatted in the "short" style
+//! when `--error-format=short` is used.
+
 //@ compile-flags: --error-format=short
 
 fn foo(_: u32) {}
diff --git a/tests/ui/diagnostic-flags/error-format-short.stderr b/tests/ui/diagnostic-flags/error-format-short.stderr
new file mode 100644
index 00000000000..0a097e2f623
--- /dev/null
+++ b/tests/ui/diagnostic-flags/error-format-short.stderr
@@ -0,0 +1,3 @@
+$DIR/error-format-short.rs:9:9: error[E0308]: mismatched types: expected `u32`, found `String`
+$DIR/error-format-short.rs:11:7: error[E0599]: no method named `salut` found for type `u32` in the current scope: method not found in `u32`
+error: aborting due to 2 previous errors
diff --git a/tests/ui/resource-assign-is-not-copy.rs b/tests/ui/drop/drop-once-on-move.rs
index ab426016901..da018058076 100644
--- a/tests/ui/resource-assign-is-not-copy.rs
+++ b/tests/ui/drop/drop-once-on-move.rs
@@ -1,3 +1,7 @@
+//! Check that types not implementing `Copy` are moved, not copied, during assignment
+//! operations, and their `Drop` implementation is called exactly once when the
+//! value goes out of scope.
+
 //@ run-pass
 
 #![allow(non_camel_case_types)]
@@ -15,9 +19,7 @@ impl<'a> Drop for r<'a> {
 }
 
 fn r(i: &Cell<isize>) -> r<'_> {
-    r {
-        i: i
-    }
+    r { i }
 }
 
 pub fn main() {
diff --git a/tests/ui/resource-destruct.rs b/tests/ui/drop/drop-scope-exit.rs
index 480cbe091a7..4d003fec712 100644
--- a/tests/ui/resource-destruct.rs
+++ b/tests/ui/drop/drop-scope-exit.rs
@@ -1,31 +1,37 @@
+//! Check that the `Drop` implementation is called when a value goes out of scope.
+
 //@ run-pass
 
 #![allow(non_camel_case_types)]
 use std::cell::Cell;
 
 struct shrinky_pointer<'a> {
-  i: &'a Cell<isize>,
+    i: &'a Cell<isize>,
 }
 
 impl<'a> Drop for shrinky_pointer<'a> {
     fn drop(&mut self) {
-        println!("Hello!"); self.i.set(self.i.get() - 1);
+        println!("Hello!");
+        self.i.set(self.i.get() - 1);
     }
 }
 
 impl<'a> shrinky_pointer<'a> {
-    pub fn look_at(&self) -> isize { return self.i.get(); }
+    pub fn look_at(&self) -> isize {
+        return self.i.get();
+    }
 }
 
 fn shrinky_pointer(i: &Cell<isize>) -> shrinky_pointer<'_> {
-    shrinky_pointer {
-        i: i
-    }
+    shrinky_pointer { i }
 }
 
 pub fn main() {
     let my_total = &Cell::new(10);
-    { let pt = shrinky_pointer(my_total); assert_eq!(pt.look_at(), 10); }
+    {
+        let pt = shrinky_pointer(my_total);
+        assert_eq!(pt.look_at(), 10);
+    }
     println!("my_total = {}", my_total.get());
     assert_eq!(my_total.get(), 9);
 }
diff --git a/tests/ui/empty/empty-attributes.stderr b/tests/ui/empty/empty-attributes.stderr
index e86dea10c70..f0be56ddc6a 100644
--- a/tests/ui/empty/empty-attributes.stderr
+++ b/tests/ui/empty/empty-attributes.stderr
@@ -1,10 +1,10 @@
 error: unused attribute
-  --> $DIR/empty-attributes.rs:9:1
+  --> $DIR/empty-attributes.rs:2:1
    |
-LL | #[repr()]
-   | ^^^^^^^^^ help: remove this attribute
+LL | #![allow()]
+   | ^^^^^^^^^^^ help: remove this attribute
    |
-   = note: attribute `repr` with an empty list has no effect
+   = note: attribute `allow` with an empty list has no effect
 note: the lint level is defined here
   --> $DIR/empty-attributes.rs:1:9
    |
@@ -12,22 +12,6 @@ LL | #![deny(unused_attributes)]
    |         ^^^^^^^^^^^^^^^^^
 
 error: unused attribute
-  --> $DIR/empty-attributes.rs:12:1
-   |
-LL | #[target_feature()]
-   | ^^^^^^^^^^^^^^^^^^^ help: remove this attribute
-   |
-   = note: attribute `target_feature` with an empty list has no effect
-
-error: unused attribute
-  --> $DIR/empty-attributes.rs:2:1
-   |
-LL | #![allow()]
-   | ^^^^^^^^^^^ help: remove this attribute
-   |
-   = note: attribute `allow` with an empty list has no effect
-
-error: unused attribute
   --> $DIR/empty-attributes.rs:3:1
    |
 LL | #![expect()]
@@ -67,5 +51,17 @@ LL | #![feature()]
    |
    = note: attribute `feature` with an empty list has no effect
 
+error: unused attribute
+  --> $DIR/empty-attributes.rs:9:1
+   |
+LL | #[repr()]
+   | ^^^^^^^^^ help: remove this attribute
+
+error: unused attribute
+  --> $DIR/empty-attributes.rs:12:1
+   |
+LL | #[target_feature()]
+   | ^^^^^^^^^^^^^^^^^^^ help: remove this attribute
+
 error: aborting due to 8 previous errors
 
diff --git a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr
index 9280dfdf92e..5d7d1caeeab 100644
--- a/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr
+++ b/tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr
@@ -367,12 +367,6 @@ warning: `#[should_panic]` only has an effect on functions
 LL | #![should_panic]
    | ^^^^^^^^^^^^^^^^
 
-warning: `#[ignore]` only has an effect on functions
-  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:54:1
-   |
-LL | #![ignore]
-   | ^^^^^^^^^^
-
 warning: `#[proc_macro_derive]` only has an effect on functions
   --> $DIR/issue-43106-gating-of-builtin-attrs.rs:60:1
    |
@@ -387,6 +381,12 @@ LL | #![link()]
    |
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
+warning: `#[ignore]` only has an effect on functions
+  --> $DIR/issue-43106-gating-of-builtin-attrs.rs:54:1
+   |
+LL | #![ignore]
+   | ^^^^^^^^^^
+
 warning: attribute should be applied to a foreign function or static
   --> $DIR/issue-43106-gating-of-builtin-attrs.rs:66:1
    |
diff --git a/tests/ui/auxiliary/delegate_macro.rs b/tests/ui/fn/auxiliary/delegate_macro.rs
index 0d752e12039..0d752e12039 100644
--- a/tests/ui/auxiliary/delegate_macro.rs
+++ b/tests/ui/fn/auxiliary/delegate_macro.rs
diff --git a/tests/ui/not-enough-arguments.rs b/tests/ui/fn/fn-arg-count-mismatch-diagnostics.rs
index ec660a1de81..b2f80ba1bf6 100644
--- a/tests/ui/not-enough-arguments.rs
+++ b/tests/ui/fn/fn-arg-count-mismatch-diagnostics.rs
@@ -1,15 +1,15 @@
+//! Checks clean diagnostics for argument count mismatches without unrelated errors.
+//!
+//! `delegate!` part related: <https://github.com/rust-lang/rust/pull/140591>
+
 //@ aux-build: delegate_macro.rs
 extern crate delegate_macro;
 use delegate_macro::delegate;
 
-// Check that the only error msg we report is the
-// mismatch between the # of params, and not other
-// unrelated errors.
 fn foo(a: isize, b: isize, c: isize, d: isize) {
     panic!();
 }
 
-// Check that all arguments are shown in the error message, even if they're across multiple lines.
 fn bar(a: i32, b: i32, c: i32, d: i32, e: i32, f: i32) {
     println!("{}", a);
     println!("{}", b);
@@ -37,6 +37,7 @@ struct Bar;
 
 impl Bar {
     fn foo(a: u8, b: u8) {}
+
     fn bar() {
         delegate_local!(foo);
         delegate!(foo);
diff --git a/tests/ui/not-enough-arguments.stderr b/tests/ui/fn/fn-arg-count-mismatch-diagnostics.stderr
index 908d0273bbe..6af7671af03 100644
--- a/tests/ui/not-enough-arguments.stderr
+++ b/tests/ui/fn/fn-arg-count-mismatch-diagnostics.stderr
@@ -1,5 +1,5 @@
 error[E0061]: this function takes 2 arguments but 1 argument was supplied
-  --> $DIR/not-enough-arguments.rs:24:9
+  --> $DIR/fn-arg-count-mismatch-diagnostics.rs:24:9
    |
 LL |         <Self>::$method(8)
    |         ^^^^^^^^^^^^^^^--- argument #2 of type `u8` is missing
@@ -8,7 +8,7 @@ LL |         delegate_local!(foo);
    |         -------------------- in this macro invocation
    |
 note: associated function defined here
-  --> $DIR/not-enough-arguments.rs:39:8
+  --> $DIR/fn-arg-count-mismatch-diagnostics.rs:39:8
    |
 LL |     fn foo(a: u8, b: u8) {}
    |        ^^^        -----
@@ -19,20 +19,20 @@ LL |         <Self>::$method(8, /* u8 */)
    |                          ++++++++++
 
 error[E0061]: this function takes 2 arguments but 1 argument was supplied
-  --> $DIR/not-enough-arguments.rs:42:9
+  --> $DIR/fn-arg-count-mismatch-diagnostics.rs:43:9
    |
 LL |         delegate!(foo);
    |         ^^^^^^^^^^^^^^ argument #2 of type `u8` is missing
    |
 note: associated function defined here
-  --> $DIR/not-enough-arguments.rs:39:8
+  --> $DIR/fn-arg-count-mismatch-diagnostics.rs:39:8
    |
 LL |     fn foo(a: u8, b: u8) {}
    |        ^^^        -----
    = note: this error originates in the macro `delegate` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error[E0061]: this function takes 2 arguments but 1 argument was supplied
-  --> $DIR/not-enough-arguments.rs:31:9
+  --> $DIR/fn-arg-count-mismatch-diagnostics.rs:31:9
    |
 LL |         <$from>::$method(8)
    |         ^^^^^^^^^^^^^^^^--- argument #2 of type `u8` is missing
@@ -41,7 +41,7 @@ LL |         delegate_from!(Bar, foo);
    |         ------------------------ in this macro invocation
    |
 note: associated function defined here
-  --> $DIR/not-enough-arguments.rs:39:8
+  --> $DIR/fn-arg-count-mismatch-diagnostics.rs:39:8
    |
 LL |     fn foo(a: u8, b: u8) {}
    |        ^^^        -----
@@ -52,13 +52,13 @@ LL |         <$from>::$method(8, /* u8 */)
    |                           ++++++++++
 
 error[E0061]: this function takes 4 arguments but 3 arguments were supplied
-  --> $DIR/not-enough-arguments.rs:49:5
+  --> $DIR/fn-arg-count-mismatch-diagnostics.rs:50:5
    |
 LL |     foo(1, 2, 3);
    |     ^^^--------- argument #4 of type `isize` is missing
    |
 note: function defined here
-  --> $DIR/not-enough-arguments.rs:8:4
+  --> $DIR/fn-arg-count-mismatch-diagnostics.rs:9:4
    |
 LL | fn foo(a: isize, b: isize, c: isize, d: isize) {
    |    ^^^                               --------
@@ -68,13 +68,13 @@ LL |     foo(1, 2, 3, /* isize */);
    |                +++++++++++++
 
 error[E0061]: this function takes 6 arguments but 3 arguments were supplied
-  --> $DIR/not-enough-arguments.rs:51:5
+  --> $DIR/fn-arg-count-mismatch-diagnostics.rs:52:5
    |
 LL |     bar(1, 2, 3);
    |     ^^^--------- three arguments of type `i32`, `i32`, and `i32` are missing
    |
 note: function defined here
-  --> $DIR/not-enough-arguments.rs:13:4
+  --> $DIR/fn-arg-count-mismatch-diagnostics.rs:13:4
    |
 LL | fn bar(a: i32, b: i32, c: i32, d: i32, e: i32, f: i32) {
    |    ^^^                         ------  ------  ------
diff --git a/tests/ui/fn/mutable-function-parameters.rs b/tests/ui/fn/mutable-function-parameters.rs
new file mode 100644
index 00000000000..5045a783f04
--- /dev/null
+++ b/tests/ui/fn/mutable-function-parameters.rs
@@ -0,0 +1,24 @@
+//! Test that function and closure parameters marked as `mut` can be mutated
+//! within the function body.
+
+//@ run-pass
+
+fn f(mut y: Box<isize>) {
+    *y = 5;
+    assert_eq!(*y, 5);
+}
+
+fn g() {
+    let frob = |mut q: Box<isize>| {
+        *q = 2;
+        assert_eq!(*q, 2);
+    };
+    let w = Box::new(37);
+    frob(w);
+}
+
+pub fn main() {
+    let z = Box::new(17);
+    f(z);
+    g();
+}
diff --git a/tests/ui/generics/generic-params-nested-fn-scope-error.rs b/tests/ui/generics/generic-params-nested-fn-scope-error.rs
new file mode 100644
index 00000000000..eaf514da337
--- /dev/null
+++ b/tests/ui/generics/generic-params-nested-fn-scope-error.rs
@@ -0,0 +1,14 @@
+//! Test that generic parameters from an outer function are not accessible
+//! in nested functions.
+
+fn foo<U>(v: Vec<U>) -> U {
+    fn bar(w: [U]) -> U {
+        //~^ ERROR can't use generic parameters from outer item
+        //~| ERROR can't use generic parameters from outer item
+        return w[0];
+    }
+
+    return bar(v);
+}
+
+fn main() {}
diff --git a/tests/ui/nested-ty-params.stderr b/tests/ui/generics/generic-params-nested-fn-scope-error.stderr
index 7ca65b421b2..7fd1069c651 100644
--- a/tests/ui/nested-ty-params.stderr
+++ b/tests/ui/generics/generic-params-nested-fn-scope-error.stderr
@@ -1,19 +1,19 @@
 error[E0401]: can't use generic parameters from outer item
-  --> $DIR/nested-ty-params.rs:2:16
+  --> $DIR/generic-params-nested-fn-scope-error.rs:5:16
    |
-LL | fn hd<U>(v: Vec<U> ) -> U {
-   |       - type parameter from outer item
-LL |     fn hd1(w: [U]) -> U { return w[0]; }
+LL | fn foo<U>(v: Vec<U>) -> U {
+   |        - type parameter from outer item
+LL |     fn bar(w: [U]) -> U {
    |           -    ^ use of generic parameter from outer item
    |           |
    |           help: try introducing a local generic parameter here: `<U>`
 
 error[E0401]: can't use generic parameters from outer item
-  --> $DIR/nested-ty-params.rs:2:23
+  --> $DIR/generic-params-nested-fn-scope-error.rs:5:23
    |
-LL | fn hd<U>(v: Vec<U> ) -> U {
-   |       - type parameter from outer item
-LL |     fn hd1(w: [U]) -> U { return w[0]; }
+LL | fn foo<U>(v: Vec<U>) -> U {
+   |        - type parameter from outer item
+LL |     fn bar(w: [U]) -> U {
    |           -           ^ use of generic parameter from outer item
    |           |
    |           help: try introducing a local generic parameter here: `<U>`
diff --git a/tests/ui/seq-args.rs b/tests/ui/generics/trait-incorrect-generic-args.rs
index 627dfcc3198..9715100b19c 100644
--- a/tests/ui/seq-args.rs
+++ b/tests/ui/generics/trait-incorrect-generic-args.rs
@@ -1,5 +1,7 @@
+//! Check for compilation errors when a trait is used with an incorrect number of generic arguments.
+
 fn main() {
-    trait Seq { }
+    trait Seq {}
 
     impl<T> Seq<T> for Vec<T> {
         //~^ ERROR trait takes 0 generic arguments but 1 generic argument
diff --git a/tests/ui/seq-args.stderr b/tests/ui/generics/trait-incorrect-generic-args.stderr
index 6e0d484d013..afc4ff03d94 100644
--- a/tests/ui/seq-args.stderr
+++ b/tests/ui/generics/trait-incorrect-generic-args.stderr
@@ -1,5 +1,5 @@
 error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
-  --> $DIR/seq-args.rs:4:13
+  --> $DIR/trait-incorrect-generic-args.rs:6:13
    |
 LL |     impl<T> Seq<T> for Vec<T> {
    |             ^^^--- help: remove the unnecessary generics
@@ -7,13 +7,13 @@ LL |     impl<T> Seq<T> for Vec<T> {
    |             expected 0 generic arguments
    |
 note: trait defined here, with 0 generic parameters
-  --> $DIR/seq-args.rs:2:11
+  --> $DIR/trait-incorrect-generic-args.rs:4:11
    |
-LL |     trait Seq { }
+LL |     trait Seq {}
    |           ^^^
 
 error[E0107]: trait takes 0 generic arguments but 1 generic argument was supplied
-  --> $DIR/seq-args.rs:9:10
+  --> $DIR/trait-incorrect-generic-args.rs:11:10
    |
 LL |     impl Seq<bool> for u32 {
    |          ^^^------ help: remove the unnecessary generics
@@ -21,9 +21,9 @@ LL |     impl Seq<bool> for u32 {
    |          expected 0 generic arguments
    |
 note: trait defined here, with 0 generic parameters
-  --> $DIR/seq-args.rs:2:11
+  --> $DIR/trait-incorrect-generic-args.rs:4:11
    |
-LL |     trait Seq { }
+LL |     trait Seq {}
    |           ^^^
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/issue-15924.rs b/tests/ui/higher-ranked/higher-ranked-encoding.rs
index eb2aef9cee1..463e0f50e53 100644
--- a/tests/ui/issue-15924.rs
+++ b/tests/ui/higher-ranked/higher-ranked-encoding.rs
@@ -1,9 +1,7 @@
-//@ run-pass
+//! Regression test for https://github.com/rust-lang/rust/issues/15924
 
-#![allow(unused_imports)]
-#![allow(unused_must_use)]
+//@ run-pass
 
-use std::fmt;
 use std::marker::PhantomData;
 
 trait Encoder {
@@ -26,9 +24,8 @@ impl Encoder for JsonEncoder<'_> {
     type Error = ();
 }
 
-fn encode_json<T: for<'r> Encodable<JsonEncoder<'r>>>(
-    object: &T,
-) -> Result<String, ()> {
+// This function uses higher-ranked trait bounds, which previously caused ICE
+fn encode_json<T: for<'r> Encodable<JsonEncoder<'r>>>(object: &T) -> Result<String, ()> {
     let s = String::new();
     {
         let mut encoder = JsonEncoder(PhantomData);
@@ -37,13 +34,15 @@ fn encode_json<T: for<'r> Encodable<JsonEncoder<'r>>>(
     Ok(s)
 }
 
+// Structure with HRTB constraint that was problematic
 struct Foo<T: for<'a> Encodable<JsonEncoder<'a>>> {
     v: T,
 }
 
+// Drop implementation that exercises the HRTB bounds
 impl<T: for<'a> Encodable<JsonEncoder<'a>>> Drop for Foo<T> {
     fn drop(&mut self) {
-        encode_json(&self.v);
+        let _ = encode_json(&self.v);
     }
 }
 
diff --git a/tests/ui/higher-ranked/structually-relate-aliases.stderr b/tests/ui/higher-ranked/structually-relate-aliases.stderr
index 025fcc5e170..b27a2dcceb1 100644
--- a/tests/ui/higher-ranked/structually-relate-aliases.stderr
+++ b/tests/ui/higher-ranked/structually-relate-aliases.stderr
@@ -1,4 +1,4 @@
- WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [?1t, '^0.Named(DefId(0:15 ~ structually_relate_aliases[de75]::{impl#1}::'a), "'a")], def_id: DefId(0:5 ~ structually_relate_aliases[de75]::ToUnit::Unit), .. }
+ WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [?1t, '^0.Named(DefId(0:15 ~ structually_relate_aliases[de75]::{impl#1}::'a))], def_id: DefId(0:5 ~ structually_relate_aliases[de75]::ToUnit::Unit), .. }
 error[E0277]: the trait bound `for<'a> T: ToUnit<'a>` is not satisfied
   --> $DIR/structually-relate-aliases.rs:13:36
    |
diff --git a/tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn.rs b/tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn.rs
new file mode 100644
index 00000000000..4fddd7c4ac8
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn.rs
@@ -0,0 +1,30 @@
+// issue#140796
+
+trait Bar {
+    fn method() -> impl Sized;
+    fn method() -> impl Sized;  //~ ERROR: the name `method` is defined multiple times
+}
+
+impl Bar for () {               //~ ERROR: not all trait items implemented, missing: `method`
+    fn method() -> impl Sized {
+        42
+    }
+    fn method() -> impl Sized { //~ ERROR: duplicate definitions with name `method`
+        42
+    }
+}
+
+trait T {
+    fn method() -> impl Sized;
+}
+
+impl T for () {
+    fn method() -> impl Sized {
+        42
+    }
+    fn method() -> impl Sized { //~ ERROR: duplicate definitions with name `method`
+        42
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn.stderr b/tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn.stderr
new file mode 100644
index 00000000000..b58e8136479
--- /dev/null
+++ b/tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn.stderr
@@ -0,0 +1,53 @@
+error[E0428]: the name `method` is defined multiple times
+  --> $DIR/rpitit-duplicate-associated-fn.rs:5:5
+   |
+LL |     fn method() -> impl Sized;
+   |     -------------------------- previous definition of the value `method` here
+LL |     fn method() -> impl Sized;
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ `method` redefined here
+   |
+   = note: `method` must be defined only once in the value namespace of this trait
+
+error[E0201]: duplicate definitions with name `method`:
+  --> $DIR/rpitit-duplicate-associated-fn.rs:12:5
+   |
+LL |       fn method() -> impl Sized;
+   |       -------------------------- item in trait
+...
+LL | /     fn method() -> impl Sized {
+LL | |         42
+LL | |     }
+   | |_____- previous definition here
+LL | /     fn method() -> impl Sized {
+LL | |         42
+LL | |     }
+   | |_____^ duplicate definition
+
+error[E0201]: duplicate definitions with name `method`:
+  --> $DIR/rpitit-duplicate-associated-fn.rs:25:5
+   |
+LL |       fn method() -> impl Sized;
+   |       -------------------------- item in trait
+...
+LL | /     fn method() -> impl Sized {
+LL | |         42
+LL | |     }
+   | |_____- previous definition here
+LL | /     fn method() -> impl Sized {
+LL | |         42
+LL | |     }
+   | |_____^ duplicate definition
+
+error[E0046]: not all trait items implemented, missing: `method`
+  --> $DIR/rpitit-duplicate-associated-fn.rs:8:1
+   |
+LL |     fn method() -> impl Sized;
+   |     -------------------------- `method` from trait
+...
+LL | impl Bar for () {
+   | ^^^^^^^^^^^^^^^ missing `method` in implementation
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0046, E0201, E0428.
+For more information about an error, try `rustc --explain E0046`.
diff --git a/tests/ui/stdio-is-blocking.rs b/tests/ui/io-checks/io-stdout-blocking-writes.rs
index 615530dcd47..1197b7f43be 100644
--- a/tests/ui/stdio-is-blocking.rs
+++ b/tests/ui/io-checks/io-stdout-blocking-writes.rs
@@ -1,10 +1,12 @@
+//! Check that writes to standard output are blocking, avoiding interleaving
+//! even with concurrent writes from multiple threads.
+
 //@ run-pass
 //@ needs-subprocess
 
-use std::env;
 use std::io::prelude::*;
 use std::process::Command;
-use std::thread;
+use std::{env, thread};
 
 const THREADS: usize = 20;
 const WRITES: usize = 100;
@@ -33,14 +35,16 @@ fn parent() {
 }
 
 fn child() {
-    let threads = (0..THREADS).map(|_| {
-        thread::spawn(|| {
-            let buf = [b'a'; WRITE_SIZE];
-            for _ in 0..WRITES {
-                write_all(&buf);
-            }
+    let threads = (0..THREADS)
+        .map(|_| {
+            thread::spawn(|| {
+                let buf = [b'a'; WRITE_SIZE];
+                for _ in 0..WRITES {
+                    write_all(&buf);
+                }
+            })
         })
-    }).collect::<Vec<_>>();
+        .collect::<Vec<_>>();
 
     for thread in threads {
         thread.join().unwrap();
@@ -63,8 +67,8 @@ fn write_all(buf: &[u8]) {
 fn write_all(buf: &[u8]) {
     use std::fs::File;
     use std::mem;
-    use std::os::windows::raw::*;
     use std::os::windows::prelude::*;
+    use std::os::windows::raw::*;
 
     const STD_OUTPUT_HANDLE: u32 = (-11i32) as u32;
 
diff --git a/tests/ui/print-stdout-eprint-stderr.rs b/tests/ui/io-checks/stdout-stderr-separation.rs
index 4b356e2fe61..1bb3f16d3a1 100644
--- a/tests/ui/print-stdout-eprint-stderr.rs
+++ b/tests/ui/io-checks/stdout-stderr-separation.rs
@@ -1,3 +1,6 @@
+//! Test that print!/println! output to stdout and eprint!/eprintln!
+//! output to stderr correctly.
+
 //@ run-pass
 //@ needs-subprocess
 
diff --git a/tests/ui/issue-16822.rs b/tests/ui/issue-16822.rs
deleted file mode 100644
index 94d89f88f47..00000000000
--- a/tests/ui/issue-16822.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-//@ run-pass
-//@ aux-build:issue-16822.rs
-
-extern crate issue_16822 as lib;
-
-use std::cell::RefCell;
-
-struct App {
-    i: isize
-}
-
-impl lib::Update for App {
-    fn update(&mut self) {
-        self.i += 1;
-    }
-}
-
-fn main(){
-    let app = App { i: 5 };
-    let window = lib::Window { data: RefCell::new(app) };
-    window.update(1);
-}
diff --git a/tests/ui/item-name-overload.rs b/tests/ui/item-name-overload.rs
deleted file mode 100644
index dd2925aa53f..00000000000
--- a/tests/ui/item-name-overload.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-//@ run-pass
-
-#![allow(dead_code)]
-
-
-
-
-mod foo {
-    pub fn baz() { }
-}
-
-mod bar {
-    pub fn baz() { }
-}
-
-pub fn main() { }
diff --git a/tests/ui/kinds-of-primitive-impl.rs b/tests/ui/kinds-of-primitive-impl.rs
deleted file mode 100644
index f1c2ee8e550..00000000000
--- a/tests/ui/kinds-of-primitive-impl.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-impl u8 {
-//~^ error: cannot define inherent `impl` for primitive types
-    pub const B: u8 = 0;
-}
-
-impl str {
-//~^ error: cannot define inherent `impl` for primitive types
-    fn foo() {}
-    fn bar(self) {} //~ ERROR: size for values of type `str` cannot be known
-}
-
-impl char {
-//~^ error: cannot define inherent `impl` for primitive types
-    pub const B: u8 = 0;
-    pub const C: u8 = 0;
-    fn foo() {}
-    fn bar(self) {}
-}
-
-struct MyType;
-impl &MyType {
-//~^ error: cannot define inherent `impl` for primitive types
-    pub fn for_ref(self) {}
-}
-
-fn main() {}
diff --git a/tests/ui/last-use-in-block.rs b/tests/ui/last-use-in-block.rs
deleted file mode 100644
index 4a166b97bda..00000000000
--- a/tests/ui/last-use-in-block.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-//@ run-pass
-
-#![allow(dead_code)]
-#![allow(unused_parens)]
-// Issue #1818
-
-
-fn lp<T, F>(s: String, mut f: F) -> T where F: FnMut(String) -> T {
-    while false {
-        let r = f(s);
-        return (r);
-    }
-    panic!();
-}
-
-fn apply<T, F>(s: String, mut f: F) -> T where F: FnMut(String) -> T {
-    fn g<T, F>(s: String, mut f: F) -> T where F: FnMut(String) -> T {f(s)}
-    g(s, |v| { let r = f(v); r })
-}
-
-pub fn main() {}
diff --git a/tests/ui/last-use-in-cap-clause.rs b/tests/ui/last-use-in-cap-clause.rs
deleted file mode 100644
index 23c263c9805..00000000000
--- a/tests/ui/last-use-in-cap-clause.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-//@ run-pass
-
-#![allow(dead_code)]
-// Make sure #1399 stays fixed
-
-struct A { a: Box<isize> }
-
-fn foo() -> Box<dyn FnMut() -> isize + 'static> {
-    let k: Box<_> = Box::new(22);
-    let _u = A {a: k.clone()};
-    let result  = || 22;
-    Box::new(result)
-}
-
-pub fn main() {
-    assert_eq!(foo()(), 22);
-}
diff --git a/tests/ui/last-use-is-capture.rs b/tests/ui/last-use-is-capture.rs
deleted file mode 100644
index 6e07895f1d3..00000000000
--- a/tests/ui/last-use-is-capture.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-//@ run-pass
-
-#![allow(dead_code)]
-// Make sure #1399 stays fixed
-
-struct A { a: Box<isize> }
-
-pub fn main() {
-    fn invoke<F>(f: F) where F: FnOnce() { f(); }
-    let k: Box<_> = 22.into();
-    let _u = A {a: k.clone()};
-    invoke(|| println!("{}", k.clone()) )
-}
diff --git a/tests/ui/nullable-pointer-size.rs b/tests/ui/layout/null-pointer-optimization-sizes.rs
index aabdfa140df..95310b32e25 100644
--- a/tests/ui/nullable-pointer-size.rs
+++ b/tests/ui/layout/null-pointer-optimization-sizes.rs
@@ -1,10 +1,20 @@
+//! null pointer optimization preserves type sizes.
+//!
+//! Verifies that Option<T> has the same size as T for non-null pointer types,
+//! and for custom enums that have a niche.
+
 //@ run-pass
 
+// Needs for Nothing variat in Enum
 #![allow(dead_code)]
 
 use std::mem;
 
-enum E<T> { Thing(isize, T), Nothing((), ((), ()), [i8; 0]) }
+enum E<T> {
+    Thing(isize, T),
+    Nothing((), ((), ()), [i8; 0]),
+}
+
 struct S<T>(isize, T);
 
 // These are macros so we get useful assert messages.
@@ -12,20 +22,20 @@ struct S<T>(isize, T);
 macro_rules! check_option {
     ($T:ty) => {
         assert_eq!(mem::size_of::<Option<$T>>(), mem::size_of::<$T>());
-    }
+    };
 }
 
 macro_rules! check_fancy {
     ($T:ty) => {
         assert_eq!(mem::size_of::<E<$T>>(), mem::size_of::<S<$T>>());
-    }
+    };
 }
 
 macro_rules! check_type {
     ($T:ty) => {{
         check_option!($T);
         check_fancy!($T);
-    }}
+    }};
 }
 
 pub fn main() {
diff --git a/tests/ui/nullable-pointer-iotareduction.rs b/tests/ui/layout/null-pointer-optimization.rs
index 1b73164c9fc..5e77c8d22ab 100644
--- a/tests/ui/nullable-pointer-iotareduction.rs
+++ b/tests/ui/layout/null-pointer-optimization.rs
@@ -1,27 +1,34 @@
-//@ run-pass
+//! null pointer optimization with iota-reduction for enums.
+//!
+//! Iota-reduction is a rule from the Calculus of (Co-)Inductive Constructions:
+//! "a destructor applied to an object built from a constructor behaves as expected".
+//! See <https://coq.inria.fr/doc/language/core/conversion.html#iota-reduction>.
+//!
+//! This test verifies that null pointer optimization works correctly for both
+//! Option<T> and custom enums, accounting for pointers and regions.
 
-// Iota-reduction is a rule in the Calculus of (Co-)Inductive Constructions,
-// which "says that a destructor applied to an object built from a constructor
-// behaves as expected".  -- https://coq.inria.fr/doc/language/core/conversion.html#iota-reduction
-//
-// It's a little more complicated here, because of pointers and regions and
-// trying to get assert failure messages that at least identify which case
-// failed.
+//@ run-pass
 
 #![allow(unpredictable_function_pointer_comparisons)]
 
-enum E<T> { Thing(isize, T), #[allow(dead_code)] Nothing((), ((), ()), [i8; 0]) }
+enum E<T> {
+    Thing(isize, T),
+    #[allow(dead_code)]
+    Nothing((), ((), ()), [i8; 0]),
+}
+
 impl<T> E<T> {
     fn is_none(&self) -> bool {
         match *self {
             E::Thing(..) => false,
-            E::Nothing(..) => true
+            E::Nothing(..) => true,
         }
     }
+
     fn get_ref(&self) -> (isize, &T) {
         match *self {
-            E::Nothing(..) => panic!("E::get_ref(Nothing::<{}>)",  stringify!(T)),
-            E::Thing(x, ref y) => (x, y)
+            E::Nothing(..) => panic!("E::get_ref(Nothing::<{}>)", stringify!(T)),
+            E::Thing(x, ref y) => (x, y),
         }
     }
 }
@@ -36,7 +43,7 @@ macro_rules! check_option {
         let s_ = Some::<$T>(e);
         let $v = s_.as_ref().unwrap();
         $chk
-    }}
+    }};
 }
 
 macro_rules! check_fancy {
@@ -48,11 +55,10 @@ macro_rules! check_fancy {
         let e = $e;
         let t_ = E::Thing::<$T>(23, e);
         match t_.get_ref() {
-            (23, $v) => { $chk }
-            _ => panic!("Thing::<{}>(23, {}).get_ref() != (23, _)",
-                       stringify!($T), stringify!($e))
+            (23, $v) => $chk,
+            _ => panic!("Thing::<{}>(23, {}).get_ref() != (23, _)", stringify!($T), stringify!($e)),
         }
-    }}
+    }};
 }
 
 macro_rules! check_type {
@@ -67,7 +73,5 @@ pub fn main() {
     check_type!(Box::new(18), Box<isize>);
     check_type!("foo".to_string(), String);
     check_type!(vec![20, 22], Vec<isize>);
-    check_type!(main, fn(), |pthing| {
-        assert_eq!(main as fn(), *pthing as fn())
-    });
+    check_type!(main, fn(), |pthing| assert_eq!(main as fn(), *pthing as fn()));
 }
diff --git a/tests/ui/lint/lint_map_unit_fn.stderr b/tests/ui/lint/lint_map_unit_fn.stderr
index 91542af0f6d..930ecd30d1d 100644
--- a/tests/ui/lint/lint_map_unit_fn.stderr
+++ b/tests/ui/lint/lint_map_unit_fn.stderr
@@ -25,19 +25,18 @@ LL +     x.iter_mut().for_each(foo);
 error: `Iterator::map` call that discard the iterator's values
   --> $DIR/lint_map_unit_fn.rs:11:18
    |
-LL |         x.iter_mut().map(|items| {
-   |                      ^   -------
-   |                      |   |
-   |  ____________________|___this function returns `()`, which is likely not what you wanted
-   | |  __________________|
-   | | |
-LL | | |
-LL | | |         items.sort();
-LL | | |     });
-   | | |     -^ after this call to map, the resulting iterator is `impl Iterator<Item = ()>`, which means the only information carried by the iterator is the number of items
-   | | |_____||
-   | |_______|
-   |         called `Iterator::map` with callable that returns `()`
+LL |        x.iter_mut().map(|items| {
+   |                     ^   -------
+   |                     |   |
+   |  ___________________|___this function returns `()`, which is likely not what you wanted
+   | | __________________|
+   | ||
+LL | ||
+LL | ||         items.sort();
+LL | ||     });
+   | ||_____-^ after this call to map, the resulting iterator is `impl Iterator<Item = ()>`, which means the only information carried by the iterator is the number of items
+   | |______|
+   |        called `Iterator::map` with callable that returns `()`
    |
    = note: `Iterator::map`, like many of the methods on `Iterator`, gets executed lazily, meaning that its effects won't be visible until it is iterated
 help: you might have meant to use `Iterator::for_each`
diff --git a/tests/ui/lint/unused/unused-attr-duplicate.stderr b/tests/ui/lint/unused/unused-attr-duplicate.stderr
index d9ceca2f29b..275eb056305 100644
--- a/tests/ui/lint/unused/unused-attr-duplicate.stderr
+++ b/tests/ui/lint/unused/unused-attr-duplicate.stderr
@@ -41,18 +41,6 @@ LL | #[path = "auxiliary/lint_unused_extern_crate.rs"]
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 error: unused attribute
-  --> $DIR/unused-attr-duplicate.rs:53:1
-   |
-LL | #[ignore = "some text"]
-   | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
-   |
-note: attribute also specified here
-  --> $DIR/unused-attr-duplicate.rs:52:1
-   |
-LL | #[ignore]
-   | ^^^^^^^^^
-
-error: unused attribute
   --> $DIR/unused-attr-duplicate.rs:55:1
    |
 LL | #[should_panic(expected = "values don't match")]
@@ -66,18 +54,6 @@ LL | #[should_panic]
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 error: unused attribute
-  --> $DIR/unused-attr-duplicate.rs:66:1
-   |
-LL | #[non_exhaustive]
-   | ^^^^^^^^^^^^^^^^^ help: remove this attribute
-   |
-note: attribute also specified here
-  --> $DIR/unused-attr-duplicate.rs:65:1
-   |
-LL | #[non_exhaustive]
-   | ^^^^^^^^^^^^^^^^^
-
-error: unused attribute
   --> $DIR/unused-attr-duplicate.rs:70:1
    |
 LL | #[automatically_derived]
@@ -178,6 +154,18 @@ LL |     #[macro_export]
    |     ^^^^^^^^^^^^^^^
 
 error: unused attribute
+  --> $DIR/unused-attr-duplicate.rs:53:1
+   |
+LL | #[ignore = "some text"]
+   | ^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
+   |
+note: attribute also specified here
+  --> $DIR/unused-attr-duplicate.rs:52:1
+   |
+LL | #[ignore]
+   | ^^^^^^^^^
+
+error: unused attribute
   --> $DIR/unused-attr-duplicate.rs:60:1
    |
 LL | #[must_use = "some message"]
@@ -191,6 +179,18 @@ LL | #[must_use]
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
 
 error: unused attribute
+  --> $DIR/unused-attr-duplicate.rs:66:1
+   |
+LL | #[non_exhaustive]
+   | ^^^^^^^^^^^^^^^^^ help: remove this attribute
+   |
+note: attribute also specified here
+  --> $DIR/unused-attr-duplicate.rs:65:1
+   |
+LL | #[non_exhaustive]
+   | ^^^^^^^^^^^^^^^^^
+
+error: unused attribute
   --> $DIR/unused-attr-duplicate.rs:74:1
    |
 LL | #[inline(never)]
diff --git a/tests/ui/malformed/malformed-regressions.stderr b/tests/ui/malformed/malformed-regressions.stderr
index 535db55a13d..8c22919a1c2 100644
--- a/tests/ui/malformed/malformed-regressions.stderr
+++ b/tests/ui/malformed/malformed-regressions.stderr
@@ -8,15 +8,6 @@ LL | #[doc]
    = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
    = note: `#[deny(ill_formed_attribute_input)]` on by default
 
-error: valid forms for the attribute are `#[ignore]` and `#[ignore = "reason"]`
-  --> $DIR/malformed-regressions.rs:3:1
-   |
-LL | #[ignore()]
-   | ^^^^^^^^^^^
-   |
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
-   = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
-
 error: attribute must be of the form `#[link(name = "...", /*opt*/ kind = "dylib|static|...", /*opt*/ wasm_import_module = "...", /*opt*/ import_name_type = "decorated|noprefix|undecorated")]`
   --> $DIR/malformed-regressions.rs:7:1
    |
@@ -35,6 +26,15 @@ LL | #[link = ""]
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
 
+error: valid forms for the attribute are `#[ignore = "reason"]` and `#[ignore]`
+  --> $DIR/malformed-regressions.rs:3:1
+   |
+LL | #[ignore()]
+   | ^^^^^^^^^^^
+   |
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = note: for more information, see issue #57571 <https://github.com/rust-lang/rust/issues/57571>
+
 error: valid forms for the attribute are `#[inline(always|never)]` and `#[inline]`
   --> $DIR/malformed-regressions.rs:5:1
    |
diff --git a/tests/ui/mismatched_types/closure-parameter-type-inference-mismatch.rs b/tests/ui/mismatched_types/closure-parameter-type-inference-mismatch.rs
new file mode 100644
index 00000000000..1cd41114bbd
--- /dev/null
+++ b/tests/ui/mismatched_types/closure-parameter-type-inference-mismatch.rs
@@ -0,0 +1,25 @@
+//! Test closure parameter type inference and type mismatch errors.
+//!
+//! Related to <https://github.com/rust-lang/rust/issues/2093>.
+
+//@ dont-require-annotations: NOTE
+
+fn let_in<T, F>(x: T, f: F)
+where
+    F: FnOnce(T),
+{
+}
+
+fn main() {
+    let_in(3u32, |i| {
+        assert!(i == 3i32);
+        //~^ ERROR mismatched types
+        //~| NOTE expected `u32`, found `i32`
+    });
+
+    let_in(3i32, |i| {
+        assert!(i == 3u32);
+        //~^ ERROR mismatched types
+        //~| NOTE expected `i32`, found `u32`
+    });
+}
diff --git a/tests/ui/mismatched_types/closure-parameter-type-inference-mismatch.stderr b/tests/ui/mismatched_types/closure-parameter-type-inference-mismatch.stderr
new file mode 100644
index 00000000000..c75e90ce4ef
--- /dev/null
+++ b/tests/ui/mismatched_types/closure-parameter-type-inference-mismatch.stderr
@@ -0,0 +1,31 @@
+error[E0308]: mismatched types
+  --> $DIR/closure-parameter-type-inference-mismatch.rs:15:22
+   |
+LL |         assert!(i == 3i32);
+   |                 -    ^^^^ expected `u32`, found `i32`
+   |                 |
+   |                 expected because this is `u32`
+   |
+help: change the type of the numeric literal from `i32` to `u32`
+   |
+LL -         assert!(i == 3i32);
+LL +         assert!(i == 3u32);
+   |
+
+error[E0308]: mismatched types
+  --> $DIR/closure-parameter-type-inference-mismatch.rs:21:22
+   |
+LL |         assert!(i == 3u32);
+   |                 -    ^^^^ expected `i32`, found `u32`
+   |                 |
+   |                 expected because this is `i32`
+   |
+help: change the type of the numeric literal from `u32` to `i32`
+   |
+LL -         assert!(i == 3u32);
+LL +         assert!(i == 3i32);
+   |
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/point-to-type-err-cause-on-impl-trait-return-2.rs b/tests/ui/mismatched_types/type-error-diagnostic-in-complex-return.rs
index 50f1fe873cb..6711d303eb3 100644
--- a/tests/ui/point-to-type-err-cause-on-impl-trait-return-2.rs
+++ b/tests/ui/mismatched_types/type-error-diagnostic-in-complex-return.rs
@@ -1,4 +1,8 @@
-fn unrelated() -> Result<(), std::string::ParseError> {  // #57664
+//! Regression test for <https://github.com/rust-lang/rust/issues/57664>.
+//! Checks that compiler doesn't get confused by `?` operator and complex
+//! return types when reporting type mismatches.
+
+fn unrelated() -> Result<(), std::string::ParseError> {
     let x = 0;
 
     match x {
diff --git a/tests/ui/point-to-type-err-cause-on-impl-trait-return-2.stderr b/tests/ui/mismatched_types/type-error-diagnostic-in-complex-return.stderr
index 34aaea5b70b..38392fe99d6 100644
--- a/tests/ui/point-to-type-err-cause-on-impl-trait-return-2.stderr
+++ b/tests/ui/mismatched_types/type-error-diagnostic-in-complex-return.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/point-to-type-err-cause-on-impl-trait-return-2.rs:9:41
+  --> $DIR/type-error-diagnostic-in-complex-return.rs:13:41
    |
 LL |             let value: &bool = unsafe { &42 };
    |                                         ^^^ expected `&bool`, found `&{integer}`
diff --git a/tests/ui/modules/mod-same-item-names.rs b/tests/ui/modules/mod-same-item-names.rs
new file mode 100644
index 00000000000..1e9a9caa5fc
--- /dev/null
+++ b/tests/ui/modules/mod-same-item-names.rs
@@ -0,0 +1,15 @@
+//! Test that items with identical names can coexist in different modules
+
+//@ run-pass
+
+#![allow(dead_code)]
+
+mod foo {
+    pub fn baz() {}
+}
+
+mod bar {
+    pub fn baz() {}
+}
+
+pub fn main() {}
diff --git a/tests/ui/mut-function-arguments.rs b/tests/ui/mut-function-arguments.rs
deleted file mode 100644
index 01c264fce03..00000000000
--- a/tests/ui/mut-function-arguments.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-//@ run-pass
-
-fn f(mut y: Box<isize>) {
-    *y = 5;
-    assert_eq!(*y, 5);
-}
-
-fn g() {
-    let frob = |mut q: Box<isize>| { *q = 2; assert_eq!(*q, 2); };
-    let w = Box::new(37);
-    frob(w);
-
-}
-
-pub fn main() {
-    let z = Box::new(17);
-    f(z);
-    g();
-}
diff --git a/tests/ui/mutual-recursion-group.rs b/tests/ui/mutual-recursion-group.rs
deleted file mode 100644
index f83150af7dc..00000000000
--- a/tests/ui/mutual-recursion-group.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-//@ run-pass
-
-#![allow(non_camel_case_types)]
-#![allow(dead_code)]
-
-
-enum colour { red, green, blue, }
-
-enum tree { children(Box<list>), leaf(colour), }
-
-enum list { cons(Box<tree>, Box<list>), nil, }
-
-enum small_list { kons(isize, Box<small_list>), neel, }
-
-pub fn main() { }
diff --git a/tests/ui/myriad-closures.rs b/tests/ui/myriad-closures.rs
deleted file mode 100644
index 541d27d5de4..00000000000
--- a/tests/ui/myriad-closures.rs
+++ /dev/null
@@ -1,39 +0,0 @@
-//@ run-pass
-// This test case tests whether we can handle code bases that contain a high
-// number of closures, something that needs special handling in the MingGW
-// toolchain.
-// See https://github.com/rust-lang/rust/issues/34793 for more information.
-
-// Make sure we don't optimize anything away:
-//@ compile-flags: -C no-prepopulate-passes -Cpasses=name-anon-globals
-
-// Expand something exponentially
-macro_rules! go_bacterial {
-    ($mac:ident) => ($mac!());
-    ($mac:ident 1 $($t:tt)*) => (
-        go_bacterial!($mac $($t)*);
-        go_bacterial!($mac $($t)*);
-    )
-}
-
-macro_rules! mk_closure {
-    () => ((move || {})())
-}
-
-macro_rules! mk_fn {
-    () => {
-        {
-            fn function() {
-                // Make 16 closures
-                go_bacterial!(mk_closure 1 1 1 1);
-            }
-            let _ = function();
-        }
-    }
-}
-
-fn main() {
-    // Make 2^8 functions, each containing 16 closures,
-    // resulting in 2^12 closures overall.
-    go_bacterial!(mk_fn 1 1 1 1  1 1 1 1);
-}
diff --git a/tests/ui/nested-block-comment.rs b/tests/ui/nested-block-comment.rs
deleted file mode 100644
index 008df27e0e2..00000000000
--- a/tests/ui/nested-block-comment.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-//@ run-pass
-
-/* This test checks that nested comments are supported
-
-   /*
-     This should not panic
-   */
-*/
-
-pub fn main() {
-}
diff --git a/tests/ui/nested-cfg-attrs.rs b/tests/ui/nested-cfg-attrs.rs
deleted file mode 100644
index 941807a8431..00000000000
--- a/tests/ui/nested-cfg-attrs.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-#[cfg_attr(all(), cfg_attr(all(), cfg(false)))]
-fn f() {}
-
-fn main() { f() } //~ ERROR cannot find function `f` in this scope
diff --git a/tests/ui/nested-class.rs b/tests/ui/nested-class.rs
deleted file mode 100644
index f84ab40dd1d..00000000000
--- a/tests/ui/nested-class.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-//@ run-pass
-
-#![allow(non_camel_case_types)]
-
-pub fn main() {
-    struct b {
-        i: isize,
-    }
-
-    impl b {
-        fn do_stuff(&self) -> isize { return 37; }
-    }
-
-    fn b(i:isize) -> b {
-        b {
-            i: i
-        }
-    }
-
-    //  fn b(x:isize) -> isize { panic!(); }
-
-    let z = b(42);
-    assert_eq!(z.i, 42);
-    assert_eq!(z.do_stuff(), 37);
-}
diff --git a/tests/ui/nested-ty-params.rs b/tests/ui/nested-ty-params.rs
deleted file mode 100644
index c00c3bc3372..00000000000
--- a/tests/ui/nested-ty-params.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-fn hd<U>(v: Vec<U> ) -> U {
-    fn hd1(w: [U]) -> U { return w[0]; }
-    //~^ ERROR can't use generic parameters from outer item
-    //~| ERROR can't use generic parameters from outer item
-
-    return hd1(v);
-}
-
-fn main() {}
diff --git a/tests/ui/nll/ty-outlives/impl-trait-captures.stderr b/tests/ui/nll/ty-outlives/impl-trait-captures.stderr
index 6fd41a761e9..6bf1e333327 100644
--- a/tests/ui/nll/ty-outlives/impl-trait-captures.stderr
+++ b/tests/ui/nll/ty-outlives/impl-trait-captures.stderr
@@ -4,14 +4,14 @@ error[E0700]: hidden type for `Opaque(DefId(0:11 ~ impl_trait_captures[aeb9]::fo
 LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> {
    |                  --     ------------ opaque type defined here
    |                  |
-   |                  hidden type `&ReLateParam(DefId(0:8 ~ impl_trait_captures[aeb9]::foo), LateNamed(DefId(0:13 ~ impl_trait_captures[aeb9]::foo::'_), '_)) T` captures the anonymous lifetime defined here
+   |                  hidden type `&ReLateParam(DefId(0:8 ~ impl_trait_captures[aeb9]::foo), LateNamed(DefId(0:13 ~ impl_trait_captures[aeb9]::foo::'_))) T` captures the anonymous lifetime defined here
 LL |     x
    |     ^
    |
-help: add a `use<...>` bound to explicitly capture `ReLateParam(DefId(0:8 ~ impl_trait_captures[aeb9]::foo), LateNamed(DefId(0:13 ~ impl_trait_captures[aeb9]::foo::'_), '_))`
+help: add a `use<...>` bound to explicitly capture `ReLateParam(DefId(0:8 ~ impl_trait_captures[aeb9]::foo), LateNamed(DefId(0:13 ~ impl_trait_captures[aeb9]::foo::'_)))`
    |
-LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> + use<'a, ReLateParam(DefId(0:8 ~ impl_trait_captures[aeb9]::foo), LateNamed(DefId(0:13 ~ impl_trait_captures[aeb9]::foo::'_), '_)), T> {
-   |                                      +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> + use<'a, ReLateParam(DefId(0:8 ~ impl_trait_captures[aeb9]::foo), LateNamed(DefId(0:13 ~ impl_trait_captures[aeb9]::foo::'_))), T> {
+   |                                      +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/occurs-check-2.rs b/tests/ui/occurs-check-2.rs
deleted file mode 100644
index 9289a8e870a..00000000000
--- a/tests/ui/occurs-check-2.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-fn main() {
-
-    let f;
-    let g;
-
-    g = f;
-    //~^ ERROR overflow assigning `Box<_>` to `_`
-    f = Box::new(g);
-}
diff --git a/tests/ui/occurs-check-3.rs b/tests/ui/occurs-check-3.rs
deleted file mode 100644
index 377a043daf3..00000000000
--- a/tests/ui/occurs-check-3.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-// From Issue #778
-
-enum Clam<T> { A(T) }
-fn main() {
-    let c;
-    c = Clam::A(c);
-    //~^ ERROR overflow assigning `Clam<_>` to `_`
-    match c {
-        Clam::A::<isize>(_) => { }
-    }
-}
diff --git a/tests/ui/occurs-check.rs b/tests/ui/occurs-check.rs
deleted file mode 100644
index 638b9b6d7e4..00000000000
--- a/tests/ui/occurs-check.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-fn main() {
-    let f;
-    f = Box::new(f);
-    //~^ ERROR overflow assigning `Box<_>` to `_`
-}
diff --git a/tests/ui/opeq.rs b/tests/ui/opeq.rs
deleted file mode 100644
index 956ea0684fa..00000000000
--- a/tests/ui/opeq.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-//@ run-pass
-
-pub fn main() {
-    let mut x: isize = 1;
-    x *= 2;
-    println!("{}", x);
-    assert_eq!(x, 2);
-    x += 3;
-    println!("{}", x);
-    assert_eq!(x, 5);
-    x *= x;
-    println!("{}", x);
-    assert_eq!(x, 25);
-    x /= 5;
-    println!("{}", x);
-    assert_eq!(x, 5);
-}
diff --git a/tests/ui/oom_unwind.rs b/tests/ui/panics/oom-panic-unwind.rs
index be5e63d430b..5974ad91406 100644
--- a/tests/ui/oom_unwind.rs
+++ b/tests/ui/panics/oom-panic-unwind.rs
@@ -1,3 +1,5 @@
+//! Test that out-of-memory conditions trigger catchable panics with `-Z oom=panic`.
+
 //@ compile-flags: -Z oom=panic
 //@ run-pass
 //@ no-prefer-dynamic
diff --git a/tests/ui/parser/doc-comment-in-generic.rs b/tests/ui/parser/doc-comment-in-generic.rs
new file mode 100644
index 00000000000..2596496763b
--- /dev/null
+++ b/tests/ui/parser/doc-comment-in-generic.rs
@@ -0,0 +1,13 @@
+//! Tests correct parsing of doc comments on generic parameters in traits.
+//! Checks that compiler doesn't panic when processing this.
+
+//@ check-pass
+
+#![crate_type = "lib"]
+
+pub trait Layer<
+    /// Documentation for generic parameter.
+    Input,
+>
+{
+}
diff --git a/tests/ui/parser/macro/bad-macro-definition.rs b/tests/ui/parser/macro/bad-macro-definition.rs
new file mode 100644
index 00000000000..3c5c93ea3b3
--- /dev/null
+++ b/tests/ui/parser/macro/bad-macro-definition.rs
@@ -0,0 +1,22 @@
+#![crate_type = "lib"]
+
+macro_rules! a { {} => }
+//~^ ERROR: macro definition ended unexpectedly
+
+macro_rules! b { 0 => }
+//~^ ERROR: macro definition ended unexpectedly
+//~| ERROR: invalid macro matcher
+
+macro_rules! c { x => }
+//~^ ERROR: macro definition ended unexpectedly
+//~| ERROR: invalid macro matcher
+
+macro_rules! d { _ => }
+//~^ ERROR: macro definition ended unexpectedly
+//~| ERROR: invalid macro matcher
+
+macro_rules! e { {} }
+//~^ ERROR: expected `=>`, found end of macro arguments
+
+macro_rules! f {}
+//~^ ERROR: macros must contain at least one rule
diff --git a/tests/ui/parser/macro/bad-macro-definition.stderr b/tests/ui/parser/macro/bad-macro-definition.stderr
new file mode 100644
index 00000000000..de6d9d6a38b
--- /dev/null
+++ b/tests/ui/parser/macro/bad-macro-definition.stderr
@@ -0,0 +1,56 @@
+error: macro definition ended unexpectedly
+  --> $DIR/bad-macro-definition.rs:3:23
+   |
+LL | macro_rules! a { {} => }
+   |                       ^ expected right-hand side of macro rule
+
+error: invalid macro matcher; matchers must be contained in balanced delimiters
+  --> $DIR/bad-macro-definition.rs:6:18
+   |
+LL | macro_rules! b { 0 => }
+   |                  ^
+
+error: macro definition ended unexpectedly
+  --> $DIR/bad-macro-definition.rs:6:22
+   |
+LL | macro_rules! b { 0 => }
+   |                      ^ expected right-hand side of macro rule
+
+error: invalid macro matcher; matchers must be contained in balanced delimiters
+  --> $DIR/bad-macro-definition.rs:10:18
+   |
+LL | macro_rules! c { x => }
+   |                  ^
+
+error: macro definition ended unexpectedly
+  --> $DIR/bad-macro-definition.rs:10:22
+   |
+LL | macro_rules! c { x => }
+   |                      ^ expected right-hand side of macro rule
+
+error: invalid macro matcher; matchers must be contained in balanced delimiters
+  --> $DIR/bad-macro-definition.rs:14:18
+   |
+LL | macro_rules! d { _ => }
+   |                  ^
+
+error: macro definition ended unexpectedly
+  --> $DIR/bad-macro-definition.rs:14:22
+   |
+LL | macro_rules! d { _ => }
+   |                      ^ expected right-hand side of macro rule
+
+error: expected `=>`, found end of macro arguments
+  --> $DIR/bad-macro-definition.rs:18:20
+   |
+LL | macro_rules! e { {} }
+   |                    ^ expected `=>`
+
+error: macros must contain at least one rule
+  --> $DIR/bad-macro-definition.rs:21:1
+   |
+LL | macro_rules! f {}
+   | ^^^^^^^^^^^^^^^^^
+
+error: aborting due to 9 previous errors
+
diff --git a/tests/ui/parser/nested-block-comments.rs b/tests/ui/parser/nested-block-comments.rs
new file mode 100644
index 00000000000..8fe77896361
--- /dev/null
+++ b/tests/ui/parser/nested-block-comments.rs
@@ -0,0 +1,34 @@
+//! Test that nested block comments are properly supported by the parser.
+//!
+//! See <https://github.com/rust-lang/rust/issues/66>.
+
+//@ run-pass
+
+/* This test checks that nested comments are supported
+
+   /* This is a nested comment
+      /* And this is even more deeply nested */
+      Back to the first level of nesting
+   */
+
+   /* Another nested comment at the same level */
+*/
+
+/* Additional test cases for nested comments */
+
+#[rustfmt::skip]
+/*
+    /* Level 1
+        /* Level 2
+            /* Level 3 */
+         */
+    */
+*/
+
+pub fn main() {
+    // Check that code after nested comments works correctly
+    let _x = 42;
+
+    /* Even inline /* nested */ comments work */
+    let _y = /* nested /* comment */ test */ 100;
+}
diff --git a/tests/ui/parser/raw/raw-string-literals.rs b/tests/ui/parser/raw/raw-string-literals.rs
new file mode 100644
index 00000000000..2272f268b36
--- /dev/null
+++ b/tests/ui/parser/raw/raw-string-literals.rs
Binary files differdiff --git a/tests/ui/pattern/move-ref-patterns/pattern-ref-bindings-reassignment.rs b/tests/ui/pattern/move-ref-patterns/pattern-ref-bindings-reassignment.rs
new file mode 100644
index 00000000000..42b0b9ac44d
--- /dev/null
+++ b/tests/ui/pattern/move-ref-patterns/pattern-ref-bindings-reassignment.rs
@@ -0,0 +1,24 @@
+//! Tests how we behave when the user attempts to mutate an immutable
+//! binding that was introduced by either `ref` or `ref mut`
+//! patterns.
+//!
+//! Such bindings cannot be made mutable via the mere addition of the
+//! `mut` keyword, and thus we want to check that the compiler does not
+//! suggest doing so.
+
+fn main() {
+    let (mut one_two, mut three_four) = ((1, 2), (3, 4));
+
+    // Bind via pattern:
+    // - `a` as immutable reference (`ref`)
+    // - `b` as mutable reference (`ref mut`)
+    let &mut (ref a, ref mut b) = &mut one_two;
+
+    // Attempt to reassign immutable `ref`-bound variable
+    a = &three_four.0;
+    //~^ ERROR cannot assign twice to immutable variable `a`
+
+    // Attempt to reassign mutable `ref mut`-bound variable
+    b = &mut three_four.1;
+    //~^ ERROR cannot assign twice to immutable variable `b`
+}
diff --git a/tests/ui/reassign-ref-mut.stderr b/tests/ui/pattern/move-ref-patterns/pattern-ref-bindings-reassignment.stderr
index e623578e025..e04eb1dd25c 100644
--- a/tests/ui/reassign-ref-mut.stderr
+++ b/tests/ui/pattern/move-ref-patterns/pattern-ref-bindings-reassignment.stderr
@@ -1,13 +1,14 @@
 error[E0384]: cannot assign twice to immutable variable `a`
-  --> $DIR/reassign-ref-mut.rs:12:5
+  --> $DIR/pattern-ref-bindings-reassignment.rs:18:5
    |
 LL |     let &mut (ref a, ref mut b) = &mut one_two;
    |               ----- first assignment to `a`
+...
 LL |     a = &three_four.0;
    |     ^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
 
 error[E0384]: cannot assign twice to immutable variable `b`
-  --> $DIR/reassign-ref-mut.rs:14:5
+  --> $DIR/pattern-ref-bindings-reassignment.rs:22:5
    |
 LL |     let &mut (ref a, ref mut b) = &mut one_two;
    |                      --------- first assignment to `b`
diff --git a/tests/ui/pptypedef.rs b/tests/ui/pptypedef.rs
deleted file mode 100644
index d5f43df9d85..00000000000
--- a/tests/ui/pptypedef.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-//@ dont-require-annotations: NOTE
-
-fn let_in<T, F>(x: T, f: F) where F: FnOnce(T) {}
-
-fn main() {
-    let_in(3u32, |i| { assert!(i == 3i32); });
-    //~^ ERROR mismatched types
-    //~| NOTE expected `u32`, found `i32`
-
-    let_in(3i32, |i| { assert!(i == 3u32); });
-    //~^ ERROR mismatched types
-    //~| NOTE expected `i32`, found `u32`
-}
diff --git a/tests/ui/pptypedef.stderr b/tests/ui/pptypedef.stderr
deleted file mode 100644
index a6d673e61c6..00000000000
--- a/tests/ui/pptypedef.stderr
+++ /dev/null
@@ -1,31 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/pptypedef.rs:6:37
-   |
-LL |     let_in(3u32, |i| { assert!(i == 3i32); });
-   |                                -    ^^^^ expected `u32`, found `i32`
-   |                                |
-   |                                expected because this is `u32`
-   |
-help: change the type of the numeric literal from `i32` to `u32`
-   |
-LL -     let_in(3u32, |i| { assert!(i == 3i32); });
-LL +     let_in(3u32, |i| { assert!(i == 3u32); });
-   |
-
-error[E0308]: mismatched types
-  --> $DIR/pptypedef.rs:10:37
-   |
-LL |     let_in(3i32, |i| { assert!(i == 3u32); });
-   |                                -    ^^^^ expected `i32`, found `u32`
-   |                                |
-   |                                expected because this is `i32`
-   |
-help: change the type of the numeric literal from `u32` to `i32`
-   |
-LL -     let_in(3i32, |i| { assert!(i == 3u32); });
-LL +     let_in(3i32, |i| { assert!(i == 3i32); });
-   |
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/primitive-binop-lhs-mut.rs b/tests/ui/primitive-binop-lhs-mut.rs
deleted file mode 100644
index d988e2ed14f..00000000000
--- a/tests/ui/primitive-binop-lhs-mut.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-//@ run-pass
-
-fn main() {
-    let x = Box::new(0);
-    assert_eq!(0, *x + { drop(x); let _ = Box::new(main); 0 });
-}
diff --git a/tests/ui/print-calling-conventions.rs b/tests/ui/print-calling-conventions.rs
deleted file mode 100644
index 302ed088142..00000000000
--- a/tests/ui/print-calling-conventions.rs
+++ /dev/null
@@ -1,2 +0,0 @@
-//@ compile-flags: --print calling-conventions
-//@ build-pass
diff --git a/tests/ui/print-request/print-calling-conventions.rs b/tests/ui/print-request/print-calling-conventions.rs
new file mode 100644
index 00000000000..cefaa0d9b6f
--- /dev/null
+++ b/tests/ui/print-request/print-calling-conventions.rs
@@ -0,0 +1,4 @@
+//! Test that `--print calling-conventions` outputs all supported calling conventions.
+
+//@ compile-flags: --print calling-conventions
+//@ build-pass
diff --git a/tests/ui/print-calling-conventions.stdout b/tests/ui/print-request/print-calling-conventions.stdout
index b8b939e1c04..b8b939e1c04 100644
--- a/tests/ui/print-calling-conventions.stdout
+++ b/tests/ui/print-request/print-calling-conventions.stdout
diff --git a/tests/ui/project-cache-issue-31849.rs b/tests/ui/project-cache-issue-31849.rs
deleted file mode 100644
index 29c278171a6..00000000000
--- a/tests/ui/project-cache-issue-31849.rs
+++ /dev/null
@@ -1,65 +0,0 @@
-//@ run-pass
-// Regression test for #31849: the problem here was actually a performance
-// cliff, but I'm adding the test for reference.
-
-pub trait Upcast<T> {
-    fn upcast(self) -> T;
-}
-
-impl<S1, S2, T1, T2> Upcast<(T1, T2)> for (S1,S2)
-    where S1: Upcast<T1>,
-          S2: Upcast<T2>,
-{
-    fn upcast(self) -> (T1, T2) { (self.0.upcast(), self.1.upcast()) }
-}
-
-impl Upcast<()> for ()
-{
-    fn upcast(self) -> () { () }
-}
-
-pub trait ToStatic {
-    type Static: 'static;
-    fn to_static(self) -> Self::Static where Self: Sized;
-}
-
-impl<T, U> ToStatic for (T, U)
-    where T: ToStatic,
-          U: ToStatic
-{
-    type Static = (T::Static, U::Static);
-    fn to_static(self) -> Self::Static { (self.0.to_static(), self.1.to_static()) }
-}
-
-impl ToStatic for ()
-{
-    type Static = ();
-    fn to_static(self) -> () { () }
-}
-
-
-trait Factory {
-    type Output;
-    fn build(&self) -> Self::Output;
-}
-
-impl<S,T> Factory for (S, T)
-    where S: Factory,
-          T: Factory,
-          S::Output: ToStatic,
-          <S::Output as ToStatic>::Static: Upcast<S::Output>,
-{
-    type Output = (S::Output, T::Output);
-    fn build(&self) -> Self::Output { (self.0.build().to_static().upcast(), self.1.build()) }
-}
-
-impl Factory for () {
-    type Output = ();
-    fn build(&self) -> Self::Output { () }
-}
-
-fn main() {
-    // More parens, more time.
-    let it = ((((((((((),()),()),()),()),()),()),()),()),());
-    it.build();
-}
diff --git a/tests/ui/ptr-coercion-rpass.rs b/tests/ui/ptr-coercion-rpass.rs
deleted file mode 100644
index 8cc4120328e..00000000000
--- a/tests/ui/ptr-coercion-rpass.rs
+++ /dev/null
@@ -1,29 +0,0 @@
-//@ run-pass
-
-#![allow(unused_variables)]
-// Test coercions between pointers which don't do anything fancy like unsizing.
-
-
-pub fn main() {
-    // &mut -> &
-    let x: &mut isize = &mut 42;
-    let x: &isize = x;
-
-    let x: &isize = &mut 42;
-
-    // & -> *const
-    let x: &isize = &42;
-    let x: *const isize = x;
-
-    let x: *const isize = &42;
-
-    // &mut -> *const
-    let x: &mut isize = &mut 42;
-    let x: *const isize = x;
-
-    let x: *const isize = &mut 42;
-
-    // *mut -> *const
-    let x: *mut isize = &mut 42;
-    let x: *const isize = x;
-}
diff --git a/tests/ui/query-visibility.rs b/tests/ui/query-visibility.rs
deleted file mode 100644
index 84abe875910..00000000000
--- a/tests/ui/query-visibility.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-//@ check-pass
-// Check that it doesn't panic when `Input` gets its visibility checked.
-
-#![crate_type = "lib"]
-
-pub trait Layer<
-    /// Hello.
-    Input,
-> {}
diff --git a/tests/ui/raw-str.rs b/tests/ui/raw-str.rs
deleted file mode 100644
index 23018403295..00000000000
--- a/tests/ui/raw-str.rs
+++ /dev/null
Binary files differdiff --git a/tests/ui/reassign-ref-mut.rs b/tests/ui/reassign-ref-mut.rs
deleted file mode 100644
index d6d41e959d9..00000000000
--- a/tests/ui/reassign-ref-mut.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Tests how we behave when the user attempts to mutate an immutable
-// binding that was introduced by either `ref` or `ref mut`
-// patterns.
-//
-// Such bindings cannot be made mutable via the mere addition of the
-// `mut` keyword, and thus we want to check that the compiler does not
-// suggest doing so.
-
-fn main() {
-    let (mut one_two, mut three_four) = ((1, 2), (3, 4));
-    let &mut (ref a, ref mut b) = &mut one_two;
-    a = &three_four.0;
-    //~^ ERROR cannot assign twice to immutable variable `a` [E0384]
-    b = &mut three_four.1;
-    //~^ ERROR cannot assign twice to immutable variable `b` [E0384]
-}
diff --git a/tests/ui/repr/repr-empty-packed.stderr b/tests/ui/repr/repr-empty-packed.stderr
index c824c2998b4..6565b2e8c1d 100644
--- a/tests/ui/repr/repr-empty-packed.stderr
+++ b/tests/ui/repr/repr-empty-packed.stderr
@@ -1,27 +1,26 @@
+error[E0517]: attribute should be applied to a struct or union
+  --> $DIR/repr-empty-packed.rs:5:8
+   |
+LL |   #[repr(packed)]
+   |          ^^^^^^
+LL | / pub enum Foo {
+LL | |     Bar,
+LL | |     Baz(i32),
+LL | | }
+   | |_- not a struct or union
+
 error: unused attribute
   --> $DIR/repr-empty-packed.rs:4:1
    |
 LL | #[repr()]
    | ^^^^^^^^^ help: remove this attribute
    |
-   = note: attribute `repr` with an empty list has no effect
 note: the lint level is defined here
   --> $DIR/repr-empty-packed.rs:2:9
    |
 LL | #![deny(unused_attributes)]
    |         ^^^^^^^^^^^^^^^^^
 
-error[E0517]: attribute should be applied to a struct or union
-  --> $DIR/repr-empty-packed.rs:5:8
-   |
-LL |   #[repr(packed)]
-   |          ^^^^^^
-LL | / pub enum Foo {
-LL | |     Bar,
-LL | |     Baz(i32),
-LL | | }
-   | |_- not a struct or union
-
 error: aborting due to 2 previous errors
 
 For more information about this error, try `rustc --explain E0517`.
diff --git a/tests/ui/resolve/resolve-same-name-struct.rs b/tests/ui/resolve/resolve-same-name-struct.rs
new file mode 100644
index 00000000000..1bea0938e3d
--- /dev/null
+++ b/tests/ui/resolve/resolve-same-name-struct.rs
@@ -0,0 +1,29 @@
+//! Test that name resolution works correctly when a struct and its constructor
+//! function have the same name within a nested scope. This checks that the
+//! compiler can distinguish between type names and value names in the same
+//! namespace.
+
+//@ run-pass
+
+struct Point {
+    i: isize,
+}
+
+impl Point {
+    fn get_value(&self) -> isize {
+        return 37;
+    }
+}
+
+// Constructor function with the same name as the struct
+#[allow(non_snake_case)]
+fn Point(i: isize) -> Point {
+    Point { i }
+}
+
+pub fn main() {
+    // Test that we can use the constructor function
+    let point = Point(42);
+    assert_eq!(point.i, 42);
+    assert_eq!(point.get_value(), 37);
+}
diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/invalid-attribute.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/invalid-attribute.stderr
index 136cd763b05..1ac017aa08b 100644
--- a/tests/ui/rfcs/rfc-2008-non-exhaustive/invalid-attribute.stderr
+++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/invalid-attribute.stderr
@@ -1,8 +1,11 @@
-error: malformed `non_exhaustive` attribute input
+error[E0565]: malformed `non_exhaustive` attribute input
   --> $DIR/invalid-attribute.rs:1:1
    |
 LL | #[non_exhaustive(anything)]
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[non_exhaustive]`
+   | ^^^^^^^^^^^^^^^^----------^
+   | |               |
+   | |               didn't expect any arguments here
+   | help: must be of the form: `#[non_exhaustive]`
 
 error[E0701]: attribute should be applied to a struct or enum
   --> $DIR/invalid-attribute.rs:5:1
@@ -27,4 +30,5 @@ LL | | }
 
 error: aborting due to 3 previous errors
 
-For more information about this error, try `rustc --explain E0701`.
+Some errors have detailed explanations: E0565, E0701.
+For more information about an error, try `rustc --explain E0565`.
diff --git a/tests/ui/sanitizer/memory-eager.rs b/tests/ui/sanitizer/memory-eager.rs
index 532d7b308f6..709299f87d4 100644
--- a/tests/ui/sanitizer/memory-eager.rs
+++ b/tests/ui/sanitizer/memory-eager.rs
@@ -8,8 +8,14 @@
 //
 //@ run-fail
 //@ error-pattern: MemorySanitizer: use-of-uninitialized-value
-//@ error-pattern: Uninitialized value was created by an allocation
-//@ error-pattern: in the stack frame
+//@ [optimized]error-pattern: Uninitialized value was created by an allocation
+//@ [optimized]error-pattern: in the stack frame
+//
+// FIXME the unoptimized case actually has that text in the output too, per
+// <https://github.com/rust-lang/rust/pull/138759#issuecomment-3037186707>
+// but doesn't seem to be getting picked up for some reason. For now we don't
+// check for that part, since it's still testing that memory sanitizer reported
+// a use of an uninitialized value, which is the critical part.
 //
 // This test case intentionally limits the usage of the std,
 // since it will be linked with an uninstrumented version of it.
diff --git a/tests/ui/shadow-bool.rs b/tests/ui/shadowed/primitive-type-shadowing.rs
index 8cba2c1710b..fdcb4246a82 100644
--- a/tests/ui/shadow-bool.rs
+++ b/tests/ui/shadowed/primitive-type-shadowing.rs
@@ -1,3 +1,6 @@
+//! Check that a primitive type can be shadowed by a user-defined type, and the primitive type
+//! can still be referenced using its fully qualified path (e.g., `core::primitive::bool`).
+
 //@ check-pass
 
 mod bar {
diff --git a/tests/ui/shadowed-use-visibility.rs b/tests/ui/shadowed/use-shadows-reexport.rs
index 5ce4103b559..d220e4b406b 100644
--- a/tests/ui/shadowed-use-visibility.rs
+++ b/tests/ui/shadowed/use-shadows-reexport.rs
@@ -1,3 +1,5 @@
+//! Check that a local `use` declaration can shadow a re-exported item within the same module.
+
 //@ run-pass
 
 #![allow(unused_imports)]
diff --git a/tests/ui/short-error-format.stderr b/tests/ui/short-error-format.stderr
deleted file mode 100644
index 1a4a6d4df88..00000000000
--- a/tests/ui/short-error-format.stderr
+++ /dev/null
@@ -1,3 +0,0 @@
-$DIR/short-error-format.rs:6:9: error[E0308]: mismatched types: expected `u32`, found `String`
-$DIR/short-error-format.rs:8:7: error[E0599]: no method named `salut` found for type `u32` in the current scope: method not found in `u32`
-error: aborting due to 2 previous errors
diff --git a/tests/ui/sized-borrowed-pointer.rs b/tests/ui/sized-borrowed-pointer.rs
deleted file mode 100644
index bd213c067db..00000000000
--- a/tests/ui/sized-borrowed-pointer.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-//@ run-pass
-
-#![allow(dead_code)]
-// Possibly-dynamic size of typaram should be cleared at pointer boundary.
-
-
-fn bar<T: Sized>() { }
-fn foo<T>() { bar::<&T>() }
-pub fn main() { }
diff --git a/tests/ui/sized-cycle-note.rs b/tests/ui/sized-cycle-note.rs
deleted file mode 100644
index 766a5fa0de3..00000000000
--- a/tests/ui/sized-cycle-note.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-struct Baz { q: Option<Foo> }
-//~^ ERROR recursive types `Baz` and `Foo` have infinite size
-struct Foo { q: Option<Baz> }
-
-impl Foo { fn bar(&self) {} }
-
-fn main() {}
diff --git a/tests/ui/sized-cycle-note.stderr b/tests/ui/sized-cycle-note.stderr
deleted file mode 100644
index 21e54c12fed..00000000000
--- a/tests/ui/sized-cycle-note.stderr
+++ /dev/null
@@ -1,19 +0,0 @@
-error[E0072]: recursive types `Baz` and `Foo` have infinite size
-  --> $DIR/sized-cycle-note.rs:1:1
-   |
-LL | struct Baz { q: Option<Foo> }
-   | ^^^^^^^^^^             --- recursive without indirection
-LL |
-LL | struct Foo { q: Option<Baz> }
-   | ^^^^^^^^^^             --- recursive without indirection
-   |
-help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
-   |
-LL ~ struct Baz { q: Option<Box<Foo>> }
-LL |
-LL ~ struct Foo { q: Option<Box<Baz>> }
-   |
-
-error: aborting due to 1 previous error
-
-For more information about this error, try `rustc --explain E0072`.
diff --git a/tests/ui/sized-owned-pointer.rs b/tests/ui/sized-owned-pointer.rs
deleted file mode 100644
index b35c0f91abd..00000000000
--- a/tests/ui/sized-owned-pointer.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-//@ run-pass
-
-#![allow(dead_code)]
-// Possibly-dynamic size of typaram should be cleared at pointer boundary.
-
-
-
-fn bar<T: Sized>() { }
-fn foo<T>() { bar::<Box<T>>() }
-pub fn main() { }
diff --git a/tests/ui/sized/recursive-type-infinite-size.rs b/tests/ui/sized/recursive-type-infinite-size.rs
new file mode 100644
index 00000000000..5cd8e895573
--- /dev/null
+++ b/tests/ui/sized/recursive-type-infinite-size.rs
@@ -0,0 +1,16 @@
+//! Check for compilation errors when recursive types are defined in a way
+//! that leads to an infinite size.
+
+struct Baz {
+    //~^ ERROR recursive types `Baz` and `Foo` have infinite size
+    q: Option<Foo>,
+}
+struct Foo {
+    q: Option<Baz>,
+}
+
+impl Foo {
+    fn bar(&self) {}
+}
+
+fn main() {}
diff --git a/tests/ui/sized/recursive-type-infinite-size.stderr b/tests/ui/sized/recursive-type-infinite-size.stderr
new file mode 100644
index 00000000000..98ac36c4bb6
--- /dev/null
+++ b/tests/ui/sized/recursive-type-infinite-size.stderr
@@ -0,0 +1,25 @@
+error[E0072]: recursive types `Baz` and `Foo` have infinite size
+  --> $DIR/recursive-type-infinite-size.rs:4:1
+   |
+LL | struct Baz {
+   | ^^^^^^^^^^
+LL |
+LL |     q: Option<Foo>,
+   |               --- recursive without indirection
+LL | }
+LL | struct Foo {
+   | ^^^^^^^^^^
+LL |     q: Option<Baz>,
+   |               --- recursive without indirection
+   |
+help: insert some indirection (e.g., a `Box`, `Rc`, or `&`) to break the cycle
+   |
+LL ~     q: Option<Box<Foo>>,
+LL | }
+LL | struct Foo {
+LL ~     q: Option<Box<Baz>>,
+   |
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0072`.
diff --git a/tests/ui/sized/sized-box-unsized-content.rs b/tests/ui/sized/sized-box-unsized-content.rs
new file mode 100644
index 00000000000..9cc202a1582
--- /dev/null
+++ b/tests/ui/sized/sized-box-unsized-content.rs
@@ -0,0 +1,11 @@
+//! Check that `Box<T>` is `Sized`, even when `T` is a dynamically sized type.
+
+//@ run-pass
+
+#![allow(dead_code)]
+
+fn bar<T: Sized>() {}
+fn foo<T>() {
+    bar::<Box<T>>()
+}
+pub fn main() {}
diff --git a/tests/ui/sized/sized-reference-to-unsized.rs b/tests/ui/sized/sized-reference-to-unsized.rs
new file mode 100644
index 00000000000..ac2934d8fe6
--- /dev/null
+++ b/tests/ui/sized/sized-reference-to-unsized.rs
@@ -0,0 +1,11 @@
+//! Check that a reference to a potentially unsized type (`&T`) is itself considered `Sized`.
+
+//@ run-pass
+
+#![allow(dead_code)]
+
+fn bar<T: Sized>() {}
+fn foo<T>() {
+    bar::<&T>()
+}
+pub fn main() {}
diff --git a/tests/ui/stable-addr-of.rs b/tests/ui/stable-addr-of.rs
deleted file mode 100644
index e330a4853ce..00000000000
--- a/tests/ui/stable-addr-of.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-//@ run-pass
-// Issue #2040
-
-
-pub fn main() {
-    let foo: isize = 1;
-    assert_eq!(&foo as *const isize, &foo as *const isize);
-}
diff --git a/tests/ui/paths-containing-nul.rs b/tests/ui/std/fs-nul-byte-paths.rs
index 5c37980127d..79012362347 100644
--- a/tests/ui/paths-containing-nul.rs
+++ b/tests/ui/std/fs-nul-byte-paths.rs
@@ -1,18 +1,22 @@
-//@ run-pass
+//! Test that `std::fs` functions properly reject paths containing NUL bytes.
 
+//@ run-pass
 #![allow(deprecated)]
 //@ ignore-wasm32 no cwd
 //@ ignore-sgx no files
 
-use std::fs;
-use std::io;
+use std::{fs, io};
 
 fn assert_invalid_input<T>(on: &str, result: io::Result<T>) {
     fn inner(on: &str, result: io::Result<()>) {
         match result {
             Ok(()) => panic!("{} didn't return an error on a path with NUL", on),
-            Err(e) => assert!(e.kind() == io::ErrorKind::InvalidInput,
-                              "{} returned a strange {:?} on a path with NUL", on, e.kind()),
+            Err(e) => assert!(
+                e.kind() == io::ErrorKind::InvalidInput,
+                "{} returned a strange {:?} on a path with NUL",
+                on,
+                e.kind()
+            ),
         }
     }
     inner(on, result.map(drop))
@@ -43,6 +47,8 @@ fn main() {
     assert_invalid_input("remove_dir", fs::remove_dir("\0"));
     assert_invalid_input("remove_dir_all", fs::remove_dir_all("\0"));
     assert_invalid_input("read_dir", fs::read_dir("\0"));
-    assert_invalid_input("set_permissions",
-                         fs::set_permissions("\0", fs::metadata(".").unwrap().permissions()));
+    assert_invalid_input(
+        "set_permissions",
+        fs::set_permissions("\0", fs::metadata(".").unwrap().permissions()),
+    );
 }
diff --git a/tests/ui/nul-characters.rs b/tests/ui/str/nul-char-equivalence.rs
index eb83f440d3e..2d4110de681 100644
--- a/tests/ui/nul-characters.rs
+++ b/tests/ui/str/nul-char-equivalence.rs
@@ -1,7 +1,8 @@
+//! Checks that different NUL character representations are equivalent in strings and chars.
+
 //@ run-pass
 
-pub fn main()
-{
+pub fn main() {
     let all_nuls1 = "\0\x00\u{0}\u{0}";
     let all_nuls2 = "\u{0}\u{0}\x00\0";
     let all_nuls3 = "\u{0}\u{0}\x00\0";
@@ -17,11 +18,9 @@ pub fn main()
     assert_eq!(all_nuls3, all_nuls4);
 
     // all extracted characters in all_nuls are equivalent to each other
-    for c1 in all_nuls1.chars()
-    {
-        for c2 in all_nuls1.chars()
-        {
-            assert_eq!(c1,c2);
+    for c1 in all_nuls1.chars() {
+        for c2 in all_nuls1.chars() {
+            assert_eq!(c1, c2);
         }
     }
 
diff --git a/tests/ui/std-uncopyable-atomics.rs b/tests/ui/sync/atomic-types-not-copyable.rs
index d85864ecac2..d96414676ee 100644
--- a/tests/ui/std-uncopyable-atomics.rs
+++ b/tests/ui/sync/atomic-types-not-copyable.rs
@@ -1,8 +1,10 @@
-// Issue #8380
+//! Check that atomic types from `std::sync::atomic` are not `Copy`
+//! and cannot be moved out of a shared reference.
+//!
+//! Regression test for <https://github.com/rust-lang/rust/issues/8380>.
 
-
-use std::sync::atomic::*;
 use std::ptr;
+use std::sync::atomic::*;
 
 fn main() {
     let x = AtomicBool::new(false);
diff --git a/tests/ui/std-uncopyable-atomics.stderr b/tests/ui/sync/atomic-types-not-copyable.stderr
index 8c5d0b96096..05103f5d8f2 100644
--- a/tests/ui/std-uncopyable-atomics.stderr
+++ b/tests/ui/sync/atomic-types-not-copyable.stderr
@@ -1,5 +1,5 @@
 error[E0507]: cannot move out of a shared reference
-  --> $DIR/std-uncopyable-atomics.rs:9:13
+  --> $DIR/atomic-types-not-copyable.rs:11:13
    |
 LL |     let x = *&x;
    |             ^^^ move occurs because value has type `std::sync::atomic::AtomicBool`, which does not implement the `Copy` trait
@@ -11,7 +11,7 @@ LL +     let x = &x;
    |
 
 error[E0507]: cannot move out of a shared reference
-  --> $DIR/std-uncopyable-atomics.rs:11:13
+  --> $DIR/atomic-types-not-copyable.rs:13:13
    |
 LL |     let x = *&x;
    |             ^^^ move occurs because value has type `std::sync::atomic::AtomicIsize`, which does not implement the `Copy` trait
@@ -23,7 +23,7 @@ LL +     let x = &x;
    |
 
 error[E0507]: cannot move out of a shared reference
-  --> $DIR/std-uncopyable-atomics.rs:13:13
+  --> $DIR/atomic-types-not-copyable.rs:15:13
    |
 LL |     let x = *&x;
    |             ^^^ move occurs because value has type `std::sync::atomic::AtomicUsize`, which does not implement the `Copy` trait
@@ -35,7 +35,7 @@ LL +     let x = &x;
    |
 
 error[E0507]: cannot move out of a shared reference
-  --> $DIR/std-uncopyable-atomics.rs:15:13
+  --> $DIR/atomic-types-not-copyable.rs:17:13
    |
 LL |     let x = *&x;
    |             ^^^ move occurs because value has type `std::sync::atomic::AtomicPtr<usize>`, which does not implement the `Copy` trait
diff --git a/tests/ui/sse2.rs b/tests/ui/target-feature/target-feature-detection.rs
index a1894cc03db..3404bfbe782 100644
--- a/tests/ui/sse2.rs
+++ b/tests/ui/target-feature/target-feature-detection.rs
@@ -1,3 +1,6 @@
+//! Check that `cfg!(target_feature = "...")` correctly detects available CPU features,
+//! specifically `sse2` on x86/x86_64 platforms, and correctly reports absent features.
+
 //@ run-pass
 
 #![allow(stable_features)]
@@ -10,17 +13,23 @@ fn main() {
         Ok(s) => {
             // Skip this tests on i586-unknown-linux-gnu where sse2 is disabled
             if s.contains("i586") {
-                return
+                return;
             }
         }
         Err(_) => return,
     }
     if cfg!(any(target_arch = "x86", target_arch = "x86_64")) {
-        assert!(cfg!(target_feature = "sse2"),
-                "SSE2 was not detected as available on an x86 platform");
+        assert!(
+            cfg!(target_feature = "sse2"),
+            "SSE2 was not detected as available on an x86 platform"
+        );
     }
     // check a negative case too -- certainly not enabled by default
     #[expect(unexpected_cfgs)]
-    { assert!(cfg!(not(target_feature = "ferris_wheel")),
-            "🎡 shouldn't be detected as available by default on any platform") };
+    {
+        assert!(
+            cfg!(not(target_feature = "ferris_wheel")),
+            "🎡 shouldn't be detected as available by default on any platform"
+        )
+    };
 }
diff --git a/tests/ui/opt-in-copy.rs b/tests/ui/traits/copy-requires-all-fields-copy.rs
index d0257b5745d..8c829a7382b 100644
--- a/tests/ui/opt-in-copy.rs
+++ b/tests/ui/traits/copy-requires-all-fields-copy.rs
@@ -1,3 +1,5 @@
+//! Test that `Copy` cannot be implemented if any field doesn't implement `Copy`.
+
 struct CantCopyThis;
 
 struct IWantToCopyThis {
diff --git a/tests/ui/opt-in-copy.stderr b/tests/ui/traits/copy-requires-all-fields-copy.stderr
index 258ff16e6e4..1a9e1ada366 100644
--- a/tests/ui/opt-in-copy.stderr
+++ b/tests/ui/traits/copy-requires-all-fields-copy.stderr
@@ -1,5 +1,5 @@
 error[E0204]: the trait `Copy` cannot be implemented for this type
-  --> $DIR/opt-in-copy.rs:7:15
+  --> $DIR/copy-requires-all-fields-copy.rs:9:15
    |
 LL |     but_i_cant: CantCopyThis,
    |     ------------------------ this field does not implement `Copy`
@@ -8,7 +8,7 @@ LL | impl Copy for IWantToCopyThis {}
    |               ^^^^^^^^^^^^^^^
 
 error[E0204]: the trait `Copy` cannot be implemented for this type
-  --> $DIR/opt-in-copy.rs:19:15
+  --> $DIR/copy-requires-all-fields-copy.rs:21:15
    |
 LL |     ButICant(CantCopyThisEither),
    |              ------------------ this field does not implement `Copy`
diff --git a/tests/ui/string-box-error.rs b/tests/ui/traits/error-trait-object-from-string.rs
index 9a7cd81ee04..896f164a04d 100644
--- a/tests/ui/string-box-error.rs
+++ b/tests/ui/traits/error-trait-object-from-string.rs
@@ -1,6 +1,7 @@
+//! Check that `String` and `&str` can be converted into `Box<dyn Error>` and
+//! `Box<dyn Error + Send + Sync>` trait objects
+
 //@ run-pass
-// Ensure that both `Box<dyn Error + Send + Sync>` and `Box<dyn Error>` can be
-// obtained from `String`.
 
 use std::error::Error;
 
diff --git a/tests/ui/traits/next-solver/issue-118950-root-region.stderr b/tests/ui/traits/next-solver/issue-118950-root-region.stderr
index 391272b8d3b..ce4f742a3fa 100644
--- a/tests/ui/traits/next-solver/issue-118950-root-region.stderr
+++ b/tests/ui/traits/next-solver/issue-118950-root-region.stderr
@@ -25,7 +25,7 @@ help: this trait has no implementations, consider adding one
 LL | trait ToUnit<'a> {
    | ^^^^^^^^^^^^^^^^
 
- WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), "'a"), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc), .. }
+ WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: ['^0.Named(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a)), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc), .. }
 error[E0277]: the trait bound `for<'a> *const T: ToUnit<'a>` is not satisfied
   --> $DIR/issue-118950-root-region.rs:19:9
    |
diff --git a/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.bad.stderr b/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.bad.stderr
index 7dd383b1e7a..d51927aaa34 100644
--- a/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.bad.stderr
+++ b/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.bad.stderr
@@ -7,19 +7,19 @@ LL | #![feature(non_lifetime_binders)]
    = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
    = note: `#[warn(incomplete_features)]` on by default
 
-error[E0310]: the placeholder type `!1_"T"` may not live long enough
+error[E0310]: the placeholder type `T` may not live long enough
   --> $DIR/placeholders-dont-outlive-static.rs:13:5
    |
 LL |     foo();
    |     ^^^^^
    |     |
-   |     the placeholder type `!1_"T"` must be valid for the static lifetime...
+   |     the placeholder type `T` must be valid for the static lifetime...
    |     ...so that the type `T` will meet its required lifetime bounds
    |
 help: consider adding an explicit lifetime bound
    |
-LL | fn bad() where !1_"T": 'static {
-   |          +++++++++++++++++++++
+LL | fn bad() where T: 'static {
+   |          ++++++++++++++++
 
 error: aborting due to 1 previous error; 1 warning emitted
 
diff --git a/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.good.stderr b/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.good.stderr
index b4f00978ada..bc1a1992399 100644
--- a/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.good.stderr
+++ b/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.good.stderr
@@ -7,19 +7,19 @@ LL | #![feature(non_lifetime_binders)]
    = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
    = note: `#[warn(incomplete_features)]` on by default
 
-error[E0310]: the placeholder type `!1_"T"` may not live long enough
+error[E0310]: the placeholder type `T` may not live long enough
   --> $DIR/placeholders-dont-outlive-static.rs:19:5
    |
 LL |     foo();
    |     ^^^^^
    |     |
-   |     the placeholder type `!1_"T"` must be valid for the static lifetime...
+   |     the placeholder type `T` must be valid for the static lifetime...
    |     ...so that the type `T` will meet its required lifetime bounds
    |
 help: consider adding an explicit lifetime bound
    |
-LL | fn good() where for<T> T: 'static, !1_"T": 'static {
-   |                                  +++++++++++++++++
+LL | fn good() where for<T> T: 'static, T: 'static {
+   |                                  ++++++++++++
 
 error: aborting due to 1 previous error; 1 warning emitted
 
diff --git a/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.rs b/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.rs
index e87863ab251..3133d6aeedc 100644
--- a/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.rs
+++ b/tests/ui/traits/non_lifetime_binders/placeholders-dont-outlive-static.rs
@@ -11,7 +11,7 @@ fn foo() where for<T> T: 'static {}
 #[cfg(bad)]
 fn bad() {
     foo();
-    //[bad]~^ ERROR the placeholder type `!1_"T"` may not live long enough
+    //[bad]~^ ERROR the placeholder type `T` may not live long enough
 }
 
 #[cfg(good)]
diff --git a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr
index 9d54675c260..15902bf16de 100644
--- a/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr
+++ b/tests/ui/traits/non_lifetime_binders/type-match-with-late-bound.stderr
@@ -7,11 +7,11 @@ LL | #![feature(non_lifetime_binders)]
    = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
    = note: `#[warn(incomplete_features)]` on by default
 
-error[E0309]: the placeholder type `!1_"F"` may not live long enough
+error[E0309]: the placeholder type `F` may not live long enough
   --> $DIR/type-match-with-late-bound.rs:8:1
    |
 LL |   async fn walk2<'a, T: 'a>(_: T)
-   |   ^              -- the placeholder type `!1_"F"` must be valid for the lifetime `'a` as defined here...
+   |   ^              -- the placeholder type `F` must be valid for the lifetime `'a` as defined here...
    |  _|
    | |
 LL | | where
@@ -25,36 +25,37 @@ LL |     for<F> F: 'a,
    |               ^^
 help: consider adding an explicit lifetime bound
    |
-LL |     for<F> F: 'a, !1_"F": 'a
-   |                   ++++++++++
+LL |     for<F> F: 'a, F: 'a
+   |                   +++++
 
-error[E0309]: the placeholder type `!1_"F"` may not live long enough
+error[E0309]: the placeholder type `F` may not live long enough
   --> $DIR/type-match-with-late-bound.rs:11:1
    |
 LL | async fn walk2<'a, T: 'a>(_: T)
-   |                -- the placeholder type `!1_"F"` must be valid for the lifetime `'a` as defined here...
+   |                -- the placeholder type `F` must be valid for the lifetime `'a` as defined here...
 ...
 LL | {}
    | ^^ ...so that the type `F` will meet its required lifetime bounds
    |
 help: consider adding an explicit lifetime bound
    |
-LL |     for<F> F: 'a, !1_"F": 'a
-   |                   ++++++++++
+LL |     for<F> F: 'a, F: 'a
+   |                   +++++
 
-error[E0309]: the placeholder type `!2_"F"` may not live long enough
+error[E0309]: the placeholder type `F` may not live long enough
   --> $DIR/type-match-with-late-bound.rs:11:1
    |
 LL | async fn walk2<'a, T: 'a>(_: T)
-   |                -- the placeholder type `!2_"F"` must be valid for the lifetime `'a` as defined here...
+   |                -- the placeholder type `F` must be valid for the lifetime `'a` as defined here...
 ...
 LL | {}
    | ^^ ...so that the type `F` will meet its required lifetime bounds
    |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 help: consider adding an explicit lifetime bound
    |
-LL |     for<F> F: 'a, !2_"F": 'a
-   |                   ++++++++++
+LL |     for<F> F: 'a, F: 'a
+   |                   +++++
 
 error: aborting due to 3 previous errors; 1 warning emitted
 
diff --git a/tests/ui/object-pointer-types.rs b/tests/ui/traits/trait-object-method-receiver-rules.rs
index 760a50e5b79..383e59c131a 100644
--- a/tests/ui/object-pointer-types.rs
+++ b/tests/ui/traits/trait-object-method-receiver-rules.rs
@@ -1,7 +1,8 @@
+//! Checks that method availability rules for trait objects depend on receiver type.
+
 trait Foo {
     fn borrowed(&self);
     fn borrowed_mut(&mut self);
-
     fn owned(self: Box<Self>);
 }
 
@@ -20,7 +21,7 @@ fn borrowed_mut_receiver(x: &mut dyn Foo) {
 fn owned_receiver(x: Box<dyn Foo>) {
     x.borrowed();
     x.borrowed_mut(); // See [1]
-    x.managed();  //~ ERROR no method named `managed` found
+    x.managed(); //~ ERROR no method named `managed` found
     x.owned();
 }
 
diff --git a/tests/ui/object-pointer-types.stderr b/tests/ui/traits/trait-object-method-receiver-rules.stderr
index 72b290f2ad9..83b61a2e6b5 100644
--- a/tests/ui/object-pointer-types.stderr
+++ b/tests/ui/traits/trait-object-method-receiver-rules.stderr
@@ -1,5 +1,5 @@
 error[E0599]: no method named `owned` found for reference `&dyn Foo` in the current scope
-  --> $DIR/object-pointer-types.rs:11:7
+  --> $DIR/trait-object-method-receiver-rules.rs:12:7
    |
 LL |     fn owned(self: Box<Self>);
    |                    --------- the method might not be found because of this arbitrary self type
@@ -13,7 +13,7 @@ LL |     x.to_owned();
    |       +++
 
 error[E0599]: no method named `owned` found for mutable reference `&mut dyn Foo` in the current scope
-  --> $DIR/object-pointer-types.rs:17:7
+  --> $DIR/trait-object-method-receiver-rules.rs:18:7
    |
 LL |     fn owned(self: Box<Self>);
    |                    --------- the method might not be found because of this arbitrary self type
@@ -22,7 +22,7 @@ LL |     x.owned();
    |       ^^^^^ method not found in `&mut dyn Foo`
 
 error[E0599]: no method named `managed` found for struct `Box<(dyn Foo + 'static)>` in the current scope
-  --> $DIR/object-pointer-types.rs:23:7
+  --> $DIR/trait-object-method-receiver-rules.rs:24:7
    |
 LL |     x.managed();
    |       ^^^^^^^ method not found in `Box<(dyn Foo + 'static)>`
diff --git a/tests/ui/objects-coerce-freeze-borrored.rs b/tests/ui/traits/trait-object-mut-to-shared-coercion.rs
index e122bb99380..26b5cc6d2df 100644
--- a/tests/ui/objects-coerce-freeze-borrored.rs
+++ b/tests/ui/traits/trait-object-mut-to-shared-coercion.rs
@@ -1,6 +1,6 @@
-//@ run-pass
-// Test that we can coerce an `@Object` to an `&Object`
+//! Tests that coercion from `&mut dyn Trait` to `&dyn Trait` works correctly.
 
+//@ run-pass
 
 trait Foo {
     fn foo(&self) -> usize;
diff --git a/tests/ui/type-inference/direct-self-reference-occurs-check.rs b/tests/ui/type-inference/direct-self-reference-occurs-check.rs
new file mode 100644
index 00000000000..6e3d8251fc4
--- /dev/null
+++ b/tests/ui/type-inference/direct-self-reference-occurs-check.rs
@@ -0,0 +1,9 @@
+//! Test that occurs check prevents direct self-reference in variable assignment.
+//!
+//! Regression test for <https://github.com/rust-lang/rust/issues/768>.
+
+fn main() {
+    let f;
+    f = Box::new(f);
+    //~^ ERROR overflow assigning `Box<_>` to `_`
+}
diff --git a/tests/ui/occurs-check.stderr b/tests/ui/type-inference/direct-self-reference-occurs-check.stderr
index ea7c541abc1..6c522ffac1f 100644
--- a/tests/ui/occurs-check.stderr
+++ b/tests/ui/type-inference/direct-self-reference-occurs-check.stderr
@@ -1,5 +1,5 @@
 error[E0275]: overflow assigning `Box<_>` to `_`
-  --> $DIR/occurs-check.rs:3:18
+  --> $DIR/direct-self-reference-occurs-check.rs:7:18
    |
 LL |     f = Box::new(f);
    |                  ^
diff --git a/tests/ui/type-inference/enum-self-reference-occurs-check.rs b/tests/ui/type-inference/enum-self-reference-occurs-check.rs
new file mode 100644
index 00000000000..2905868b8bf
--- /dev/null
+++ b/tests/ui/type-inference/enum-self-reference-occurs-check.rs
@@ -0,0 +1,16 @@
+//! Test that occurs check prevents infinite types with enum self-references.
+//!
+//! Regression test for <https://github.com/rust-lang/rust/issues/778>.
+
+enum Clam<T> {
+    A(T),
+}
+
+fn main() {
+    let c;
+    c = Clam::A(c);
+    //~^ ERROR overflow assigning `Clam<_>` to `_`
+    match c {
+        Clam::A::<isize>(_) => {}
+    }
+}
diff --git a/tests/ui/occurs-check-3.stderr b/tests/ui/type-inference/enum-self-reference-occurs-check.stderr
index eb05c94957c..3239be51a17 100644
--- a/tests/ui/occurs-check-3.stderr
+++ b/tests/ui/type-inference/enum-self-reference-occurs-check.stderr
@@ -1,5 +1,5 @@
 error[E0275]: overflow assigning `Clam<_>` to `_`
-  --> $DIR/occurs-check-3.rs:6:17
+  --> $DIR/enum-self-reference-occurs-check.rs:11:17
    |
 LL |     c = Clam::A(c);
    |                 ^
diff --git a/tests/ui/type-inference/infinite-type-occurs-check.rs b/tests/ui/type-inference/infinite-type-occurs-check.rs
new file mode 100644
index 00000000000..b353824e931
--- /dev/null
+++ b/tests/ui/type-inference/infinite-type-occurs-check.rs
@@ -0,0 +1,12 @@
+//! Test that occurs check prevents infinite types during type inference.
+//!
+//! Regression test for <https://github.com/rust-lang/rust/issues/768>.
+
+fn main() {
+    let f;
+    let g;
+
+    g = f;
+    //~^ ERROR overflow assigning `Box<_>` to `_`
+    f = Box::new(g);
+}
diff --git a/tests/ui/occurs-check-2.stderr b/tests/ui/type-inference/infinite-type-occurs-check.stderr
index 5f296967f30..9cb8bb91796 100644
--- a/tests/ui/occurs-check-2.stderr
+++ b/tests/ui/type-inference/infinite-type-occurs-check.stderr
@@ -1,5 +1,5 @@
 error[E0275]: overflow assigning `Box<_>` to `_`
-  --> $DIR/occurs-check-2.rs:6:9
+  --> $DIR/infinite-type-occurs-check.rs:9:9
    |
 LL |     g = f;
    |         ^
diff --git a/tests/ui/type/inherent-impl-primitive-types-error.rs b/tests/ui/type/inherent-impl-primitive-types-error.rs
new file mode 100644
index 00000000000..88b8b9da56b
--- /dev/null
+++ b/tests/ui/type/inherent-impl-primitive-types-error.rs
@@ -0,0 +1,28 @@
+//! Test that inherent impl blocks cannot be defined for primitive types
+
+impl u8 {
+    //~^ ERROR: cannot define inherent `impl` for primitive types
+    pub const B: u8 = 0;
+}
+
+impl str {
+    //~^ ERROR: cannot define inherent `impl` for primitive types
+    fn foo() {}
+    fn bar(self) {} //~ ERROR: size for values of type `str` cannot be known
+}
+
+impl char {
+    //~^ ERROR: cannot define inherent `impl` for primitive types
+    pub const B: u8 = 0;
+    pub const C: u8 = 0;
+    fn foo() {}
+    fn bar(self) {}
+}
+
+struct MyType;
+impl &MyType {
+    //~^ ERROR: cannot define inherent `impl` for primitive types
+    pub fn for_ref(self) {}
+}
+
+fn main() {}
diff --git a/tests/ui/kinds-of-primitive-impl.stderr b/tests/ui/type/inherent-impl-primitive-types-error.stderr
index 1c8c417e88c..5b79521a35e 100644
--- a/tests/ui/kinds-of-primitive-impl.stderr
+++ b/tests/ui/type/inherent-impl-primitive-types-error.stderr
@@ -1,5 +1,5 @@
 error[E0390]: cannot define inherent `impl` for primitive types
-  --> $DIR/kinds-of-primitive-impl.rs:1:1
+  --> $DIR/inherent-impl-primitive-types-error.rs:3:1
    |
 LL | impl u8 {
    | ^^^^^^^
@@ -7,7 +7,7 @@ LL | impl u8 {
    = help: consider using an extension trait instead
 
 error[E0390]: cannot define inherent `impl` for primitive types
-  --> $DIR/kinds-of-primitive-impl.rs:6:1
+  --> $DIR/inherent-impl-primitive-types-error.rs:8:1
    |
 LL | impl str {
    | ^^^^^^^^
@@ -15,7 +15,7 @@ LL | impl str {
    = help: consider using an extension trait instead
 
 error[E0390]: cannot define inherent `impl` for primitive types
-  --> $DIR/kinds-of-primitive-impl.rs:12:1
+  --> $DIR/inherent-impl-primitive-types-error.rs:14:1
    |
 LL | impl char {
    | ^^^^^^^^^
@@ -23,7 +23,7 @@ LL | impl char {
    = help: consider using an extension trait instead
 
 error[E0390]: cannot define inherent `impl` for primitive types
-  --> $DIR/kinds-of-primitive-impl.rs:21:1
+  --> $DIR/inherent-impl-primitive-types-error.rs:23:1
    |
 LL | impl &MyType {
    | ^^^^^^^^^^^^
@@ -32,7 +32,7 @@ LL | impl &MyType {
    = note: you could also try moving the reference to uses of `MyType` (such as `self`) within the implementation
 
 error[E0277]: the size for values of type `str` cannot be known at compilation time
-  --> $DIR/kinds-of-primitive-impl.rs:9:12
+  --> $DIR/inherent-impl-primitive-types-error.rs:11:12
    |
 LL |     fn bar(self) {}
    |            ^^^^ doesn't have a size known at compile-time
diff --git a/tests/ui/type/mutually-recursive-types.rs b/tests/ui/type/mutually-recursive-types.rs
new file mode 100644
index 00000000000..5472e158221
--- /dev/null
+++ b/tests/ui/type/mutually-recursive-types.rs
@@ -0,0 +1,47 @@
+//! Test that mutually recursive type definitions are properly handled by the compiler.
+//! This checks that types can reference each other in their definitions through
+//! `Box` indirection, creating cycles in the type dependency graph.
+
+//@ run-pass
+
+#[derive(Debug, PartialEq)]
+enum Colour {
+    Red,
+    Green,
+    Blue,
+}
+
+#[derive(Debug, PartialEq)]
+enum Tree {
+    Children(Box<List>),
+    Leaf(Colour),
+}
+
+#[derive(Debug, PartialEq)]
+enum List {
+    Cons(Box<Tree>, Box<List>),
+    Nil,
+}
+
+#[derive(Debug, PartialEq)]
+enum SmallList {
+    Kons(isize, Box<SmallList>),
+    Neel,
+}
+
+pub fn main() {
+    // Construct and test all variants of Colour
+    let _ = Tree::Leaf(Colour::Red);
+
+    let _ = Tree::Leaf(Colour::Green);
+
+    let _ = Tree::Leaf(Colour::Blue);
+
+    let _ = List::Nil;
+
+    let _ = Tree::Children(Box::new(List::Nil));
+
+    let _ = List::Cons(Box::new(Tree::Leaf(Colour::Blue)), Box::new(List::Nil));
+
+    let _ = SmallList::Kons(42, Box::new(SmallList::Neel));
+}
diff --git a/tests/ui/typeck/nested-generic-traits-performance.rs b/tests/ui/typeck/nested-generic-traits-performance.rs
new file mode 100644
index 00000000000..e029228c1b2
--- /dev/null
+++ b/tests/ui/typeck/nested-generic-traits-performance.rs
@@ -0,0 +1,82 @@
+//! Test that deeply nested generic traits with complex bounds
+//! don't cause excessive memory usage during type checking.
+//!
+//! Regression test for <https://github.com/rust-lang/rust/issues/31849>.
+
+//@ run-pass
+
+pub trait Upcast<T> {
+    fn upcast(self) -> T;
+}
+
+impl<S1, S2, T1, T2> Upcast<(T1, T2)> for (S1, S2)
+where
+    S1: Upcast<T1>,
+    S2: Upcast<T2>,
+{
+    fn upcast(self) -> (T1, T2) {
+        (self.0.upcast(), self.1.upcast())
+    }
+}
+
+impl Upcast<()> for () {
+    fn upcast(self) -> () {
+        ()
+    }
+}
+
+pub trait ToStatic {
+    type Static: 'static;
+    fn to_static(self) -> Self::Static
+    where
+        Self: Sized;
+}
+
+impl<T, U> ToStatic for (T, U)
+where
+    T: ToStatic,
+    U: ToStatic,
+{
+    type Static = (T::Static, U::Static);
+    fn to_static(self) -> Self::Static {
+        (self.0.to_static(), self.1.to_static())
+    }
+}
+
+impl ToStatic for () {
+    type Static = ();
+    fn to_static(self) -> () {
+        ()
+    }
+}
+
+trait Factory {
+    type Output;
+    fn build(&self) -> Self::Output;
+}
+
+impl<S, T> Factory for (S, T)
+where
+    S: Factory,
+    T: Factory,
+    S::Output: ToStatic,
+    <S::Output as ToStatic>::Static: Upcast<S::Output>,
+{
+    type Output = (S::Output, T::Output);
+    fn build(&self) -> Self::Output {
+        (self.0.build().to_static().upcast(), self.1.build())
+    }
+}
+
+impl Factory for () {
+    type Output = ();
+    fn build(&self) -> Self::Output {
+        ()
+    }
+}
+
+fn main() {
+    // Deeply nested tuple to trigger the original performance issue
+    let it = ((((((((((), ()), ()), ()), ()), ()), ()), ()), ()), ());
+    it.build();
+}
diff --git a/tests/ui/uninhabited/uninhabited-patterns.rs b/tests/ui/uninhabited/uninhabited-patterns.rs
index b7429464fa5..1f30af2acc6 100644
--- a/tests/ui/uninhabited/uninhabited-patterns.rs
+++ b/tests/ui/uninhabited/uninhabited-patterns.rs
@@ -27,7 +27,11 @@ fn main() {
 
     let x: Result<Box<NotSoSecretlyEmpty>, &[Result<!, !>]> = Err(&[]);
     match x {
-        Ok(box _) => (), //~ ERROR unreachable pattern
+        Ok(box _) => (), // We'd get a non-exhaustiveness error if this arm was removed; don't lint.
+        Err(&[]) => (),
+        Err(&[..]) => (),
+    }
+    match x { //~ ERROR non-exhaustive patterns
         Err(&[]) => (),
         Err(&[..]) => (),
     }
diff --git a/tests/ui/uninhabited/uninhabited-patterns.stderr b/tests/ui/uninhabited/uninhabited-patterns.stderr
index 7a872767d95..62113c82a36 100644
--- a/tests/ui/uninhabited/uninhabited-patterns.stderr
+++ b/tests/ui/uninhabited/uninhabited-patterns.stderr
@@ -1,21 +1,23 @@
-error: unreachable pattern
-  --> $DIR/uninhabited-patterns.rs:30:9
+error[E0004]: non-exhaustive patterns: `Ok(_)` not covered
+  --> $DIR/uninhabited-patterns.rs:34:11
    |
-LL |         Ok(box _) => (),
-   |         ^^^^^^^^^-------
-   |         |
-   |         matches no values because `NotSoSecretlyEmpty` is uninhabited
-   |         help: remove the match arm
+LL |     match x {
+   |           ^ pattern `Ok(_)` not covered
    |
-   = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
-note: the lint level is defined here
-  --> $DIR/uninhabited-patterns.rs:4:9
+note: `Result<Box<NotSoSecretlyEmpty>, &[Result<!, !>]>` defined here
+  --> $SRC_DIR/core/src/result.rs:LL:COL
+  ::: $SRC_DIR/core/src/result.rs:LL:COL
+   |
+   = note: not covered
+   = note: the matched value is of type `Result<Box<NotSoSecretlyEmpty>, &[Result<!, !>]>`
+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 ~         Err(&[..]) => (),
+LL ~         Ok(_) => todo!(),
    |
-LL | #![deny(unreachable_patterns)]
-   |         ^^^^^^^^^^^^^^^^^^^^
 
 error: unreachable pattern
-  --> $DIR/uninhabited-patterns.rs:39:9
+  --> $DIR/uninhabited-patterns.rs:43:9
    |
 LL |         Err(Ok(_y)) => (),
    |         ^^^^^^^^^^^-------
@@ -24,9 +26,14 @@ LL |         Err(Ok(_y)) => (),
    |         help: remove the match arm
    |
    = note: to learn more about uninhabited types, see https://doc.rust-lang.org/nomicon/exotic-sizes.html#empty-types
+note: the lint level is defined here
+  --> $DIR/uninhabited-patterns.rs:4:9
+   |
+LL | #![deny(unreachable_patterns)]
+   |         ^^^^^^^^^^^^^^^^^^^^
 
 error: unreachable pattern
-  --> $DIR/uninhabited-patterns.rs:42:15
+  --> $DIR/uninhabited-patterns.rs:46:15
    |
 LL |     while let Some(_y) = foo() {
    |               ^^^^^^^^ matches no values because `NotSoSecretlyEmpty` is uninhabited
@@ -35,3 +42,4 @@ LL |     while let Some(_y) = foo() {
 
 error: aborting due to 3 previous errors
 
+For more information about this error, try `rustc --explain E0004`.
diff --git a/tests/ui/unpretty/deprecated-attr.stdout b/tests/ui/unpretty/deprecated-attr.stdout
index a2b645d00d0..042c2f61bd4 100644
--- a/tests/ui/unpretty/deprecated-attr.stdout
+++ b/tests/ui/unpretty/deprecated-attr.stdout
@@ -9,12 +9,12 @@ extern crate std;
 #[attr = Deprecation {deprecation: Deprecation {since: Unspecified}}]
 struct PlainDeprecated;
 
-#[attr = Deprecation {deprecation: Deprecation {since: Unspecified, note:
-"here's why this is deprecated"}}]
+#[attr = Deprecation {deprecation: Deprecation {since: Unspecified,
+note: "here's why this is deprecated"}}]
 struct DirectNote;
 
-#[attr = Deprecation {deprecation: Deprecation {since: Unspecified, note:
-"here's why this is deprecated"}}]
+#[attr = Deprecation {deprecation: Deprecation {since: Unspecified,
+note: "here's why this is deprecated"}}]
 struct ExplicitNote;
 
 #[attr = Deprecation {deprecation: Deprecation {since: NonStandard("1.2.3"),
@@ -28,8 +28,6 @@ struct FlippedOrder;
 fn f() {
 
     // Attribute is ignored here (with a warning), but still preserved in HIR
-    #[attr = Deprecation {deprecation:
-    Deprecation {since:
-    Unspecified}}]
+    #[attr = Deprecation {deprecation: Deprecation {since: Unspecified}}]
     0
 }
diff --git a/tests/ui/unpretty/exhaustive.hir.stdout b/tests/ui/unpretty/exhaustive.hir.stdout
index 2b8f3b21396..a559d51ed5d 100644
--- a/tests/ui/unpretty/exhaustive.hir.stdout
+++ b/tests/ui/unpretty/exhaustive.hir.stdout
@@ -64,7 +64,7 @@ mod attributes {
     #[doc = "outer doc attribute"]
     #[doc = "macro"]
     #[allow()]
-    #[attr = Repr([ReprC])]
+    #[attr = Repr {reprs: [ReprC]}]
     struct Struct;
 }
 
diff --git a/tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr b/tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr
index 0d8ec5f8928..89a91a1f1ad 100644
--- a/tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr
+++ b/tests/ui/where-clauses/higher-ranked-fn-type.verbose.stderr
@@ -1,10 +1,10 @@
-error[E0277]: the trait bound `for<Region(BrNamed(DefId(0:6 ~ higher_ranked_fn_type[9e51]::called::'b), 'b))> fn(&'^1_0.Named(DefId(0:6 ~ higher_ranked_fn_type[9e51]::called::'b), "'b") ()): Foo` is not satisfied
+error[E0277]: the trait bound `for<Region(BrNamed(DefId(0:6 ~ higher_ranked_fn_type[9e51]::called::'b)))> fn(&'^1_0.Named(DefId(0:6 ~ higher_ranked_fn_type[9e51]::called::'b)) ()): Foo` is not satisfied
   --> $DIR/higher-ranked-fn-type.rs:20:5
    |
 LL |     called()
    |     ^^^^^^^^ unsatisfied trait bound
    |
-   = help: the trait `for<Region(BrNamed(DefId(0:6 ~ higher_ranked_fn_type[9e51]::called::'b), 'b))> Foo` is not implemented for `fn(&'^1_0.Named(DefId(0:6 ~ higher_ranked_fn_type[9e51]::called::'b), "'b") ())`
+   = help: the trait `for<Region(BrNamed(DefId(0:6 ~ higher_ranked_fn_type[9e51]::called::'b)))> Foo` is not implemented for `fn(&'^1_0.Named(DefId(0:6 ~ higher_ranked_fn_type[9e51]::called::'b)) ())`
 help: this trait has no implementations, consider adding one
   --> $DIR/higher-ranked-fn-type.rs:6:1
    |