rust/src/test/ui/static/static-region-bound.rs
2019-04-22 08:40:08 +01:00

12 lines
208 B
Rust

#![feature(box_syntax)]
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);
}