Skip to content

Fix rustdoc not correctly showing attributes on re-exports #143083

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
_ => {}
Expand Down
13 changes: 13 additions & 0 deletions tests/rustdoc/attributes-re-export.rs
Original file line number Diff line number Diff line change
@@ -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() {

}
}
Loading