2 // Ensure that a user-defined type admits multiple inherent methods
3 // with the same name, which can be called on values that have a
4 // precise enough type to allow distinguishing between the methods.
10 fn bar(&self) -> i32 { self.0 as i32 }
14 fn bar(&self) -> i32 { -(self.0 as i32) }
18 let foo_u = Foo::<usize>(5);
19 assert_eq!(foo_u.bar(), 5);
21 let foo_i = Foo::<isize>(3);
22 assert_eq!(foo_i.bar(), -3);