rust/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.stderr

34 lines
1.2 KiB
Plaintext
Raw Normal View History

2018-08-08 07:28:26 -05:00
error[E0597]: borrowed value does not live long enough
2018-12-25 09:56:47 -06:00
--> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:14:20
2018-08-08 07:28:26 -05:00
|
LL | let testValue = &id(Test);
| ^^^^^^^^ temporary value does not live long enough
...
LL | }
| - temporary value only lives until here
|
2018-12-25 09:56:47 -06:00
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 13:19...
--> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:13:19
2018-08-08 07:28:26 -05:00
|
LL | fn structLifetime<'a>() -> &'a Test {
| ^^
error[E0597]: borrowed value does not live long enough
2018-12-25 09:56:47 -06:00
--> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:20:20
2018-08-08 07:28:26 -05:00
|
LL | let testValue = &id(MyEnum::Variant1);
| ^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
...
LL | }
| - temporary value only lives until here
|
2018-12-25 09:56:47 -06:00
note: borrowed value must be valid for the lifetime 'a as defined on the function body at 19:20...
--> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:19:20
2018-08-08 07:28:26 -05:00
|
LL | fn variantLifetime<'a>() -> &'a MyEnum {
| ^^
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0597`.