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``
This commit is contained in:
Jana Dönszelmann 2025-07-03 13:29:37 +02:00 committed by GitHub
commit 622722aada
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 1 deletions

View file

@ -2746,7 +2746,8 @@ fn add_without_unwanted_attributes<'hir>(
attrs.push((Cow::Owned(attr), import_parent));
}
}
hir::Attribute::Parsed(..) if is_inline => {
// FIXME: make sure to exclude `#[cfg_trace]` here when it is ported to the new parsers
hir::Attribute::Parsed(..) => {
attrs.push((Cow::Owned(attr), import_parent));
}
_ => {}

View file

@ -0,0 +1,13 @@
// Tests that attributes are correctly copied onto a re-exported item.
//@ edition:2021
#![crate_name = "re_export"]
//@ has 're_export/fn.thingy2.html' '//pre[@class="rust item-decl"]' '#[no_mangle]'
pub use thingymod::thingy as thingy2;
mod thingymod {
#[no_mangle]
pub fn thingy() {
}
}