rust/src/test/ui/static/static-region-bound.rs

13 lines
210 B
Rust
Raw Normal View History

2015-01-07 20:53:58 -06:00
#![feature(box_syntax)]
2017-08-13 03:46:49 -05:00
fn id<T>(x: T) -> T { x }
fn f<T:'static>(_: T) {}
fn main() {
let x: Box<_> = box 3;
f(x);
2017-08-13 03:46:49 -05:00
let x = &id(3); //~ ERROR borrowed value does not live long enough
f(x);
}