about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-07-04 06:34:31 +0000
committerbors <bors@rust-lang.org>2021-07-04 06:34:31 +0000
commit64ae15ddd3f3cca7036ab2b2f3a6b130b62af4da (patch)
tree7191489e7b2f2689bec80837cf03ba77ab5db85d /src/test
parent71a567fae4c282aa5ecb1e6e48f020ade8df23e7 (diff)
parent7a774a8537a3ad27d1e4ada7c041c97ad7655c6d (diff)
downloadrust-64ae15ddd3f3cca7036ab2b2f3a6b130b62af4da.tar.gz
rust-64ae15ddd3f3cca7036ab2b2f3a6b130b62af4da.zip
Auto merge of #86849 - jyn514:rustdoc-group, r=Manishearth
Warn when `rustdoc::` group is omitted from lint names

When rustdoc lints were first made a tool lint, they gave an unconditional warning when you used the original name:
```
warning: lint `broken_intra_doc_links` has been renamed to `rustdoc::broken_intra_doc_links`
  --> $DIR/renamed-lint-still-applies.rs:2:9
   |
LL | #![deny(broken_intra_doc_links)]
   |         ^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `rustdoc::broken_intra_doc_links`
   |
   = note: `#[warn(renamed_and_removed_lints)]` on by default
```
That was reverted in https://github.com/rust-lang/rust/pull/83203 because adding `rustdoc::x` lints would cause the code to break on old versions of the compiler (due to https://github.com/rust-lang/rust/issues/66079#issuecomment-788589193, "fixed" in https://github.com/rust-lang/rust/pull/83216 in the sense that you can now opt-in to not breaking on nightly, which is not ideal but `register_tool` is a long way from stabilizing). Since https://github.com/rust-lang/rust/pull/80527 is now on 1.52.0 stable, we can re-enable the warning. For nightly users, they can change immediately and still have their code work on stable; for stable users, they can change their code in 12 weeks and still have it work up to 3 releases back (about 18 weeks). That seems reasonable to me.

r? `@Manishearth` cc `@rust-lang/rustdoc`
Diffstat (limited to 'src/test')
-rw-r--r--src/test/rustdoc-ui/renamed-lint-still-applies.rs3
-rw-r--r--src/test/rustdoc-ui/renamed-lint-still-applies.stderr21
-rw-r--r--src/test/rustdoc-ui/unknown-renamed-lints.rs3
-rw-r--r--src/test/rustdoc-ui/unknown-renamed-lints.stderr12
4 files changed, 24 insertions, 15 deletions
diff --git a/src/test/rustdoc-ui/renamed-lint-still-applies.rs b/src/test/rustdoc-ui/renamed-lint-still-applies.rs
index 05a32d3cc31..a4d3a4b4971 100644
--- a/src/test/rustdoc-ui/renamed-lint-still-applies.rs
+++ b/src/test/rustdoc-ui/renamed-lint-still-applies.rs
@@ -1,7 +1,6 @@
 // compile-args: --crate-type lib
 #![deny(broken_intra_doc_links)]
-// FIXME: the old names for rustdoc lints should warn by default once `rustdoc::` makes it to the
-// stable channel.
+//~^ WARNING renamed to `rustdoc::broken_intra_doc_links`
 //! [x]
 //~^ ERROR unresolved link
 
diff --git a/src/test/rustdoc-ui/renamed-lint-still-applies.stderr b/src/test/rustdoc-ui/renamed-lint-still-applies.stderr
index 3040cad532c..8e2a2cdd759 100644
--- a/src/test/rustdoc-ui/renamed-lint-still-applies.stderr
+++ b/src/test/rustdoc-ui/renamed-lint-still-applies.stderr
@@ -1,13 +1,19 @@
+warning: lint `broken_intra_doc_links` has been renamed to `rustdoc::broken_intra_doc_links`
+  --> $DIR/renamed-lint-still-applies.rs:2:9
+   |
+LL | #![deny(broken_intra_doc_links)]
+   |         ^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `rustdoc::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:8:9
+  --> $DIR/renamed-lint-still-applies.rs:7:9
    |
 LL | #![deny(rustdoc::non_autolinks)]
    |         ^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `rustdoc::bare_urls`
-   |
-   = note: `#[warn(renamed_and_removed_lints)]` on by default
 
 error: unresolved link to `x`
-  --> $DIR/renamed-lint-still-applies.rs:5:6
+  --> $DIR/renamed-lint-still-applies.rs:4:6
    |
 LL | //! [x]
    |      ^ no item named `x` in scope
@@ -17,21 +23,20 @@ note: the lint level is defined here
    |
 LL | #![deny(broken_intra_doc_links)]
    |         ^^^^^^^^^^^^^^^^^^^^^^
-   = note: `#[deny(rustdoc::broken_intra_doc_links)]` implied by `#[deny(broken_intra_doc_links)]`
    = help: to escape `[` and `]` characters, add '\' before them like `\[` or `\]`
 
 error: this URL is not a hyperlink
-  --> $DIR/renamed-lint-still-applies.rs:10:5
+  --> $DIR/renamed-lint-still-applies.rs:9:5
    |
 LL | //! http://example.com
    |     ^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<http://example.com>`
    |
 note: the lint level is defined here
-  --> $DIR/renamed-lint-still-applies.rs:8:9
+  --> $DIR/renamed-lint-still-applies.rs:7:9
    |
 LL | #![deny(rustdoc::non_autolinks)]
    |         ^^^^^^^^^^^^^^^^^^^^^^
    = note: bare URLs are not automatically turned into clickable links
 
-error: aborting due to 2 previous errors; 1 warning emitted
+error: aborting due to 2 previous errors; 2 warnings emitted
 
diff --git a/src/test/rustdoc-ui/unknown-renamed-lints.rs b/src/test/rustdoc-ui/unknown-renamed-lints.rs
index 9096cce1276..ddf03dd079f 100644
--- a/src/test/rustdoc-ui/unknown-renamed-lints.rs
+++ b/src/test/rustdoc-ui/unknown-renamed-lints.rs
@@ -14,8 +14,7 @@
 //~^ ERROR renamed to `rustdoc::bare_urls`
 
 #![deny(private_doc_tests)]
-// FIXME: the old names for rustdoc lints should warn by default once `rustdoc::` makes it to the
-// stable channel.
+//~^ ERROR renamed to `rustdoc::private_doc_tests`
 
 #![deny(rustdoc)]
 //~^ ERROR removed: use `rustdoc::all` instead
diff --git a/src/test/rustdoc-ui/unknown-renamed-lints.stderr b/src/test/rustdoc-ui/unknown-renamed-lints.stderr
index 51e06821cf7..ad814b82352 100644
--- a/src/test/rustdoc-ui/unknown-renamed-lints.stderr
+++ b/src/test/rustdoc-ui/unknown-renamed-lints.stderr
@@ -40,19 +40,25 @@ error: lint `rustdoc::non_autolinks` has been renamed to `rustdoc::bare_urls`
 LL | #![deny(rustdoc::non_autolinks)]
    |         ^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `rustdoc::bare_urls`
 
+error: lint `private_doc_tests` has been renamed to `rustdoc::private_doc_tests`
+  --> $DIR/unknown-renamed-lints.rs:16:9
+   |
+LL | #![deny(private_doc_tests)]
+   |         ^^^^^^^^^^^^^^^^^ help: use the new name: `rustdoc::private_doc_tests`
+
 error: lint `rustdoc` has been removed: use `rustdoc::all` instead
-  --> $DIR/unknown-renamed-lints.rs:20:9
+  --> $DIR/unknown-renamed-lints.rs:19:9
    |
 LL | #![deny(rustdoc)]
    |         ^^^^^^^
 
 error: unknown lint: `rustdoc::intra_doc_link_resolution_failure`
-  --> $DIR/unknown-renamed-lints.rs:24:9
+  --> $DIR/unknown-renamed-lints.rs:23:9
    |
 LL | #![deny(rustdoc::intra_doc_link_resolution_failure)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: Compilation failed, aborting rustdoc
 
-error: aborting due to 8 previous errors
+error: aborting due to 9 previous errors