From bd864efa70d9622f6b1f1c7ee899485a63405f1f Mon Sep 17 00:00:00 2001 From: Edvin Bryntesson Date: Tue, 10 Mar 2026 16:54:27 +0100 Subject: [PATCH] bless tests and tidy also removes E0452 and splits `tests/rustdoc-ui/lints/renamed-lint-still-applies` into 2 tests this is because of delayed warn lint being lost on compiler aborting on error --- .../src/error_codes/E0452.md | 3 +- .../tests/ui/unknown_clippy_lints.stderr | 30 +- tests/pretty/delegation-inherit-attributes.pp | 11 +- tests/pretty/delegation-inline-attribute.pp | 11 +- tests/pretty/hir-delegation.pp | 11 +- tests/pretty/hir-lifetimes.pp | 14 +- tests/pretty/pin-ergonomics-hir.pp | 11 +- .../lints/renamed-lint-still-applies-2.rs | 12 + .../lints/renamed-lint-still-applies-2.stderr | 32 ++ .../lints/renamed-lint-still-applies.rs | 5 +- .../lints/renamed-lint-still-applies.stderr | 36 +- ...-highlight-span-extra-arguments-147070.svg | 2 +- tests/ui/attributes/malformed-attrs.stderr | 170 +++++---- .../unsafe/proc-unsafe-attributes.rs | 9 +- .../unsafe/proc-unsafe-attributes.stderr | 62 ++- ...deduplicate-diagnostics.deduplicate.stderr | 29 +- .../deduplicate-diagnostics.duplicate.stderr | 35 +- .../deduplicate-diagnostics.rs | 4 +- tests/ui/error-codes/E0452.rs | 8 - tests/ui/error-codes/E0452.stderr | 49 --- ...issue-43106-gating-of-builtin-attrs.stderr | 206 +++++----- ...between-expected-trait-and-found-trait.svg | 2 +- tests/ui/lint/empty-lint-attributes.stderr | 8 +- tests/ui/lint/inert-attr-macro.rs | 6 +- tests/ui/lint/inert-attr-macro.stderr | 9 +- tests/ui/lint/issue-97094.stderr | 36 +- tests/ui/lint/lint-malformed.rs | 8 +- tests/ui/lint/lint-malformed.stderr | 71 ++-- tests/ui/lint/reasons-erroneous.rs | 34 +- tests/ui/lint/reasons-erroneous.stderr | 141 +++++-- tests/ui/lint/register-tool-lint.rs | 2 - tests/ui/lint/register-tool-lint.stderr | 11 +- .../ui/lint/renamed-lints-still-apply.stderr | 16 +- .../expect_lint_from_macro.rs | 4 +- .../expect_lint_from_macro.stderr | 9 +- .../expect_multiple_lints.rs | 44 +++ .../expect_multiple_lints.stderr | 178 ++++++++- .../force_warn_expected_lints_unfulfilled.rs | 90 +++++ ...rce_warn_expected_lints_unfulfilled.stderr | 358 +++++++++++++++++- .../lint-attribute-only-with-reason.stderr | 10 +- .../multiple_expect_attrs.rs | 1 - .../multiple_expect_attrs.stderr | 2 +- .../semicolon-in-expressions-from-macros.rs | 3 +- ...emicolon-in-expressions-from-macros.stderr | 9 +- tests/ui/lint/unused/empty-attributes.stderr | 90 ++--- tests/ui/parser/issues/issue-104620.rs | 4 +- tests/ui/proc-macro/cfg-eval.stderr | 2 +- tests/ui/tool-attributes/tool_lints.rs | 2 - tests/ui/tool-attributes/tool_lints.stderr | 20 +- .../tool-attributes/unknown-lint-tool-name.rs | 10 +- .../unknown-lint-tool-name.stderr | 40 +- tests/ui/unpretty/exhaustive.hir.stdout | 56 ++- ...ct-exprs-tuple-call-pretty-printing.stdout | 11 +- tests/ui/unpretty/unpretty-expr-fn-arg.stdout | 9 +- .../ui/where-clauses/unsupported_attribute.rs | 4 +- .../unsupported_attribute.stderr | 8 +- 56 files changed, 1363 insertions(+), 695 deletions(-) create mode 100644 tests/rustdoc-ui/lints/renamed-lint-still-applies-2.rs create mode 100644 tests/rustdoc-ui/lints/renamed-lint-still-applies-2.stderr delete mode 100644 tests/ui/error-codes/E0452.rs delete mode 100644 tests/ui/error-codes/E0452.stderr diff --git a/compiler/rustc_error_codes/src/error_codes/E0452.md b/compiler/rustc_error_codes/src/error_codes/E0452.md index 429813a7cdd4..a2471ec78eed 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0452.md +++ b/compiler/rustc_error_codes/src/error_codes/E0452.md @@ -1,8 +1,9 @@ +#### Note: this error code is no longer emitted by the compiler An invalid lint attribute has been given. Erroneous code example: -```compile_fail,E0452 +```compile_fail #![allow(foo = "")] // error: malformed lint attribute ``` diff --git a/src/tools/clippy/tests/ui/unknown_clippy_lints.stderr b/src/tools/clippy/tests/ui/unknown_clippy_lints.stderr index 592fdfbebd43..974c24bdc3bf 100644 --- a/src/tools/clippy/tests/ui/unknown_clippy_lints.stderr +++ b/src/tools/clippy/tests/ui/unknown_clippy_lints.stderr @@ -1,23 +1,11 @@ -error: unknown lint: `clippy::All` - --> tests/ui/unknown_clippy_lints.rs:3:10 - | -LL | #![allow(clippy::All)] - | ^^^^^^^^^^^ help: did you mean: `clippy::all` - | - = note: `-D unknown-lints` implied by `-D warnings` - = help: to override `-D warnings` add `#[allow(unknown_lints)]` - -error: unknown lint: `clippy::CMP_OWNED` - --> tests/ui/unknown_clippy_lints.rs:5:9 - | -LL | #![warn(clippy::CMP_OWNED)] - | ^^^^^^^^^^^^^^^^^ help: did you mean: `clippy::cmp_owned` - error: unknown lint: `clippy::if_not_els` --> tests/ui/unknown_clippy_lints.rs:9:8 | LL | #[warn(clippy::if_not_els)] | ^^^^^^^^^^^^^^^^^^ help: did you mean: `clippy::if_not_else` + | + = note: `-D unknown-lints` implied by `-D warnings` + = help: to override `-D warnings` add `#[allow(unknown_lints)]` error: unknown lint: `clippy::UNNecsaRy_cAst` --> tests/ui/unknown_clippy_lints.rs:11:8 @@ -67,5 +55,17 @@ LL - #[warn(clippy::missing_docs)] LL + #[warn(missing_docs)] | +error: unknown lint: `clippy::All` + --> tests/ui/unknown_clippy_lints.rs:3:10 + | +LL | #![allow(clippy::All)] + | ^^^^^^^^^^^ help: did you mean: `clippy::all` + +error: unknown lint: `clippy::CMP_OWNED` + --> tests/ui/unknown_clippy_lints.rs:5:9 + | +LL | #![warn(clippy::CMP_OWNED)] + | ^^^^^^^^^^^^^^^^^ help: did you mean: `clippy::cmp_owned` + error: aborting due to 9 previous errors diff --git a/tests/pretty/delegation-inherit-attributes.pp b/tests/pretty/delegation-inherit-attributes.pp index 242e7161aa84..2db27f3598cd 100644 --- a/tests/pretty/delegation-inherit-attributes.pp +++ b/tests/pretty/delegation-inherit-attributes.pp @@ -1,14 +1,15 @@ +#![attr = LintAttributes([LintAttribute {kind: Allow, attr_style: Inner, +lint_instances: [incomplete_features]}])] +#![attr = Feature([fn_delegation#0])] +extern crate std; +#[attr = PreludeImport] +use std::prelude::rust_2021::*; //@ edition:2021 //@ aux-crate:to_reuse_functions=to-reuse-functions.rs //@ pretty-mode:hir //@ pretty-compare-only //@ pp-exact:delegation-inherit-attributes.pp -#![allow(incomplete_features)] -#![attr = Feature([fn_delegation#0])] -extern crate std; -#[attr = PreludeImport] -use std::prelude::rust_2021::*; extern crate to_reuse_functions; diff --git a/tests/pretty/delegation-inline-attribute.pp b/tests/pretty/delegation-inline-attribute.pp index 125ed1c29826..4828f2e6c80f 100644 --- a/tests/pretty/delegation-inline-attribute.pp +++ b/tests/pretty/delegation-inline-attribute.pp @@ -1,12 +1,13 @@ -//@ pretty-compare-only -//@ pretty-mode:hir -//@ pp-exact:delegation-inline-attribute.pp - -#![allow(incomplete_features)] +#![attr = LintAttributes([LintAttribute {kind: Allow, attr_style: Inner, +lint_instances: [incomplete_features]}])] #![attr = Feature([fn_delegation#0])] extern crate std; #[attr = PreludeImport] use ::std::prelude::rust_2015::*; +//@ pretty-compare-only +//@ pretty-mode:hir +//@ pp-exact:delegation-inline-attribute.pp + mod to_reuse { fn foo(x: usize) -> usize { x } diff --git a/tests/pretty/hir-delegation.pp b/tests/pretty/hir-delegation.pp index 28bb49458ce1..5337dd2e96df 100644 --- a/tests/pretty/hir-delegation.pp +++ b/tests/pretty/hir-delegation.pp @@ -1,12 +1,13 @@ -//@ pretty-compare-only -//@ pretty-mode:hir -//@ pp-exact:hir-delegation.pp - -#![allow(incomplete_features)] +#![attr = LintAttributes([LintAttribute {kind: Allow, attr_style: Inner, +lint_instances: [incomplete_features]}])] #![attr = Feature([fn_delegation#0])] extern crate std; #[attr = PreludeImport] use ::std::prelude::rust_2015::*; +//@ pretty-compare-only +//@ pretty-mode:hir +//@ pp-exact:hir-delegation.pp + fn b(e: C) { } diff --git a/tests/pretty/hir-lifetimes.pp b/tests/pretty/hir-lifetimes.pp index c35a40eed0c5..07ac4ccfdd45 100644 --- a/tests/pretty/hir-lifetimes.pp +++ b/tests/pretty/hir-lifetimes.pp @@ -1,13 +1,19 @@ +#![attr = LintAttributes([LintAttribute {kind: Allow, attr_style: Inner, +lint_instances: [unused_imports, unused_variables, unused_visibilities, +unused_assignments, dead_code, unused_mut, unreachable_code, +unreachable_patterns, unused_must_use, unused_unsafe, path_statements, +unused_attributes, unused_macros, unused_macro_rules, unused_allocation, +unused_doc_comments, unused_extern_crates, unused_features, unused_labels, +unused_parens, unused_braces, redundant_semicolons, map_unit_fn]}])] +extern crate std; +#[attr = PreludeImport] +use ::std::prelude::rust_2015::*; //@ pretty-compare-only //@ pretty-mode:hir //@ pp-exact:hir-lifetimes.pp // This tests the pretty-printing of lifetimes in lots of ways. -#![allow(unused)] -extern crate std; -#[attr = PreludeImport] -use ::std::prelude::rust_2015::*; struct Foo<'a> { x: &'a u32, diff --git a/tests/pretty/pin-ergonomics-hir.pp b/tests/pretty/pin-ergonomics-hir.pp index 6c9dec2bfb1f..5b024bfff3b5 100644 --- a/tests/pretty/pin-ergonomics-hir.pp +++ b/tests/pretty/pin-ergonomics-hir.pp @@ -1,12 +1,13 @@ +#![attr = Feature([pin_ergonomics#0])] +#![attr = LintAttributes([LintAttribute {kind: Allow, attr_style: Inner, +lint_instances: [dead_code, incomplete_features]}])] +extern crate std; +#[attr = PreludeImport] +use ::std::prelude::rust_2015::*; //@ pretty-compare-only //@ pretty-mode:hir //@ pp-exact:pin-ergonomics-hir.pp -#![allow(dead_code, incomplete_features)] -#![attr = Feature([pin_ergonomics#0])] -extern crate std; -#[attr = PreludeImport] -use ::std::prelude::rust_2015::*; use std::pin::Pin; diff --git a/tests/rustdoc-ui/lints/renamed-lint-still-applies-2.rs b/tests/rustdoc-ui/lints/renamed-lint-still-applies-2.rs new file mode 100644 index 000000000000..6fe663518ad6 --- /dev/null +++ b/tests/rustdoc-ui/lints/renamed-lint-still-applies-2.rs @@ -0,0 +1,12 @@ +// compile-args: --crate-type lib + +// This file does not emit the rename warnings +// due to compilation aborting before we emit delayed lints + +#![deny(broken_intra_doc_links)] +//! [x] +//~^ ERROR unresolved link + +#![deny(rustdoc::non_autolinks)] +//! http://example.com +//~^ ERROR not a hyperlink diff --git a/tests/rustdoc-ui/lints/renamed-lint-still-applies-2.stderr b/tests/rustdoc-ui/lints/renamed-lint-still-applies-2.stderr new file mode 100644 index 000000000000..484566587d9e --- /dev/null +++ b/tests/rustdoc-ui/lints/renamed-lint-still-applies-2.stderr @@ -0,0 +1,32 @@ +error: unresolved link to `x` + --> $DIR/renamed-lint-still-applies-2.rs:7:6 + | +LL | //! [x] + | ^ no item named `x` in scope + | + = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` +note: the lint level is defined here + --> $DIR/renamed-lint-still-applies-2.rs:6:9 + | +LL | #![deny(broken_intra_doc_links)] + | ^^^^^^^^^^^^^^^^^^^^^^ + +error: this URL is not a hyperlink + --> $DIR/renamed-lint-still-applies-2.rs:11:5 + | +LL | //! http://example.com + | ^^^^^^^^^^^^^^^^^^ + | + = note: bare URLs are not automatically turned into clickable links +note: the lint level is defined here + --> $DIR/renamed-lint-still-applies-2.rs:10:9 + | +LL | #![deny(rustdoc::non_autolinks)] + | ^^^^^^^^^^^^^^^^^^^^^^ +help: use an automatic link instead + | +LL | //! + | + + + +error: aborting due to 2 previous errors + diff --git a/tests/rustdoc-ui/lints/renamed-lint-still-applies.rs b/tests/rustdoc-ui/lints/renamed-lint-still-applies.rs index a4d3a4b49711..8dded5460f12 100644 --- a/tests/rustdoc-ui/lints/renamed-lint-still-applies.rs +++ b/tests/rustdoc-ui/lints/renamed-lint-still-applies.rs @@ -1,10 +1,7 @@ +//@ check-pass // compile-args: --crate-type lib #![deny(broken_intra_doc_links)] //~^ WARNING renamed to `rustdoc::broken_intra_doc_links` -//! [x] -//~^ ERROR unresolved link #![deny(rustdoc::non_autolinks)] //~^ WARNING renamed to `rustdoc::bare_urls` -//! http://example.com -//~^ ERROR not a hyperlink diff --git a/tests/rustdoc-ui/lints/renamed-lint-still-applies.stderr b/tests/rustdoc-ui/lints/renamed-lint-still-applies.stderr index 88807dfb495d..b9dde5fbc7fe 100644 --- a/tests/rustdoc-ui/lints/renamed-lint-still-applies.stderr +++ b/tests/rustdoc-ui/lints/renamed-lint-still-applies.stderr @@ -1,5 +1,5 @@ warning: lint `broken_intra_doc_links` has been renamed to `rustdoc::broken_intra_doc_links` - --> $DIR/renamed-lint-still-applies.rs:2:9 + --> $DIR/renamed-lint-still-applies.rs:3:9 | LL | #![deny(broken_intra_doc_links)] | ^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `rustdoc::broken_intra_doc_links` @@ -7,40 +7,10 @@ LL | #![deny(broken_intra_doc_links)] = note: `#[warn(renamed_and_removed_lints)]` on by default warning: lint `rustdoc::non_autolinks` has been renamed to `rustdoc::bare_urls` - --> $DIR/renamed-lint-still-applies.rs:7:9 + --> $DIR/renamed-lint-still-applies.rs:6:9 | LL | #![deny(rustdoc::non_autolinks)] | ^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `rustdoc::bare_urls` -error: unresolved link to `x` - --> $DIR/renamed-lint-still-applies.rs:4:6 - | -LL | //! [x] - | ^ no item named `x` in scope - | - = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]` -note: the lint level is defined here - --> $DIR/renamed-lint-still-applies.rs:2:9 - | -LL | #![deny(broken_intra_doc_links)] - | ^^^^^^^^^^^^^^^^^^^^^^ - -error: this URL is not a hyperlink - --> $DIR/renamed-lint-still-applies.rs:9:5 - | -LL | //! http://example.com - | ^^^^^^^^^^^^^^^^^^ - | - = note: bare URLs are not automatically turned into clickable links -note: the lint level is defined here - --> $DIR/renamed-lint-still-applies.rs:7:9 - | -LL | #![deny(rustdoc::non_autolinks)] - | ^^^^^^^^^^^^^^^^^^^^^^ -help: use an automatic link instead - | -LL | //! - | + + - -error: aborting due to 2 previous errors; 2 warnings emitted +warning: 2 warnings emitted diff --git a/tests/ui/argument-suggestions/wrong-highlight-span-extra-arguments-147070.svg b/tests/ui/argument-suggestions/wrong-highlight-span-extra-arguments-147070.svg index 549acee7cee5..08239ac686a6 100644 --- a/tests/ui/argument-suggestions/wrong-highlight-span-extra-arguments-147070.svg +++ b/tests/ui/argument-suggestions/wrong-highlight-span-extra-arguments-147070.svg @@ -1,4 +1,4 @@ - +