Skip to content

Commit 622722a

Browse files
authored
Rollup merge of #143083 - JonathanBrouwer:rustdoc-fix, r=jdonszelmann
Fix rustdoc not correctly showing attributes on re-exports Fixes attributes not being shown correctly in rustdoc on re-exports Does this need to be backported to beta? r? ``@jdonszelmann``
2 parents 0aaac88 + 58418d8 commit 622722a

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

‎src/librustdoc/clean/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2746,7 +2746,8 @@ fn add_without_unwanted_attributes<'hir>(
27462746
attrs.push((Cow::Owned(attr), import_parent));
27472747
}
27482748
}
2749-
hir::Attribute::Parsed(..) if is_inline => {
2749+
// FIXME: make sure to exclude `#[cfg_trace]` here when it is ported to the new parsers
2750+
hir::Attribute::Parsed(..) => {
27502751
attrs.push((Cow::Owned(attr), import_parent));
27512752
}
27522753
_ => {}

‎tests/rustdoc/attributes-re-export.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Tests that attributes are correctly copied onto a re-exported item.
2+
//@ edition:2021
3+
#![crate_name = "re_export"]
4+
5+
//@ has 're_export/fn.thingy2.html' '//pre[@class="rust item-decl"]' '#[no_mangle]'
6+
pub use thingymod::thingy as thingy2;
7+
8+
mod thingymod {
9+
#[no_mangle]
10+
pub fn thingy() {
11+
12+
}
13+
}

0 commit comments

Comments
 (0)