Rollup merge of #153594 - reddevilmidzy:ui-refactor, r=JohnTitor,Kivooeo

Move some ui tests

> [!NOTE]
> I split the commits to make the review easier and to keep the git history easier to trace.

Renamed issue-xxx tests

`tests/ui/dyn-drop` -> `tests/ui/dyn-keyword`
`tests/ui/missing-trait-bounds` -> `tests/ui/trait-bound/missing-trait-bounds`
`tests/ui/recursion_limit` -> `tests/ui/recursion/recursion_limit`
`tests/ui/version` -> `tests/ui/compile-flags`

Reorganize `tests/ui/empty`
This commit is contained in:
Jonathan Brouwer
2026-03-09 11:49:26 +01:00
committed by GitHub
69 changed files with 56 additions and 101 deletions
-6
View File
@@ -927,7 +927,6 @@ ui/dst/issue-90528-unsizing-suggestion-3.rs
ui/dst/issue-90528-unsizing-suggestion-4.rs
ui/dyn-keyword/issue-5153.rs
ui/dyn-keyword/issue-56327-dyn-trait-in-macro-is-okay.rs
ui/empty/issue-37026.rs
ui/enum-discriminant/auxiliary/issue-41394.rs
ui/enum-discriminant/issue-104519.rs
ui/enum-discriminant/issue-41394-rpass.rs
@@ -1706,9 +1705,6 @@ ui/mismatched_types/issue-47706.rs
ui/mismatched_types/issue-74918-missing-lifetime.rs
ui/mismatched_types/issue-75361-mismatched-impl.rs
ui/mismatched_types/issue-84976.rs
ui/missing-trait-bounds/auxiliary/issue-69725.rs
ui/missing-trait-bounds/issue-35677.rs
ui/missing-trait-bounds/issue-69725.rs
ui/modules/auxiliary/issue-13872-1.rs
ui/modules/auxiliary/issue-13872-2.rs
ui/modules/auxiliary/issue-13872-3.rs
@@ -2284,8 +2280,6 @@ ui/recursion/issue-38591-non-regular-dropck-recursion.rs
ui/recursion/issue-83150.rs
ui/recursion/issue-86784.rs
ui/recursion/issue-95134.rs
ui/recursion_limit/issue-105700.rs
ui/recursion_limit/issue-40003.rs
ui/regions/issue-101280.rs
ui/regions/issue-102374.rs
ui/regions/issue-102392.rs
-24
View File
@@ -498,10 +498,6 @@ See:
Previously known as "object safety".
## `tests/ui/dyn-drop/`: `dyn Drop`
**FIXME**: Contains a single test, used only to check the `dyn_drop` lint (which is normally `warn` level).
## `tests/ui/dyn-keyword/`: `dyn` and Dynamic Dispatch
The `dyn` keyword is used to highlight that calls to methods on the associated Trait are dynamically dispatched. To use the trait this way, it must be dyn-compatible - tests about dyn-compatibility belong in `tests/ui/dyn-compatibility/`, while more general tests on dynamic dispatch belong here.
@@ -518,10 +514,6 @@ These tests run in specific Rust editions, such as Rust 2015 or Rust 2018, and c
Exercises `eii` keyword.
## `tests/ui/empty/`: Various tests related to the concept of "empty"
**FIXME**: These tests need better homes, this is not very informative.
## `tests/ui/entry-point/`: `main` function
Tests exercising the `main` entry-point.
@@ -940,12 +932,6 @@ Something is missing which could be added to fix (e.g. suggestions).
**FIXME**: this is way too vague, tests should be rehomed.
## `tests/ui/missing-trait-bounds/`
Tests for checking missing trait bounds, and their diagnostics.
**FIXME**: Maybe a subdirectory of `ui/trait-bounds` would be more appropriate.
## `tests/ui/modules/`
Tests on the module system.
@@ -1173,12 +1159,6 @@ Broad category of tests exercising recursions (compile test and run time), in fu
Also exercises the `#![recursion_limit = ""]` attribute.
## `tests/ui/recursion_limit/`: `#![recursion_limit = ""]`
Sets a recursion limit on recursive code.
**FIXME**: Should be merged with `tests/ui/recursion/`.
## `tests/ui/reflection/`
Exercises the `#![feature(type_info)]` feature.
@@ -1601,10 +1581,6 @@ Tests on `enum` variants.
**FIXME**: Should be rehomed with `tests/ui/enum/`.
## `tests/ui/version/`
**FIXME**: Contains a single test described as "Check that rustc accepts various version info flags.", should be rehomed.
## `tests/ui/wasm/`
These tests target the `wasm32` architecture specifically. They are usually regression tests for WASM-specific bugs which were observed in the past.
@@ -0,0 +1 @@
pub struct XEmpty {}
@@ -5,5 +5,5 @@
extern crate empty_struct;
fn main() {
empty_struct::XEmpty1 {};
empty_struct::XEmpty {};
}
-15
View File
@@ -1,15 +0,0 @@
#![deny(dyn_drop)]
fn foo(_: Box<dyn Drop>) {} //~ ERROR
fn bar(_: &dyn Drop) {} //~ERROR
fn baz(_: *mut dyn Drop) {} //~ ERROR
struct Foo {
_x: Box<dyn Drop> //~ ERROR
}
trait Bar {
type T: ?Sized;
}
struct Baz {}
impl Bar for Baz {
type T = dyn Drop; //~ ERROR
}
fn main() {}
+15
View File
@@ -0,0 +1,15 @@
#![deny(dyn_drop)]
fn foo(_: Box<dyn Drop>) {} //~ ERROR: types that do not implement `Drop` can still have drop glue,
fn bar(_: &dyn Drop) {} //~ ERROR: types that do not implement `Drop` can still have drop glue,
fn baz(_: *mut dyn Drop) {} //~ ERROR: types that do not implement `Drop` can still have drop glue,
struct Foo {
_x: Box<dyn Drop>, //~ ERROR: types that do not implement `Drop` can still have drop glue,
}
trait Bar {
type T: ?Sized;
}
struct Baz {}
impl Bar for Baz {
type T = dyn Drop; //~ ERROR: types that do not implement `Drop` can still have drop glue,
}
fn main() {}
@@ -23,16 +23,16 @@ LL | fn baz(_: *mut dyn Drop) {}
| ^^^^
error: types that do not implement `Drop` can still have drop glue, consider instead using `std::mem::needs_drop` to detect whether a type is trivially dropped
--> $DIR/dyn-drop.rs:6:15
--> $DIR/dyn-drop.rs:6:17
|
LL | _x: Box<dyn Drop>
| ^^^^
LL | _x: Box<dyn Drop>,
| ^^^^
error: types that do not implement `Drop` can still have drop glue, consider instead using `std::mem::needs_drop` to detect whether a type is trivially dropped
--> $DIR/dyn-drop.rs:13:16
--> $DIR/dyn-drop.rs:13:18
|
LL | type T = dyn Drop;
| ^^^^
LL | type T = dyn Drop;
| ^^^^
error: aborting due to 5 previous errors
-5
View File
@@ -1,5 +0,0 @@
#[macro_export]
macro_rules! macro_one { () => ("one") }
#[macro_export]
macro_rules! macro_two { () => ("two") }
-4
View File
@@ -1,4 +0,0 @@
#[link(name = "")] //~ ERROR: link name must not be empty
extern "C" {}
fn main() {}
-9
View File
@@ -1,9 +0,0 @@
error[E0454]: link name must not be empty
--> $DIR/empty-linkname.rs:1:15
|
LL | #[link(name = "")]
| ^^ empty link name
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0454`.
-8
View File
@@ -1,8 +0,0 @@
//@ aux-build:empty-struct.rs
extern crate empty_struct;
fn main() {
let empty_struct::XEmpty2 = (); //~ ERROR mismatched types
let empty_struct::XEmpty6(..) = (); //~ ERROR mismatched types
}
@@ -1,5 +1,5 @@
error: cannot find macro `macro_two` in this scope
--> $DIR/empty-macro-use.rs:8:5
--> $DIR/macro-use-empty.rs:8:5
|
LL | macro_two!();
| ^^^^^^^^^
@@ -10,7 +10,7 @@ LL + use two_macros::macro_two;
|
warning: unused attribute
--> $DIR/empty-macro-use.rs:3:12
--> $DIR/macro-use-empty.rs:3:12
|
LL | #[macro_use()]
| ^^ help: remove these parentheses
@@ -1,10 +1,10 @@
error: recursion limit reached while expanding `#[invalid_attribute]`
--> $DIR/issue-105700.rs:6:1
--> $DIR/invalid-attribute-105700.rs:6:1
|
LL | #![invalid_attribute]
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "8"]` attribute to your crate (`issue_105700`)
= help: consider increasing the recursion limit by adding a `#![recursion_limit = "8"]` attribute to your crate (`invalid_attribute_105700`)
error: aborting due to 1 previous error
@@ -1,9 +1,9 @@
//@ run-rustfix
//@ aux-build:issue-69725.rs
//@ aux-build:struct-69725.rs
#![allow(dead_code)]
extern crate issue_69725;
use issue_69725::Struct;
extern crate struct_69725;
use struct_69725::Struct;
fn crash<A>() where A: Clone {
let _ = Struct::<A>::new().clone();
@@ -1,9 +1,9 @@
//@ run-rustfix
//@ aux-build:issue-69725.rs
//@ aux-build:struct-69725.rs
#![allow(dead_code)]
extern crate issue_69725;
use issue_69725::Struct;
extern crate struct_69725;
use struct_69725::Struct;
fn crash<A>() {
let _ = Struct::<A>::new().clone();
@@ -1,17 +1,17 @@
error[E0599]: the method `clone` exists for struct `issue_69725::Struct<A>`, but its trait bounds were not satisfied
--> $DIR/issue-69725.rs:9:32
error[E0599]: the method `clone` exists for struct `struct_69725::Struct<A>`, but its trait bounds were not satisfied
--> $DIR/derive-clone-missing-bound-69725.rs:9:32
|
LL | let _ = Struct::<A>::new().clone();
| ^^^^^ method cannot be called on `issue_69725::Struct<A>` due to unsatisfied trait bounds
| ^^^^^ method cannot be called on `struct_69725::Struct<A>` due to unsatisfied trait bounds
|
::: $DIR/auxiliary/issue-69725.rs:2:1
::: $DIR/auxiliary/struct-69725.rs:2:1
|
LL | pub struct Struct<A>(A);
| -------------------- doesn't satisfy `issue_69725::Struct<A>: Clone`
| -------------------- doesn't satisfy `struct_69725::Struct<A>: Clone`
|
= note: the following trait bounds were not satisfied:
`A: Clone`
which is required by `issue_69725::Struct<A>: Clone`
which is required by `struct_69725::Struct<A>: Clone`
help: consider restricting the type parameter to satisfy the trait bound
|
LL | fn crash<A>() where A: Clone {
@@ -1,5 +1,5 @@
error[E0599]: the method `is_subset` exists for reference `&HashSet<T>`, but its trait bounds were not satisfied
--> $DIR/issue-35677.rs:7:10
--> $DIR/duplicate-bounds-diagnostic-35677.rs:7:10
|
LL | this.is_subset(other)
| ^^^^^^^^^ method cannot be called on `&HashSet<T>` due to unsatisfied trait bounds
@@ -0,0 +1,2 @@
pub struct XEmpty1;
pub struct XEmpty2();
@@ -0,0 +1,8 @@
//@ aux-build:empty-struct.rs
extern crate empty_struct;
fn main() {
let empty_struct::XEmpty1 = (); //~ ERROR mismatched types
let empty_struct::XEmpty2(..) = (); //~ ERROR mismatched types
}
@@ -1,18 +1,18 @@
error[E0308]: mismatched types
--> $DIR/issue-37026.rs:6:9
--> $DIR/struct-pattern-mismatch-37026.rs:6:9
|
LL | let empty_struct::XEmpty2 = ();
LL | let empty_struct::XEmpty1 = ();
| ^^^^^^^^^^^^^^^^^^^^^ -- this expression has type `()`
| |
| expected `()`, found `XEmpty2`
| expected `()`, found `XEmpty1`
error[E0308]: mismatched types
--> $DIR/issue-37026.rs:7:9
--> $DIR/struct-pattern-mismatch-37026.rs:7:9
|
LL | let empty_struct::XEmpty6(..) = ();
LL | let empty_struct::XEmpty2(..) = ();
| ^^^^^^^^^^^^^^^^^^^^^^^^^ -- this expression has type `()`
| |
| expected `()`, found `XEmpty6`
| expected `()`, found `XEmpty2`
error: aborting due to 2 previous errors