Rollup merge of #154606 - cyrgani:misc-test-cleanups, r=Kivooeo

misc test cleanups

These are some mixed cleanups to `tests/ui` that individually seemed too small for a PR of their own. Some duplicated tests are removed, `issues-*` tests are renamed and more FIXMEs are added to `ui/README.md`.
Reasoning for the deleted tests:
* `tests/ui/associated-types/issue-47814.rs`: duplicate of `tests/ui/associated-consts/issue-47814.rs`
* rename `tests/ui/closures/2229_closure_analysis/migrations/issue-78720.rs` to `.../nested-copy-drops-83176.rs` since rust-lang/rust#78720 was not the correct issue, rust-lang/rust#83176 was.
* `tests/ui/specialization/defaultimpl/specialization-feature-gate-default.rs`: duplicate of `tests/ui/specialization/specialization-feature-gate-default.rs`
* `fn/issue-1900.rs`: duplicate of `error-codes/E0131.rs`

r? @Kivooeo
This commit is contained in:
Jonathan Brouwer
2026-03-31 13:58:43 +02:00
committed by GitHub
12 changed files with 30 additions and 79 deletions
-3
View File
@@ -117,7 +117,6 @@ ui/associated-types/issue-44153.rs
ui/associated-types/issue-47139-1.rs
ui/associated-types/issue-47139-2.rs
ui/associated-types/issue-47385.rs
ui/associated-types/issue-47814.rs
ui/associated-types/issue-48010.rs
ui/associated-types/issue-48551.rs
ui/associated-types/issue-50301.rs
@@ -406,7 +405,6 @@ ui/closures/2229_closure_analysis/match/issue-87097.rs
ui/closures/2229_closure_analysis/match/issue-87426.rs
ui/closures/2229_closure_analysis/match/issue-87988.rs
ui/closures/2229_closure_analysis/match/issue-88331.rs
ui/closures/2229_closure_analysis/migrations/issue-78720.rs
ui/closures/2229_closure_analysis/migrations/issue-86753.rs
ui/closures/2229_closure_analysis/migrations/issue-90024-adt-correct-subst.rs
ui/closures/2229_closure_analysis/run_pass/issue-87378.rs
@@ -1001,7 +999,6 @@ ui/fmt/issue-86085.rs
ui/fmt/issue-89173.rs
ui/fmt/issue-91556.rs
ui/fn/issue-1451.rs
ui/fn/issue-1900.rs
ui/fn/issue-3044.rs
ui/fn/issue-3099.rs
ui/fn/issue-3904.rs
+22 -6
View File
@@ -36,6 +36,8 @@ These tests exercise the [`annotate-snippets`]-based emitter implementation.
[`annotate-snippets`]: https://github.com/rust-lang/annotate-snippets-rs
**FIXME**: merge this with `error-emitter`
## `tests/ui/anon-params`
These tests deal with anonymous parameters (no name, only type), a deprecated feature that becomes a hard error in Edition 2018.
@@ -141,6 +143,8 @@ However, only a single test was ever added to this category: <https://github.com
Tests for pattern binding in match expressions, let statements, and other binding contexts. E.g. binding modes and refutability. See [Patterns | Reference](https://doc.rust-lang.org/reference/patterns.html).
**FIXME**: quite some overlap with `tests/ui/pattern` and `tests/ui/match`.
## `tests/ui/binop/`: Binary operators
Tests for binary operators (such as `==`, `&&` or `^`). E.g. overloading, type checking, and diagnostics for invalid operations.
@@ -272,7 +276,7 @@ This directory is actually for the standard library [`std::process::Command`](ht
Some traits' implementation must be compared with their definition, checking for problems such as the implementation having stricter requirements (such as needing to implement `Copy`).
This subdirectory is *not* intended comparison traits (`PartialEq`, `Eq`, `PartialOrd`, `Ord`).
This subdirectory is *not* intended for comparison traits (`PartialEq`, `Eq`, `PartialOrd`, `Ord`).
## `tests/ui/compile-flags/`
@@ -448,6 +452,8 @@ Exercises diagnostics for when a code block attempts to gain ownership of a non-
Exercises diagnostics for disallowed struct destructuring.
**FIXME**: does this really need to be its own immediate subdirectory?
## `tests/ui/dist`
Tests that require distribution artifacts.
@@ -508,7 +514,7 @@ These tests run in specific Rust editions, such as Rust 2015 or Rust 2018, and c
## `tests/ui/eii`: Externally Implementable Items
Exercises `eii` keyword.
Exercises the `#[eii]` attribute and related features.
## `tests/ui/entry-point/`: `main` function
@@ -611,8 +617,6 @@ Tests for `#![feature(fn_traits)]`. See [`fn_traits` | The Unstable book](https:
Anything to do with loops and `for`, `loop` and `while` keywords to express them.
**FIXME**: After `ui/for` is merged into this, also carry over its SUMMARY text.
## `tests/ui/force-inlining/`: `#[rustc_force_inline]`
Tests for `#[rustc_force_inline]`, which will force a function to always be labelled as inline by the compiler (it will be inserted at the point of its call instead of being used as a normal function call.) If the compiler is unable to inline the function, an error will be reported. See <https://github.com/rust-lang/rust/pull/134082>.
@@ -730,6 +734,8 @@ Tests on type inference.
Tests for diagnostics on infinitely recursive types without indirection.
**FIXME**: check for overlap with `structs-enums/enum-rec` and `structs-enums/struct-rec`
## `tests/ui/inline-const/`
These tests revolve around the inline `const` block that forces the compiler to const-eval its content.
@@ -853,7 +859,9 @@ Tests exercising analysis for unused variables, unreachable statements, function
## `tests/ui/loop-match`
Tests for `loop` with `match` expressions.
Tests for the `loop_match` feature to optimize `loop`s consisting of one big `match` expressions.
See [Tracking issue for way to express intraprocedural finite state machines #132306](https://github.com/rust-lang/rust/issues/132306).
## `tests/ui/loops/`
@@ -891,6 +899,8 @@ See [Tracking issue for allowing overlapping implementations for marker trait #2
Broad category of tests on `match` constructs.
**FIXME**: many tests overlap with `tests/ui/bindings`, try to reduce duplication.
## `tests/ui/methods/`
A broad category for anything related to methods and method resolution.
@@ -899,6 +909,8 @@ A broad category for anything related to methods and method resolution.
Certain mir-opt regression tests.
**FIXME**: many tests in this directory are not about MIR or optimizations, relocate these.
## `tests/ui/mir-dataflow`
Tests for MIR dataflow analysis.
@@ -977,6 +989,8 @@ Tests that exercises edge cases, such as specific floats, large or very small nu
Tests that checks numeric types and their interactions, such as casting among them with `as` or providing the wrong numeric suffix.
**FIXME**: these tests could get moved to other directories, in particular `cast/` or `parser/`.
## `tests/ui/object-lifetime/`
Tests on lifetimes on objects, such as a lifetime bound not being able to be deduced from context, or checking that lifetimes are inherited properly.
@@ -1308,7 +1322,7 @@ Some standard library tests which are too inconvenient or annoying to implement
## `tests/ui/str/`
Exercise `str` keyword and string slices.
Exercise `str` primitive and string slices.
## `tests/ui/structs/`
@@ -1464,6 +1478,8 @@ See [RFC 0132 Unified Function Call Syntax](https://github.com/rust-lang/rfcs/bl
`#![feature(unboxed_closures)]`, `Fn`, `FnMut` and `FnOnce` traits
**FIXME**: many tests have `unboxed-closure` in their name but only test normal closures, rename these.
See [Tracking issue for Fn traits (`unboxed_closures` & `fn_traits` feature)](https://github.com/rust-lang/rust/issues/29625).
## `tests/ui/underscore-lifetime/`: `'_` elided lifetime
-13
View File
@@ -1,13 +0,0 @@
struct ArpIPv4<'a> {
s: &'a u8
}
impl<'a> ArpIPv4<'a> {
const LENGTH: usize = 20;
pub fn to_buffer() -> [u8; Self::LENGTH] { //~ ERROR generic `Self` types are currently not permitted in anonymous constants
unimplemented!()
}
}
pub fn main() {}
@@ -1,14 +0,0 @@
error: generic `Self` types are currently not permitted in anonymous constants
--> $DIR/issue-47814.rs:8:32
|
LL | pub fn to_buffer() -> [u8; Self::LENGTH] {
| ^^^^
|
note: not a concrete type
--> $DIR/issue-47814.rs:5:10
|
LL | impl<'a> ArpIPv4<'a> {
| ^^^^^^^^^^^
error: aborting due to 1 previous error
@@ -1,3 +1,4 @@
// Regression test for https://github.com/rust-lang/rust/issues/83176.
//@ run-pass
#![warn(rust_2021_incompatible_closure_captures)]
@@ -1,5 +1,5 @@
warning: irrefutable `if let` pattern
--> $DIR/issue-78720.rs:7:8
--> $DIR/nested-copy-drops-83176.rs:8:8
|
LL | if let a = "" {
| ^^^^^^^^^^
-2
View File
@@ -1,2 +0,0 @@
fn main<T>() { }
//~^ ERROR `main` function is not allowed to have generic parameters
-9
View File
@@ -1,9 +0,0 @@
error[E0131]: `main` function is not allowed to have generic parameters
--> $DIR/issue-1900.rs:1:8
|
LL | fn main<T>() { }
| ^^^ `main` cannot have generic parameters
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0131`.
@@ -0,0 +1,6 @@
//! Regression test for https://github.com/rust-lang/rust/issues/36379
//@ check-pass
fn _test() -> impl Default { }
fn main() {}
-5
View File
@@ -1,5 +0,0 @@
//@ check-pass
fn _test() -> impl Default { }
fn main() {}
@@ -1,11 +0,0 @@
// Check that specialization must be ungated to use the `default` keyword
trait Foo {
fn foo(&self);
}
default impl<T> Foo for T { //~ ERROR specialization is unstable
fn foo(&self) {}
}
fn main() {}
@@ -1,15 +0,0 @@
error[E0658]: specialization is unstable
--> $DIR/specialization-feature-gate-default.rs:7:1
|
LL | / default impl<T> Foo for T {
LL | | fn foo(&self) {}
LL | | }
| |_^
|
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
= help: add `#![feature(specialization)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0658`.