rust/src/test/run-fail/borrowck-wg-fail-object-arg.rs
2013-08-17 08:42:35 -07:00

23 lines
301 B
Rust

// error-pattern:borrowed
trait Foo {
fn foo(&self, @mut int);
}
impl Foo for int {
fn foo(&self, x: @mut int) {
*x += *self;
}
}
fn it_takes_two(_f: &Foo, _g: &mut Foo) {
}
fn main() {
let x = @mut 3_i;
let y = x as @mut Foo;
let z = y;
it_takes_two(y, z);
}