Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Renamed lint groups are not honored in attributes #82813

Closed
jyn514 opened this issue Mar 5, 2021 · 3 comments
Closed

Renamed lint groups are not honored in attributes #82813

jyn514 opened this issue Mar 5, 2021 · 3 comments
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jyn514
Copy link
Member

jyn514 commented Mar 5, 2021

I tried renaming rustdoc to rustdoc::all. I expected this to continue denying rustdoc warnings when I use deny(rustdoc). Instead, it warned that the lint name was outdated, but did not apply the lint level.

#![deny(rustdoc)]
//! [x]
warning: lint `rustdoc` has been removed: use `rustdoc::all` instead
 --> ../test-rustdoc/lints.rs:1:9
  |
1 | #![deny(rustdoc)]
  |         ^^^^^^^
  |
  = note: `#[warn(renamed_and_removed_lints)]` on by default

warning: unresolved link to `x`
 --> ../test-rustdoc/lints.rs:2:6
  |
2 | //! [x]
  |      ^ no item named `x` in scope
  |
  = note: `#[warn(rustdoc::broken_intra_doc_links)]` on by default
  = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`

warning: 2 warnings emitted

This is #82615, but for lint groups instead of individual lints. cc #82798

@jyn514 jyn514 added A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Mar 5, 2021
@jyn514
Copy link
Member Author

jyn514 commented Mar 5, 2021

I tried renaming rustdoc to rustdoc::all

diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs
index 3f5da7910aa..94ca0df818b 100644
--- a/compiler/rustc_lint/src/lib.rs
+++ b/compiler/rustc_lint/src/lib.rs
@@ -343,8 +343,7 @@ fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) {
         "intra_doc_link_resolution_failure",
         "use `rustdoc::broken_intra_doc_links` instead",
     );
-    // This doesn't actually do anything, it's just so `deny(rustdoc)` doesn't give warnings.
-    store.register_group(false, "rustdoc", None, vec![]);
+    store.register_removed("rustdoc", "use `rustdoc::all` instead");
 
     store.register_removed("unknown_features", "replaced by an error");
     store.register_removed("unsigned_negation", "replaced by negate_unsigned feature gate");
diff --git a/src/librustdoc/lint.rs b/src/librustdoc/lint.rs
index e8806c1b6d7..f0916c7aea2 100644
--- a/src/librustdoc/lint.rs
+++ b/src/librustdoc/lint.rs
@@ -175,7 +175,7 @@ pub(crate) fn init_lints<F>(
     lint_store.register_lints(&**RUSTDOC_LINTS);
     lint_store.register_group(
         true,
-        "rustdoc",
+        "rustdoc::all",
         None,
         RUSTDOC_LINTS.iter().map(|&lint| LintId::of(lint)).collect(),
     );

@jyn514
Copy link
Member Author

jyn514 commented Mar 5, 2021

Oh wait I'm dumb, I used register_removed instead of register_renamed 😆

@jyn514
Copy link
Member Author

jyn514 commented Mar 5, 2021

Yup, this fixes it:

diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs
index 3f5da7910aa..94ca0df818b 100644
--- a/compiler/rustc_lint/src/lib.rs
+++ b/compiler/rustc_lint/src/lib.rs
@@ -343,8 +343,7 @@ fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) {
         "intra_doc_link_resolution_failure",
         "use `rustdoc::broken_intra_doc_links` instead",
     );
-    // This doesn't actually do anything, it's just so `deny(rustdoc)` doesn't give warnings.
-    store.register_group(false, "rustdoc", None, vec![]);
+    store.register_removed("rustdoc", "use `rustdoc::all` instead");
 
     store.register_removed("unknown_features", "replaced by an error");
     store.register_removed("unsigned_negation", "replaced by negate_unsigned feature gate");
diff --git a/src/librustdoc/lint.rs b/src/librustdoc/lint.rs
index e8806c1b6d7..754ec53b330 100644
--- a/src/librustdoc/lint.rs
+++ b/src/librustdoc/lint.rs
@@ -175,8 +175,8 @@ pub(crate) fn init_lints<F>(
     lint_store.register_lints(&**RUSTDOC_LINTS);
     lint_store.register_group(
         true,
-        "rustdoc",
-        None,
+        "rustdoc::all",
+        Some("rustdoc"),
         RUSTDOC_LINTS.iter().map(|&lint| LintId::of(lint)).collect(),
     );
     for lint in &*RUSTDOC_LINTS {

@jyn514 jyn514 closed this as completed Mar 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

1 participant