]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-26205.rs
Rollup merge of #100168 - WaffleLapkin:improve_diagnostics_for_missing_type_in_a_cons...
[rust.git] / src / test / ui / issues / issue-26205.rs
1 // check-pass
2 #![allow(dead_code)]
3 use std::ops::{Deref, DerefMut};
4
5 struct Foo;
6
7 impl Foo {
8     fn foo_mut(&mut self) {}
9 }
10
11 struct Bar(Foo);
12
13 impl Deref for Bar {
14     type Target = Foo;
15
16     fn deref(&self) -> &Foo {
17         &self.0
18     }
19 }
20
21 impl DerefMut for Bar {
22     fn deref_mut(&mut self) -> &mut Foo {
23         &mut self.0
24     }
25 }
26
27 fn test(mut bar: Box<Bar>) {
28     bar.foo_mut();
29 }
30
31 fn main() {}