summaryrefslogtreecommitdiffstats
path: root/src/test/ui/autoref-autoderef/autoderef-method-twice-but-not-thrice.rs
blob: 3657e61d42534a99253362e9bfa559045e057dda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// run-pass
#![allow(non_camel_case_types)]

trait double {
    fn double(self: Box<Self>) -> usize;
}

impl double for Box<usize> {
    fn double(self: Box<Box<usize>>) -> usize { **self * 2 }
}

pub fn main() {
    let x: Box<Box<Box<Box<Box<_>>>>> = Box::new(Box::new(Box::new(Box::new(Box::new(3)))));
    assert_eq!(x.double(), 6);
}