2014-01-17 07:03:43 -06:00
|
|
|
// Test lifetimes are linked properly when we take reference
|
|
|
|
// to interior.
|
|
|
|
|
2017-08-13 03:46:49 -05:00
|
|
|
fn id<T>(x: T) -> T { x }
|
|
|
|
|
2015-01-08 04:54:35 -06:00
|
|
|
struct Foo(isize);
|
2014-01-17 07:03:43 -06:00
|
|
|
|
2015-01-08 04:54:35 -06:00
|
|
|
fn foo<'a>() -> &'a isize {
|
2019-04-22 02:40:08 -05:00
|
|
|
let &Foo(ref x) = &id(Foo(3));
|
|
|
|
x //~ ERROR cannot return value referencing temporary value
|
2014-01-17 07:03:43 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn main() {
|
|
|
|
}
|