summaryrefslogtreecommitdiffstats
path: root/tests/ui/autoref-autoderef/autoderef-method-on-trait.rs
blob: af747cc76e9a062700280cb4a75107a767277966 (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 usize {
    fn double(self: Box<usize>) -> usize { *self * 2 }
}

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