]> git.lizzy.rs Git - rust.git/blob - tests/rustdoc/deref-mut-methods.rs
Rollup merge of #107194 - xfix:remove-slice-internals-dependency-in-rustc-ast, r...
[rust.git] / tests / rustdoc / deref-mut-methods.rs
1 #![crate_name = "foo"]
2
3 use std::ops;
4
5 pub struct Foo;
6
7 impl Foo {
8     pub fn foo(&mut self) {}
9 }
10
11 // @has foo/struct.Bar.html
12 // @has - '//*[@class="sidebar-elems"]//*[@class="block"]//a[@href="#method.foo"]' 'foo'
13 pub struct Bar {
14     foo: Foo,
15 }
16
17 impl ops::Deref for Bar {
18     type Target = Foo;
19
20     fn deref(&self) -> &Foo {
21         &self.foo
22     }
23 }
24
25 impl ops::DerefMut for Bar {
26     fn deref_mut(&mut self) -> &mut Foo {
27         &mut self.foo
28     }
29 }