Skip to content

invalid_doc_attributes should not fire on extern crate items #86046

Closed
@jyn514

Description

@jyn514

I tried this code:

#[doc(inline)]
pub extern crate cre;

I expected to see this happen: Rustdoc gives no warning, and shows the module "core" instead of "pub use extern crate core".

Instead, this happened: Rustdoc shows the module, but still gives a warning:

warning: this attribute can only be applied to a `use` item
 --> src\main.rs:1:7
  |
1 | #[doc(inline)]
  |       ^^^^^^ only applicable on `use` items
2 | pub extern crate std;
  | --------------------- not a `use` item
  |
  = note: `#[warn(invalid_doc_attributes)]` on by default
  = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
  = note: for more information, see issue #82730 <https://github.com/rust-lang/rust/issues/82730>
  = note: read https://doc.rust-lang.org/nightly/rustdoc/the-doc-attribute.html#docno_inlinedocinline for more information

Meta

rustc --version: rustc 1.54.0-nightly (cc77ba4 2021-06-03)

Metadata

Metadata

Assignees

Labels

A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions