mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 00:03:43 +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() {
|
|
}
|