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

13 lines
208 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);
let x = &id(3); //~ ERROR temporary value dropped while borrowed
f(x);
}