Skip to content

Don't fire invalid_doc_attributes on extern crate items #86047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_passes/src/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ impl CheckAttrVisitor<'tcx> {
target: Target,
specified_inline: &mut Option<(bool, Span)>,
) -> bool {
if target == Target::Use {
if target == Target::Use || target == Target::ExternCrate {
let do_inline = meta.name_or_empty() == sym::inline;
if let Some((prev_inline, prev_span)) = *specified_inline {
if do_inline != prev_inline {
Expand Down
9 changes: 9 additions & 0 deletions src/test/ui/rustdoc/doc-inline-extern-crate.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#[doc(inline)]
//~^ ERROR conflicting
#[doc(no_inline)]
pub extern crate core;

// no warning
pub extern crate alloc;

fn main() {}
13 changes: 13 additions & 0 deletions src/test/ui/rustdoc/doc-inline-extern-crate.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
error: conflicting doc inlining attributes
--> $DIR/doc-inline-extern-crate.rs:1:7
|
LL | #[doc(inline)]
| ^^^^^^ this attribute...
LL |
LL | #[doc(no_inline)]
| ^^^^^^^^^ ...conflicts with this attribute
|
= help: remove one of the conflicting attributes

error: aborting due to previous error