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.
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.
12 use std::ops::DerefMut;
18 pub fn by_ref(&self) {}
19 pub fn by_explicit_ref(self: &Foo) {}
20 pub fn by_mut_ref(&mut self) {}
21 pub fn by_explicit_mut_ref(self: &mut Foo) {}
22 pub fn by_explicit_box(self: Box<Foo>) {}
23 pub fn by_explicit_self_box(self: Box<Self>) {}
24 pub fn static_foo() {}
29 fn deref(&self) -> &Foo { loop {} }
32 impl DerefMut for Bar {
33 fn deref_mut(&mut self) -> &mut Foo { loop {} }
36 // @has issue_35169_2/Bar.t.html
37 // @has issue_35169_2/struct.Bar.html
38 // @has - '//*[@id="by_ref.v"]' 'fn by_ref(&self)'
39 // @has - '//*[@id="method.by_ref"]' 'fn by_ref(&self)'
40 // @has - '//*[@id="by_explicit_ref.v"]' 'fn by_explicit_ref(self: &Foo)'
41 // @has - '//*[@id="method.by_explicit_ref"]' 'fn by_explicit_ref(self: &Foo)'
42 // @has - '//*[@id="by_mut_ref.v"]' 'fn by_mut_ref(&mut self)'
43 // @has - '//*[@id="method.by_mut_ref"]' 'fn by_mut_ref(&mut self)'
44 // @has - '//*[@id="by_explicit_mut_ref.v"]' 'fn by_explicit_mut_ref(self: &mut Foo)'
45 // @has - '//*[@id="method.by_explicit_mut_ref"]' 'fn by_explicit_mut_ref(self: &mut Foo)'
46 // @!has - '//*[@id="by_explicit_box.v"]' 'fn by_explicit_box(self: Box<Foo>)'
47 // @!has - '//*[@id="method.by_explicit_box"]' 'fn by_explicit_box(self: Box<Foo>)'
48 // @!has - '//*[@id="by_explicit_self_box.v"]' 'fn by_explicit_self_box(self: Box<Self>)'
49 // @!has - '//*[@id="method.by_explicit_self_box"]' 'fn by_explicit_self_box(self: Box<Self>)'
50 // @!has - '//*[@id="static_foo.v"]' 'fn static_foo()'
51 // @!has - '//*[@id="method.static_foo"]' 'fn static_foo()'