Auto merge of #86322 - trinity-1686a:rustdoc-fix-overflow-recursive-deref, r=jyn514
fix rustdoc stack overflow on mutually recursive Deref fix #85095 fix #85037
This commit is contained in:
commit
966361fe49
3 changed files with 44 additions and 13 deletions
22
src/test/rustdoc/recursive-deref-sidebar.rs
Normal file
22
src/test/rustdoc/recursive-deref-sidebar.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 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!() }
|
||||
}
|
||||
22
src/test/rustdoc/recursive-deref.rs
Normal file
22
src/test/rustdoc/recursive-deref.rs
Normal file
|
|
@ -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!()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue