about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-07-11 07:35:19 +0200
committerGitHub <noreply@github.com>2025-07-11 07:35:19 +0200
commit66799d0b83df8ef34df210ba454b59fce53fd1e9 (patch)
tree4d5703b8d224e0d654c41b81edd9eb7fed76be7d
parent3d6eb225e26448b09fdec1ba7222f3e7174c6ac2 (diff)
parent259512e3b6a920b1e1eb6034fbc738e7b9815337 (diff)
downloadrust-66799d0b83df8ef34df210ba454b59fce53fd1e9.tar.gz
rust-66799d0b83df8ef34df210ba454b59fce53fd1e9.zip
Rollup merge of #143303 - Kivooeo:tf28, r=tgross35
`tests/ui`: A New Order [28/28] FINAL PART

> [!NOTE]
>
> Intermediate commits are intended to help review, but will be squashed prior to merge.

Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895.

r? ``@tgross35``
-rw-r--r--tests/ui/allocator/weak-uninhabited-type.rs13
-rw-r--r--tests/ui/binding/underscore-prefixed-function-argument.rs15
-rw-r--r--tests/ui/borrowck/ownership-struct-update-moved-error.rs19
-rw-r--r--tests/ui/borrowck/ownership-struct-update-moved-error.stderr (renamed from tests/ui/walk-struct-literal-with.stderr)12
-rw-r--r--tests/ui/closures/no-capture-closure-call.rs (renamed from tests/ui/unused-move-capture.rs)2
-rw-r--r--tests/ui/codegen/llvm-args-invalid-flag.rs (renamed from tests/ui/unknown-llvm-arg.rs)0
-rw-r--r--tests/ui/codegen/llvm-args-invalid-flag.stderr (renamed from tests/ui/unknown-llvm-arg.stderr)0
-rw-r--r--tests/ui/drop/box-drop-unused-value-statement-regression.rs12
-rw-r--r--tests/ui/expr/syntax-edge-cases-lint-clean.rs (renamed from tests/ui/weird-exprs.rs)0
-rw-r--r--tests/ui/hashmap/hashset-enum-variant.rs (renamed from tests/ui/wrong-hashset-issue-42918.rs)13
-rw-r--r--tests/ui/io-checks/write-macro-error.rs (renamed from tests/ui/write-fmt-errors.rs)13
-rw-r--r--tests/ui/lang-items/lang-item-unknown-definition-error.rs12
-rw-r--r--tests/ui/lang-items/lang-item-unknown-definition-error.stderr (renamed from tests/ui/unknown-language-item.stderr)2
-rw-r--r--tests/ui/modules/module-qualified-paths-basic.rs20
-rw-r--r--tests/ui/modules/module-use-nested-groups.rs (renamed from tests/ui/use-nested-groups.rs)2
-rw-r--r--tests/ui/modules/primitive-type-module-deprecated-paths.rs13
-rw-r--r--tests/ui/modules/use-keyword-reexport-type-alias.rs (renamed from tests/ui/use-keyword-2.rs)10
-rw-r--r--tests/ui/numbers-arithmetic/unary-negation-unsigned-integer-error.rs (renamed from tests/ui/unsigned-literal-negation.rs)2
-rw-r--r--tests/ui/numbers-arithmetic/unary-negation-unsigned-integer-error.stderr (renamed from tests/ui/unsigned-literal-negation.stderr)6
-rw-r--r--tests/ui/panics/unwind-force-no-unwind-tables.rs (renamed from tests/ui/unwind-no-uwtable.rs)15
-rw-r--r--tests/ui/process/process-spawn-failure.rs (renamed from tests/ui/wait-forked-but-failed-child.rs)47
-rw-r--r--tests/ui/process/windows-exit-code-still-active.rs26
-rw-r--r--tests/ui/reachable/diverging-expressions-unreachable-code.rs19
-rw-r--r--tests/ui/reachable/unreachable-code-diverging-expressions.rs (renamed from tests/ui/unreachable-code.rs)10
-rw-r--r--tests/ui/traits/virtual-call-parameter-handling.rs (renamed from tests/ui/virtual-call-attrs-issue-137646.rs)6
-rw-r--r--tests/ui/type/unit-type-basic-usages.rs14
-rw-r--r--tests/ui/type/usize-no-generic-arguments.rs (renamed from tests/ui/usize-generic-argument-parent.rs)2
-rw-r--r--tests/ui/type/usize-no-generic-arguments.stderr (renamed from tests/ui/usize-generic-argument-parent.stderr)2
-rw-r--r--tests/ui/unit.rs16
-rw-r--r--tests/ui/unknown-language-item.rs10
-rw-r--r--tests/ui/unnamed_argument_mode.rs13
-rw-r--r--tests/ui/unreachable-code-1.rs19
-rw-r--r--tests/ui/unsafe/maybe-uninit-zero-sized-types.rs (renamed from tests/ui/uninit-empty-types.rs)7
-rw-r--r--tests/ui/unused-move.rs12
-rw-r--r--tests/ui/use-import-export.rs11
-rw-r--r--tests/ui/use-module-level-int-consts.rs12
-rw-r--r--tests/ui/walk-struct-literal-with.rs17
-rw-r--r--tests/ui/weak-new-uninhabited-issue-48493.rs7
-rw-r--r--tests/ui/weird-exit-code.rs28
39 files changed, 262 insertions, 197 deletions
diff --git a/tests/ui/allocator/weak-uninhabited-type.rs b/tests/ui/allocator/weak-uninhabited-type.rs
new file mode 100644
index 00000000000..74258eedc6a
--- /dev/null
+++ b/tests/ui/allocator/weak-uninhabited-type.rs
@@ -0,0 +1,13 @@
+//! Checks that `Weak` pointers can be created with an empty enum type parameter.
+//! And generic `Weak` handles zero-variant enums without error.
+//!
+//! Regression test for <https://github.com/rust-lang/rust/issues/48493>
+
+//@ run-pass
+
+enum Void {}
+
+fn main() {
+    let _ = std::rc::Weak::<Void>::new();
+    let _ = std::sync::Weak::<Void>::new();
+}
diff --git a/tests/ui/binding/underscore-prefixed-function-argument.rs b/tests/ui/binding/underscore-prefixed-function-argument.rs
new file mode 100644
index 00000000000..e5b2ec1b5f0
--- /dev/null
+++ b/tests/ui/binding/underscore-prefixed-function-argument.rs
@@ -0,0 +1,15 @@
+//! Test that argument names starting with `_` are usable.
+
+//@ run-pass
+
+fn good(_a: &isize) {}
+
+fn called<F>(_f: F)
+where
+    F: FnOnce(&isize),
+{
+}
+
+pub fn main() {
+    called(good);
+}
diff --git a/tests/ui/borrowck/ownership-struct-update-moved-error.rs b/tests/ui/borrowck/ownership-struct-update-moved-error.rs
new file mode 100644
index 00000000000..62fc1f42969
--- /dev/null
+++ b/tests/ui/borrowck/ownership-struct-update-moved-error.rs
@@ -0,0 +1,19 @@
+//! Checks borrow after move error when using `self` consuming method with struct update syntax.
+
+struct Mine {
+    test: String,
+    other_val: isize,
+}
+
+impl Mine {
+    fn make_string_bar(mut self) -> Mine {
+        self.test = "Bar".to_string();
+        self
+    }
+}
+
+fn main() {
+    let start = Mine { test: "Foo".to_string(), other_val: 0 };
+    let end = Mine { other_val: 1, ..start.make_string_bar() };
+    println!("{}", start.test); //~ ERROR borrow of moved value: `start`
+}
diff --git a/tests/ui/walk-struct-literal-with.stderr b/tests/ui/borrowck/ownership-struct-update-moved-error.stderr
index 34b501f8ec8..83cfc7bb412 100644
--- a/tests/ui/walk-struct-literal-with.stderr
+++ b/tests/ui/borrowck/ownership-struct-update-moved-error.stderr
@@ -1,17 +1,17 @@
 error[E0382]: borrow of moved value: `start`
-  --> $DIR/walk-struct-literal-with.rs:16:20
+  --> $DIR/ownership-struct-update-moved-error.rs:18:20
    |
-LL |     let start = Mine{test:"Foo".to_string(), other_val:0};
+LL |     let start = Mine { test: "Foo".to_string(), other_val: 0 };
    |         ----- move occurs because `start` has type `Mine`, which does not implement the `Copy` trait
-LL |     let end = Mine{other_val:1, ..start.make_string_bar()};
-   |                                         ----------------- `start` moved due to this method call
+LL |     let end = Mine { other_val: 1, ..start.make_string_bar() };
+   |                                            ----------------- `start` moved due to this method call
 LL |     println!("{}", start.test);
    |                    ^^^^^^^^^^ value borrowed here after move
    |
 note: `Mine::make_string_bar` takes ownership of the receiver `self`, which moves `start`
-  --> $DIR/walk-struct-literal-with.rs:7:28
+  --> $DIR/ownership-struct-update-moved-error.rs:9:28
    |
-LL |     fn make_string_bar(mut self) -> Mine{
+LL |     fn make_string_bar(mut self) -> Mine {
    |                            ^^^^
    = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
 
diff --git a/tests/ui/unused-move-capture.rs b/tests/ui/closures/no-capture-closure-call.rs
index 5f42bcbe280..29e5ac635b4 100644
--- a/tests/ui/unused-move-capture.rs
+++ b/tests/ui/closures/no-capture-closure-call.rs
@@ -1,3 +1,5 @@
+//! Sanity check for no capture closures
+
 //@ run-pass
 
 pub fn main() {
diff --git a/tests/ui/unknown-llvm-arg.rs b/tests/ui/codegen/llvm-args-invalid-flag.rs
index a8fa55a220a..a8fa55a220a 100644
--- a/tests/ui/unknown-llvm-arg.rs
+++ b/tests/ui/codegen/llvm-args-invalid-flag.rs
diff --git a/tests/ui/unknown-llvm-arg.stderr b/tests/ui/codegen/llvm-args-invalid-flag.stderr
index e1d3cfea28f..e1d3cfea28f 100644
--- a/tests/ui/unknown-llvm-arg.stderr
+++ b/tests/ui/codegen/llvm-args-invalid-flag.stderr
diff --git a/tests/ui/drop/box-drop-unused-value-statement-regression.rs b/tests/ui/drop/box-drop-unused-value-statement-regression.rs
new file mode 100644
index 00000000000..43865e08444
--- /dev/null
+++ b/tests/ui/drop/box-drop-unused-value-statement-regression.rs
@@ -0,0 +1,12 @@
+//! Regression test for a crash caused by an "unsused move"
+//! (specifically, a variable bound to a `Box` used as a statement)
+//! leading to incorrect memory zero-filling after drop.
+//!
+//! Regression test for <https://github.com/rust-lang/rust/issues/3878>.
+
+//@ run-pass
+
+pub fn main() {
+    let y: Box<_> = Box::new(1);
+    drop(y);
+}
diff --git a/tests/ui/weird-exprs.rs b/tests/ui/expr/syntax-edge-cases-lint-clean.rs
index 7db92d46067..7db92d46067 100644
--- a/tests/ui/weird-exprs.rs
+++ b/tests/ui/expr/syntax-edge-cases-lint-clean.rs
diff --git a/tests/ui/wrong-hashset-issue-42918.rs b/tests/ui/hashmap/hashset-enum-variant.rs
index 5795cc527cf..39a59d3a39b 100644
--- a/tests/ui/wrong-hashset-issue-42918.rs
+++ b/tests/ui/hashmap/hashset-enum-variant.rs
@@ -1,26 +1,27 @@
+//! Check for correct initialization of `HashSet` with enums. This is a regression test for a
+//! codegen bug that caused the `HashSet` to appear as if it contained one of each enum variant.
+//!
+//! Regression test for <https://github.com/rust-lang/rust/issues/42918>
+
 //@ run-pass
-//
-#![allow(dead_code)]
 //@ compile-flags: -O
 
+#![allow(dead_code)]
+
 use std::collections::HashSet;
 
 #[derive(PartialEq, Debug, Hash, Eq, Clone, PartialOrd, Ord)]
 enum MyEnum {
     E0,
-
     E1,
-
     E2,
     E3,
     E4,
-
     E5,
     E6,
     E7,
 }
 
-
 fn main() {
     use MyEnum::*;
     let s: HashSet<_> = [E4, E1].iter().cloned().collect();
diff --git a/tests/ui/write-fmt-errors.rs b/tests/ui/io-checks/write-macro-error.rs
index b48fa3f11cc..857ea0024e1 100644
--- a/tests/ui/write-fmt-errors.rs
+++ b/tests/ui/io-checks/write-macro-error.rs
@@ -1,3 +1,6 @@
+//! Tests that errors from both the writer (`Write::write`) and formatter (`Display::fmt`)
+//! are correctly propagated: writer errors return `Err`, formatter errors cause panics.
+
 //@ run-pass
 //@ needs-unwind
 
@@ -24,7 +27,9 @@ impl Write for ErrorWriter {
         Err(Error::new(WRITER_ERROR, "not connected"))
     }
 
-    fn flush(&mut self) -> io::Result<()> { Ok(()) }
+    fn flush(&mut self) -> io::Result<()> {
+        Ok(())
+    }
 }
 
 fn main() {
@@ -37,7 +42,8 @@ fn main() {
     let err = res.expect_err("formatter error did not lead to panic").downcast::<&str>().unwrap();
     assert!(
         err.contains("formatting trait implementation returned an error"),
-        "unexpected panic: {}", err
+        "unexpected panic: {}",
+        err
     );
 
     // Writer error when there's some string before the first `{}`
@@ -50,6 +56,7 @@ fn main() {
     let err = res.expect_err("formatter error did not lead to panic").downcast::<&str>().unwrap();
     assert!(
         err.contains("formatting trait implementation returned an error"),
-        "unexpected panic: {}", err
+        "unexpected panic: {}",
+        err
     );
 }
diff --git a/tests/ui/lang-items/lang-item-unknown-definition-error.rs b/tests/ui/lang-items/lang-item-unknown-definition-error.rs
new file mode 100644
index 00000000000..22812128c2d
--- /dev/null
+++ b/tests/ui/lang-items/lang-item-unknown-definition-error.rs
@@ -0,0 +1,12 @@
+//! Checks that compiler prevernt attempting to define an unrecognized or unknown lang item
+
+#![allow(unused)]
+#![feature(lang_items)]
+
+#[lang = "foo"]
+fn bar() -> ! {
+    //~^^ ERROR definition of an unknown lang item: `foo`
+    loop {}
+}
+
+fn main() {}
diff --git a/tests/ui/unknown-language-item.stderr b/tests/ui/lang-items/lang-item-unknown-definition-error.stderr
index 832f1342418..3b939757ac2 100644
--- a/tests/ui/unknown-language-item.stderr
+++ b/tests/ui/lang-items/lang-item-unknown-definition-error.stderr
@@ -1,5 +1,5 @@
 error[E0522]: definition of an unknown lang item: `foo`
-  --> $DIR/unknown-language-item.rs:4:1
+  --> $DIR/lang-item-unknown-definition-error.rs:6:1
    |
 LL | #[lang = "foo"]
    | ^^^^^^^^^^^^^^^ definition of unknown lang item `foo`
diff --git a/tests/ui/modules/module-qualified-paths-basic.rs b/tests/ui/modules/module-qualified-paths-basic.rs
new file mode 100644
index 00000000000..c02f6060caa
--- /dev/null
+++ b/tests/ui/modules/module-qualified-paths-basic.rs
@@ -0,0 +1,20 @@
+//! Checks that functions from different modules are accessible via their fully-qualified paths.
+
+//@ run-pass
+
+mod foo {
+    pub fn x() -> isize {
+        return 1;
+    }
+}
+
+mod bar {
+    pub fn y() -> isize {
+        return 1;
+    }
+}
+
+pub fn main() {
+    foo::x();
+    bar::y();
+}
diff --git a/tests/ui/use-nested-groups.rs b/tests/ui/modules/module-use-nested-groups.rs
index c5d66a86935..84d1f9141a8 100644
--- a/tests/ui/use-nested-groups.rs
+++ b/tests/ui/modules/module-use-nested-groups.rs
@@ -1,3 +1,5 @@
+//! Checks complex `use` syntax and availability of types across nested modules.
+
 //@ run-pass
 
 mod a {
diff --git a/tests/ui/modules/primitive-type-module-deprecated-paths.rs b/tests/ui/modules/primitive-type-module-deprecated-paths.rs
new file mode 100644
index 00000000000..5c9d2a616b3
--- /dev/null
+++ b/tests/ui/modules/primitive-type-module-deprecated-paths.rs
@@ -0,0 +1,13 @@
+//! Make sure the module level constants are still there and accessible even after
+//! the corresponding associated constants have been added, and later stabilized.
+
+//@ run-pass
+
+#![allow(deprecated, deprecated_in_future)]
+use std::{f32, u16};
+
+fn main() {
+    let _ = u16::MAX;
+    let _ = f32::EPSILON;
+    let _ = std::f64::MANTISSA_DIGITS;
+}
diff --git a/tests/ui/use-keyword-2.rs b/tests/ui/modules/use-keyword-reexport-type-alias.rs
index 4f3d1ee500d..c62bd9687ae 100644
--- a/tests/ui/use-keyword-2.rs
+++ b/tests/ui/modules/use-keyword-reexport-type-alias.rs
@@ -1,18 +1,20 @@
+//! Checks module re-exports, aliasing with `pub use`,
+//! and calling private methods via `Self` in an impl block.
+
 //@ run-pass
 
 #![allow(unused_variables)]
 pub struct A;
 
 mod test {
-    pub use super :: A;
-
-    pub use self :: A as B;
+    pub use self::A as B;
+    pub use super::A;
 }
 
 impl A {
     fn f() {}
     fn g() {
-        Self :: f()
+        Self::f()
     }
 }
 
diff --git a/tests/ui/unsigned-literal-negation.rs b/tests/ui/numbers-arithmetic/unary-negation-unsigned-integer-error.rs
index 943c7f79742..4325c8b111b 100644
--- a/tests/ui/unsigned-literal-negation.rs
+++ b/tests/ui/numbers-arithmetic/unary-negation-unsigned-integer-error.rs
@@ -1,3 +1,5 @@
+//! This test ensures that the unary negation operator (`-`) cannot be applied to unsigned ints
+
 fn main() {
     let x = -1 as usize; //~ ERROR: cannot apply unary operator `-`
     let x = (-1) as usize; //~ ERROR: cannot apply unary operator `-`
diff --git a/tests/ui/unsigned-literal-negation.stderr b/tests/ui/numbers-arithmetic/unary-negation-unsigned-integer-error.stderr
index 0bedbc1accd..4ce870ded9f 100644
--- a/tests/ui/unsigned-literal-negation.stderr
+++ b/tests/ui/numbers-arithmetic/unary-negation-unsigned-integer-error.stderr
@@ -1,5 +1,5 @@
 error[E0600]: cannot apply unary operator `-` to type `usize`
-  --> $DIR/unsigned-literal-negation.rs:2:13
+  --> $DIR/unary-negation-unsigned-integer-error.rs:4:13
    |
 LL |     let x = -1 as usize;
    |             ^^ cannot apply unary operator `-`
@@ -12,7 +12,7 @@ LL +     let x = usize::MAX;
    |
 
 error[E0600]: cannot apply unary operator `-` to type `usize`
-  --> $DIR/unsigned-literal-negation.rs:3:13
+  --> $DIR/unary-negation-unsigned-integer-error.rs:5:13
    |
 LL |     let x = (-1) as usize;
    |             ^^^^ cannot apply unary operator `-`
@@ -25,7 +25,7 @@ LL +     let x = usize::MAX;
    |
 
 error[E0600]: cannot apply unary operator `-` to type `u32`
-  --> $DIR/unsigned-literal-negation.rs:4:18
+  --> $DIR/unary-negation-unsigned-integer-error.rs:6:18
    |
 LL |     let x: u32 = -1;
    |                  ^^ cannot apply unary operator `-`
diff --git a/tests/ui/unwind-no-uwtable.rs b/tests/ui/panics/unwind-force-no-unwind-tables.rs
index fb8082e3188..2226e4dd03e 100644
--- a/tests/ui/unwind-no-uwtable.rs
+++ b/tests/ui/panics/unwind-force-no-unwind-tables.rs
@@ -1,3 +1,7 @@
+//! This test checks that Rust's unwinding mechanism correctly executes `Drop`
+//! implementations during stack unwinding, even when unwind tables (`uwtable`)
+//! are explicitly disabled via `-C force-unwind-tables=n`.
+
 //@ run-pass
 //@ needs-unwind
 //@ ignore-windows target requires uwtable
@@ -26,9 +30,12 @@ fn increase(count: &mut u8) {
 
 fn main() {
     let mut count = 0;
-    assert!(panic::catch_unwind(AssertUnwindSafe(
-        #[inline(never)]
-        || increase(&mut count)
-    )).is_err());
+    assert!(
+        panic::catch_unwind(AssertUnwindSafe(
+            #[inline(never)]
+            || increase(&mut count)
+        ))
+        .is_err()
+    );
     assert_eq!(count, 1);
 }
diff --git a/tests/ui/wait-forked-but-failed-child.rs b/tests/ui/process/process-spawn-failure.rs
index 4a7f2bee9d9..0950b044c97 100644
--- a/tests/ui/wait-forked-but-failed-child.rs
+++ b/tests/ui/process/process-spawn-failure.rs
@@ -1,3 +1,9 @@
+//! Tests that repeatedly spawning a failing command does not create zombie processes.
+//! Spawns a deliberately invalid command multiple times, verifies each spawn fails,
+//! then uses `ps` (on Unix) to detect any leftover zombie (defunct) child processes.
+//! Checks Rust's process spawning cleans up resources properly.
+//! Skipped on platforms without `ps` utility.
+
 //@ run-pass
 //@ needs-subprocess
 //@ ignore-vxworks no 'ps'
@@ -36,35 +42,42 @@ fn find_zombies() {
     // the PPID column contains a "-" for the respective process.
     // Filter out any lines that have a "-" as the PPID as the PPID is
     // expected to be an integer.
-    let filtered_ps: Vec<_> = ps_output
-        .lines()
-        .filter(|line| line.split_whitespace().nth(1) != Some("-"))
-        .collect();
+    let filtered_ps: Vec<_> =
+        ps_output.lines().filter(|line| line.split_whitespace().nth(1) != Some("-")).collect();
 
     for (line_no, line) in filtered_ps.into_iter().enumerate() {
-        if 0 < line_no && 0 < line.len() &&
-           my_pid == line.split(' ').filter(|w| 0 < w.len()).nth(1)
-                         .expect("1st column should be PPID")
-                         .parse().ok()
-                         .expect("PPID string into integer") &&
-           line.contains("defunct") {
+        if 0 < line_no
+            && 0 < line.len()
+            && my_pid
+                == line
+                    .split(' ')
+                    .filter(|w| 0 < w.len())
+                    .nth(1)
+                    .expect("1st column should be PPID")
+                    .parse()
+                    .ok()
+                    .expect("PPID string into integer")
+            && line.contains("defunct")
+        {
             panic!("Zombie child {}", line);
         }
     }
 }
 
 #[cfg(windows)]
-fn find_zombies() { }
+fn find_zombies() {}
 
 fn main() {
     let too_long = format!("/NoSuchCommand{:0300}", 0u8);
 
-    let _failures = (0..100).map(|_| {
-        let mut cmd = Command::new(&too_long);
-        let failed = cmd.spawn();
-        assert!(failed.is_err(), "Make sure the command fails to spawn(): {:?}", cmd);
-        failed
-    }).collect::<Vec<_>>();
+    let _failures = (0..100)
+        .map(|_| {
+            let mut cmd = Command::new(&too_long);
+            let failed = cmd.spawn();
+            assert!(failed.is_err(), "Make sure the command fails to spawn(): {:?}", cmd);
+            failed
+        })
+        .collect::<Vec<_>>();
 
     find_zombies();
     // then _failures goes out of scope
diff --git a/tests/ui/process/windows-exit-code-still-active.rs b/tests/ui/process/windows-exit-code-still-active.rs
new file mode 100644
index 00000000000..e661a4f6adc
--- /dev/null
+++ b/tests/ui/process/windows-exit-code-still-active.rs
@@ -0,0 +1,26 @@
+//! On Windows the GetExitCodeProcess API is used to get the exit code of a
+//! process, but it's easy to mistake a process exiting with the code 259 as
+//! "still running" because this is the value of the STILL_ACTIVE constant. Make
+//! sure we handle this case in the standard library and correctly report the
+//! status.
+//!
+//! Note that this is disabled on unix as processes exiting with 259 will have
+//! their exit status truncated to 3 (only the lower 8 bits are used).
+
+//@ run-pass
+
+#[cfg(windows)]
+fn main() {
+    use std::env;
+    use std::process::{self, Command};
+
+    if env::args().len() == 1 {
+        let status = Command::new(env::current_exe().unwrap()).arg("foo").status().unwrap();
+        assert_eq!(status.code(), Some(259));
+    } else {
+        process::exit(259);
+    }
+}
+
+#[cfg(not(windows))]
+fn main() {}
diff --git a/tests/ui/reachable/diverging-expressions-unreachable-code.rs b/tests/ui/reachable/diverging-expressions-unreachable-code.rs
new file mode 100644
index 00000000000..bb56987775f
--- /dev/null
+++ b/tests/ui/reachable/diverging-expressions-unreachable-code.rs
@@ -0,0 +1,19 @@
+//@ run-pass
+
+#![allow(unused_must_use)]
+#![allow(unreachable_code)]
+
+fn _id(x: bool) -> bool {
+    x
+}
+
+fn _call_id() {
+    let _c = panic!();
+    _id(_c);
+}
+
+fn _call_id_3() {
+    _id(return) && _id(return);
+}
+
+pub fn main() {}
diff --git a/tests/ui/unreachable-code.rs b/tests/ui/reachable/unreachable-code-diverging-expressions.rs
index 0c46a38d73f..00676418002 100644
--- a/tests/ui/unreachable-code.rs
+++ b/tests/ui/reachable/unreachable-code-diverging-expressions.rs
@@ -26,9 +26,13 @@ fn call_id_3() {
 
 fn ret_guard() {
     match 2 {
-      x if (return) => { x; }
-      x if let true = return => { x; }
-      _ => {}
+        x if (return) => {
+            x;
+        }
+        x if let true = return => {
+            x;
+        }
+        _ => {}
     }
 }
 
diff --git a/tests/ui/virtual-call-attrs-issue-137646.rs b/tests/ui/traits/virtual-call-parameter-handling.rs
index e80bd5768a4..71ed459d15a 100644
--- a/tests/ui/virtual-call-attrs-issue-137646.rs
+++ b/tests/ui/traits/virtual-call-parameter-handling.rs
@@ -1,5 +1,7 @@
-//! Regression test for https://github.com/rust-lang/rust/issues/137646.
-//! The parameter value at all calls to `check` should be `(1, 1, 1)`.
+//! This test checks the correct parameter handling during virtual method calls
+//! through a `dyn Trait` object.
+//!
+//! Regression test for: <https://github.com/rust-lang/rust/issues/137646>
 
 //@ run-pass
 
diff --git a/tests/ui/type/unit-type-basic-usages.rs b/tests/ui/type/unit-type-basic-usages.rs
new file mode 100644
index 00000000000..c3ee8067f59
--- /dev/null
+++ b/tests/ui/type/unit-type-basic-usages.rs
@@ -0,0 +1,14 @@
+//! Checks the basic usage of unit type
+
+//@ run-pass
+
+fn f(u: ()) {
+    u
+}
+
+pub fn main() {
+    let u1: () = ();
+    let mut _u2: () = f(u1);
+    _u2 = ();
+    ()
+}
diff --git a/tests/ui/usize-generic-argument-parent.rs b/tests/ui/type/usize-no-generic-arguments.rs
index 4ab80d944a5..d4d1eea757c 100644
--- a/tests/ui/usize-generic-argument-parent.rs
+++ b/tests/ui/type/usize-no-generic-arguments.rs
@@ -1,3 +1,5 @@
+//! Sanity test that primitives cannot have const generics.
+
 fn foo() {
     let x: usize<foo>; //~ ERROR const arguments are not allowed on builtin type `usize`
 }
diff --git a/tests/ui/usize-generic-argument-parent.stderr b/tests/ui/type/usize-no-generic-arguments.stderr
index 9c081a287ed..f1f3456461f 100644
--- a/tests/ui/usize-generic-argument-parent.stderr
+++ b/tests/ui/type/usize-no-generic-arguments.stderr
@@ -1,5 +1,5 @@
 error[E0109]: const arguments are not allowed on builtin type `usize`
-  --> $DIR/usize-generic-argument-parent.rs:2:18
+  --> $DIR/usize-no-generic-arguments.rs:4:18
    |
 LL |     let x: usize<foo>;
    |            ----- ^^^ const argument not allowed
diff --git a/tests/ui/unit.rs b/tests/ui/unit.rs
deleted file mode 100644
index 04404fc3f5e..00000000000
--- a/tests/ui/unit.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-//@ run-pass
-
-#![allow(unused_assignments)]
-#![allow(unknown_lints)]
-
-#![allow(unused_variables)]
-#![allow(dead_assignment)]
-
-fn f(u: ()) { return u; }
-
-pub fn main() {
-    let u1: () = ();
-    let mut u2: () = f(u1);
-    u2 = ();
-    return ();
-}
diff --git a/tests/ui/unknown-language-item.rs b/tests/ui/unknown-language-item.rs
deleted file mode 100644
index ce206d20358..00000000000
--- a/tests/ui/unknown-language-item.rs
+++ /dev/null
@@ -1,10 +0,0 @@
-#![allow(unused)]
-#![feature(lang_items)]
-
-#[lang = "foo"]
-fn bar() -> ! {
-//~^^ ERROR definition of an unknown lang item: `foo`
-    loop {}
-}
-
-fn main() {}
diff --git a/tests/ui/unnamed_argument_mode.rs b/tests/ui/unnamed_argument_mode.rs
deleted file mode 100644
index 2014e0d23d8..00000000000
--- a/tests/ui/unnamed_argument_mode.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-//@ run-pass
-
-fn good(_a: &isize) {
-}
-
-// unnamed argument &isize is now parse x: &isize
-
-fn called<F>(_f: F) where F: FnOnce(&isize) {
-}
-
-pub fn main() {
-    called(good);
-}
diff --git a/tests/ui/unreachable-code-1.rs b/tests/ui/unreachable-code-1.rs
deleted file mode 100644
index 9c5f7c8f451..00000000000
--- a/tests/ui/unreachable-code-1.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-//@ run-pass
-
-#![allow(unused_must_use)]
-#![allow(unreachable_code)]
-
-#![allow(unused_variables)]
-#![allow(dead_code)]
-
-fn id(x: bool) -> bool { x }
-
-fn call_id() {
-    let c = panic!();
-    id(c);
-}
-
-fn call_id_3() { id(return) && id(return); }
-
-pub fn main() {
-}
diff --git a/tests/ui/uninit-empty-types.rs b/tests/ui/unsafe/maybe-uninit-zero-sized-types.rs
index 82474d873b7..e587ca554fe 100644
--- a/tests/ui/uninit-empty-types.rs
+++ b/tests/ui/unsafe/maybe-uninit-zero-sized-types.rs
@@ -1,6 +1,9 @@
-//@ build-pass
-// Test the uninit() construct returning various empty types.
+//! This test checks that ZSTs can be safely initialized from
+//! `MaybeUninit::uninit().assume_init()` and `std::mem::uninitialized()`
+//! (which is deprecated). This is safe because ZSTs inherently
+//! require no actual memory initialization, as they occupy no memory.
 
+//@ build-pass
 
 use std::mem::MaybeUninit;
 
diff --git a/tests/ui/unused-move.rs b/tests/ui/unused-move.rs
deleted file mode 100644
index 3d5eff2c48d..00000000000
--- a/tests/ui/unused-move.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-//@ run-pass
-// Issue #3878
-// Issue Name: Unused move causes a crash
-// Abstract: zero-fill to block after drop
-
-
-#![allow(path_statements)]
-
-pub fn main() {
-    let y: Box<_> = Box::new(1);
-    y;
-}
diff --git a/tests/ui/use-import-export.rs b/tests/ui/use-import-export.rs
deleted file mode 100644
index d948ffc1520..00000000000
--- a/tests/ui/use-import-export.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-//@ run-pass
-
-mod foo {
-    pub fn x() -> isize { return 1; }
-}
-
-mod bar {
-    pub fn y() -> isize { return 1; }
-}
-
-pub fn main() { foo::x(); bar::y(); }
diff --git a/tests/ui/use-module-level-int-consts.rs b/tests/ui/use-module-level-int-consts.rs
deleted file mode 100644
index 6e8c7053c57..00000000000
--- a/tests/ui/use-module-level-int-consts.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-//@ run-pass
-
-// Make sure the module level constants are still there and accessible even after
-// the corresponding associated constants have been added, and later stabilized.
-#![allow(deprecated, deprecated_in_future)]
-use std::{u16, f32};
-
-fn main() {
-    let _ = u16::MAX;
-    let _ = f32::EPSILON;
-    let _ = std::f64::MANTISSA_DIGITS;
-}
diff --git a/tests/ui/walk-struct-literal-with.rs b/tests/ui/walk-struct-literal-with.rs
deleted file mode 100644
index ee1a77eb9a4..00000000000
--- a/tests/ui/walk-struct-literal-with.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-struct Mine{
-    test: String,
-    other_val: isize
-}
-
-impl Mine{
-    fn make_string_bar(mut self) -> Mine{
-        self.test = "Bar".to_string();
-        self
-    }
-}
-
-fn main(){
-    let start = Mine{test:"Foo".to_string(), other_val:0};
-    let end = Mine{other_val:1, ..start.make_string_bar()};
-    println!("{}", start.test); //~ ERROR borrow of moved value: `start`
-}
diff --git a/tests/ui/weak-new-uninhabited-issue-48493.rs b/tests/ui/weak-new-uninhabited-issue-48493.rs
deleted file mode 100644
index ce7d5786b41..00000000000
--- a/tests/ui/weak-new-uninhabited-issue-48493.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-//@ run-pass
-
-fn main() {
-    enum Void {}
-    let _ = std::rc::Weak::<Void>::new();
-    let _ = std::sync::Weak::<Void>::new();
-}
diff --git a/tests/ui/weird-exit-code.rs b/tests/ui/weird-exit-code.rs
deleted file mode 100644
index e016343f8ba..00000000000
--- a/tests/ui/weird-exit-code.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-//@ run-pass
-// On Windows the GetExitCodeProcess API is used to get the exit code of a
-// process, but it's easy to mistake a process exiting with the code 259 as
-// "still running" because this is the value of the STILL_ACTIVE constant. Make
-// sure we handle this case in the standard library and correctly report the
-// status.
-//
-// Note that this is disabled on unix as processes exiting with 259 will have
-// their exit status truncated to 3 (only the lower 8 bits are used).
-
-#[cfg(windows)]
-fn main() {
-    use std::process::{self, Command};
-    use std::env;
-
-    if env::args().len() == 1 {
-        let status = Command::new(env::current_exe().unwrap())
-                             .arg("foo")
-                             .status()
-                             .unwrap();
-        assert_eq!(status.code(), Some(259));
-    } else {
-        process::exit(259);
-    }
-}
-
-#[cfg(not(windows))]
-fn main() {}