Skip to content

Commit b8ebf44

Browse files
committed
Don't fire invalid_doc_attributes on extern crate items
1 parent 34b9932 commit b8ebf44

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

compiler/rustc_passes/src/check_attr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ impl CheckAttrVisitor<'tcx> {
577577
target: Target,
578578
specified_inline: &mut Option<(bool, Span)>,
579579
) -> bool {
580-
if target == Target::Use {
580+
if target == Target::Use || target == Target::ExternCrate {
581581
let do_inline = meta.name_or_empty() == sym::inline;
582582
if let Some((prev_inline, prev_span)) = *specified_inline {
583583
if do_inline != prev_inline {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#[doc(inline)]
2+
//~^ ERROR conflicting
3+
#[doc(no_inline)]
4+
pub extern crate core;
5+
6+
// no warning
7+
pub extern crate alloc;
8+
9+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
error: conflicting doc inlining attributes
2+
--> $DIR/doc-inline-extern-crate.rs:1:7
3+
|
4+
LL | #[doc(inline)]
5+
| ^^^^^^ this attribute...
6+
LL |
7+
LL | #[doc(no_inline)]
8+
| ^^^^^^^^^ ...conflicts with this attribute
9+
|
10+
= help: remove one of the conflicting attributes
11+
12+
error: aborting due to previous error
13+

0 commit comments

Comments
 (0)