rust/src/test/compile-fail/box-static-bound.rs
Patrick Walton 9089cf2ec9 librustc: Forbid & pointers (other than &'static) inside @ boxes.
This makes custom borrowing implementations for custom smart pointers
sound.
2013-07-18 17:12:46 -07:00

11 lines
140 B
Rust

fn f<T>(x: T) -> @T {
@x //~ ERROR value may contain borrowed pointers
}
fn g<T:'static>(x: T) -> @T {
@x // ok
}
fn main() {}