]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc/issue-35169.rs
Auto merge of #42480 - eddyb:issue-42463, r=nikomatsakis
[rust.git] / src / test / rustdoc / issue-35169.rs
1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 use std::ops::Deref;
12
13 pub struct Foo;
14 pub struct Bar;
15
16 impl Foo {
17     pub fn by_ref(&self) {}
18     pub fn by_explicit_ref(self: &Foo) {}
19     pub fn by_mut_ref(&mut self) {}
20     pub fn by_explicit_mut_ref(self: &mut Foo) {}
21     pub fn by_explicit_box(self: Box<Foo>) {}
22     pub fn by_explicit_self_box(self: Box<Self>) {}
23     pub fn static_foo() {}
24 }
25
26 impl Deref for Bar {
27     type Target = Foo;
28     fn deref(&self) -> &Foo { loop {} }
29 }
30
31 // @has issue_35169/Bar.t.html
32 // @has issue_35169/struct.Bar.html
33 // @has - '//*[@id="by_ref.v"]' 'fn by_ref(&self)'
34 // @has - '//*[@id="method.by_ref"]' 'fn by_ref(&self)'
35 // @has - '//*[@id="by_explicit_ref.v"]' 'fn by_explicit_ref(self: &Foo)'
36 // @has - '//*[@id="method.by_explicit_ref"]' 'fn by_explicit_ref(self: &Foo)'
37 // @!has - '//*[@id="by_mut_ref.v"]' 'fn by_mut_ref(&mut self)'
38 // @!has - '//*[@id="method.by_mut_ref"]' 'fn by_mut_ref(&mut self)'
39 // @!has - '//*[@id="by_explicit_mut_ref.v"]' 'fn by_explicit_mut_ref(self: &mut Foo)'
40 // @!has - '//*[@id="method.by_explicit_mut_ref"]' 'fn by_explicit_mut_ref(self: &mut Foo)'
41 // @!has - '//*[@id="by_explicit_box.v"]' 'fn by_explicit_box(self: Box<Foo>)'
42 // @!has - '//*[@id="method.by_explicit_box"]' 'fn by_explicit_box(self: Box<Foo>)'
43 // @!has - '//*[@id="by_explicit_self_box.v"]' 'fn by_explicit_self_box(self: Box<Self>)'
44 // @!has - '//*[@id="method.by_explicit_self_box"]' 'fn by_explicit_self_box(self: Box<Self>)'
45 // @!has - '//*[@id="static_foo.v"]' 'fn static_foo()'
46 // @!has - '//*[@id="method.static_foo"]' 'fn static_foo()'