]> git.lizzy.rs Git - rust.git/blob - tests/rustdoc/issue-35169-2.rs
Rollup merge of #107819 - clubby789:x-py-root, r=jyn514
[rust.git] / tests / rustdoc / issue-35169-2.rs
1 use std::ops::Deref;
2 use std::ops::DerefMut;
3
4 pub struct Foo;
5 pub struct Bar;
6
7 impl Foo {
8     pub fn by_ref(&self) {}
9     pub fn by_explicit_ref(self: &Foo) {}
10     pub fn by_mut_ref(&mut self) {}
11     pub fn by_explicit_mut_ref(self: &mut Foo) {}
12     pub fn by_explicit_box(self: Box<Foo>) {}
13     pub fn by_explicit_self_box(self: Box<Self>) {}
14     pub fn static_foo() {}
15 }
16
17 impl Deref for Bar {
18     type Target = Foo;
19     fn deref(&self) -> &Foo { loop {} }
20 }
21
22 impl DerefMut for Bar {
23     fn deref_mut(&mut self) -> &mut Foo { loop {} }
24 }
25
26 // @has issue_35169_2/struct.Bar.html
27 // @has - '//*[@id="method.by_ref"]//h4[@class="code-header"]' 'fn by_ref(&self)'
28 // @has - '//*[@id="method.by_ref"]' 'fn by_ref(&self)'
29 // @has - '//*[@id="method.by_explicit_ref"]//h4[@class="code-header"]' 'fn by_explicit_ref(self: &Foo)'
30 // @has - '//*[@id="method.by_explicit_ref"]' 'fn by_explicit_ref(self: &Foo)'
31 // @has - '//*[@id="method.by_mut_ref"]//h4[@class="code-header"]' 'fn by_mut_ref(&mut self)'
32 // @has - '//*[@id="method.by_mut_ref"]' 'fn by_mut_ref(&mut self)'
33 // @has - '//*[@id="method.by_explicit_mut_ref"]//h4[@class="code-header"]' 'fn by_explicit_mut_ref(self: &mut Foo)'
34 // @has - '//*[@id="method.by_explicit_mut_ref"]' 'fn by_explicit_mut_ref(self: &mut Foo)'
35 // @!has - '//*[@id="method.by_explicit_box"]//h4[@class="code-header"]' 'fn by_explicit_box(self: Box<Foo>)'
36 // @!has - '//*[@id="method.by_explicit_box"]' 'fn by_explicit_box(self: Box<Foo>)'
37 // @!has - '//*[@id="method.by_explicit_self_box"]//h4[@class="code-header"]' 'fn by_explicit_self_box(self: Box<Self>)'
38 // @!has - '//*[@id="method.by_explicit_self_box"]' 'fn by_explicit_self_box(self: Box<Self>)'
39 // @!has - '//*[@id="method.static_foo"]//h4[@class="code-header"]' 'fn static_foo()'
40 // @!has - '//*[@id="method.static_foo"]' 'fn static_foo()'