rust/src/test/run-pass/autoderef-method-priority.rs
2012-07-17 15:46:43 -07:00

17 lines
250 B
Rust

trait double {
fn double() -> uint;
}
impl methods of double for uint {
fn double() -> uint { self }
}
impl methods of double for @uint {
fn double() -> uint { *self * 2u }
}
fn main() {
let x = @3u;
assert x.double() == 6u;
}