Rollup merge of #97617 - GuillaumeGomez:rustdoc-anonymous-reexports, r=Nemo157

Rustdoc anonymous reexports

Fixes #97615.

r? `@Nemo157`
This commit is contained in:
Dylan DPC 2022-06-02 15:27:00 +02:00 committed by GitHub
commit f95e2d34c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 2 deletions

View File

@ -286,8 +286,8 @@ fn visit_item(
self.visit_foreign_item(item, None, om);
}
}
// If we're inlining, skip private items.
_ if self.inlining && !is_pub => {}
// If we're inlining, skip private items or item reexported as "_".
_ if self.inlining && (!is_pub || renamed == Some(kw::Underscore)) => {}
hir::ItemKind::GlobalAsm(..) => {}
hir::ItemKind::Use(_, hir::UseKind::ListStem) => {}
hir::ItemKind::Use(path, kind) => {

View 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;