From fa10d90b9974844790b0ad98fa5c50fae80ee166 Mon Sep 17 00:00:00 2001 From: David Koloski Date: Wed, 2 Mar 2022 00:10:39 +0000 Subject: [PATCH] Fix docs, fix incorrect lint source in note --- compiler/rustc_lint/src/levels.rs | 5 +++-- compiler/rustc_lint_defs/src/builtin.rs | 2 +- .../feature-gate-non_exhaustive_omitted_patterns_lint.stderr | 2 +- .../ui/feature-gates/feature-gate-test_unstable_lint.stderr | 2 +- src/test/ui/lint/must_not_suspend/gated.stderr | 2 +- .../deny-unstable-lint-command-line.stderr | 2 +- .../unknown-unstable-lints/deny-unstable-lint-inline.stderr | 1 - .../warn-unknown-unstable-lint-command-line.stderr | 2 +- .../warn-unknown-unstable-lint-inline.stderr | 1 - 9 files changed, 9 insertions(+), 10 deletions(-) diff --git a/compiler/rustc_lint/src/levels.rs b/compiler/rustc_lint/src/levels.rs index 2b28fc2c011..7b018e7f75f 100644 --- a/compiler/rustc_lint/src/levels.rs +++ b/compiler/rustc_lint/src/levels.rs @@ -601,10 +601,11 @@ fn create_stable_id( fn check_gated_lint(&self, lint_id: LintId, span: Span) -> bool { if let Some(feature) = lint_id.lint.feature_gate { if !self.sess.features_untracked().enabled(feature) { + let lint = builtin::UNKNOWN_LINTS; let (level, src) = self.lint_level(builtin::UNKNOWN_LINTS); - struct_lint_level(self.sess, lint_id.lint, level, src, Some(span.into()), |lint| { + struct_lint_level(self.sess, lint, level, src, Some(span.into()), |lint_db| { let mut db = - lint.build(&format!("unknown lint: `{}`", lint_id.lint.name_lower())); + lint_db.build(&format!("unknown lint: `{}`", lint_id.lint.name_lower())); db.note(&format!("the `{}` lint is unstable", lint_id.lint.name_lower(),)); add_feature_diagnostics(&mut db, &self.sess.parse_sess, feature); db.emit(); diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index 7f1591a7212..62eba796eae 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -3786,7 +3786,7 @@ /// /// ### Explanation /// - /// In order to test the behavior of unstable traits, a permanently-unstable + /// In order to test the behavior of unstable lints, a permanently-unstable /// lint is required. This lint can be used to trigger warnings and errors /// from the compiler related to unstable lints. pub TEST_UNSTABLE_LINT, diff --git a/src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr b/src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr index 94568c96b40..7f82fbdea4e 100644 --- a/src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr +++ b/src/test/ui/feature-gates/feature-gate-non_exhaustive_omitted_patterns_lint.stderr @@ -4,7 +4,7 @@ warning: unknown lint: `non_exhaustive_omitted_patterns` LL | #![deny(non_exhaustive_omitted_patterns)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(non_exhaustive_omitted_patterns)]` on by default + = note: `#[warn(unknown_lints)]` on by default = note: the `non_exhaustive_omitted_patterns` lint is unstable = note: see issue #89554 for more information = help: add `#![feature(non_exhaustive_omitted_patterns_lint)]` to the crate attributes to enable diff --git a/src/test/ui/feature-gates/feature-gate-test_unstable_lint.stderr b/src/test/ui/feature-gates/feature-gate-test_unstable_lint.stderr index eab89f02018..a29322443ea 100644 --- a/src/test/ui/feature-gates/feature-gate-test_unstable_lint.stderr +++ b/src/test/ui/feature-gates/feature-gate-test_unstable_lint.stderr @@ -4,7 +4,7 @@ warning: unknown lint: `test_unstable_lint` LL | #![allow(test_unstable_lint)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(test_unstable_lint)]` on by default + = note: `#[warn(unknown_lints)]` on by default = note: the `test_unstable_lint` lint is unstable = help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable diff --git a/src/test/ui/lint/must_not_suspend/gated.stderr b/src/test/ui/lint/must_not_suspend/gated.stderr index 3d6877045ff..b58ecb55596 100644 --- a/src/test/ui/lint/must_not_suspend/gated.stderr +++ b/src/test/ui/lint/must_not_suspend/gated.stderr @@ -4,7 +4,7 @@ warning: unknown lint: `must_not_suspend` LL | #![deny(must_not_suspend)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | - = note: `#[warn(must_not_suspend)]` on by default + = note: `#[warn(unknown_lints)]` on by default = note: the `must_not_suspend` lint is unstable = note: see issue #83310 for more information = help: add `#![feature(must_not_suspend)]` to the crate attributes to enable diff --git a/src/test/ui/unknown-unstable-lints/deny-unstable-lint-command-line.stderr b/src/test/ui/unknown-unstable-lints/deny-unstable-lint-command-line.stderr index c840849a27d..7e6885bd706 100644 --- a/src/test/ui/unknown-unstable-lints/deny-unstable-lint-command-line.stderr +++ b/src/test/ui/unknown-unstable-lints/deny-unstable-lint-command-line.stderr @@ -1,6 +1,6 @@ error: unknown lint: `test_unstable_lint` | - = note: `-D test-unstable-lint` implied by `-D unknown-lints` + = note: requested on the command line with `-D unknown-lints` = note: the `test_unstable_lint` lint is unstable = help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable diff --git a/src/test/ui/unknown-unstable-lints/deny-unstable-lint-inline.stderr b/src/test/ui/unknown-unstable-lints/deny-unstable-lint-inline.stderr index 6e909f9902c..2d1027dd0e0 100644 --- a/src/test/ui/unknown-unstable-lints/deny-unstable-lint-inline.stderr +++ b/src/test/ui/unknown-unstable-lints/deny-unstable-lint-inline.stderr @@ -9,7 +9,6 @@ note: the lint level is defined here | LL | #![deny(unknown_lints)] | ^^^^^^^^^^^^^ - = note: `#[deny(test_unstable_lint)]` implied by `#[deny(unknown_lints)]` = note: the `test_unstable_lint` lint is unstable = help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable diff --git a/src/test/ui/unknown-unstable-lints/warn-unknown-unstable-lint-command-line.stderr b/src/test/ui/unknown-unstable-lints/warn-unknown-unstable-lint-command-line.stderr index a45bed843c7..799d740b00e 100644 --- a/src/test/ui/unknown-unstable-lints/warn-unknown-unstable-lint-command-line.stderr +++ b/src/test/ui/unknown-unstable-lints/warn-unknown-unstable-lint-command-line.stderr @@ -1,6 +1,6 @@ warning: unknown lint: `test_unstable_lint` | - = note: `-W test-unstable-lint` implied by `-W unknown-lints` + = note: requested on the command line with `-W unknown-lints` = note: the `test_unstable_lint` lint is unstable = help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable diff --git a/src/test/ui/unknown-unstable-lints/warn-unknown-unstable-lint-inline.stderr b/src/test/ui/unknown-unstable-lints/warn-unknown-unstable-lint-inline.stderr index ce6bd0f3ef9..142558b471b 100644 --- a/src/test/ui/unknown-unstable-lints/warn-unknown-unstable-lint-inline.stderr +++ b/src/test/ui/unknown-unstable-lints/warn-unknown-unstable-lint-inline.stderr @@ -9,7 +9,6 @@ note: the lint level is defined here | LL | #![warn(unknown_lints)] | ^^^^^^^^^^^^^ - = note: `#[warn(test_unstable_lint)]` implied by `#[warn(unknown_lints)]` = note: the `test_unstable_lint` lint is unstable = help: add `#![feature(test_unstable_lint)]` to the crate attributes to enable