summaryrefslogtreecommitdiffstats
path: root/src/test/ui/autoref-autoderef/autoref-intermediate-types-issue-3585.rs
blob: 3bdc248ff0f7f1dea34472e624358c7931a95db7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// run-pass

trait Foo {
    fn foo(&self) -> String;
}

impl<T:Foo> Foo for Box<T> {
    fn foo(&self) -> String {
        format!("box {}", (**self).foo())
    }
}

impl Foo for usize {
    fn foo(&self) -> String {
        format!("{}", *self)
    }
}

pub fn main() {
    let x: Box<_> = Box::new(3);
    assert_eq!(x.foo(), "box 3".to_string());
}