rust/tests/ui/autoref-autoderef/autoderef-method-priority.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
315 B
Rust
Raw Normal View History

// run-pass
#![allow(non_camel_case_types)]
2013-10-23 03:49:18 -05:00
trait double {
fn double(self) -> usize;
}
impl double for usize {
fn double(self) -> usize { self }
2012-06-19 22:36:01 -05:00
}
impl double for Box<usize> {
fn double(self) -> usize { *self * 2 }
2012-06-19 22:36:01 -05:00
}
pub fn main() {
let x: Box<_> = Box::new(3);
assert_eq!(x.double(), 6);
2012-06-19 22:36:01 -05:00
}