about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/associated-consts/equality-unused-issue-126729.rs44
-rw-r--r--tests/ui/auxiliary/svh-a-base.rs25
-rw-r--r--tests/ui/auxiliary/svh-b.rs13
-rw-r--r--tests/ui/borrowck/super-let-lifetime-and-drop.borrowck.stderr (renamed from tests/ui/super-let.borrowck.stderr)26
-rw-r--r--tests/ui/borrowck/super-let-lifetime-and-drop.rs (renamed from tests/ui/super-let.rs)0
-rw-r--r--tests/ui/cast/cast-enum-to-primitive-error.fixed (renamed from tests/ui/tag-variant-cast-non-nullary.fixed)9
-rw-r--r--tests/ui/cast/cast-enum-to-primitive-error.rs (renamed from tests/ui/tag-variant-cast-non-nullary.rs)9
-rw-r--r--tests/ui/cast/cast-enum-to-primitive-error.stderr (renamed from tests/ui/tag-variant-cast-non-nullary.stderr)2
-rw-r--r--tests/ui/cast/coercion-as-explicit-cast.rs (renamed from tests/ui/trivial_casts-rpass.rs)4
-rw-r--r--tests/ui/cast/coercion-as-explicit-cast.stderr (renamed from tests/ui/trivial_casts-rpass.stderr)2
-rw-r--r--tests/ui/const-generics/cross_crate_complex.rs1
-rw-r--r--tests/ui/generic-associated-types/missing-bounds.fixed2
-rw-r--r--tests/ui/generic-associated-types/missing-bounds.rs2
-rw-r--r--tests/ui/generic-associated-types/missing-bounds.stderr18
-rw-r--r--tests/ui/generics/generic-enum-errors.rs15
-rw-r--r--tests/ui/generics/generic-enum-errors.stderr (renamed from tests/ui/tag-type-args.stderr)14
-rw-r--r--tests/ui/lint/dead-code/unused-trait-with-assoc-const.rs13
-rw-r--r--tests/ui/lint/dead-code/unused-trait-with-assoc-const.stderr20
-rw-r--r--tests/ui/lint/dead-code/unused-trait-with-assoc-ty.rs11
-rw-r--r--tests/ui/lint/dead-code/unused-trait-with-assoc-ty.stderr20
-rw-r--r--tests/ui/modules/module-super-access.rs16
-rw-r--r--tests/ui/modules/super-at-crate-root.rs6
-rw-r--r--tests/ui/modules/super-at-crate-root.stderr (renamed from tests/ui/super-at-top-level.stderr)2
-rw-r--r--tests/ui/parser/syntactic-trailing-commas.rs (renamed from tests/ui/trailing-comma.rs)8
-rw-r--r--tests/ui/pattern/issue-22546.rs2
-rw-r--r--tests/ui/pattern/issue-22546.stderr10
-rw-r--r--tests/ui/ptr_ops/ptr-swap-basic.rs14
-rw-r--r--tests/ui/ptr_ops/ptr-swap-overlapping-regions.rs (renamed from tests/ui/swap-overlapping.rs)16
-rw-r--r--tests/ui/recursion/recursion-tail-call-no-arg-leak.rs15
-rw-r--r--tests/ui/recursion/recursion-tail-cps.rs34
-rw-r--r--tests/ui/specialization/issue-111232.rs9
-rw-r--r--tests/ui/specialization/issue-111232.stderr9
-rw-r--r--tests/ui/super-at-top-level.rs4
-rw-r--r--tests/ui/super.rs15
-rw-r--r--tests/ui/svh-add-nothing.rs13
-rw-r--r--tests/ui/svh/svh-no-api-change-no-recompile.rs20
-rw-r--r--tests/ui/swap-1.rs10
-rw-r--r--tests/ui/switched-expectations.rs4
-rw-r--r--tests/ui/tag-type-args.rs6
-rw-r--r--tests/ui/tail-call-arg-leak.rs8
-rw-r--r--tests/ui/tail-cps.rs17
-rw-r--r--tests/ui/tail-typeck.rs5
-rw-r--r--tests/ui/tail-typeck.stderr16
-rw-r--r--tests/ui/trait-method-number-parameters.rs13
-rw-r--r--tests/ui/traits/const-traits/non-const-op-in-closure-in-const.rs4
-rw-r--r--tests/ui/traits/const-traits/non-const-op-in-closure-in-const.stderr30
-rw-r--r--tests/ui/traits/trait-method-signature-mismatch.rs18
-rw-r--r--tests/ui/traits/trait-method-signature-mismatch.stderr (renamed from tests/ui/trait-method-number-parameters.stderr)2
-rw-r--r--tests/ui/traits/tryfrominterror-result-comparison.rs19
-rw-r--r--tests/ui/transmute-non-immediate-to-immediate.rs10
-rw-r--r--tests/ui/transmute/transmute-array-to-scalar.rs14
-rw-r--r--tests/ui/transmute/transmute-same-associated-type.rs (renamed from tests/ui/transmute-equal-assoc-types.rs)2
-rw-r--r--tests/ui/try-from-int-error-partial-eq.rs12
-rw-r--r--tests/ui/typeck/mismatched-types-ref-binding.rs8
-rw-r--r--tests/ui/typeck/mismatched-types-ref-binding.stderr (renamed from tests/ui/switched-expectations.stderr)2
-rw-r--r--tests/ui/typeck/tail-return-type-mismatch.rs14
-rw-r--r--tests/ui/typeck/tail-return-type-mismatch.stderr16
57 files changed, 411 insertions, 262 deletions
diff --git a/tests/ui/associated-consts/equality-unused-issue-126729.rs b/tests/ui/associated-consts/equality-unused-issue-126729.rs
new file mode 100644
index 00000000000..1482b874b9d
--- /dev/null
+++ b/tests/ui/associated-consts/equality-unused-issue-126729.rs
@@ -0,0 +1,44 @@
+//@ check-pass
+
+#![feature(associated_const_equality)]
+#![deny(dead_code)]
+
+trait Tr {
+    const I: i32;
+}
+
+impl Tr for () {
+    const I: i32 = 1;
+}
+
+fn foo() -> impl Tr<I = 1> {}
+
+trait Tr2 {
+    const J: i32;
+    const K: i32;
+}
+
+impl Tr2 for () {
+    const J: i32 = 1;
+    const K: i32 = 1;
+}
+
+fn foo2() -> impl Tr2<J = 1, K = 1> {}
+
+mod t {
+    pub trait Tr3 {
+        const L: i32;
+    }
+
+    impl Tr3 for () {
+        const L: i32 = 1;
+    }
+}
+
+fn foo3() -> impl t::Tr3<L = 1> {}
+
+fn main() {
+    foo();
+    foo2();
+    foo3();
+}
diff --git a/tests/ui/auxiliary/svh-a-base.rs b/tests/ui/auxiliary/svh-a-base.rs
deleted file mode 100644
index 36b41fc818f..00000000000
--- a/tests/ui/auxiliary/svh-a-base.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-//! The `svh-a-*.rs` files are all deviations from the base file
-//! svh-a-base.rs with some difference (usually in `fn foo`) that
-//! should not affect the strict version hash (SVH) computation
-//! (#14132).
-
-#![crate_name = "a"]
-
-macro_rules! three {
-    () => { 3 }
-}
-
-pub trait U {}
-pub trait V {}
-impl U for () {}
-impl V for () {}
-
-static A_CONSTANT : isize = 2;
-
-pub fn foo<T:U>(_: isize) -> isize {
-    3
-}
-
-pub fn an_unused_name() -> isize {
-    4
-}
diff --git a/tests/ui/auxiliary/svh-b.rs b/tests/ui/auxiliary/svh-b.rs
deleted file mode 100644
index 57029f70888..00000000000
--- a/tests/ui/auxiliary/svh-b.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-//! This is a client of the `a` crate defined in `svn-a-base.rs`. The
-//! rpass and cfail tests (such as `run-pass/svh-add-comment.rs`) use
-//! it by swapping in a different object code library crate built from
-//! some variant of `svn-a-base.rs`, and then we are checking if the
-//! compiler properly ignores or accepts the change, based on whether
-//! the change could affect the downstream crate content or not
-//! (#14132).
-
-#![crate_name = "b"]
-
-extern crate a;
-
-pub fn foo() { assert_eq!(a::foo::<()>(0), 3); }
diff --git a/tests/ui/super-let.borrowck.stderr b/tests/ui/borrowck/super-let-lifetime-and-drop.borrowck.stderr
index 01ef29d8758..7fe0b47ed57 100644
--- a/tests/ui/super-let.borrowck.stderr
+++ b/tests/ui/borrowck/super-let-lifetime-and-drop.borrowck.stderr
@@ -1,5 +1,5 @@
 error[E0506]: cannot assign to `x` because it is borrowed
-  --> $DIR/super-let.rs:30:28
+  --> $DIR/super-let-lifetime-and-drop.rs:30:28
    |
 LL |             super let b = DropMe(&mut x);
    |                                  ------ `x` is borrowed here
@@ -11,7 +11,7 @@ LL |     }
    |     - borrow might be used here, when `b` is dropped and runs the `Drop` code for type `DropMe`
 
 error[E0506]: cannot assign to `x` because it is borrowed
-  --> $DIR/super-let.rs:46:28
+  --> $DIR/super-let-lifetime-and-drop.rs:46:28
    |
 LL |             super let b = &DropMe(&mut x);
    |                            --------------
@@ -26,7 +26,7 @@ LL |     }
    |     - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `DropMe`
 
 error[E0506]: cannot assign to `x` because it is borrowed
-  --> $DIR/super-let.rs:64:32
+  --> $DIR/super-let-lifetime-and-drop.rs:64:32
    |
 LL |             super let b = identity(&DropMe(&mut x));
    |                                     --------------
@@ -40,7 +40,7 @@ LL |         };
    |          - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `DropMe`
 
 error[E0506]: cannot assign to `x` because it is borrowed
-  --> $DIR/super-let.rs:87:36
+  --> $DIR/super-let-lifetime-and-drop.rs:87:36
    |
 LL |                 super let b = identity(&DropMe(&mut x));
    |                                         --------------
@@ -55,7 +55,7 @@ LL |         ));
    |           - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `DropMe`
 
 error[E0506]: cannot assign to `x` because it is borrowed
-  --> $DIR/super-let.rs:107:28
+  --> $DIR/super-let-lifetime-and-drop.rs:107:28
    |
 LL |                 super let b = DropMe(&mut x);
    |                                      ------ `x` is borrowed here
@@ -67,7 +67,7 @@ LL |     }
    |     - borrow might be used here, when `b` is dropped and runs the `Drop` code for type `DropMe`
 
 error[E0506]: cannot assign to `x` because it is borrowed
-  --> $DIR/super-let.rs:125:28
+  --> $DIR/super-let-lifetime-and-drop.rs:125:28
    |
 LL |             super let b = DropMe(&mut x);
    |                                  ------ `x` is borrowed here
@@ -79,7 +79,7 @@ LL |     }
    |     - borrow might be used here, when `b` is dropped and runs the `Drop` code for type `DropMe`
 
 error[E0506]: cannot assign to `x` because it is borrowed
-  --> $DIR/super-let.rs:143:28
+  --> $DIR/super-let-lifetime-and-drop.rs:143:28
    |
 LL |             super let b = DropMe(&mut x);
    |                                  ------ `x` is borrowed here
@@ -91,7 +91,7 @@ LL |     }
    |     - borrow might be used here, when `b` is dropped and runs the `Drop` code for type `DropMe`
 
 error[E0506]: cannot assign to `x` because it is borrowed
-  --> $DIR/super-let.rs:159:28
+  --> $DIR/super-let-lifetime-and-drop.rs:159:28
    |
 LL |             b = DropMe(&mut x);
    |                        ------ `x` is borrowed here
@@ -102,7 +102,7 @@ LL |         drop(a);
    |              - borrow later used here
 
 error[E0716]: temporary value dropped while borrowed
-  --> $DIR/super-let.rs:172:33
+  --> $DIR/super-let-lifetime-and-drop.rs:172:33
    |
 LL |         #[cfg(borrowck)] { a = &String::from("asdf"); };
    |                                 ^^^^^^^^^^^^^^^^^^^^- temporary value is freed at the end of this statement
@@ -115,7 +115,7 @@ LL |         let _ = a;
    = note: consider using a `let` binding to create a longer lived value
 
 error[E0506]: cannot assign to `x` because it is borrowed
-  --> $DIR/super-let.rs:206:28
+  --> $DIR/super-let-lifetime-and-drop.rs:206:28
    |
 LL |                     super let d = &DropMe(&mut x);
    |                                    --------------
@@ -130,7 +130,7 @@ LL |     }
    |     - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `DropMe`
 
 error[E0506]: cannot assign to `x` because it is borrowed
-  --> $DIR/super-let.rs:227:32
+  --> $DIR/super-let-lifetime-and-drop.rs:227:32
    |
 LL |                     super let d = identity(&DropMe(&mut x));
    |                                             --------------
@@ -145,7 +145,7 @@ LL |         };
    |          - ... and the borrow might be used here, when that temporary is dropped and runs the `Drop` code for type `DropMe`
 
 error[E0506]: cannot assign to `x` because it is borrowed
-  --> $DIR/super-let.rs:246:28
+  --> $DIR/super-let-lifetime-and-drop.rs:246:28
    |
 LL |             super let b = DropMe(&mut x);
    |                                  ------ `x` is borrowed here
@@ -157,7 +157,7 @@ LL |     }
    |     - borrow might be used here, when `b` is dropped and runs the `Drop` code for type `DropMe`
 
 error[E0506]: cannot assign to `x` because it is borrowed
-  --> $DIR/super-let.rs:263:28
+  --> $DIR/super-let-lifetime-and-drop.rs:263:28
    |
 LL |             let dropme = Some(DropMe(&mut x));
    |                                      ------ `x` is borrowed here
diff --git a/tests/ui/super-let.rs b/tests/ui/borrowck/super-let-lifetime-and-drop.rs
index 380470f792f..380470f792f 100644
--- a/tests/ui/super-let.rs
+++ b/tests/ui/borrowck/super-let-lifetime-and-drop.rs
diff --git a/tests/ui/tag-variant-cast-non-nullary.fixed b/tests/ui/cast/cast-enum-to-primitive-error.fixed
index 7e22116b955..4d447c81ac9 100644
--- a/tests/ui/tag-variant-cast-non-nullary.fixed
+++ b/tests/ui/cast/cast-enum-to-primitive-error.fixed
@@ -1,5 +1,10 @@
+//! This test verifies that a direct non-primitive cast from an enum to an integer type
+//! is correctly disallowed, even when a `From` implementation exists for that enum.
+
 //@ run-rustfix
+
 #![allow(dead_code, unused_variables)]
+
 enum NonNullary {
     Nullary,
     Other(isize),
@@ -16,5 +21,7 @@ impl From<NonNullary> for isize {
 
 fn main() {
     let v = NonNullary::Nullary;
-    let val = isize::from(v); //~ ERROR non-primitive cast: `NonNullary` as `isize` [E0605]
+    let val = isize::from(v);
+    //~^ ERROR non-primitive cast: `NonNullary` as `isize` [E0605]
+    //~| HELP consider using the `From` trait instead
 }
diff --git a/tests/ui/tag-variant-cast-non-nullary.rs b/tests/ui/cast/cast-enum-to-primitive-error.rs
index 1a64cf1933d..fdbe63b9bc7 100644
--- a/tests/ui/tag-variant-cast-non-nullary.rs
+++ b/tests/ui/cast/cast-enum-to-primitive-error.rs
@@ -1,5 +1,10 @@
+//! This test verifies that a direct non-primitive cast from an enum to an integer type
+//! is correctly disallowed, even when a `From` implementation exists for that enum.
+
 //@ run-rustfix
+
 #![allow(dead_code, unused_variables)]
+
 enum NonNullary {
     Nullary,
     Other(isize),
@@ -16,5 +21,7 @@ impl From<NonNullary> for isize {
 
 fn main() {
     let v = NonNullary::Nullary;
-    let val = v as isize; //~ ERROR non-primitive cast: `NonNullary` as `isize` [E0605]
+    let val = v as isize;
+    //~^ ERROR non-primitive cast: `NonNullary` as `isize` [E0605]
+    //~| HELP consider using the `From` trait instead
 }
diff --git a/tests/ui/tag-variant-cast-non-nullary.stderr b/tests/ui/cast/cast-enum-to-primitive-error.stderr
index 8ec1c5f11ec..692e5c19e06 100644
--- a/tests/ui/tag-variant-cast-non-nullary.stderr
+++ b/tests/ui/cast/cast-enum-to-primitive-error.stderr
@@ -1,5 +1,5 @@
 error[E0605]: non-primitive cast: `NonNullary` as `isize`
-  --> $DIR/tag-variant-cast-non-nullary.rs:19:15
+  --> $DIR/cast-enum-to-primitive-error.rs:24:15
    |
 LL |     let val = v as isize;
    |               ^^^^^^^^^^ an `as` expression can be used to convert enum types to numeric types only if the enum type is unit-only or field-less
diff --git a/tests/ui/trivial_casts-rpass.rs b/tests/ui/cast/coercion-as-explicit-cast.rs
index 701e2f6166f..b99f5d93478 100644
--- a/tests/ui/trivial_casts-rpass.rs
+++ b/tests/ui/cast/coercion-as-explicit-cast.rs
@@ -1,5 +1,7 @@
+//! This test checks that various forms of "trivial" casts and coercions
+//! can be explicitly performed using the `as` keyword without compilation errors.
+
 //@ run-pass
-// Test that all coercions can actually be done using casts (modulo the lints).
 
 #![allow(trivial_casts, trivial_numeric_casts)]
 
diff --git a/tests/ui/trivial_casts-rpass.stderr b/tests/ui/cast/coercion-as-explicit-cast.stderr
index 74698b61ab4..d66298c7d44 100644
--- a/tests/ui/trivial_casts-rpass.stderr
+++ b/tests/ui/cast/coercion-as-explicit-cast.stderr
@@ -1,5 +1,5 @@
 warning: method `foo` is never used
-  --> $DIR/trivial_casts-rpass.rs:7:8
+  --> $DIR/coercion-as-explicit-cast.rs:9:8
    |
 LL | trait Foo {
    |       --- method in this trait
diff --git a/tests/ui/const-generics/cross_crate_complex.rs b/tests/ui/const-generics/cross_crate_complex.rs
index d13b69aa0cf..b44d889f5e9 100644
--- a/tests/ui/const-generics/cross_crate_complex.rs
+++ b/tests/ui/const-generics/cross_crate_complex.rs
@@ -11,6 +11,7 @@ async fn foo() {
     async_in_foo(async_out_foo::<4>().await).await;
 }
 
+#[allow(dead_code)]
 struct Faz<const N: usize>;
 
 impl<const N: usize> Foo<N> for Faz<N> {}
diff --git a/tests/ui/generic-associated-types/missing-bounds.fixed b/tests/ui/generic-associated-types/missing-bounds.fixed
index 703d3c1e0fb..15cdd44d7f1 100644
--- a/tests/ui/generic-associated-types/missing-bounds.fixed
+++ b/tests/ui/generic-associated-types/missing-bounds.fixed
@@ -1,5 +1,7 @@
 //@ run-rustfix
 
+#![allow(dead_code)]
+
 use std::ops::Add;
 
 struct A<B>(B);
diff --git a/tests/ui/generic-associated-types/missing-bounds.rs b/tests/ui/generic-associated-types/missing-bounds.rs
index f40b4228873..dad111c8c15 100644
--- a/tests/ui/generic-associated-types/missing-bounds.rs
+++ b/tests/ui/generic-associated-types/missing-bounds.rs
@@ -1,5 +1,7 @@
 //@ run-rustfix
 
+#![allow(dead_code)]
+
 use std::ops::Add;
 
 struct A<B>(B);
diff --git a/tests/ui/generic-associated-types/missing-bounds.stderr b/tests/ui/generic-associated-types/missing-bounds.stderr
index 13e4d249876..97b88c26e3b 100644
--- a/tests/ui/generic-associated-types/missing-bounds.stderr
+++ b/tests/ui/generic-associated-types/missing-bounds.stderr
@@ -1,5 +1,5 @@
 error: equality constraints are not yet supported in `where` clauses
-  --> $DIR/missing-bounds.rs:37:33
+  --> $DIR/missing-bounds.rs:39:33
    |
 LL | impl<B: Add> Add for E<B> where <B as Add>::Output = B {
    |                                 ^^^^^^^^^^^^^^^^^^^^^^ not supported
@@ -12,7 +12,7 @@ LL + impl<B: Add> Add for E<B> where B: Add<Output = B> {
    |
 
 error[E0308]: mismatched types
-  --> $DIR/missing-bounds.rs:11:11
+  --> $DIR/missing-bounds.rs:13:11
    |
 LL | impl<B> Add for A<B> where B: Add {
    |      - expected this type parameter
@@ -25,14 +25,14 @@ LL |         A(self.0 + rhs.0)
    = note: expected type parameter `B`
              found associated type `<B as Add>::Output`
 help: the type constructed contains `<B as Add>::Output` due to the type of the argument passed
-  --> $DIR/missing-bounds.rs:11:9
+  --> $DIR/missing-bounds.rs:13:9
    |
 LL |         A(self.0 + rhs.0)
    |         ^^--------------^
    |           |
    |           this argument influences the type of `A`
 note: tuple struct defined here
-  --> $DIR/missing-bounds.rs:5:8
+  --> $DIR/missing-bounds.rs:7:8
    |
 LL | struct A<B>(B);
    |        ^
@@ -42,7 +42,7 @@ LL | impl<B> Add for A<B> where B: Add<Output = B> {
    |                                  ++++++++++++
 
 error[E0308]: mismatched types
-  --> $DIR/missing-bounds.rs:21:14
+  --> $DIR/missing-bounds.rs:23:14
    |
 LL | impl<B: Add> Add for C<B> {
    |      - expected this type parameter
@@ -55,7 +55,7 @@ LL |         Self(self.0 + rhs.0)
    = note: expected type parameter `B`
              found associated type `<B as Add>::Output`
 note: tuple struct defined here
-  --> $DIR/missing-bounds.rs:15:8
+  --> $DIR/missing-bounds.rs:17:8
    |
 LL | struct C<B>(B);
    |        ^
@@ -65,7 +65,7 @@ LL | impl<B: Add<Output = B>> Add for C<B> {
    |            ++++++++++++
 
 error[E0369]: cannot add `B` to `B`
-  --> $DIR/missing-bounds.rs:31:21
+  --> $DIR/missing-bounds.rs:33:21
    |
 LL |         Self(self.0 + rhs.0)
    |              ------ ^ ----- B
@@ -78,7 +78,7 @@ LL | impl<B: std::ops::Add<Output = B>> Add for D<B> {
    |       +++++++++++++++++++++++++++
 
 error[E0308]: mismatched types
-  --> $DIR/missing-bounds.rs:42:14
+  --> $DIR/missing-bounds.rs:44:14
    |
 LL | impl<B: Add> Add for E<B> where <B as Add>::Output = B {
    |      - expected this type parameter
@@ -91,7 +91,7 @@ LL |         Self(self.0 + rhs.0)
    = note: expected type parameter `B`
              found associated type `<B as Add>::Output`
 note: tuple struct defined here
-  --> $DIR/missing-bounds.rs:35:8
+  --> $DIR/missing-bounds.rs:37:8
    |
 LL | struct E<B>(B);
    |        ^
diff --git a/tests/ui/generics/generic-enum-errors.rs b/tests/ui/generics/generic-enum-errors.rs
new file mode 100644
index 00000000000..111f5635168
--- /dev/null
+++ b/tests/ui/generics/generic-enum-errors.rs
@@ -0,0 +1,15 @@
+//! This test checks that unused generics are rejected by compiler
+
+enum Quux<T> {
+    //~^ ERROR: parameter `T` is never used
+    Bar,
+}
+
+fn foo(c: Quux) {
+    //~^ ERROR missing generics for enum `Quux`
+    assert!((false));
+}
+
+fn main() {
+    panic!();
+}
diff --git a/tests/ui/tag-type-args.stderr b/tests/ui/generics/generic-enum-errors.stderr
index def13832e1a..47a8badbd5d 100644
--- a/tests/ui/tag-type-args.stderr
+++ b/tests/ui/generics/generic-enum-errors.stderr
@@ -1,26 +1,26 @@
 error[E0392]: type parameter `T` is never used
-  --> $DIR/tag-type-args.rs:1:11
+  --> $DIR/generic-enum-errors.rs:3:11
    |
-LL | enum Quux<T> { Bar }
+LL | enum Quux<T> {
    |           ^ unused type parameter
    |
    = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
    = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
 
 error[E0107]: missing generics for enum `Quux`
-  --> $DIR/tag-type-args.rs:4:11
+  --> $DIR/generic-enum-errors.rs:8:11
    |
-LL | fn foo(c: Quux) { assert!((false)); }
+LL | fn foo(c: Quux) {
    |           ^^^^ expected 1 generic argument
    |
 note: enum defined here, with 1 generic parameter: `T`
-  --> $DIR/tag-type-args.rs:1:6
+  --> $DIR/generic-enum-errors.rs:3:6
    |
-LL | enum Quux<T> { Bar }
+LL | enum Quux<T> {
    |      ^^^^ -
 help: add missing generic argument
    |
-LL | fn foo(c: Quux<T>) { assert!((false)); }
+LL | fn foo(c: Quux<T>) {
    |               +++
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/lint/dead-code/unused-trait-with-assoc-const.rs b/tests/ui/lint/dead-code/unused-trait-with-assoc-const.rs
new file mode 100644
index 00000000000..8259e932c64
--- /dev/null
+++ b/tests/ui/lint/dead-code/unused-trait-with-assoc-const.rs
@@ -0,0 +1,13 @@
+#![deny(dead_code)]
+
+trait Tr { //~ ERROR trait `Tr` is never used
+    const I: Self;
+}
+
+struct Foo; //~ ERROR struct `Foo` is never constructed
+
+impl Tr for Foo {
+    const I: Self = Foo;
+}
+
+fn main() {}
diff --git a/tests/ui/lint/dead-code/unused-trait-with-assoc-const.stderr b/tests/ui/lint/dead-code/unused-trait-with-assoc-const.stderr
new file mode 100644
index 00000000000..ec894210f71
--- /dev/null
+++ b/tests/ui/lint/dead-code/unused-trait-with-assoc-const.stderr
@@ -0,0 +1,20 @@
+error: trait `Tr` is never used
+  --> $DIR/unused-trait-with-assoc-const.rs:3:7
+   |
+LL | trait Tr {
+   |       ^^
+   |
+note: the lint level is defined here
+  --> $DIR/unused-trait-with-assoc-const.rs:1:9
+   |
+LL | #![deny(dead_code)]
+   |         ^^^^^^^^^
+
+error: struct `Foo` is never constructed
+  --> $DIR/unused-trait-with-assoc-const.rs:7:8
+   |
+LL | struct Foo;
+   |        ^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/lint/dead-code/unused-trait-with-assoc-ty.rs b/tests/ui/lint/dead-code/unused-trait-with-assoc-ty.rs
new file mode 100644
index 00000000000..e8116d83ebf
--- /dev/null
+++ b/tests/ui/lint/dead-code/unused-trait-with-assoc-ty.rs
@@ -0,0 +1,11 @@
+#![deny(dead_code)]
+
+struct T1; //~ ERROR struct `T1` is never constructed
+
+trait Foo { type Unused; } //~ ERROR trait `Foo` is never used
+impl Foo for T1 { type Unused = Self; }
+
+pub trait Bar { type Used; }
+impl Bar for T1 { type Used = Self; }
+
+fn main() {}
diff --git a/tests/ui/lint/dead-code/unused-trait-with-assoc-ty.stderr b/tests/ui/lint/dead-code/unused-trait-with-assoc-ty.stderr
new file mode 100644
index 00000000000..ab73c640634
--- /dev/null
+++ b/tests/ui/lint/dead-code/unused-trait-with-assoc-ty.stderr
@@ -0,0 +1,20 @@
+error: struct `T1` is never constructed
+  --> $DIR/unused-trait-with-assoc-ty.rs:3:8
+   |
+LL | struct T1;
+   |        ^^
+   |
+note: the lint level is defined here
+  --> $DIR/unused-trait-with-assoc-ty.rs:1:9
+   |
+LL | #![deny(dead_code)]
+   |         ^^^^^^^^^
+
+error: trait `Foo` is never used
+  --> $DIR/unused-trait-with-assoc-ty.rs:5:7
+   |
+LL | trait Foo { type Unused; }
+   |       ^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/tests/ui/modules/module-super-access.rs b/tests/ui/modules/module-super-access.rs
new file mode 100644
index 00000000000..8acba607f6c
--- /dev/null
+++ b/tests/ui/modules/module-super-access.rs
@@ -0,0 +1,16 @@
+//! Check path resolution using `super`
+
+//@ run-pass
+
+#![allow(dead_code)]
+
+pub mod a {
+    pub fn f() {}
+    pub mod b {
+        fn g() {
+            super::f(); // Accessing `f` from module `a` (parent of `b`)
+        }
+    }
+}
+
+pub fn main() {}
diff --git a/tests/ui/modules/super-at-crate-root.rs b/tests/ui/modules/super-at-crate-root.rs
new file mode 100644
index 00000000000..d605dc0cccb
--- /dev/null
+++ b/tests/ui/modules/super-at-crate-root.rs
@@ -0,0 +1,6 @@
+//! Check that `super` keyword used at the crate root (top-level) results in a compilation error
+//! as there is no parent module to resolve.
+
+use super::f; //~ ERROR there are too many leading `super` keywords
+
+fn main() {}
diff --git a/tests/ui/super-at-top-level.stderr b/tests/ui/modules/super-at-crate-root.stderr
index 4dce81fbef4..02798708864 100644
--- a/tests/ui/super-at-top-level.stderr
+++ b/tests/ui/modules/super-at-crate-root.stderr
@@ -1,5 +1,5 @@
 error[E0433]: failed to resolve: there are too many leading `super` keywords
-  --> $DIR/super-at-top-level.rs:1:5
+  --> $DIR/super-at-crate-root.rs:4:5
    |
 LL | use super::f;
    |     ^^^^^ there are too many leading `super` keywords
diff --git a/tests/ui/trailing-comma.rs b/tests/ui/parser/syntactic-trailing-commas.rs
index 53b76fb6037..ba688dffb3c 100644
--- a/tests/ui/trailing-comma.rs
+++ b/tests/ui/parser/syntactic-trailing-commas.rs
@@ -1,3 +1,11 @@
+//! Checks trailing commas are accepted in various places:
+//! - Generic parameters in function and struct definitions.
+//! - Function and method arguments.
+//! - Tuple and array literal expressions.
+//! - Tuple and array destructuring patterns, including those with `..`.
+//! - Enum variant declarations.
+//! - Attributes.
+
 //@ run-pass
 
 fn f<T,>(_: T,) {}
diff --git a/tests/ui/pattern/issue-22546.rs b/tests/ui/pattern/issue-22546.rs
index 81908017b4e..cf128d185df 100644
--- a/tests/ui/pattern/issue-22546.rs
+++ b/tests/ui/pattern/issue-22546.rs
@@ -15,7 +15,7 @@ impl<T: std::fmt::Display> Foo<T> {
     }
 }
 
-trait Tr { //~ WARN trait `Tr` is never used
+trait Tr {
     type U;
 }
 
diff --git a/tests/ui/pattern/issue-22546.stderr b/tests/ui/pattern/issue-22546.stderr
deleted file mode 100644
index e067a95e422..00000000000
--- a/tests/ui/pattern/issue-22546.stderr
+++ /dev/null
@@ -1,10 +0,0 @@
-warning: trait `Tr` is never used
-  --> $DIR/issue-22546.rs:18:7
-   |
-LL | trait Tr {
-   |       ^^
-   |
-   = note: `#[warn(dead_code)]` on by default
-
-warning: 1 warning emitted
-
diff --git a/tests/ui/ptr_ops/ptr-swap-basic.rs b/tests/ui/ptr_ops/ptr-swap-basic.rs
new file mode 100644
index 00000000000..ce230feeb32
--- /dev/null
+++ b/tests/ui/ptr_ops/ptr-swap-basic.rs
@@ -0,0 +1,14 @@
+//! Check the basic functionality of `std::mem::swap` to ensure it correctly
+//! exchanges the values of two mutable variables.
+
+//@ run-pass
+
+use std::mem::swap;
+
+pub fn main() {
+    let mut x = 3;
+    let mut y = 7;
+    swap(&mut x, &mut y);
+    assert_eq!(x, 7);
+    assert_eq!(y, 3);
+}
diff --git a/tests/ui/swap-overlapping.rs b/tests/ui/ptr_ops/ptr-swap-overlapping-regions.rs
index 38d5a8109d1..8f05e937d59 100644
--- a/tests/ui/swap-overlapping.rs
+++ b/tests/ui/ptr_ops/ptr-swap-overlapping-regions.rs
@@ -1,17 +1,17 @@
+//! Check that `std::ptr::swap` behaves correctly when the source and destination
+//! pointers refer to the same memory location, avoiding issues like overlapping `memcpy`.
+//!
+//! Regression test: <https://github.com/rust-lang/rust/issues/5041>
+
 //@ run-pass
 
 #![allow(dead_code)]
-// Issue #5041 - avoid overlapping memcpy when src and dest of a swap are the same
-
 
 use std::ptr;
 
 pub fn main() {
     let mut test = TestDescAndFn {
-        desc: TestDesc {
-            name: TestName::DynTestName("test".to_string()),
-            should_fail: false
-        },
+        desc: TestDesc { name: TestName::DynTestName("test".to_string()), should_fail: false },
         testfn: TestFn::DynTestFn(22),
     };
     do_swap(&mut test);
@@ -24,7 +24,7 @@ fn do_swap(test: &mut TestDescAndFn) {
 }
 
 pub enum TestName {
-    DynTestName(String)
+    DynTestName(String),
 }
 
 pub enum TestFn {
@@ -34,7 +34,7 @@ pub enum TestFn {
 
 pub struct TestDesc {
     name: TestName,
-    should_fail: bool
+    should_fail: bool,
 }
 
 pub struct TestDescAndFn {
diff --git a/tests/ui/recursion/recursion-tail-call-no-arg-leak.rs b/tests/ui/recursion/recursion-tail-call-no-arg-leak.rs
new file mode 100644
index 00000000000..fe10b890700
--- /dev/null
+++ b/tests/ui/recursion/recursion-tail-call-no-arg-leak.rs
@@ -0,0 +1,15 @@
+//! This test verifies that tail call optimization does not lead to argument slot leaks.
+//!
+//! Regression test for: <https://github.com/rust-lang/rust/issues/160>
+
+//@ run-pass
+
+fn inner(dummy: String, b: bool) {
+    if b {
+        return inner(dummy, false);
+    }
+}
+
+pub fn main() {
+    inner("hi".to_string(), true);
+}
diff --git a/tests/ui/recursion/recursion-tail-cps.rs b/tests/ui/recursion/recursion-tail-cps.rs
new file mode 100644
index 00000000000..9014be0ce98
--- /dev/null
+++ b/tests/ui/recursion/recursion-tail-cps.rs
@@ -0,0 +1,34 @@
+//! Verify that mutually recursive functions use CPS to avoid overflowing the stack.
+
+//@ run-pass
+
+fn checktrue(rs: bool) -> bool {
+    assert!(rs);
+    return true;
+}
+
+pub fn main() {
+    let k = checktrue;
+    evenk(42, k);
+    oddk(45, k);
+}
+
+fn evenk(n: isize, k: fn(bool) -> bool) -> bool {
+    println!("evenk");
+    println!("{}", n);
+    if n == 0 {
+        return k(true);
+    } else {
+        return oddk(n - 1, k);
+    }
+}
+
+fn oddk(n: isize, k: fn(bool) -> bool) -> bool {
+    println!("oddk");
+    println!("{}", n);
+    if n == 0 {
+        return k(false);
+    } else {
+        return evenk(n - 1, k);
+    }
+}
diff --git a/tests/ui/specialization/issue-111232.rs b/tests/ui/specialization/issue-111232.rs
index 3ed3c580e6d..fa00f01886f 100644
--- a/tests/ui/specialization/issue-111232.rs
+++ b/tests/ui/specialization/issue-111232.rs
@@ -1,4 +1,13 @@
 #![feature(min_specialization)]
+#![feature(const_trait_impl)]
+
+trait From<T> {
+    fn from(t: T) -> Self;
+}
+
+impl<T> From<T> for T {
+    fn from(t: T) -> T { t }
+}
 
 struct S;
 
diff --git a/tests/ui/specialization/issue-111232.stderr b/tests/ui/specialization/issue-111232.stderr
index ed392e4f915..5f169f0bb36 100644
--- a/tests/ui/specialization/issue-111232.stderr
+++ b/tests/ui/specialization/issue-111232.stderr
@@ -1,10 +1,13 @@
 error[E0520]: `from` specializes an item from a parent `impl`, but that item is not marked `default`
-  --> $DIR/issue-111232.rs:6:5
+  --> $DIR/issue-111232.rs:15:5
    |
+LL | impl<T> From<T> for T {
+   | --------------------- parent `impl` is here
+...
 LL |     fn from(s: S) -> S {
-   |     ^^^^^^^^^^^^^^^^^^
+   |     ^^^^^^^^^^^^^^^^^^ cannot specialize default item `from`
    |
-   = note: parent implementation is in crate `core`
+   = note: to specialize, `from` in the parent `impl` must be marked `default`
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/super-at-top-level.rs b/tests/ui/super-at-top-level.rs
deleted file mode 100644
index e4d587bc9ef..00000000000
--- a/tests/ui/super-at-top-level.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-use super::f; //~ ERROR there are too many leading `super` keywords
-
-fn main() {
-}
diff --git a/tests/ui/super.rs b/tests/ui/super.rs
deleted file mode 100644
index 69aff4f98e0..00000000000
--- a/tests/ui/super.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-//@ run-pass
-
-#![allow(dead_code)]
-
-pub mod a {
-    pub fn f() {}
-    pub mod b {
-        fn g() {
-            super::f();
-        }
-    }
-}
-
-pub fn main() {
-}
diff --git a/tests/ui/svh-add-nothing.rs b/tests/ui/svh-add-nothing.rs
deleted file mode 100644
index 6e4b9fa7f4c..00000000000
--- a/tests/ui/svh-add-nothing.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-//@ run-pass
-// note that these aux-build directives must be in this order
-//@ aux-build:svh-a-base.rs
-//@ aux-build:svh-b.rs
-//@ aux-build:svh-a-base.rs
-
-
-extern crate a;
-extern crate b;
-
-fn main() {
-    b::foo()
-}
diff --git a/tests/ui/svh/svh-no-api-change-no-recompile.rs b/tests/ui/svh/svh-no-api-change-no-recompile.rs
new file mode 100644
index 00000000000..d4b8ac77444
--- /dev/null
+++ b/tests/ui/svh/svh-no-api-change-no-recompile.rs
@@ -0,0 +1,20 @@
+//! This test verifies that the Signature Version Hash (SVH) system correctly identifies
+//! when changes to an auxiliary crate do not affect its public API.
+//!
+//! Specifically, it checks that adding non-public items to a crate does not alter
+//! its SVH, preventing unnecessary recompilations of dependent crates.
+
+//@ run-pass
+
+// Note that these aux-build directives must be in this order
+
+//@ aux-build:svh-a-base.rs
+//@ aux-build:svh-b.rs
+//@ aux-build:svh-a-base.rs
+
+extern crate a;
+extern crate b;
+
+fn main() {
+    b::foo()
+}
diff --git a/tests/ui/swap-1.rs b/tests/ui/swap-1.rs
deleted file mode 100644
index b104c3ade42..00000000000
--- a/tests/ui/swap-1.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-//@ run-pass
-
-use std::mem::swap;
-
-pub fn main() {
-    let mut x = 3; let mut y = 7;
-    swap(&mut x, &mut y);
-    assert_eq!(x, 7);
-    assert_eq!(y, 3);
-}
diff --git a/tests/ui/switched-expectations.rs b/tests/ui/switched-expectations.rs
deleted file mode 100644
index c5bc84de54c..00000000000
--- a/tests/ui/switched-expectations.rs
+++ /dev/null
@@ -1,4 +0,0 @@
-fn main() {
-    let var = 10i32;
-    let ref string: String = var; //~ ERROR mismatched types [E0308]
-}
diff --git a/tests/ui/tag-type-args.rs b/tests/ui/tag-type-args.rs
deleted file mode 100644
index 75a54927443..00000000000
--- a/tests/ui/tag-type-args.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-enum Quux<T> { Bar }
-//~^ ERROR: parameter `T` is never used
-
-fn foo(c: Quux) { assert!((false)); } //~ ERROR missing generics for enum `Quux`
-
-fn main() { panic!(); }
diff --git a/tests/ui/tail-call-arg-leak.rs b/tests/ui/tail-call-arg-leak.rs
deleted file mode 100644
index 234924307c3..00000000000
--- a/tests/ui/tail-call-arg-leak.rs
+++ /dev/null
@@ -1,8 +0,0 @@
-//@ run-pass
-// use of tail calls causes arg slot leaks, issue #160.
-
-fn inner(dummy: String, b: bool) { if b { return inner(dummy, false); } }
-
-pub fn main() {
-    inner("hi".to_string(), true);
-}
diff --git a/tests/ui/tail-cps.rs b/tests/ui/tail-cps.rs
deleted file mode 100644
index fe99dadf795..00000000000
--- a/tests/ui/tail-cps.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-//@ run-pass
-
-fn checktrue(rs: bool) -> bool { assert!(rs); return true; }
-
-pub fn main() { let k = checktrue; evenk(42, k); oddk(45, k); }
-
-fn evenk(n: isize, k: fn(bool) -> bool) -> bool {
-    println!("evenk");
-    println!("{}", n);
-    if n == 0 { return k(true); } else { return oddk(n - 1, k); }
-}
-
-fn oddk(n: isize, k: fn(bool) -> bool) -> bool {
-    println!("oddk");
-    println!("{}", n);
-    if n == 0 { return k(false); } else { return evenk(n - 1, k); }
-}
diff --git a/tests/ui/tail-typeck.rs b/tests/ui/tail-typeck.rs
deleted file mode 100644
index 1deb43c9496..00000000000
--- a/tests/ui/tail-typeck.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-fn f() -> isize { return g(); } //~ ERROR mismatched types
-
-fn g() -> usize { return 0; }
-
-fn main() { let y = f(); }
diff --git a/tests/ui/tail-typeck.stderr b/tests/ui/tail-typeck.stderr
deleted file mode 100644
index 3cfbfa0fb56..00000000000
--- a/tests/ui/tail-typeck.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0308]: mismatched types
-  --> $DIR/tail-typeck.rs:1:26
-   |
-LL | fn f() -> isize { return g(); }
-   |           -----          ^^^ expected `isize`, found `usize`
-   |           |
-   |           expected `isize` because of return type
-   |
-help: you can convert a `usize` to an `isize` and panic if the converted value doesn't fit
-   |
-LL | fn f() -> isize { return g().try_into().unwrap(); }
-   |                             ++++++++++++++++++++
-
-error: aborting due to 1 previous error
-
-For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/trait-method-number-parameters.rs b/tests/ui/trait-method-number-parameters.rs
deleted file mode 100644
index 719005d6643..00000000000
--- a/tests/ui/trait-method-number-parameters.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-trait Foo {
-    fn foo(&mut self, x: i32, y: i32) -> i32;
-}
-
-impl Foo for i32 {
-    fn foo(
-        &mut self, //~ ERROR
-        x: i32,
-    ) {
-    }
-}
-
-fn main() {}
diff --git a/tests/ui/traits/const-traits/non-const-op-in-closure-in-const.rs b/tests/ui/traits/const-traits/non-const-op-in-closure-in-const.rs
index 86e3e5f769f..d5f80acc15b 100644
--- a/tests/ui/traits/const-traits/non-const-op-in-closure-in-const.rs
+++ b/tests/ui/traits/const-traits/non-const-op-in-closure-in-const.rs
@@ -1,6 +1,6 @@
-//@ known-bug: #110395
+#![feature(const_trait_impl, const_from)]
 
-#![feature(const_trait_impl)]
+//@ check-pass
 
 #[const_trait]
 trait Convert<T> {
diff --git a/tests/ui/traits/const-traits/non-const-op-in-closure-in-const.stderr b/tests/ui/traits/const-traits/non-const-op-in-closure-in-const.stderr
deleted file mode 100644
index e7f10e73c69..00000000000
--- a/tests/ui/traits/const-traits/non-const-op-in-closure-in-const.stderr
+++ /dev/null
@@ -1,30 +0,0 @@
-error: `[const]` can only be applied to `#[const_trait]` traits
-  --> $DIR/non-const-op-in-closure-in-const.rs:10:44
-   |
-LL | impl<A, B> const Convert<B> for A where B: [const] From<A> {
-   |                                            ^^^^^^^ can't be applied to `From`
-   |
-note: `From` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
-  --> $SRC_DIR/core/src/convert/mod.rs:LL:COL
-
-error: `[const]` can only be applied to `#[const_trait]` traits
-  --> $DIR/non-const-op-in-closure-in-const.rs:10:44
-   |
-LL | impl<A, B> const Convert<B> for A where B: [const] From<A> {
-   |                                            ^^^^^^^ can't be applied to `From`
-   |
-note: `From` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
-  --> $SRC_DIR/core/src/convert/mod.rs:LL:COL
-   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
-
-error[E0015]: cannot call non-const associated function `<B as From<A>>::from` in constant functions
-  --> $DIR/non-const-op-in-closure-in-const.rs:12:9
-   |
-LL |         B::from(self)
-   |         ^^^^^^^^^^^^^
-   |
-   = note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0015`.
diff --git a/tests/ui/traits/trait-method-signature-mismatch.rs b/tests/ui/traits/trait-method-signature-mismatch.rs
new file mode 100644
index 00000000000..118aff69e4e
--- /dev/null
+++ b/tests/ui/traits/trait-method-signature-mismatch.rs
@@ -0,0 +1,18 @@
+//! This test verifies that implementing a trait method with a signature that does not
+//! exactly match its declaration in the trait results in a compilation error.
+//! Specifically, it checks for errors when the number of parameters or the return type
+//! in the `impl` differs from the trait definition.
+
+trait Foo {
+    fn foo(&mut self, x: i32, y: i32) -> i32;
+}
+
+impl Foo for i32 {
+    fn foo(
+        &mut self, //~ ERROR method `foo` has 2 parameters but the declaration
+        x: i32,
+    ) {
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/trait-method-number-parameters.stderr b/tests/ui/traits/trait-method-signature-mismatch.stderr
index cf9b4f2ae79..c7a77aa7aba 100644
--- a/tests/ui/trait-method-number-parameters.stderr
+++ b/tests/ui/traits/trait-method-signature-mismatch.stderr
@@ -1,5 +1,5 @@
 error[E0050]: method `foo` has 2 parameters but the declaration in trait `Foo::foo` has 3
-  --> $DIR/trait-method-number-parameters.rs:7:9
+  --> $DIR/trait-method-signature-mismatch.rs:12:9
    |
 LL |       fn foo(&mut self, x: i32, y: i32) -> i32;
    |              ------------------------- trait requires 3 parameters
diff --git a/tests/ui/traits/tryfrominterror-result-comparison.rs b/tests/ui/traits/tryfrominterror-result-comparison.rs
new file mode 100644
index 00000000000..8a2741e9058
--- /dev/null
+++ b/tests/ui/traits/tryfrominterror-result-comparison.rs
@@ -0,0 +1,19 @@
+//! This test verifies that `std::num::TryFromIntError` correctly implements `PartialEq`,
+//! allowing `Result<T, TryFromIntError>` values to be compared for equality using `==`.
+//! It specifically checks a successful numeric conversion scenario where the `Result::Ok`
+//! variant is compared, ensuring that the comparison yields the expected boolean result.
+
+//@ run-pass
+
+#![allow(unused_must_use)] // Allow ignoring the result of the comparison for the test's purpose
+
+use std::convert::TryFrom;
+use std::num::TryFromIntError;
+
+fn main() {
+    let x: u32 = 125;
+    // Attempt to convert u32 to u8, which should succeed as 125 fits in u8.
+    let y: Result<u8, TryFromIntError> = u8::try_from(x);
+    // Verify that the Result can be correctly compared with an Ok value.
+    y == Ok(125);
+}
diff --git a/tests/ui/transmute-non-immediate-to-immediate.rs b/tests/ui/transmute-non-immediate-to-immediate.rs
deleted file mode 100644
index d99bbcc600f..00000000000
--- a/tests/ui/transmute-non-immediate-to-immediate.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-//@ run-pass
-// Issue #7988
-// Transmuting non-immediate type to immediate type
-
-
-pub fn main() {
-    unsafe {
-        ::std::mem::transmute::<[isize; 1],isize>([1])
-    };
-}
diff --git a/tests/ui/transmute/transmute-array-to-scalar.rs b/tests/ui/transmute/transmute-array-to-scalar.rs
new file mode 100644
index 00000000000..cd6dbb040c8
--- /dev/null
+++ b/tests/ui/transmute/transmute-array-to-scalar.rs
@@ -0,0 +1,14 @@
+//! Verify transmuting from a single-element array to a scalar is allowed.
+//!
+//! Regression test: <https://github.com/rust-lang/rust/issues/7988>
+
+//@ run-pass
+
+pub fn main() {
+    unsafe {
+        // Transmute a single-element array `[1]` (which might be treated as a "non-immediate" type)
+        // to a scalar `isize` (an "immediate" type).
+        // This is safe because `[isize; 1]` and `isize` have the same size and alignment.
+        ::std::mem::transmute::<[isize; 1], isize>([1]);
+    }
+}
diff --git a/tests/ui/transmute-equal-assoc-types.rs b/tests/ui/transmute/transmute-same-associated-type.rs
index 526f4ebbffa..8bc452c6df4 100644
--- a/tests/ui/transmute-equal-assoc-types.rs
+++ b/tests/ui/transmute/transmute-same-associated-type.rs
@@ -1,3 +1,5 @@
+//! Verify transmuting is allowed when `Src` and `Dst` are the same associated type.
+
 //@ check-pass
 
 trait Foo {
diff --git a/tests/ui/try-from-int-error-partial-eq.rs b/tests/ui/try-from-int-error-partial-eq.rs
deleted file mode 100644
index 66a78b3f842..00000000000
--- a/tests/ui/try-from-int-error-partial-eq.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-//@ run-pass
-
-#![allow(unused_must_use)]
-
-use std::convert::TryFrom;
-use std::num::TryFromIntError;
-
-fn main() {
-    let x: u32 = 125;
-    let y: Result<u8, TryFromIntError> = u8::try_from(x);
-    y == Ok(125);
-}
diff --git a/tests/ui/typeck/mismatched-types-ref-binding.rs b/tests/ui/typeck/mismatched-types-ref-binding.rs
new file mode 100644
index 00000000000..baf9056dfeb
--- /dev/null
+++ b/tests/ui/typeck/mismatched-types-ref-binding.rs
@@ -0,0 +1,8 @@
+//! Check that a `mismatched types` error (E0308) is correctly reported when attempting to
+//! bind a reference to an `i32` to a reference to a `String`.
+//! Ensure `ref` bindings report a mismatched type error.
+
+fn main() {
+    let var = 10i32;
+    let ref string: String = var; //~ ERROR mismatched types [E0308]
+}
diff --git a/tests/ui/switched-expectations.stderr b/tests/ui/typeck/mismatched-types-ref-binding.stderr
index e235c2da1f7..c08e5d2a60b 100644
--- a/tests/ui/switched-expectations.stderr
+++ b/tests/ui/typeck/mismatched-types-ref-binding.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/switched-expectations.rs:3:30
+  --> $DIR/mismatched-types-ref-binding.rs:7:30
    |
 LL |     let ref string: String = var;
    |                              ^^^ expected `String`, found `i32`
diff --git a/tests/ui/typeck/tail-return-type-mismatch.rs b/tests/ui/typeck/tail-return-type-mismatch.rs
new file mode 100644
index 00000000000..fa0d205ad82
--- /dev/null
+++ b/tests/ui/typeck/tail-return-type-mismatch.rs
@@ -0,0 +1,14 @@
+//! Test for type mismatch error when returning `usize` from `isize` function.
+
+fn f() -> isize {
+    return g();
+    //~^ ERROR mismatched types [E0308]
+}
+
+fn g() -> usize {
+    return 0;
+}
+
+fn main() {
+    let y = f();
+}
diff --git a/tests/ui/typeck/tail-return-type-mismatch.stderr b/tests/ui/typeck/tail-return-type-mismatch.stderr
new file mode 100644
index 00000000000..36da65d0304
--- /dev/null
+++ b/tests/ui/typeck/tail-return-type-mismatch.stderr
@@ -0,0 +1,16 @@
+error[E0308]: mismatched types
+  --> $DIR/tail-return-type-mismatch.rs:4:12
+   |
+LL | fn f() -> isize {
+   |           ----- expected `isize` because of return type
+LL |     return g();
+   |            ^^^ expected `isize`, found `usize`
+   |
+help: you can convert a `usize` to an `isize` and panic if the converted value doesn't fit
+   |
+LL |     return g().try_into().unwrap();
+   |               ++++++++++++++++++++
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0308`.