3 use std::ops::DerefMut;
9 fn deref(&self) -> &Self::Target {
15 fn deref(&self) -> &Self::Target {
21 fn deref(&self) -> &Self::Target {
25 impl DerefMut for Bar{
26 fn deref_mut(&mut self) -> &mut Self::Target {
30 impl DerefMut for Foo {
31 fn deref_mut(&mut self) -> &mut Self::Target {
35 impl DerefMut for Emm {
36 fn deref_mut(&mut self) -> &mut Self::Target {
41 // Suggest dereference with arbitrary mutability
42 let a = Emm(Foo(Bar(0)));
43 let _: *const u8 = &a; //~ ERROR mismatched types
45 let mut a = Emm(Foo(Bar(0)));
46 let _: *mut u8 = &a; //~ ERROR mismatched types
48 let a = Emm(Foo(Bar(0)));
49 let _: *const u8 = &mut a; //~ ERROR mismatched types
51 let mut a = Emm(Foo(Bar(0)));
52 let _: *mut u8 = &mut a; //~ ERROR mismatched types