Skip to content

Commit 0aaefff

Browse files
committed
Account for more cases
1 parent bd7caf4 commit 0aaefff

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

Diff for: src/librustdoc/clean/inline.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//! Support for inlining external documentation into the current AST.
22
3-
use std::collections::VecDeque;
43
use std::iter::once;
54
use std::sync::Arc;
65

@@ -425,15 +424,16 @@ crate fn build_impl(
425424
}
426425

427426
// Return if the trait itself or any types of the generic parameters are doc(hidden).
428-
let mut deque: VecDeque<&Type> = trait_.iter().collect();
429-
while let Some(ty) = deque.pop_back() {
427+
let mut stack: Vec<&Type> = trait_.iter().collect();
428+
stack.push(&for_);
429+
while let Some(ty) = stack.pop() {
430430
if let Some(did) = ty.def_id() {
431431
if cx.tcx.get_attrs(did).lists(sym::doc).has_word(sym::hidden) {
432432
return;
433433
}
434434
}
435435
if let Some(generics) = ty.generics() {
436-
deque.extend(generics);
436+
stack.extend(generics);
437437
}
438438
}
439439

Diff for: src/test/rustdoc/auxiliary/cross-crate-hidden.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
#[doc(hidden)]
22
pub enum HiddenType {}
3+
4+
#[doc(hidden)]
5+
pub trait HiddenTrait {}

Diff for: src/test/rustdoc/cross-crate-hidden.rs

+16-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// aux-build:cross-crate-hidden.rs
55
extern crate cross_crate_hidden;
66

7-
pub use ::cross_crate_hidden::HiddenType; // OK, not re-exported
7+
pub use ::cross_crate_hidden::{HiddenType, HiddenTrait}; // OK, not re-exported
88

99
pub enum MyLibType {}
1010

@@ -15,9 +15,21 @@ impl From<HiddenType> for MyLibType {
1515
}
1616
}
1717

18-
// @!has foo/enum.MyLibType.html '//*[@id="impl-From%3COption%3COption%3COption%3COption%3CHiddenType%3E%3E%3E%3E%3E"]' 'impl From<Option<Option<Option<Option<HiddenType>>>>> for MyLibType'
19-
impl From<Option<Option<Option<Option<HiddenType>>>>> for MyLibType {
20-
fn from(it: Option<Option<Option<Option<HiddenType>>>>) -> MyLibType {
18+
pub struct T<T>(T);
19+
20+
// @!has foo/enum.MyLibType.html '//*[@id="impl-From%3CT%3CT%3CT%3CT%3CHiddenType%3E%3E%3E%3E%3E"]' 'impl From<T<T<T<T<HiddenType>>>>> for MyLibType'
21+
impl From<T<T<T<T<HiddenType>>>>> for MyLibType {
22+
fn from(it: T<T<T<T<HiddenType>>>>) -> MyLibType {
2123
todo!()
2224
}
2325
}
26+
27+
// @!has foo/enum.MyLibType.html '//*[@id="impl-HiddenTrait"]' 'impl HiddenTrait for MyLibType'
28+
impl HiddenTrait for MyLibType {}
29+
30+
// @!has foo/struct.T.html '//*[@id="impl-From%3CMyLibType%3E"]' 'impl From<MyLibType> for T<T<T<T<HiddenType>>>>'
31+
impl From<MyLibType> for T<T<T<T<HiddenType>>>> {
32+
fn from(it: MyLibType) -> T<T<T<T<HiddenType>>>> {
33+
match it {}
34+
}
35+
}

0 commit comments

Comments
 (0)