mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
13 lines
191 B
Rust
13 lines
191 B
Rust
fn id<T>(x: T) -> T { x }
|
|
|
|
fn f<T:'static>(_: T) {}
|
|
|
|
fn main() {
|
|
|
|
let x: Box<_> = Box::new(3);
|
|
f(x);
|
|
|
|
let x = &id(3); //~ ERROR temporary value dropped while borrowed
|
|
f(x);
|
|
}
|