summary refs log tree commit diff
path: root/src/test/run-pass/self/explicit-self-objects-uniq.rs
blob: f95686cf11234212ce5c587541679b89d27e6ca3 (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
#![feature(box_syntax)]

trait Foo {
    fn f(self: Box<Self>);
}

struct S {
    x: isize
}

impl Foo for S {
    fn f(self: Box<S>) {
        assert_eq!(self.x, 3);
    }
}

pub fn main() {
    let x = box S { x: 3 };
    let y = x as Box<Foo>;
    y.f();
}