mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 18:53:39 +00:00
15 lines
273 B
Rust
15 lines
273 B
Rust
// Test lifetimes are linked properly when we take reference
|
|
// to interior.
|
|
|
|
fn id<T>(x: T) -> T { x }
|
|
|
|
struct Foo(isize);
|
|
|
|
fn foo<'a>() -> &'a isize {
|
|
let &Foo(ref x) = &id(Foo(3));
|
|
x //~ ERROR cannot return value referencing temporary value
|
|
}
|
|
|
|
pub fn main() {
|
|
}
|