Skip to content

Commit 16227c8

Browse files
committed
Rustdoc lints on duplicate, unused, and stable features
1 parent cc8ef70 commit 16227c8

5 files changed

Lines changed: 12 additions & 8 deletions

File tree

src/librustdoc/core.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,9 @@ pub(crate) fn create_config(
232232
rustc_lint::builtin::RENAMED_AND_REMOVED_LINTS.name.to_string(),
233233
rustc_lint::builtin::UNKNOWN_LINTS.name.to_string(),
234234
rustc_lint::builtin::UNEXPECTED_CFGS.name.to_string(),
235+
rustc_lint::builtin::DUPLICATE_FEATURES.name.to_string(),
236+
rustc_lint::builtin::UNUSED_FEATURES.name.to_string(),
237+
rustc_lint::builtin::STABLE_FEATURES.name.to_string(),
235238
// this lint is needed to support `#[expect]` attributes
236239
rustc_lint::builtin::UNFULFILLED_LINT_EXPECTATIONS.name.to_string(),
237240
];
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
//@ only-64bit
22

3-
#![feature(const_transmute)]
4-
53
pub const ZST: &[u8] = unsafe { std::mem::transmute(1usize) };
64
//~^ ERROR transmuting from 8-byte type to 16-byte type

tests/rustdoc-ui/issues/issue-79494.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0080]: transmuting from 8-byte type to 16-byte type: `usize` -> `&[u8]`
2-
--> $DIR/issue-79494.rs:5:33
2+
--> $DIR/issue-79494.rs:3:33
33
|
44
LL | pub const ZST: &[u8] = unsafe { std::mem::transmute(1usize) };
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation of `ZST` failed here
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
//@ check-pass
2+
13
#![feature(rustdoc_internals)]
2-
#![feature(rustdoc_internals)] //~ ERROR
4+
#![feature(rustdoc_internals)] //~ WARN duplicate
35

46
pub fn foo() {}

tests/rustdoc-ui/rustc-check-passes.stderr

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
error[E0636]: the feature `rustdoc_internals` has already been enabled
2-
--> $DIR/rustc-check-passes.rs:2:12
1+
warning: the feature `rustdoc_internals` has already been enabled
2+
--> $DIR/rustc-check-passes.rs:4:12
33
|
44
LL | #![feature(rustdoc_internals)]
55
| ^^^^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(duplicate_features)]` on by default
68

7-
error: aborting due to 1 previous error
9+
warning: 1 warning emitted
810

9-
For more information about this error, try `rustc --explain E0636`.

0 commit comments

Comments
 (0)