]> git.proxmox.com Git - rustc.git/blob - src/test/run-pass/autoref-autoderef/autoderef-method-priority.rs
New upstream version 1.37.0+dfsg1
[rustc.git] / src / test / run-pass / autoref-autoderef / autoderef-method-priority.rs
1 // run-pass
2 #![allow(non_camel_case_types)]
3 #![feature(box_syntax)]
4
5 trait double {
6 fn double(self) -> usize;
7 }
8
9 impl double for usize {
10 fn double(self) -> usize { self }
11 }
12
13 impl double for Box<usize> {
14 fn double(self) -> usize { *self * 2 }
15 }
16
17 pub fn main() {
18 let x: Box<_> = box 3;
19 assert_eq!(x.double(), 6);
20 }