Don't fire invalid_doc_attributes on extern crate items

This commit is contained in:
Joshua Nelson 2021-06-05 21:16:19 -04:00
parent 34b9932f5c
commit b8ebf4431e
3 changed files with 23 additions and 1 deletions

View File

@ -577,7 +577,7 @@ fn check_doc_inline(
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 {

View File

@ -0,0 +1,9 @@
#[doc(inline)]
//~^ ERROR conflicting
#[doc(no_inline)]
pub extern crate core;
// no warning
pub extern crate alloc;
fn main() {}

View File

@ -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