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