2021-06-15 04:47:17 -05:00
|
|
|
use std::ops::Deref;
|
|
|
|
|
2021-10-22 15:39:33 -05:00
|
|
|
// Cyclic deref with the parent (which is not the top parent).
|
2021-06-15 04:47:17 -05:00
|
|
|
pub struct A;
|
|
|
|
pub struct B;
|
2021-10-22 15:39:33 -05:00
|
|
|
pub struct C;
|
2021-06-15 04:47:17 -05:00
|
|
|
|
2021-10-23 15:57:02 -05:00
|
|
|
impl C {
|
|
|
|
pub fn c(&self) {}
|
|
|
|
}
|
|
|
|
|
2022-09-25 15:52:26 -05:00
|
|
|
// @has recursive_deref/struct.A.html '//h3[@class="code-header"]' 'impl Deref for A'
|
2021-10-23 15:57:02 -05:00
|
|
|
// @has '-' '//*[@class="impl-items"]//*[@id="method.c"]' 'pub fn c(&self)'
|
2021-06-15 04:47:17 -05:00
|
|
|
impl Deref for A {
|
|
|
|
type Target = B;
|
|
|
|
|
|
|
|
fn deref(&self) -> &Self::Target {
|
|
|
|
panic!()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-25 15:52:26 -05:00
|
|
|
// @has recursive_deref/struct.B.html '//h3[@class="code-header"]' 'impl Deref for B'
|
2021-10-23 15:57:02 -05:00
|
|
|
// @has '-' '//*[@class="impl-items"]//*[@id="method.c"]' 'pub fn c(&self)'
|
2021-06-15 04:47:17 -05:00
|
|
|
impl Deref for B {
|
2021-10-22 15:39:33 -05:00
|
|
|
type Target = C;
|
|
|
|
|
|
|
|
fn deref(&self) -> &Self::Target {
|
|
|
|
panic!()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-25 15:52:26 -05:00
|
|
|
// @has recursive_deref/struct.C.html '//h3[@class="code-header"]' 'impl Deref for C'
|
2021-10-22 15:39:33 -05:00
|
|
|
impl Deref for C {
|
|
|
|
type Target = B;
|
|
|
|
|
|
|
|
fn deref(&self) -> &Self::Target {
|
|
|
|
panic!()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Cyclic deref with the grand-parent (which is not the top parent).
|
|
|
|
pub struct D;
|
|
|
|
pub struct E;
|
|
|
|
pub struct F;
|
|
|
|
pub struct G;
|
|
|
|
|
2021-10-23 15:57:02 -05:00
|
|
|
impl G {
|
|
|
|
// There is no "self" parameter so it shouldn't be listed!
|
|
|
|
pub fn g() {}
|
|
|
|
}
|
|
|
|
|
2022-09-25 15:52:26 -05:00
|
|
|
// @has recursive_deref/struct.D.html '//h3[@class="code-header"]' 'impl Deref for D'
|
2021-10-30 09:30:14 -05:00
|
|
|
// We also check that `G::g` method isn't rendered because there is no `self` argument.
|
2022-08-12 23:56:16 -05:00
|
|
|
// @!has '-' '//*[@id="deref-methods-G"]' ''
|
2021-10-22 15:39:33 -05:00
|
|
|
impl Deref for D {
|
|
|
|
type Target = E;
|
|
|
|
|
|
|
|
fn deref(&self) -> &Self::Target {
|
|
|
|
panic!()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-25 15:52:26 -05:00
|
|
|
// @has recursive_deref/struct.E.html '//h3[@class="code-header"]' 'impl Deref for E'
|
2021-10-30 09:30:14 -05:00
|
|
|
// We also check that `G::g` method isn't rendered because there is no `self` argument.
|
2022-08-12 23:56:16 -05:00
|
|
|
// @!has '-' '//*[@id="deref-methods-G"]' ''
|
2021-10-22 15:39:33 -05:00
|
|
|
impl Deref for E {
|
|
|
|
type Target = F;
|
|
|
|
|
|
|
|
fn deref(&self) -> &Self::Target {
|
|
|
|
panic!()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-25 15:52:26 -05:00
|
|
|
// @has recursive_deref/struct.F.html '//h3[@class="code-header"]' 'impl Deref for F'
|
2021-10-30 09:30:14 -05:00
|
|
|
// We also check that `G::g` method isn't rendered because there is no `self` argument.
|
2022-08-12 23:56:16 -05:00
|
|
|
// @!has '-' '//*[@id="deref-methods-G"]' ''
|
2021-10-22 15:39:33 -05:00
|
|
|
impl Deref for F {
|
|
|
|
type Target = G;
|
|
|
|
|
|
|
|
fn deref(&self) -> &Self::Target {
|
|
|
|
panic!()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-25 15:52:26 -05:00
|
|
|
// @has recursive_deref/struct.G.html '//h3[@class="code-header"]' 'impl Deref for G'
|
2021-10-22 15:39:33 -05:00
|
|
|
impl Deref for G {
|
|
|
|
type Target = E;
|
|
|
|
|
|
|
|
fn deref(&self) -> &Self::Target {
|
|
|
|
panic!()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Cyclic deref with top parent.
|
|
|
|
pub struct H;
|
|
|
|
pub struct I;
|
|
|
|
|
2021-10-23 15:57:02 -05:00
|
|
|
impl I {
|
|
|
|
// There is no "self" parameter so it shouldn't be listed!
|
|
|
|
pub fn i() {}
|
|
|
|
}
|
|
|
|
|
2022-09-25 15:52:26 -05:00
|
|
|
// @has recursive_deref/struct.H.html '//h3[@class="code-header"]' 'impl Deref for H'
|
2022-08-12 23:56:16 -05:00
|
|
|
// @!has '-' '//*[@id="deref-methods-I"]' ''
|
2021-10-22 15:39:33 -05:00
|
|
|
impl Deref for H {
|
|
|
|
type Target = I;
|
|
|
|
|
|
|
|
fn deref(&self) -> &Self::Target {
|
|
|
|
panic!()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-09-25 15:52:26 -05:00
|
|
|
// @has recursive_deref/struct.I.html '//h3[@class="code-header"]' 'impl Deref for I'
|
2021-10-22 15:39:33 -05:00
|
|
|
impl Deref for I {
|
|
|
|
type Target = H;
|
2021-06-15 04:47:17 -05:00
|
|
|
|
|
|
|
fn deref(&self) -> &Self::Target {
|
|
|
|
panic!()
|
|
|
|
}
|
|
|
|
}
|