Skip to content

Commit f502263

Browse files
committed
Improve test
1 parent 799e822 commit f502263

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

src/librustdoc/clean/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2162,6 +2162,7 @@ impl Clean<Vec<Item>> for doctree::Import<'_> {
21622162
// #[doc(no_inline)] attribute is present.
21632163
// Don't inline doc(hidden) imports so they can be stripped at a later stage.
21642164
let mut denied = !self.vis.node.is_pub()
2165+
|| (self.vis.node.is_pub() && self.name == kw::Underscore)
21652166
|| self.attrs.iter().any(|a| {
21662167
a.has_name(sym::doc)
21672168
&& match a.meta_item_list() {
@@ -2171,8 +2172,7 @@ impl Clean<Vec<Item>> for doctree::Import<'_> {
21712172
}
21722173
None => false,
21732174
}
2174-
})
2175-
|| (self.vis.node.is_pub() && self.name == kw::Underscore);
2175+
});
21762176
// Also check whether imports were asked to be inlined, in case we're trying to re-export a
21772177
// crate in Rust 2018+
21782178
let please_inline = self.attrs.lists(sym::doc).has_word(sym::inline);
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#![crate_name = "foo"]
2+
3+
pub trait FooTrait {}
4+
pub struct FooStruct;

src/test/rustdoc/issue-61592.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1-
pub mod foo {
2-
pub struct Foo;
3-
}
1+
// aux-build:issue-61592.rs
2+
3+
extern crate foo;
4+
5+
// @has issue_61592/index.html
6+
// @has - '//a[@href="#reexports"]' 'Re-exports'
7+
// @has - '//code' 'pub use foo::FooTrait as _;'
8+
// @!has - '//a[@href="trait._.html"]'
9+
pub use foo::FooTrait as _;
410

511
// @has issue_61592/index.html
6-
// @has - '//*[@href="#reexports"]' 'Re-exports'
7-
pub use foo::Foo as _;
12+
// @has - '//a[@href="#reexports"]' 'Re-exports'
13+
// @has - '//code' 'pub use foo::FooStruct as _;'
14+
// @!has - '//a[@href="struct._.html"]'
15+
pub use foo::FooStruct as _;

0 commit comments

Comments
 (0)