rust/src/test/run-pass/explicit-self-objects-simple.rs

22 lines
202 B
Rust
Raw Normal View History

trait Foo {
fn f(&self);
}
struct S {
x: int
}
impl S : Foo {
fn f(&self) {
assert self.x == 3;
}
}
fn main() {
let x = @S { x: 3 };
let y = x as @Foo;
y.f();
}