mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
parent
aee50f417f
commit
2d76d44eae
@ -1960,19 +1960,13 @@ fn sidebar_assoc_items(cx: &Context<'_>, out: &mut Buffer, it: &clean::Item) {
|
||||
.filter(|i| i.inner_impl().trait_.is_some())
|
||||
.find(|i| i.inner_impl().trait_.def_id_full(cache) == cx.cache.deref_trait_did)
|
||||
{
|
||||
sidebar_deref_methods(cx, out, impl_, v, FxHashSet::default());
|
||||
sidebar_deref_methods(cx, out, impl_, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn sidebar_deref_methods(
|
||||
cx: &Context<'_>,
|
||||
out: &mut Buffer,
|
||||
impl_: &Impl,
|
||||
v: &Vec<Impl>,
|
||||
mut already_seen: FxHashSet<DefId>,
|
||||
) {
|
||||
fn sidebar_deref_methods(cx: &Context<'_>, out: &mut Buffer, impl_: &Impl, v: &Vec<Impl>) {
|
||||
let c = cx.cache();
|
||||
|
||||
debug!("found Deref: {:?}", impl_);
|
||||
@ -2029,27 +2023,6 @@ fn sidebar_deref_methods(
|
||||
out.push_str("</div>");
|
||||
}
|
||||
}
|
||||
|
||||
// Recurse into any further impls that might exist for `target`
|
||||
if let Some(target_did) = target.def_id_full(c) {
|
||||
if let Some(target_impls) = c.impls.get(&target_did) {
|
||||
if let Some(target_deref_impl) = target_impls
|
||||
.iter()
|
||||
.filter(|i| i.inner_impl().trait_.is_some())
|
||||
.find(|i| i.inner_impl().trait_.def_id_full(c) == c.deref_trait_did)
|
||||
{
|
||||
if already_seen.insert(target_did.clone()) {
|
||||
sidebar_deref_methods(
|
||||
cx,
|
||||
out,
|
||||
target_deref_impl,
|
||||
target_impls,
|
||||
already_seen,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
22
src/test/rustdoc/issue-85037.rs
Normal file
22
src/test/rustdoc/issue-85037.rs
Normal file
@ -0,0 +1,22 @@
|
||||
use std::ops::Deref;
|
||||
|
||||
pub struct A {}
|
||||
impl A { pub fn foo_a(&self) {} }
|
||||
|
||||
pub struct B {}
|
||||
impl B { pub fn foo_b(&self) {} }
|
||||
|
||||
pub struct C {}
|
||||
impl C { pub fn foo_c(&self) {} }
|
||||
|
||||
// @has issue_85037/struct.A.html '//div[@class="sidebar-links"]' 'foo_b'
|
||||
impl Deref for A {
|
||||
type Target = B;
|
||||
fn deref(&self) -> &B { todo!() }
|
||||
}
|
||||
|
||||
// @!has issue_85037/struct.A.html '//div[@class="sidebar-links"]' 'foo_c'
|
||||
impl Deref for B {
|
||||
type Target = C;
|
||||
fn deref(&self) -> &C { todo!() }
|
||||
}
|
Loading…
Reference in New Issue
Block a user