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