about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustdoc/html/render/mod.rs13
-rw-r--r--src/test/rustdoc/recursive-deref-sidebar.rs22
-rw-r--r--src/test/rustdoc/recursive-deref.rs22
3 files changed, 44 insertions, 13 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index 499f33f14f5..62d3c142eeb 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -1997,19 +1997,6 @@ fn sidebar_deref_methods(cx: &Context<'_>, out: &mut Buffer, impl_: &Impl, v: &V
                 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)
-                {
-                    sidebar_deref_methods(cx, out, target_deref_impl, target_impls);
-                }
-            }
-        }
     }
 }
 
diff --git a/src/test/rustdoc/recursive-deref-sidebar.rs b/src/test/rustdoc/recursive-deref-sidebar.rs
new file mode 100644
index 00000000000..fcb636ade8f
--- /dev/null
+++ b/src/test/rustdoc/recursive-deref-sidebar.rs
@@ -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 recursive_deref_sidebar/struct.A.html '//div[@class="sidebar-links"]' 'foo_b'
+impl Deref for A {
+    type Target = B;
+    fn deref(&self) -> &B { todo!() }
+}
+
+// @!has recursive_deref_sidebar/struct.A.html '//div[@class="sidebar-links"]' 'foo_c'
+impl Deref for B {
+    type Target = C;
+    fn deref(&self) -> &C { todo!() }
+}
diff --git a/src/test/rustdoc/recursive-deref.rs b/src/test/rustdoc/recursive-deref.rs
new file mode 100644
index 00000000000..91db01177c5
--- /dev/null
+++ b/src/test/rustdoc/recursive-deref.rs
@@ -0,0 +1,22 @@
+use std::ops::Deref;
+
+pub struct A;
+pub struct B;
+
+// @has recursive_deref/struct.A.html '//code' 'impl Deref for A'
+impl Deref for A {
+    type Target = B;
+
+    fn deref(&self) -> &Self::Target {
+        panic!()
+    }
+}
+
+// @has recursive_deref/struct.B.html '//code' 'impl Deref for B'
+impl Deref for B {
+    type Target = A;
+
+    fn deref(&self) -> &Self::Target {
+        panic!()
+    }
+}