Skip to content

Commit 2d76d44

Browse files
committed
remove code for recursive Deref in sidebar
fix #85037
1 parent aee50f4 commit 2d76d44

File tree

2 files changed

+24
-29
lines changed

2 files changed

+24
-29
lines changed

src/librustdoc/html/render/mod.rs

+2-29
Original file line numberDiff line numberDiff line change
@@ -1960,19 +1960,13 @@ fn sidebar_assoc_items(cx: &Context<'_>, out: &mut Buffer, it: &clean::Item) {
19601960
.filter(|i| i.inner_impl().trait_.is_some())
19611961
.find(|i| i.inner_impl().trait_.def_id_full(cache) == cx.cache.deref_trait_did)
19621962
{
1963-
sidebar_deref_methods(cx, out, impl_, v, FxHashSet::default());
1963+
sidebar_deref_methods(cx, out, impl_, v);
19641964
}
19651965
}
19661966
}
19671967
}
19681968

1969-
fn sidebar_deref_methods(
1970-
cx: &Context<'_>,
1971-
out: &mut Buffer,
1972-
impl_: &Impl,
1973-
v: &Vec<Impl>,
1974-
mut already_seen: FxHashSet<DefId>,
1975-
) {
1969+
fn sidebar_deref_methods(cx: &Context<'_>, out: &mut Buffer, impl_: &Impl, v: &Vec<Impl>) {
19761970
let c = cx.cache();
19771971

19781972
debug!("found Deref: {:?}", impl_);
@@ -2029,27 +2023,6 @@ fn sidebar_deref_methods(
20292023
out.push_str("</div>");
20302024
}
20312025
}
2032-
2033-
// Recurse into any further impls that might exist for `target`
2034-
if let Some(target_did) = target.def_id_full(c) {
2035-
if let Some(target_impls) = c.impls.get(&target_did) {
2036-
if let Some(target_deref_impl) = target_impls
2037-
.iter()
2038-
.filter(|i| i.inner_impl().trait_.is_some())
2039-
.find(|i| i.inner_impl().trait_.def_id_full(c) == c.deref_trait_did)
2040-
{
2041-
if already_seen.insert(target_did.clone()) {
2042-
sidebar_deref_methods(
2043-
cx,
2044-
out,
2045-
target_deref_impl,
2046-
target_impls,
2047-
already_seen,
2048-
);
2049-
}
2050-
}
2051-
}
2052-
}
20532026
}
20542027
}
20552028

src/test/rustdoc/issue-85037.rs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
use std::ops::Deref;
2+
3+
pub struct A {}
4+
impl A { pub fn foo_a(&self) {} }
5+
6+
pub struct B {}
7+
impl B { pub fn foo_b(&self) {} }
8+
9+
pub struct C {}
10+
impl C { pub fn foo_c(&self) {} }
11+
12+
// @has issue_85037/struct.A.html '//div[@class="sidebar-links"]' 'foo_b'
13+
impl Deref for A {
14+
type Target = B;
15+
fn deref(&self) -> &B { todo!() }
16+
}
17+
18+
// @!has issue_85037/struct.A.html '//div[@class="sidebar-links"]' 'foo_c'
19+
impl Deref for B {
20+
type Target = C;
21+
fn deref(&self) -> &C { todo!() }
22+
}

0 commit comments

Comments
 (0)