1 use std::ops::{Deref, DerefMut};
7 fn mut_method(&mut self) -> T;
10 impl Method<i32> for Thing {
11 fn method(&self) -> i32 { 0 }
12 fn mut_method(&mut self) -> i32 { 0 }
15 impl Method<u32> for Thing {
16 fn method(&self) -> u32 { 0 }
17 fn mut_method(&mut self) -> u32 { 0 }
23 impl MethodRef<i32> for &Thing {
26 impl MethodRef<u32> for &Thing {
30 struct DerefsTo<T>(T);
31 impl<T> Deref for DerefsTo<T> {
33 fn deref(&self) -> &Self::Target {
37 impl<T> DerefMut for DerefsTo<T> {
38 fn deref_mut(&mut self) -> &mut Self::Target {
44 let mut ref_thing = &Thing;
46 //~^ ERROR type annotations needed
47 //~| ERROR type annotations needed
48 ref_thing.by_self(); //~ ERROR type annotations needed
50 let mut mut_thing = &mut Thing;
51 mut_thing.method(); //~ ERROR type annotations needed
52 mut_thing.mut_method(); //~ ERROR type annotations needed
53 mut_thing.by_self(); //~ ERROR type annotations needed
55 let mut deref_to = &DerefsTo(Thing);
56 deref_to.method(); //~ ERROR type annotations needed
57 deref_to.mut_method(); //~ ERROR type annotations needed
58 deref_to.by_self(); //~ ERROR type annotations needed
60 let mut deref_deref_to = &DerefsTo(DerefsTo(Thing));
61 deref_deref_to.method(); //~ ERROR type annotations needed
62 deref_deref_to.mut_method(); //~ ERROR type annotations needed
63 deref_deref_to.by_self(); //~ ERROR type annotations needed