rust/src/test/run-pass/rcvr-borrowed-to-region.rs

34 lines
508 B
Rust
Raw Normal View History

// Note: impl on a slice
impl foo/& for &int {
fn get() -> int {
ret *self;
}
}
fn main() {
/*
let x = @mut 6;
let y = x.get();
assert y == 6;
*/
let x = @6;
let y = x.get();
#debug["y=%d", y];
assert y == 6;
let x = ~mut 6;
let y = x.get();
#debug["y=%d", y];
assert y == 6;
let x = ~6;
let y = x.get();
#debug["y=%d", y];
assert y == 6;
let x = &6;
let y = x.get();
#debug["y=%d", y];
assert y == 6;
}