about summary refs log tree commit diff
path: root/src/test/rustdoc-ui
diff options
context:
space:
mode:
authorJoshua Nelson <jyn514@gmail.com>2021-03-16 11:59:05 -0400
committerJoshua Nelson <jyn514@gmail.com>2021-03-16 13:13:59 -0400
commitc1b99f0b905f3aec1e44d312a692c5df4440bcd1 (patch)
treef9c08ddf321d2940a0947e81044700fbfedb5250 /src/test/rustdoc-ui
parentf24ce9b0140d9be5a336954e878d0c1522966bb8 (diff)
downloadrust-c1b99f0b905f3aec1e44d312a692c5df4440bcd1.tar.gz
rust-c1b99f0b905f3aec1e44d312a692c5df4440bcd1.zip
Don't warn about old rustdoc lint names (temporarily)
Right now, rustdoc users have an unpleasant situation: they can either
use the new tool lint names (`rustdoc::non_autolinks`) or they can use
the old names (`non_autolinks`). If they use the tool lints, they get a
hard error on stable compilers, because rustc rejects all tool names it
doesn't recognize. If they use the old name, they get a warning to
rename the lint to the new name. The only way to compile without
warnings is to add `#[allow(renamed_removed_lints)]`, which defeats the
whole point of the change: we *want* people to switch to the new name.

To avoid people silencing the lint and never migrating to the tool lint,
this avoids warning about the old name, while still allowing you to use
the new name. Once the new `rustdoc` tool name makes it to the stable
channel, we can change these lints to warn again.

This adds the new lint functions `register_alias` and `register_ignored`
- I didn't see an existing way to do this.
Diffstat (limited to 'src/test/rustdoc-ui')
-rw-r--r--src/test/rustdoc-ui/renamed-lint-still-applies.rs3
-rw-r--r--src/test/rustdoc-ui/renamed-lint-still-applies.stderr13
-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, 10 insertions, 21 deletions
diff --git a/src/test/rustdoc-ui/renamed-lint-still-applies.rs b/src/test/rustdoc-ui/renamed-lint-still-applies.rs
index 6d4bad16aad..8c61c1ccb6a 100644
--- a/src/test/rustdoc-ui/renamed-lint-still-applies.rs
+++ b/src/test/rustdoc-ui/renamed-lint-still-applies.rs
@@ -1,5 +1,6 @@
 // compile-args: --crate-type lib
 #![deny(broken_intra_doc_links)]
-//~^ WARNING renamed
+// FIXME: the old names for rustdoc lints should warn by default once `rustdoc::` makes it to the
+// stable channel.
 //! [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 e14cbfa1726..8a12991558a 100644
--- a/src/test/rustdoc-ui/renamed-lint-still-applies.stderr
+++ b/src/test/rustdoc-ui/renamed-lint-still-applies.stderr
@@ -1,13 +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
-   |
-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
-
 error: unresolved link to `x`
-  --> $DIR/renamed-lint-still-applies.rs:4:6
+  --> $DIR/renamed-lint-still-applies.rs:5:6
    |
 LL | //! [x]
    |      ^ no item named `x` in scope
@@ -17,7 +9,8 @@ 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: aborting due to previous error; 1 warning emitted
+error: aborting due to previous error
 
diff --git a/src/test/rustdoc-ui/unknown-renamed-lints.rs b/src/test/rustdoc-ui/unknown-renamed-lints.rs
index 9d20cb7d30d..a05c0c81168 100644
--- a/src/test/rustdoc-ui/unknown-renamed-lints.rs
+++ b/src/test/rustdoc-ui/unknown-renamed-lints.rs
@@ -10,7 +10,8 @@
 //~^ ERROR renamed to `rustdoc::broken_intra_doc_links`
 
 #![deny(non_autolinks)]
-//~^ ERROR renamed to `rustdoc::non_autolinks`
+// FIXME: the old names for rustdoc lints should warn by default once `rustdoc::` makes it to the
+// stable channel.
 
 #![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 2036335e855..98bfb83c704 100644
--- a/src/test/rustdoc-ui/unknown-renamed-lints.stderr
+++ b/src/test/rustdoc-ui/unknown-renamed-lints.stderr
@@ -28,25 +28,19 @@ note: the lint level is defined here
 LL | #![deny(renamed_and_removed_lints)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: lint `non_autolinks` has been renamed to `rustdoc::non_autolinks`
-  --> $DIR/unknown-renamed-lints.rs:12:9
-   |
-LL | #![deny(non_autolinks)]
-   |         ^^^^^^^^^^^^^ help: use the new name: `rustdoc::non_autolinks`
-
 error: lint `rustdoc` has been removed: use `rustdoc::all` instead
-  --> $DIR/unknown-renamed-lints.rs:15:9
+  --> $DIR/unknown-renamed-lints.rs:16:9
    |
 LL | #![deny(rustdoc)]
    |         ^^^^^^^
 
 error: unknown lint: `rustdoc::intra_doc_link_resolution_failure`
-  --> $DIR/unknown-renamed-lints.rs:19:9
+  --> $DIR/unknown-renamed-lints.rs:20:9
    |
 LL | #![deny(rustdoc::intra_doc_link_resolution_failure)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: Compilation failed, aborting rustdoc
 
-error: aborting due to 7 previous errors
+error: aborting due to 6 previous errors