1 // run-pass 2 #![allow(non_camel_case_types)] 3 4 trait double { double(self) -> usize5 fn double(self) -> usize; 6 } 7 8 impl double for usize { double(self) -> usize9 fn double(self) -> usize { self } 10 } 11 12 impl double for Box<usize> { double(self) -> usize13 fn double(self) -> usize { *self * 2 } 14 } 15 main()16pub fn main() { 17 let x: Box<_> = Box::new(3); 18 assert_eq!(x.double(), 6); 19 } 20