]> git.proxmox.com Git - rustc.git/blame - src/test/rustdoc/issue-35169-2.rs
New upstream version 1.67.1+dfsg1
[rustc.git] / src / test / rustdoc / issue-35169-2.rs
CommitLineData
9e0c209e
SL
1use std::ops::Deref;
2use std::ops::DerefMut;
3
4pub struct Foo;
5pub struct Bar;
6
7impl 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) {}
041b39d2
XL
12 pub fn by_explicit_box(self: Box<Foo>) {}
13 pub fn by_explicit_self_box(self: Box<Self>) {}
9e0c209e
SL
14 pub fn static_foo() {}
15}
16
17impl Deref for Bar {
18 type Target = Foo;
19 fn deref(&self) -> &Foo { loop {} }
20}
21
22impl DerefMut for Bar {
23 fn deref_mut(&mut self) -> &mut Foo { loop {} }
24}
25
9e0c209e 26// @has issue_35169_2/struct.Bar.html
17df50a5 27// @has - '//*[@id="method.by_ref"]//h4[@class="code-header"]' 'fn by_ref(&self)'
9e0c209e 28// @has - '//*[@id="method.by_ref"]' 'fn by_ref(&self)'
17df50a5 29// @has - '//*[@id="method.by_explicit_ref"]//h4[@class="code-header"]' 'fn by_explicit_ref(self: &Foo)'
9e0c209e 30// @has - '//*[@id="method.by_explicit_ref"]' 'fn by_explicit_ref(self: &Foo)'
17df50a5 31// @has - '//*[@id="method.by_mut_ref"]//h4[@class="code-header"]' 'fn by_mut_ref(&mut self)'
9e0c209e 32// @has - '//*[@id="method.by_mut_ref"]' 'fn by_mut_ref(&mut self)'
17df50a5 33// @has - '//*[@id="method.by_explicit_mut_ref"]//h4[@class="code-header"]' 'fn by_explicit_mut_ref(self: &mut Foo)'
9e0c209e 34// @has - '//*[@id="method.by_explicit_mut_ref"]' 'fn by_explicit_mut_ref(self: &mut Foo)'
17df50a5 35// @!has - '//*[@id="method.by_explicit_box"]//h4[@class="code-header"]' 'fn by_explicit_box(self: Box<Foo>)'
041b39d2 36// @!has - '//*[@id="method.by_explicit_box"]' 'fn by_explicit_box(self: Box<Foo>)'
17df50a5 37// @!has - '//*[@id="method.by_explicit_self_box"]//h4[@class="code-header"]' 'fn by_explicit_self_box(self: Box<Self>)'
041b39d2 38// @!has - '//*[@id="method.by_explicit_self_box"]' 'fn by_explicit_self_box(self: Box<Self>)'
17df50a5 39// @!has - '//*[@id="method.static_foo"]//h4[@class="code-header"]' 'fn static_foo()'
9e0c209e 40// @!has - '//*[@id="method.static_foo"]' 'fn static_foo()'