Rollup merge of #155081 - reddevilmidzy:ui-fixme, r=Kivooeo

Move and clean up some ui test

`ui/reserved` -> `ui/keyword`
`ui/deref-patterns` -> `ui/pattern/deref-patterns`
`ui/unknown-unstable-lints` -> `ui/lint/unknown-lints`

Tests related to unknown_lints that were located above lint have also been moved to a subdirectory, and duplicate tests have been deleted.

And delete unnecessary `//@ check-fail`

r? Kivooeo
This commit is contained in:
Jacob Pratt
2026-04-24 02:42:49 -04:00
committed by GitHub
42 changed files with 39 additions and 272 deletions
-4
View File
@@ -834,8 +834,6 @@ ui/cycle-trait/issue-12511.rs
ui/debuginfo/issue-105386-debuginfo-ub.rs
ui/deprecation/issue-66340-deprecated-attr-non-meta-grammar.rs
ui/deprecation/issue-84637-deprecated-associated-function.rs
ui/deref-patterns/issue-71676-1.rs
ui/deref-patterns/issue-71676-2.rs
ui/derived-errors/issue-30580.rs
ui/derived-errors/issue-31997-1.rs
ui/derived-errors/issue-31997.rs
@@ -1456,10 +1454,8 @@ ui/lint/issue-63364.rs
ui/lint/issue-70819-dont-override-forbid-in-same-scope.rs
ui/lint/issue-79744.rs
ui/lint/issue-81218.rs
ui/lint/issue-83477.rs
ui/lint/issue-87274-paren-parent.rs
ui/lint/issue-90614-accept-allow-text-direction-codepoint-in-comment-lint.rs
ui/lint/issue-97094.rs
ui/lint/issue-99387.rs
ui/lint/let_underscore/issue-119696-err-on-fn.rs
ui/lint/let_underscore/issue-119697-extra-let.rs
-22
View File
@@ -404,14 +404,6 @@ Tests for `#[deprecated]` attribute and `deprecated_in_future` internal lint.
Tests for `Deref` and `DerefMut` traits.
## `tests/ui/deref-patterns`: `#![feature(deref_patterns)]` and `#![feature(string_deref_patterns)]`
Tests for `#![feature(deref_patterns)]` and `#![feature(string_deref_patterns)]`. See [Deref patterns | The Unstable book](https://doc.rust-lang.org/nightly/unstable-book/language-features/deref-patterns.html).
**FIXME**: May have some overlap with `tests/ui/pattern/deref-patterns`.
See [`std::ops::Deref`](https://doc.rust-lang.org/std/ops/trait.Deref.html) and [`std::ops::DerefMut`](https://doc.rust-lang.org/std/ops/trait.DerefMut.html)
## `tests/ui/derived-errors/`: Derived Error Messages
Tests for quality of diagnostics involving suppression of cascading errors in some cases to avoid overwhelming the user.
@@ -1172,14 +1164,6 @@ Exercises `[Type; n]` syntax for creating arrays with repeated types across a se
Tests on the `#[repr(..)]` attribute. See [Representations | Reference](https://doc.rust-lang.org/reference/type-layout.html#representations).
## `tests/ui/reserved/`
Reserved keywords and attribute names.
See e.g. [Reserved keywords | Reference](https://doc.rust-lang.org/reference/keywords.html).
**FIXME**: maybe merge under `tests/ui/keyword/`.
## `tests/ui/resolve/`: Name resolution
See [Name resolution | rustc-dev-guide](https://rustc-dev-guide.rust-lang.org/name-resolution.html).
@@ -1506,12 +1490,6 @@ See [Uninhabited | Reference](https://doc.rust-lang.org/reference/glossary.html?
See [Unions | Reference](https://doc.rust-lang.org/reference/items/unions.html).
## `tests/ui/unknown-unstable-lints/`: Attempting to refer to an unstable lint which does not exist
Tests for trying to use non-existent unstable lints.
**FIXME**: move this under `tests/ui/lints/`.
## `tests/ui/unop/`: Unary operators `-`, `*` and `!`
Tests the three unary operators for negating, dereferencing and inverting, across different contexts.
@@ -1,5 +0,0 @@
fn main() {
match *1 { //~ ERROR: cannot be dereferenced
_ => { panic!(); }
}
}
-42
View File
@@ -1,42 +0,0 @@
use std::ops::Deref;
use std::ops::DerefMut;
struct Bar(u8);
struct Foo(Bar);
struct Emm(Foo);
impl Deref for Bar{
type Target = u8;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl Deref for Foo {
type Target = Bar;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl Deref for Emm {
type Target = Foo;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl DerefMut for Bar{
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl DerefMut for Foo {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
impl DerefMut for Emm {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}
fn main() {
let a = Emm(Foo(Bar(0)));
let _: *mut u8 = &a; //~ ERROR mismatched types
}
@@ -1,18 +0,0 @@
error[E0308]: mismatched types
--> $DIR/issue-71676-2.rs:41:22
|
LL | let _: *mut u8 = &a;
| ------- ^^ types differ in mutability
| |
| expected due to this
|
= note: expected raw pointer `*mut u8`
found reference `&Emm`
help: consider dereferencing
|
LL | let _: *mut u8 = &mut ***a;
| +++++++
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0308`.
@@ -1,4 +0,0 @@
//@ check-pass
//@ compile-flags:-A unknown-lints -D bogus -D dead_cod
fn main() { }
@@ -1,16 +0,0 @@
//@ compile-flags:-D unknown-lints -D bogus -D dead_cod
//@ dont-require-annotations: HELP
//@ dont-require-annotations: NOTE
fn main() { }
//~? ERROR unknown lint: `bogus`
//~? ERROR unknown lint: `dead_cod`
//~? ERROR unknown lint: `bogus`
//~? ERROR unknown lint: `dead_cod`
//~? ERROR unknown lint: `bogus`
//~? ERROR unknown lint: `dead_cod`
//~? NOTE requested on the command line with `-D bogus`
//~? NOTE requested on the command line with `-D dead_cod`
//~? NOTE requested on the command line with `-D unknown-lints`
//~? HELP did you mean: `dead_code`
@@ -1,35 +0,0 @@
error[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
= note: requested on the command line with `-D unknown-lints`
error[E0602]: unknown lint: `dead_cod`
|
= help: did you mean: `dead_code`
= note: requested on the command line with `-D dead_cod`
error[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0602]: unknown lint: `dead_cod`
|
= help: did you mean: `dead_code`
= note: requested on the command line with `-D dead_cod`
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error[E0602]: unknown lint: `dead_cod`
|
= help: did you mean: `dead_code`
= note: requested on the command line with `-D dead_cod`
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: aborting due to 6 previous errors
For more information about this error, try `rustc --explain E0602`.
@@ -1,17 +0,0 @@
//@ check-pass
//@ compile-flags:-D bogus -D dead_cod
//@ dont-require-annotations: HELP
//@ dont-require-annotations: NOTE
fn main() { }
//~? WARN unknown lint: `bogus`
//~? WARN unknown lint: `dead_cod`
//~? WARN unknown lint: `bogus`
//~? WARN unknown lint: `dead_cod`
//~? WARN unknown lint: `bogus`
//~? WARN unknown lint: `dead_cod`
//~? NOTE requested on the command line with `-D bogus`
//~? NOTE `#[warn(unknown_lints)]` on by default
//~? NOTE requested on the command line with `-D dead_cod`
//~? HELP did you mean: `dead_code`
@@ -1,35 +0,0 @@
warning[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
= note: `#[warn(unknown_lints)]` on by default
warning[E0602]: unknown lint: `dead_cod`
|
= help: did you mean: `dead_code`
= note: requested on the command line with `-D dead_cod`
warning[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning[E0602]: unknown lint: `dead_cod`
|
= help: did you mean: `dead_code`
= note: requested on the command line with `-D dead_cod`
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning[E0602]: unknown lint: `bogus`
|
= note: requested on the command line with `-D bogus`
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning[E0602]: unknown lint: `dead_cod`
|
= help: did you mean: `dead_code`
= note: requested on the command line with `-D dead_cod`
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
warning: 6 warnings emitted
For more information about this error, try `rustc --explain E0602`.
-13
View File
@@ -1,13 +0,0 @@
#![deny(unknown_lints)]
#![allow(not_a_real_lint)] //~ ERROR unknown lint
#![deny(dead_cod)] //~ ERROR unknown lint
//~| HELP did you mean
//~| SUGGESTION dead_code
#![deny(rust_2018_idiots)] //~ ERROR unknown lint
//~| HELP did you mean
//~| SUGGESTION rust_2018_idioms
fn main() {}
-26
View File
@@ -1,26 +0,0 @@
error: unknown lint: `not_a_real_lint`
--> $DIR/lint-unknown-lint.rs:3:10
|
LL | #![allow(not_a_real_lint)]
| ^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/lint-unknown-lint.rs:1:9
|
LL | #![deny(unknown_lints)]
| ^^^^^^^^^^^^^
error: unknown lint: `dead_cod`
--> $DIR/lint-unknown-lint.rs:5:9
|
LL | #![deny(dead_cod)]
| ^^^^^^^^ help: did you mean: `dead_code`
error: unknown lint: `rust_2018_idiots`
--> $DIR/lint-unknown-lint.rs:9:9
|
LL | #![deny(rust_2018_idiots)]
| ^^^^^^^^^^^^^^^^ help: did you mean: `rust_2018_idioms`
error: aborting due to 3 previous errors
@@ -1,7 +0,0 @@
//@ run-pass
//@ compile-flags: -D warnings -D unknown-lints
#![allow(unknown_lints)]
#![allow(random_lint_name)]
fn main() {}
@@ -1,6 +1,5 @@
//~ ERROR unknown lint: `test_unstable_lint`
//~^ NOTE the `test_unstable_lint` lint is unstable
//@ check-fail
//@ compile-flags: -Dunknown_lints -Atest_unstable_lint
//@ dont-require-annotations: NOTE
@@ -1,5 +1,3 @@
//@ check-fail
#![deny(unknown_lints)]
#![allow(test_unstable_lint)]
//~^ ERROR unknown lint: `test_unstable_lint`
@@ -1,5 +1,5 @@
error: unknown lint: `test_unstable_lint`
--> $DIR/deny-unstable-lint-inline.rs:4:10
--> $DIR/deny-unstable-lint-inline.rs:2:10
|
LL | #![allow(test_unstable_lint)]
| ^^^^^^^^^^^^^^^^^^
@@ -8,7 +8,7 @@ LL | #![allow(test_unstable_lint)]
= help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
note: the lint level is defined here
--> $DIR/deny-unstable-lint-inline.rs:3:9
--> $DIR/deny-unstable-lint-inline.rs:1:9
|
LL | #![deny(unknown_lints)]
| ^^^^^^^^^^^^^
@@ -1,5 +1,5 @@
warning: unknown lint: `rustc::foo::bar::default_hash_types`
--> $DIR/issue-83477.rs:5:9
--> $DIR/redundant-path-83477.rs:5:9
|
LL | #[allow(rustc::foo::bar::default_hash_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `rustc::default_hash_types`
@@ -7,20 +7,20 @@ LL | #[allow(rustc::foo::bar::default_hash_types)]
= note: `#[warn(unknown_lints)]` on by default
warning: unknown lint: `rustc::foo::default_hash_types`
--> $DIR/issue-83477.rs:9:9
--> $DIR/redundant-path-83477.rs:9:9
|
LL | #[allow(rustc::foo::default_hash_types)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: did you mean: `rustc::default_hash_types`
warning: prefer `FxHashMap` over `HashMap`, it has better performance
--> $DIR/issue-83477.rs:14:13
--> $DIR/redundant-path-83477.rs:14:13
|
LL | let _ = std::collections::HashMap::<String, String>::new();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: a `use rustc_data_structures::fx::FxHashMap` may be necessary
note: the lint level is defined here
--> $DIR/issue-83477.rs:3:9
--> $DIR/redundant-path-83477.rs:3:9
|
LL | #![warn(rustc::internal)]
| ^^^^^^^^^^^^^^^
@@ -16,6 +16,9 @@
//~^ WARNING unknown lint
//~| HELP did you mean
#[deny(rust_2018_idiots)] //~ WARNING unknown lint
//~| HELP did you mean
fn main() {
unimplemented!();
}
@@ -1,5 +1,5 @@
warning: unknown lint: `FOO_BAR`
--> $DIR/not_found.rs:6:9
--> $DIR/suggestions.rs:6:9
|
LL | #[allow(FOO_BAR)]
| ^^^^^^^
@@ -7,16 +7,22 @@ LL | #[allow(FOO_BAR)]
= note: `#[warn(unknown_lints)]` on by default
warning: unknown lint: `DEAD_CODE`
--> $DIR/not_found.rs:10:8
--> $DIR/suggestions.rs:10:8
|
LL | #[warn(DEAD_CODE)]
| ^^^^^^^^^ help: did you mean: `dead_code`
warning: unknown lint: `Warnings`
--> $DIR/not_found.rs:15:8
--> $DIR/suggestions.rs:15:8
|
LL | #[deny(Warnings)]
| ^^^^^^^^ help: did you mean (notice the capitalization): `warnings`
warning: 3 warnings emitted
warning: unknown lint: `rust_2018_idiots`
--> $DIR/suggestions.rs:19:8
|
LL | #[deny(rust_2018_idiots)]
| ^^^^^^^^^^^^^^^^ help: did you mean: `rust_2018_idioms`
warning: 4 warnings emitted
@@ -1,18 +1,18 @@
error: unknown lint: `nonex_lint_top_level`
--> $DIR/issue-97094.rs:5:25
--> $DIR/unknown-lints-in-cfg-attr-97094.rs:5:25
|
LL | #![cfg_attr(true, allow(nonex_lint_top_level))]
| ^^^^^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/issue-97094.rs:1:9
--> $DIR/unknown-lints-in-cfg-attr-97094.rs:1:9
|
LL | #![deny(warnings)]
| ^^^^^^^^
= note: `#[deny(unknown_lints)]` implied by `#[deny(warnings)]`
error: lint `bare_trait_object` has been renamed to `bare_trait_objects`
--> $DIR/issue-97094.rs:7:25
--> $DIR/unknown-lints-in-cfg-attr-97094.rs:7:25
|
LL | #![cfg_attr(true, allow(bare_trait_object))]
| ^^^^^^^^^^^^^^^^^ help: use the new name: `bare_trait_objects`
@@ -20,31 +20,31 @@ LL | #![cfg_attr(true, allow(bare_trait_object))]
= note: `#[deny(renamed_and_removed_lints)]` implied by `#[deny(warnings)]`
error: unknown lint: `nonex_lint_mod`
--> $DIR/issue-97094.rs:10:24
--> $DIR/unknown-lints-in-cfg-attr-97094.rs:10:24
|
LL | #[cfg_attr(true, allow(nonex_lint_mod))]
| ^^^^^^^^^^^^^^
error: unknown lint: `nonex_lint_mod_inner`
--> $DIR/issue-97094.rs:13:29
--> $DIR/unknown-lints-in-cfg-attr-97094.rs:13:29
|
LL | #![cfg_attr(true, allow(nonex_lint_mod_inner))]
| ^^^^^^^^^^^^^^^^^^^^
error: unknown lint: `nonex_lint_fn`
--> $DIR/issue-97094.rs:17:24
--> $DIR/unknown-lints-in-cfg-attr-97094.rs:17:24
|
LL | #[cfg_attr(true, allow(nonex_lint_fn))]
| ^^^^^^^^^^^^^
error: unknown lint: `nonex_lint_in_macro`
--> $DIR/issue-97094.rs:28:28
--> $DIR/unknown-lints-in-cfg-attr-97094.rs:28:28
|
LL | #[cfg_attr(true, allow(nonex_lint_in_macro))]
| ^^^^^^^^^^^^^^^^^^^
error: unknown lint: `nonex_lint_fn`
--> $DIR/issue-97094.rs:47:13
--> $DIR/unknown-lints-in-cfg-attr-97094.rs:47:13
|
LL | #[allow(nonex_lint_fn)]
| ^^^^^^^^^^^^^
@@ -0,0 +1,5 @@
fn main() {
match *1 { //~ ERROR: cannot be dereferenced
_ => {}
}
}
@@ -1,8 +1,8 @@
error[E0614]: type `{integer}` cannot be dereferenced
--> $DIR/deref-non-pointer.rs:2:9
--> $DIR/deref-non-pointer.rs:2:11
|
LL | match *1 {
| ^^ can't be dereferenced
LL | match *1 {
| ^^ can't be dereferenced
error: aborting due to 1 previous error
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/issue-71676-1.rs:43:24
--> $DIR/deref-pointer-cast-mutability-71676.rs:43:24
|
LL | let _: *const u8 = &a;
| --------- ^^ expected `*const u8`, found `&Emm`
@@ -14,7 +14,7 @@ LL | let _: *const u8 = &***a;
| +++
error[E0308]: mismatched types
--> $DIR/issue-71676-1.rs:46:22
--> $DIR/deref-pointer-cast-mutability-71676.rs:46:22
|
LL | let _: *mut u8 = &a;
| ------- ^^ types differ in mutability
@@ -29,7 +29,7 @@ LL | let _: *mut u8 = &mut ***a;
| +++++++
error[E0308]: mismatched types
--> $DIR/issue-71676-1.rs:49:24
--> $DIR/deref-pointer-cast-mutability-71676.rs:49:24
|
LL | let _: *const u8 = &mut a;
| --------- ^^^^^^ expected `*const u8`, found `&mut Emm`
@@ -45,7 +45,7 @@ LL + let _: *const u8 = &***a;
|
error[E0308]: mismatched types
--> $DIR/issue-71676-1.rs:52:22
--> $DIR/deref-pointer-cast-mutability-71676.rs:52:22
|
LL | let _: *mut u8 = &mut a;
| ------- ^^^^^^ expected `*mut u8`, found `&mut Emm`