Rollup merge of #97617 - GuillaumeGomez:rustdoc-anonymous-reexports, r=Nemo157
Rustdoc anonymous reexports Fixes #97615. r? `@Nemo157`
This commit is contained in:
commit
f95e2d34c3
@ -286,8 +286,8 @@ fn visit_item(
|
|||||||
self.visit_foreign_item(item, None, om);
|
self.visit_foreign_item(item, None, om);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If we're inlining, skip private items.
|
// If we're inlining, skip private items or item reexported as "_".
|
||||||
_ if self.inlining && !is_pub => {}
|
_ if self.inlining && (!is_pub || renamed == Some(kw::Underscore)) => {}
|
||||||
hir::ItemKind::GlobalAsm(..) => {}
|
hir::ItemKind::GlobalAsm(..) => {}
|
||||||
hir::ItemKind::Use(_, hir::UseKind::ListStem) => {}
|
hir::ItemKind::Use(_, hir::UseKind::ListStem) => {}
|
||||||
hir::ItemKind::Use(path, kind) => {
|
hir::ItemKind::Use(path, kind) => {
|
||||||
|
22
src/test/rustdoc/anonymous-reexport.rs
Normal file
22
src/test/rustdoc/anonymous-reexport.rs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#![crate_name = "foo"]
|
||||||
|
|
||||||
|
// This test ensures we don't display anonymous (non-inline) re-exports of public items.
|
||||||
|
|
||||||
|
// @has 'foo/index.html'
|
||||||
|
// @has - '//*[@id="main-content"]' ''
|
||||||
|
// We check that the only "h2" present is for "Bla".
|
||||||
|
// @count - '//*[@id="main-content"]/h2' 1
|
||||||
|
// @has - '//*[@id="main-content"]/h2' 'Structs'
|
||||||
|
// @count - '//*[@id="main-content"]//a[@class="struct"]' 1
|
||||||
|
|
||||||
|
mod ext {
|
||||||
|
pub trait Foo {}
|
||||||
|
pub trait Bar {}
|
||||||
|
pub struct S;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub use crate::ext::Foo as _;
|
||||||
|
pub use crate::ext::Bar as _;
|
||||||
|
pub use crate::ext::S as _;
|
||||||
|
|
||||||
|
pub struct Bla;
|
Loading…
Reference in New Issue
Block a user