Skip to content

Commit 45229b0

Browse files
committed
Rename rustdoc to rustdoc::all
When rustdoc lints were changed to be tool lints, the `rustdoc` group was removed, leading to spurious warnings like ``` warning: unknown lint: `rustdoc` ``` The lint group still worked when rustdoc ran, since rustdoc added the group itself. This renames the group to `rustdoc::all` for consistency with `clippy::all` and the rest of the rustdoc lints.
1 parent 8ccc89b commit 45229b0

12 files changed

+58
-33
lines changed

compiler/rustc_lint/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) {
343343
"intra_doc_link_resolution_failure",
344344
"use `rustdoc::broken_intra_doc_links` instead",
345345
);
346+
store.register_removed("rustdoc", "use `rustdoc::all` instead");
346347

347348
store.register_removed("unknown_features", "replaced by an error");
348349
store.register_removed("unsigned_negation", "replaced by negate_unsigned feature gate");

src/librustdoc/lint.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ crate fn register_lints(_sess: &Session, lint_store: &mut LintStore) {
175175
lint_store.register_lints(&**RUSTDOC_LINTS);
176176
lint_store.register_group(
177177
true,
178-
"rustdoc",
179-
None,
178+
"rustdoc::all",
179+
Some("rustdoc"),
180180
RUSTDOC_LINTS.iter().map(|&lint| LintId::of(lint)).collect(),
181181
);
182182
for lint in &*RUSTDOC_LINTS {

src/test/rustdoc-ui/check-fail.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// compile-flags: -Z unstable-options --check
22

33
#![deny(missing_docs)]
4-
#![deny(rustdoc)]
4+
#![deny(rustdoc::all)]
55

66
//! ```rust,testharness
77
//~^ ERROR

src/test/rustdoc-ui/check-fail.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ LL | pub fn foo() {}
1919
note: the lint level is defined here
2020
--> $DIR/check-fail.rs:4:9
2121
|
22-
LL | #![deny(rustdoc)]
23-
| ^^^^^^^
24-
= note: `#[deny(rustdoc::missing_doc_code_examples)]` implied by `#[deny(rustdoc)]`
22+
LL | #![deny(rustdoc::all)]
23+
| ^^^^^^^^^^^^
24+
= note: `#[deny(rustdoc::missing_doc_code_examples)]` implied by `#[deny(rustdoc::all)]`
2525

2626
error: unknown attribute `testharness`. Did you mean `test_harness`?
2727
--> $DIR/check-fail.rs:6:1
@@ -35,9 +35,9 @@ LL | | //! ```
3535
note: the lint level is defined here
3636
--> $DIR/check-fail.rs:4:9
3737
|
38-
LL | #![deny(rustdoc)]
39-
| ^^^^^^^
40-
= note: `#[deny(rustdoc::invalid_codeblock_attributes)]` implied by `#[deny(rustdoc)]`
38+
LL | #![deny(rustdoc::all)]
39+
| ^^^^^^^^^^^^
40+
= note: `#[deny(rustdoc::invalid_codeblock_attributes)]` implied by `#[deny(rustdoc::all)]`
4141
= help: the code block will either not be tested if not marked as a rust one or the code will be wrapped inside a main function
4242

4343
error: unknown attribute `testharness`. Did you mean `test_harness`?

src/test/rustdoc-ui/check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#![warn(missing_docs)]
55
//~^ WARN
66
//~^^ WARN
7-
#![warn(rustdoc)]
7+
#![warn(rustdoc::all)]
88

99
pub fn foo() {}
1010
//~^ WARN

src/test/rustdoc-ui/check.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ warning: missing documentation for the crate
44
LL | / #![warn(missing_docs)]
55
LL | |
66
LL | |
7-
LL | | #![warn(rustdoc)]
7+
LL | | #![warn(rustdoc::all)]
88
LL | |
99
LL | | pub fn foo() {}
1010
| |_______________^
@@ -26,9 +26,9 @@ warning: no documentation found for this crate's top-level module
2626
note: the lint level is defined here
2727
--> $DIR/check.rs:7:9
2828
|
29-
LL | #![warn(rustdoc)]
30-
| ^^^^^^^
31-
= note: `#[warn(rustdoc::missing_crate_level_docs)]` implied by `#[warn(rustdoc)]`
29+
LL | #![warn(rustdoc::all)]
30+
| ^^^^^^^^^^^^
31+
= note: `#[warn(rustdoc::missing_crate_level_docs)]` implied by `#[warn(rustdoc::all)]`
3232
= help: The following guide may be of use:
3333
https://doc.rust-lang.org/nightly/rustdoc/how-to-write-documentation.html
3434

@@ -38,17 +38,17 @@ warning: missing code example in this documentation
3838
LL | / #![warn(missing_docs)]
3939
LL | |
4040
LL | |
41-
LL | | #![warn(rustdoc)]
41+
LL | | #![warn(rustdoc::all)]
4242
LL | |
4343
LL | | pub fn foo() {}
4444
| |_______________^
4545
|
4646
note: the lint level is defined here
4747
--> $DIR/check.rs:7:9
4848
|
49-
LL | #![warn(rustdoc)]
50-
| ^^^^^^^
51-
= note: `#[warn(rustdoc::missing_doc_code_examples)]` implied by `#[warn(rustdoc)]`
49+
LL | #![warn(rustdoc::all)]
50+
| ^^^^^^^^^^^^
51+
= note: `#[warn(rustdoc::missing_doc_code_examples)]` implied by `#[warn(rustdoc::all)]`
5252

5353
warning: missing code example in this documentation
5454
--> $DIR/check.rs:9:1

src/test/rustdoc-ui/lint-group.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! println!("sup");
55
//! ```
66
7-
#![deny(rustdoc)]
7+
#![deny(rustdoc::all)]
88

99
/// what up, let's make an [error]
1010
///

src/test/rustdoc-ui/lint-group.stderr

+12-12
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ LL | /// wait, this doesn't have a doctest?
77
note: the lint level is defined here
88
--> $DIR/lint-group.rs:7:9
99
|
10-
LL | #![deny(rustdoc)]
11-
| ^^^^^^^
12-
= note: `#[deny(rustdoc::missing_doc_code_examples)]` implied by `#[deny(rustdoc)]`
10+
LL | #![deny(rustdoc::all)]
11+
| ^^^^^^^^^^^^
12+
= note: `#[deny(rustdoc::missing_doc_code_examples)]` implied by `#[deny(rustdoc::all)]`
1313

1414
error: documentation test in private item
1515
--> $DIR/lint-group.rs:19:1
@@ -24,9 +24,9 @@ LL | | /// ```
2424
note: the lint level is defined here
2525
--> $DIR/lint-group.rs:7:9
2626
|
27-
LL | #![deny(rustdoc)]
28-
| ^^^^^^^
29-
= note: `#[deny(rustdoc::private_doc_tests)]` implied by `#[deny(rustdoc)]`
27+
LL | #![deny(rustdoc::all)]
28+
| ^^^^^^^^^^^^
29+
= note: `#[deny(rustdoc::private_doc_tests)]` implied by `#[deny(rustdoc::all)]`
3030

3131
error: missing code example in this documentation
3232
--> $DIR/lint-group.rs:26:1
@@ -43,9 +43,9 @@ LL | /// what up, let's make an [error]
4343
note: the lint level is defined here
4444
--> $DIR/lint-group.rs:7:9
4545
|
46-
LL | #![deny(rustdoc)]
47-
| ^^^^^^^
48-
= note: `#[deny(rustdoc::broken_intra_doc_links)]` implied by `#[deny(rustdoc)]`
46+
LL | #![deny(rustdoc::all)]
47+
| ^^^^^^^^^^^^
48+
= note: `#[deny(rustdoc::broken_intra_doc_links)]` implied by `#[deny(rustdoc::all)]`
4949
= help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
5050

5151
error: unclosed HTML tag `unknown`
@@ -57,9 +57,9 @@ LL | /// <unknown>
5757
note: the lint level is defined here
5858
--> $DIR/lint-group.rs:7:9
5959
|
60-
LL | #![deny(rustdoc)]
61-
| ^^^^^^^
62-
= note: `#[deny(rustdoc::invalid_html_tags)]` implied by `#[deny(rustdoc)]`
60+
LL | #![deny(rustdoc::all)]
61+
| ^^^^^^^^^^^^
62+
= note: `#[deny(rustdoc::invalid_html_tags)]` implied by `#[deny(rustdoc::all)]`
6363

6464
error: aborting due to 5 previous errors
6565

src/test/rustdoc-ui/unknown-renamed-lints.rs

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
#![deny(non_autolinks)]
1313
//~^ ERROR renamed to `rustdoc::non_autolinks`
1414

15+
#![deny(rustdoc)]
16+
//~^ ERROR removed: use `rustdoc::all` instead
17+
1518
// Explicitly don't try to handle this case, it was never valid
1619
#![deny(rustdoc::intra_doc_link_resolution_failure)]
1720
//~^ ERROR unknown lint

src/test/rustdoc-ui/unknown-renamed-lints.stderr

+8-2
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,19 @@ error: lint `non_autolinks` has been renamed to `rustdoc::non_autolinks`
3434
LL | #![deny(non_autolinks)]
3535
| ^^^^^^^^^^^^^ help: use the new name: `rustdoc::non_autolinks`
3636

37+
error: lint `rustdoc` has been removed: use `rustdoc::all` instead
38+
--> $DIR/unknown-renamed-lints.rs:15:9
39+
|
40+
LL | #![deny(rustdoc)]
41+
| ^^^^^^^
42+
3743
error: unknown lint: `rustdoc::intra_doc_link_resolution_failure`
38-
--> $DIR/unknown-renamed-lints.rs:16:9
44+
--> $DIR/unknown-renamed-lints.rs:19:9
3945
|
4046
LL | #![deny(rustdoc::intra_doc_link_resolution_failure)]
4147
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4248

4349
error: Compilation failed, aborting rustdoc
4450

45-
error: aborting due to 6 previous errors
51+
error: aborting due to 7 previous errors
4652

src/test/ui/lint/rustdoc-group.rs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// check-pass
2+
// compile-flags: --crate-type lib
3+
#![deny(rustdoc)]
4+
//~^ WARNING removed: use `rustdoc::all`
5+
#![deny(rustdoc::all)] // has no effect when run with rustc directly

src/test/ui/lint/rustdoc-group.stderr

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
warning: lint `rustdoc` has been removed: use `rustdoc::all` instead
2+
--> $DIR/rustdoc-group.rs:3:9
3+
|
4+
LL | #![deny(rustdoc)]
5+
| ^^^^^^^
6+
|
7+
= note: `#[warn(renamed_and_removed_lints)]` on by default
8+
9+
warning: 1 warning emitted
10+

0 commit comments

Comments
 (0)