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

13 lines
210 B
Rust
Raw Normal View History

2015-01-08 02:53:58 +00:00
#![feature(box_syntax)]
2017-08-13 08:46:49 +00: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 08:46:49 +00:00
let x = &id(3); //~ ERROR borrowed value does not live long enough
f(x);
}