about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-07-11 07:35:18 +0200
committerGitHub <noreply@github.com>2025-07-11 07:35:18 +0200
commit3d6eb225e26448b09fdec1ba7222f3e7174c6ac2 (patch)
tree17d044aac71ec4a410ebbb33c8f8349d46d395e1 /tests
parent2730bebbf88ae9473b339bb7f66eb77fb2c9fa6f (diff)
parent3ad95cccf9b3af7e527869a1eb130217971b7a57 (diff)
downloadrust-3d6eb225e26448b09fdec1ba7222f3e7174c6ac2.tar.gz
rust-3d6eb225e26448b09fdec1ba7222f3e7174c6ac2.zip
Rollup merge of #143302 - Kivooeo:tf27, r=tgross35
`tests/ui`: A New Order [27/N]

> [!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``
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/auto-traits/auto-traits-type-parameter.rs (renamed from tests/ui/type-param-constraints.rs)17
-rw-r--r--tests/ui/consts/const-eval-array-len-in-impl.rs15
-rw-r--r--tests/ui/consts/const-eval-array-len-in-impl.stderr (renamed from tests/ui/unevaluated_fixed_size_array_len.stderr)2
-rw-r--r--tests/ui/destructuring-assignment/let-binding-tuple-destructuring.rs (renamed from tests/ui/typestate-multi-decl.rs)2
-rw-r--r--tests/ui/lifetimes/any-lifetime-escape-higher-rank.rs (renamed from tests/ui/type-id-higher-rank-2.rs)12
-rw-r--r--tests/ui/limits/type-length-limit-enforcement.rs (renamed from tests/ui/type_length_limit.rs)16
-rw-r--r--tests/ui/limits/type-length-limit-enforcement.stderr (renamed from tests/ui/type_length_limit.stderr)4
-rw-r--r--tests/ui/macros/macro-fragment-ident-underscore-error.rs12
-rw-r--r--tests/ui/macros/macro-fragment-ident-underscore-error.stderr (renamed from tests/ui/underscore-ident-matcher.stderr)6
-rw-r--r--tests/ui/namespace/struct-type-and-function-name-coexistence.rs14
-rw-r--r--tests/ui/parser/integer-literal-method-call-underscore.rs15
-rw-r--r--tests/ui/ptr_ops/ptr-write-bool-representation.rs18
-rw-r--r--tests/ui/ptr_ops/raw-pointer-type-basic.rs18
-rw-r--r--tests/ui/try-operator-hygiene.rs26
-rw-r--r--tests/ui/try-trait/try-operator-expansion-hygiene.rs24
-rw-r--r--tests/ui/try-trait/try-operator-various-contexts.rs (renamed from tests/ui/try-operator.rs)35
-rw-r--r--tests/ui/tydesc-name.rs14
-rw-r--r--tests/ui/type-inference/type-inference-none-in-generic-ref.rs9
-rw-r--r--tests/ui/type-inference/type-inference-none-in-generic-ref.stderr (renamed from tests/ui/unconstrained-ref.stderr)2
-rw-r--r--tests/ui/type-inference/type-inference-unconstrained-none.rs5
-rw-r--r--tests/ui/type-inference/type-inference-unconstrained-none.stderr (renamed from tests/ui/unconstrained-none.stderr)2
-rw-r--r--tests/ui/type-namespace.rs7
-rw-r--r--tests/ui/type-ptr.rs9
-rw-r--r--tests/ui/type-use-i1-versus-i8.rs11
-rw-r--r--tests/ui/type/auxiliary/typeid-consistency-aux1.rs (renamed from tests/ui/auxiliary/typeid-intrinsic-aux1.rs)0
-rw-r--r--tests/ui/type/auxiliary/typeid-consistency-aux2.rs (renamed from tests/ui/auxiliary/typeid-intrinsic-aux2.rs)0
-rw-r--r--tests/ui/type/type-name-basic.rs17
-rw-r--r--tests/ui/type/typeid-consistency.rs (renamed from tests/ui/typeid-intrinsic.rs)27
-rw-r--r--tests/ui/unconstrained-none.rs5
-rw-r--r--tests/ui/unconstrained-ref.rs7
-rw-r--r--tests/ui/underscore-ident-matcher.rs9
-rw-r--r--tests/ui/underscore-lifetime/basic-underscore-lifetime-elision.rs (renamed from tests/ui/underscore-lifetimes.rs)8
-rw-r--r--tests/ui/underscore-method-after-integer.rs11
-rw-r--r--tests/ui/unevaluated_fixed_size_array_len.rs13
34 files changed, 219 insertions, 173 deletions
diff --git a/tests/ui/type-param-constraints.rs b/tests/ui/auto-traits/auto-traits-type-parameter.rs
index 83d81c0d833..0c448f58996 100644
--- a/tests/ui/type-param-constraints.rs
+++ b/tests/ui/auto-traits/auto-traits-type-parameter.rs
@@ -1,24 +1,25 @@
+//! Checks how type parameters interact with auto-traits like `Send` and `Sync` with implicit
+//! bounds
+
 //@ run-pass
 
 #![allow(non_camel_case_types)]
 #![allow(dead_code)]
 
-fn p_foo<T>(_pinned: T) { }
-fn s_foo<T>(_shared: T) { }
-fn u_foo<T:Send>(_unique: T) { }
+fn p_foo<T>(_pinned: T) {}
+fn s_foo<T>(_shared: T) {}
+fn u_foo<T: Send>(_unique: T) {}
 
 struct r {
-  i: isize,
+    i: isize,
 }
 
 impl Drop for r {
     fn drop(&mut self) {}
 }
 
-fn r(i:isize) -> r {
-    r {
-        i: i
-    }
+fn r(i: isize) -> r {
+    r { i }
 }
 
 pub fn main() {
diff --git a/tests/ui/consts/const-eval-array-len-in-impl.rs b/tests/ui/consts/const-eval-array-len-in-impl.rs
new file mode 100644
index 00000000000..0373274770d
--- /dev/null
+++ b/tests/ui/consts/const-eval-array-len-in-impl.rs
@@ -0,0 +1,15 @@
+//! This checks that compiler correctly evaluate constant array lengths within trait `impl` headers.
+//!
+//! Regression test for <https://github.com/rust-lang/rust/issues/49208>.
+
+trait Foo {
+    fn foo();
+}
+
+impl Foo for [(); 1] {
+    fn foo() {}
+}
+
+fn main() {
+    <[(); 0] as Foo>::foo() //~ ERROR E0277
+}
diff --git a/tests/ui/unevaluated_fixed_size_array_len.stderr b/tests/ui/consts/const-eval-array-len-in-impl.stderr
index 43cc377006e..faff7aa3ff7 100644
--- a/tests/ui/unevaluated_fixed_size_array_len.stderr
+++ b/tests/ui/consts/const-eval-array-len-in-impl.stderr
@@ -1,5 +1,5 @@
 error[E0277]: the trait bound `[(); 0]: Foo` is not satisfied
-  --> $DIR/unevaluated_fixed_size_array_len.rs:12:6
+  --> $DIR/const-eval-array-len-in-impl.rs:14:6
    |
 LL |     <[(); 0] as Foo>::foo()
    |      ^^^^^^^ the trait `Foo` is not implemented for `[(); 0]`
diff --git a/tests/ui/typestate-multi-decl.rs b/tests/ui/destructuring-assignment/let-binding-tuple-destructuring.rs
index 3d0e79632bb..f62fae86219 100644
--- a/tests/ui/typestate-multi-decl.rs
+++ b/tests/ui/destructuring-assignment/let-binding-tuple-destructuring.rs
@@ -1,3 +1,5 @@
+//! Checks basic multiple variable declaration using tuple destructuring in a `let` binding.
+
 //@ run-pass
 
 pub fn main() {
diff --git a/tests/ui/type-id-higher-rank-2.rs b/tests/ui/lifetimes/any-lifetime-escape-higher-rank.rs
index 7b0c7b53940..f9f38ee532d 100644
--- a/tests/ui/type-id-higher-rank-2.rs
+++ b/tests/ui/lifetimes/any-lifetime-escape-higher-rank.rs
@@ -1,11 +1,15 @@
+//! Checks that `std::any::Any` cannot be used to circumvent lifetime rules
+//! with higher-rank types.
+
 //@ run-pass
-// Test that we can't ignore lifetimes by going through Any.
 
 use std::any::Any;
 
 struct Foo<'a>(&'a str);
 
-fn good(s: &String) -> Foo<'_> { Foo(s) }
+fn good(s: &String) -> Foo<'_> {
+    Foo(s)
+}
 
 fn bad1(s: String) -> Option<&'static str> {
     let a: Box<dyn Any> = Box::new(good as fn(&String) -> Foo);
@@ -17,7 +21,9 @@ trait AsStr<'a, 'b> {
 }
 
 impl<'a> AsStr<'a, 'a> for String {
-   fn get(&'a self) -> &'a str { self }
+    fn get(&'a self) -> &'a str {
+        self
+    }
 }
 
 fn bad2(s: String) -> Option<&'static str> {
diff --git a/tests/ui/type_length_limit.rs b/tests/ui/limits/type-length-limit-enforcement.rs
index 87f5ffd76d7..3b34d6eb5c8 100644
--- a/tests/ui/type_length_limit.rs
+++ b/tests/ui/limits/type-length-limit-enforcement.rs
@@ -1,17 +1,19 @@
-//@ build-fail
+//~ ERROR reached the type-length limit
+
+//! Checks the enforcement of the type-length limit
+//! and its configurability via `#![type_length_limit]`.
+
 //@ compile-flags: -Copt-level=0 -Zenforce-type-length-limit
-//~^^ ERROR reached the type-length limit
 
-// Test that the type length limit can be changed.
-// The exact type depends on optimizations, so disable them.
+//@ build-fail
 
 #![allow(dead_code)]
-#![type_length_limit="8"]
+#![type_length_limit = "8"]
 
 macro_rules! link {
     ($id:ident, $t:ty) => {
         pub type $id = ($t, $t, $t);
-    }
+    };
 }
 
 link! { A1, B1 }
@@ -26,7 +28,7 @@ link! { D, E }
 link! { E, F }
 link! { F, G<Option<i32>, Option<i32>> }
 
-pub struct G<T, K>(std::marker::PhantomData::<(T, K)>);
+pub struct G<T, K>(std::marker::PhantomData<(T, K)>);
 
 fn main() {
     drop::<Option<A>>(None);
diff --git a/tests/ui/type_length_limit.stderr b/tests/ui/limits/type-length-limit-enforcement.stderr
index 198d133c08c..516230ae832 100644
--- a/tests/ui/type_length_limit.stderr
+++ b/tests/ui/limits/type-length-limit-enforcement.stderr
@@ -1,11 +1,11 @@
 error: reached the type-length limit while instantiating `std::mem::drop::<Option<((((..., ..., ...), ..., ...), ..., ...), ..., ...)>>`
-  --> $DIR/type_length_limit.rs:32:5
+  --> $DIR/type-length-limit-enforcement.rs:34:5
    |
 LL |     drop::<Option<A>>(None);
    |     ^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: consider adding a `#![type_length_limit="4010"]` attribute to your crate
-   = note: the full type name has been written to '$TEST_BUILD_DIR/type_length_limit.long-type.txt'
+   = note: the full type name has been written to '$TEST_BUILD_DIR/type-length-limit-enforcement.long-type.txt'
 
 error: reached the type-length limit while instantiating `<{closure@rt::lang_start<()>::{closure#0}} as FnMut<()>>::call_mut`
    |
diff --git a/tests/ui/macros/macro-fragment-ident-underscore-error.rs b/tests/ui/macros/macro-fragment-ident-underscore-error.rs
new file mode 100644
index 00000000000..882dd167adc
--- /dev/null
+++ b/tests/ui/macros/macro-fragment-ident-underscore-error.rs
@@ -0,0 +1,12 @@
+//! Verifies that the reserved underscore `_` cannot be used as an `ident` fragment specifier
+//! within a macro pattern, as it leads to a compilation error.
+
+macro_rules! identity {
+    ($i: ident) => {
+        $i
+    };
+}
+
+fn main() {
+    let identity!(_) = 10; //~ ERROR no rules expected reserved identifier `_`
+}
diff --git a/tests/ui/underscore-ident-matcher.stderr b/tests/ui/macros/macro-fragment-ident-underscore-error.stderr
index 0c3f980cf6c..929e4624e4b 100644
--- a/tests/ui/underscore-ident-matcher.stderr
+++ b/tests/ui/macros/macro-fragment-ident-underscore-error.stderr
@@ -1,5 +1,5 @@
 error: no rules expected reserved identifier `_`
-  --> $DIR/underscore-ident-matcher.rs:8:19
+  --> $DIR/macro-fragment-ident-underscore-error.rs:11:19
    |
 LL | macro_rules! identity {
    | --------------------- when calling this macro
@@ -8,9 +8,9 @@ LL |     let identity!(_) = 10;
    |                   ^ no rules expected this token in macro call
    |
 note: while trying to match meta-variable `$i:ident`
-  --> $DIR/underscore-ident-matcher.rs:2:6
+  --> $DIR/macro-fragment-ident-underscore-error.rs:5:6
    |
-LL |     ($i: ident) => (
+LL |     ($i: ident) => {
    |      ^^^^^^^^^
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/namespace/struct-type-and-function-name-coexistence.rs b/tests/ui/namespace/struct-type-and-function-name-coexistence.rs
new file mode 100644
index 00000000000..8d5ab3781b5
--- /dev/null
+++ b/tests/ui/namespace/struct-type-and-function-name-coexistence.rs
@@ -0,0 +1,14 @@
+//@ run-pass
+
+struct A {
+    a: isize,
+}
+
+fn a(a: A) -> isize {
+    return a.a;
+}
+
+pub fn main() {
+    let x: A = A { a: 1 };
+    assert_eq!(a(x), 1);
+}
diff --git a/tests/ui/parser/integer-literal-method-call-underscore.rs b/tests/ui/parser/integer-literal-method-call-underscore.rs
new file mode 100644
index 00000000000..9e4abf28cba
--- /dev/null
+++ b/tests/ui/parser/integer-literal-method-call-underscore.rs
@@ -0,0 +1,15 @@
+//! Checks that methods with names starting with an underscore (`_`) can be
+//! successfully called directly on integer literals, confirming the correct
+//! parsing of such expressions where the underscore is part of the method identifier.
+
+//@ run-pass
+
+trait Tr: Sized {
+    fn _method_on_numbers(self) {}
+}
+
+impl Tr for i32 {}
+
+fn main() {
+    42._method_on_numbers();
+}
diff --git a/tests/ui/ptr_ops/ptr-write-bool-representation.rs b/tests/ui/ptr_ops/ptr-write-bool-representation.rs
new file mode 100644
index 00000000000..3dfc3e51ab2
--- /dev/null
+++ b/tests/ui/ptr_ops/ptr-write-bool-representation.rs
@@ -0,0 +1,18 @@
+//! Validates the correct behavior of writing a `bool` value using `std::ptr::write`.
+//!
+//! This test addresses historical concerns regarding the internal representation of `bool`
+//! (e.g., as `i1` in LLVM versus its byte-aligned memory layout) and checks that
+//! `ptr::write` correctly handles this type without issues, confirming its memory
+//! behavior is as expected.
+
+//@ run-pass
+
+use std::ptr;
+
+pub fn main() {
+    unsafe {
+        let mut x: bool = false;
+        // this line breaks it
+        ptr::write(&mut x, false);
+    }
+}
diff --git a/tests/ui/ptr_ops/raw-pointer-type-basic.rs b/tests/ui/ptr_ops/raw-pointer-type-basic.rs
new file mode 100644
index 00000000000..349e8e67909
--- /dev/null
+++ b/tests/ui/ptr_ops/raw-pointer-type-basic.rs
@@ -0,0 +1,18 @@
+//! Checks the basic usage of raw pointers (`*const isize`) as function argument and return types.
+
+//@ run-pass
+
+#![allow(dead_code)]
+
+fn f(a: *const isize) -> *const isize {
+    return a;
+}
+
+fn g(a: *const isize) -> *const isize {
+    let b = f(a);
+    return b;
+}
+
+pub fn main() {
+    return;
+}
diff --git a/tests/ui/try-operator-hygiene.rs b/tests/ui/try-operator-hygiene.rs
deleted file mode 100644
index 20538e094c6..00000000000
--- a/tests/ui/try-operator-hygiene.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-//@ run-pass
-
-#![allow(non_upper_case_globals)]
-#![allow(dead_code)]
-// `expr?` expands to:
-//
-// match expr {
-//     Ok(val) => val,
-//     Err(err) => return Err(From::from(err)),
-// }
-//
-// This test verifies that the expansion is hygienic, i.e., it's not affected by other `val` and
-// `err` bindings that may be in scope.
-
-use std::num::ParseIntError;
-
-fn main() {
-    assert_eq!(parse(), Ok(1));
-}
-
-fn parse() -> Result<i32, ParseIntError> {
-    const val: char = 'a';
-    const err: char = 'b';
-
-    Ok("1".parse::<i32>()?)
-}
diff --git a/tests/ui/try-trait/try-operator-expansion-hygiene.rs b/tests/ui/try-trait/try-operator-expansion-hygiene.rs
new file mode 100644
index 00000000000..b6f4e533d8d
--- /dev/null
+++ b/tests/ui/try-trait/try-operator-expansion-hygiene.rs
@@ -0,0 +1,24 @@
+//! This test verifies that the `?` operator expansion is hygienic,
+//! i.e., it's not affected by other `val` and `err` bindings that may be in scope.
+//!
+//! Note: Prior to the Try trait stabilization, `expr?` expanded to a match
+//! with `val` and `err` bindings. The current implementation uses Try::branch()
+//! but this test remains relevant for hygiene verification.
+
+//@ run-pass
+
+#![allow(non_upper_case_globals)]
+#![allow(dead_code)]
+
+use std::num::ParseIntError;
+
+fn main() {
+    assert_eq!(parse(), Ok(1));
+}
+
+fn parse() -> Result<i32, ParseIntError> {
+    const val: char = 'a';
+    const err: char = 'b';
+
+    Ok("1".parse::<i32>()?)
+}
diff --git a/tests/ui/try-operator.rs b/tests/ui/try-trait/try-operator-various-contexts.rs
index b9978204557..41c3679c96f 100644
--- a/tests/ui/try-operator.rs
+++ b/tests/ui/try-trait/try-operator-various-contexts.rs
@@ -1,9 +1,11 @@
+//! Checks the functionality of the `?` operator in various syntactic contexts.
+
 //@ run-pass
 
 #![allow(dead_code)]
 
 use std::fs::File;
-use std::io::{Read, self};
+use std::io::{self, Read};
 use std::num::ParseIntError;
 use std::str::FromStr;
 
@@ -35,7 +37,9 @@ fn on_path() -> Result<i32, ParseIntError> {
 
 fn on_macro() -> Result<i32, ParseIntError> {
     macro_rules! id {
-        ($e:expr) => { $e }
+        ($e:expr) => {
+            $e
+        };
     }
 
     Ok(id!("7".parse::<i32>())?)
@@ -50,11 +54,14 @@ fn on_parens() -> Result<i32, ParseIntError> {
 fn on_block() -> Result<i32, ParseIntError> {
     let x = "9".parse::<i32>();
 
-    Ok({x}?)
+    Ok({ x }?)
 }
 
 fn on_field() -> Result<i32, ParseIntError> {
-    struct Pair<A, B> { a: A, b: B }
+    struct Pair<A, B> {
+        a: A,
+        b: B,
+    }
 
     let x = Pair { a: "10".parse::<i32>(), b: 0 };
 
@@ -89,7 +96,9 @@ fn on_index() -> Result<i32, ParseIntError> {
 }
 
 fn on_args() -> Result<i32, ParseIntError> {
-    fn sub(x: i32, y: i32) -> i32 { x - y }
+    fn sub(x: i32, y: i32) -> i32 {
+        x - y
+    }
 
     let x = "20".parse();
     let y = "21".parse();
@@ -98,19 +107,11 @@ fn on_args() -> Result<i32, ParseIntError> {
 }
 
 fn on_if() -> Result<i32, ParseIntError> {
-    Ok(if true {
-        "22".parse::<i32>()
-    } else {
-        "23".parse::<i32>()
-    }?)
+    Ok(if true { "22".parse::<i32>() } else { "23".parse::<i32>() }?)
 }
 
 fn on_if_let() -> Result<i32, ParseIntError> {
-    Ok(if let Ok(..) = "24".parse::<i32>() {
-        "25".parse::<i32>()
-    } else {
-        "26".parse::<i32>()
-    }?)
+    Ok(if let Ok(..) = "24".parse::<i32>() { "25".parse::<i32>() } else { "26".parse::<i32>() }?)
 }
 
 fn on_match() -> Result<i32, ParseIntError> {
@@ -121,7 +122,9 @@ fn on_match() -> Result<i32, ParseIntError> {
 }
 
 fn tight_binding() -> Result<bool, ()> {
-    fn ok<T>(x: T) -> Result<T, ()> { Ok(x) }
+    fn ok<T>(x: T) -> Result<T, ()> {
+        Ok(x)
+    }
 
     let x = ok(true);
     Ok(!x?)
diff --git a/tests/ui/tydesc-name.rs b/tests/ui/tydesc-name.rs
deleted file mode 100644
index 068a42606c2..00000000000
--- a/tests/ui/tydesc-name.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-//@ run-pass
-
-#![allow(dead_code)]
-
-use std::any::type_name;
-
-struct Foo<T> {
-    x: T
-}
-
-pub fn main() {
-    assert_eq!(type_name::<isize>(), "isize");
-    assert_eq!(type_name::<Foo<usize>>(), "tydesc_name::Foo<usize>");
-}
diff --git a/tests/ui/type-inference/type-inference-none-in-generic-ref.rs b/tests/ui/type-inference/type-inference-none-in-generic-ref.rs
new file mode 100644
index 00000000000..9c1b7c19e3d
--- /dev/null
+++ b/tests/ui/type-inference/type-inference-none-in-generic-ref.rs
@@ -0,0 +1,9 @@
+//! Checks that unconstrained `None` is rejected through references and generics
+
+struct S<'a, T: 'a> {
+    o: &'a Option<T>,
+}
+
+fn main() {
+    S { o: &None }; //~ ERROR type annotations needed [E0282]
+}
diff --git a/tests/ui/unconstrained-ref.stderr b/tests/ui/type-inference/type-inference-none-in-generic-ref.stderr
index 72fd0202f4e..d671c189b37 100644
--- a/tests/ui/unconstrained-ref.stderr
+++ b/tests/ui/type-inference/type-inference-none-in-generic-ref.stderr
@@ -1,5 +1,5 @@
 error[E0282]: type annotations needed
-  --> $DIR/unconstrained-ref.rs:6:5
+  --> $DIR/type-inference-none-in-generic-ref.rs:8:5
    |
 LL |     S { o: &None };
    |     ^^^^^^^^^^^^^^ cannot infer type of the type parameter `T` declared on the struct `S`
diff --git a/tests/ui/type-inference/type-inference-unconstrained-none.rs b/tests/ui/type-inference/type-inference-unconstrained-none.rs
new file mode 100644
index 00000000000..38a506763c7
--- /dev/null
+++ b/tests/ui/type-inference/type-inference-unconstrained-none.rs
@@ -0,0 +1,5 @@
+//! Regression test for <https://github.com/rust-lang/rust/issues/5062>.
+
+fn main() {
+    None; //~ ERROR type annotations needed [E0282]
+}
diff --git a/tests/ui/unconstrained-none.stderr b/tests/ui/type-inference/type-inference-unconstrained-none.stderr
index 4af6f412e5b..80572b845e8 100644
--- a/tests/ui/unconstrained-none.stderr
+++ b/tests/ui/type-inference/type-inference-unconstrained-none.stderr
@@ -1,5 +1,5 @@
 error[E0282]: type annotations needed
-  --> $DIR/unconstrained-none.rs:4:5
+  --> $DIR/type-inference-unconstrained-none.rs:4:5
    |
 LL |     None;
    |     ^^^^ cannot infer type of the type parameter `T` declared on the enum `Option`
diff --git a/tests/ui/type-namespace.rs b/tests/ui/type-namespace.rs
deleted file mode 100644
index 31dc684a214..00000000000
--- a/tests/ui/type-namespace.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-//@ run-pass
-
-struct A { a: isize }
-
-fn a(a: A) -> isize { return a.a; }
-
-pub fn main() { let x: A = A {a: 1}; assert_eq!(a(x), 1); }
diff --git a/tests/ui/type-ptr.rs b/tests/ui/type-ptr.rs
deleted file mode 100644
index 5c8ed344ab3..00000000000
--- a/tests/ui/type-ptr.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-//@ run-pass
-
-#![allow(dead_code)]
-
-fn f(a: *const isize) -> *const isize { return a; }
-
-fn g(a: *const isize) -> *const isize { let b = f(a); return b; }
-
-pub fn main() { return; }
diff --git a/tests/ui/type-use-i1-versus-i8.rs b/tests/ui/type-use-i1-versus-i8.rs
deleted file mode 100644
index 4eb25329223..00000000000
--- a/tests/ui/type-use-i1-versus-i8.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-//@ run-pass
-
-use std::ptr;
-
-pub fn main() {
-    unsafe {
-        let mut x: bool = false;
-        // this line breaks it
-        ptr::write(&mut x, false);
-    }
-}
diff --git a/tests/ui/auxiliary/typeid-intrinsic-aux1.rs b/tests/ui/type/auxiliary/typeid-consistency-aux1.rs
index a028008c6ae..a028008c6ae 100644
--- a/tests/ui/auxiliary/typeid-intrinsic-aux1.rs
+++ b/tests/ui/type/auxiliary/typeid-consistency-aux1.rs
diff --git a/tests/ui/auxiliary/typeid-intrinsic-aux2.rs b/tests/ui/type/auxiliary/typeid-consistency-aux2.rs
index a028008c6ae..a028008c6ae 100644
--- a/tests/ui/auxiliary/typeid-intrinsic-aux2.rs
+++ b/tests/ui/type/auxiliary/typeid-consistency-aux2.rs
diff --git a/tests/ui/type/type-name-basic.rs b/tests/ui/type/type-name-basic.rs
new file mode 100644
index 00000000000..9381cb82578
--- /dev/null
+++ b/tests/ui/type/type-name-basic.rs
@@ -0,0 +1,17 @@
+//! Checks the basic functionality of `std::any::type_name` for primitive types
+//! and simple generic structs.
+
+//@ run-pass
+
+#![allow(dead_code)]
+
+use std::any::type_name;
+
+struct Foo<T> {
+    x: T,
+}
+
+pub fn main() {
+    assert_eq!(type_name::<isize>(), "isize");
+    assert_eq!(type_name::<Foo<usize>>(), "type_name_basic::Foo<usize>");
+}
diff --git a/tests/ui/typeid-intrinsic.rs b/tests/ui/type/typeid-consistency.rs
index 7c4fb3f95a9..67ee1b6d839 100644
--- a/tests/ui/typeid-intrinsic.rs
+++ b/tests/ui/type/typeid-consistency.rs
@@ -1,16 +1,18 @@
+//! Checks the correctness and consistency of `std::any::TypeId::of`.
+
 //@ run-pass
 
 #![allow(deprecated)]
-//@ aux-build:typeid-intrinsic-aux1.rs
-//@ aux-build:typeid-intrinsic-aux2.rs
-
 #![feature(core_intrinsics)]
 
-extern crate typeid_intrinsic_aux1 as other1;
-extern crate typeid_intrinsic_aux2 as other2;
+//@ aux-build:typeid-consistency-aux1.rs
+//@ aux-build:typeid-consistency-aux2.rs
+
+extern crate typeid_consistency_aux1 as other1;
+extern crate typeid_consistency_aux2 as other2;
 
-use std::hash::{SipHasher, Hasher, Hash};
 use std::any::TypeId;
+use std::hash::{Hash, Hasher, SipHasher};
 
 struct A;
 struct Test;
@@ -34,7 +36,7 @@ pub fn main() {
     assert_eq!(TypeId::of::<other2::F>(), other2::id_F());
     assert_eq!(TypeId::of::<other2::G>(), other2::id_G());
     assert_eq!(TypeId::of::<other2::H>(), other2::id_H());
-    assert_eq!(TypeId::of::<other1::I>(), other2::id_I());
+    assert_eq!(TypeId::of::<other2::I>(), other2::id_I());
 
     assert_eq!(other1::id_F(), other2::id_F());
     assert_eq!(other1::id_G(), other2::id_G());
@@ -49,10 +51,8 @@ pub fn main() {
     assert_eq!(other2::foo::<A>(), other1::foo::<A>());
 
     // sanity test of TypeId
-    let (a, b, c) = (TypeId::of::<usize>(), TypeId::of::<&'static str>(),
-                     TypeId::of::<Test>());
-    let (d, e, f) = (TypeId::of::<usize>(), TypeId::of::<&'static str>(),
-                     TypeId::of::<Test>());
+    let (a, b, c) = (TypeId::of::<usize>(), TypeId::of::<&'static str>(), TypeId::of::<Test>());
+    let (d, e, f) = (TypeId::of::<usize>(), TypeId::of::<&'static str>(), TypeId::of::<Test>());
 
     assert!(a != b);
     assert!(a != c);
@@ -82,10 +82,7 @@ pub fn main() {
     assert_ne!(TypeId::of::<other1::I32Iterator>(), TypeId::of::<other1::U32Iterator>());
 
     // Check fn pointer against collisions
-    assert_ne!(
-        TypeId::of::<fn(fn(A) -> A) -> A>(),
-        TypeId::of::<fn(fn() -> A, A) -> A>()
-    );
+    assert_ne!(TypeId::of::<fn(fn(A) -> A) -> A>(), TypeId::of::<fn(fn() -> A, A) -> A>());
     assert_ne!(
         TypeId::of::<for<'a> fn(&'a i32) -> &'a i32>(),
         TypeId::of::<for<'a> fn(&'a i32) -> &'static i32>()
diff --git a/tests/ui/unconstrained-none.rs b/tests/ui/unconstrained-none.rs
deleted file mode 100644
index e180b3163d4..00000000000
--- a/tests/ui/unconstrained-none.rs
+++ /dev/null
@@ -1,5 +0,0 @@
-// Issue #5062
-
-fn main() {
-    None; //~ ERROR type annotations needed [E0282]
-}
diff --git a/tests/ui/unconstrained-ref.rs b/tests/ui/unconstrained-ref.rs
deleted file mode 100644
index 473ca954b23..00000000000
--- a/tests/ui/unconstrained-ref.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-struct S<'a, T:'a> {
-    o: &'a Option<T>
-}
-
-fn main() {
-    S { o: &None }; //~ ERROR type annotations needed [E0282]
-}
diff --git a/tests/ui/underscore-ident-matcher.rs b/tests/ui/underscore-ident-matcher.rs
deleted file mode 100644
index 77ec70d43d5..00000000000
--- a/tests/ui/underscore-ident-matcher.rs
+++ /dev/null
@@ -1,9 +0,0 @@
-macro_rules! identity {
-    ($i: ident) => (
-        $i
-    )
-}
-
-fn main() {
-    let identity!(_) = 10; //~ ERROR no rules expected reserved identifier `_`
-}
diff --git a/tests/ui/underscore-lifetimes.rs b/tests/ui/underscore-lifetime/basic-underscore-lifetime-elision.rs
index a372851f9cf..a2e3c8e26d4 100644
--- a/tests/ui/underscore-lifetimes.rs
+++ b/tests/ui/underscore-lifetime/basic-underscore-lifetime-elision.rs
@@ -1,6 +1,9 @@
+//! Checks the correct usage and behavior of the anonymous lifetime `'_` (underscore lifetime)
+
 //@ run-pass
 
 #![allow(dead_code, mismatched_lifetime_syntaxes)]
+
 struct Foo<'a>(&'a u8);
 
 fn foo(x: &u8) -> Foo<'_> {
@@ -31,8 +34,5 @@ fn main() {
     let _ = foo2(x);
     let _ = foo3(x);
     foo4(Foo(x));
-    let _ = foo5(Foo2 {
-        a: x,
-        b: &6,
-    });
+    let _ = foo5(Foo2 { a: x, b: &6 });
 }
diff --git a/tests/ui/underscore-method-after-integer.rs b/tests/ui/underscore-method-after-integer.rs
deleted file mode 100644
index d9eb21894e8..00000000000
--- a/tests/ui/underscore-method-after-integer.rs
+++ /dev/null
@@ -1,11 +0,0 @@
-//@ run-pass
-
-trait Tr : Sized {
-    fn _method_on_numbers(self) {}
-}
-
-impl Tr for i32 {}
-
-fn main() {
-    42._method_on_numbers();
-}
diff --git a/tests/ui/unevaluated_fixed_size_array_len.rs b/tests/ui/unevaluated_fixed_size_array_len.rs
deleted file mode 100644
index 6c545913dd9..00000000000
--- a/tests/ui/unevaluated_fixed_size_array_len.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// https://github.com/rust-lang/rust/issues/49208
-
-trait Foo {
-    fn foo();
-}
-
-impl Foo for [(); 1] {
-    fn foo() {}
-}
-
-fn main() {
-    <[(); 0] as Foo>::foo() //~ ERROR E0277
-}