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/static-reference-to-fn-2.rs:18:22
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | self_.statefn = &id(state2 as StateMachineFunc);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value only lives until here
|
|
|
|
| |
|
|
|
|
| temporary value does not live long enough
|
|
|
|
|
|
2018-12-25 09:56:47 -06:00
|
|
|
note: borrowed value must be valid for the anonymous lifetime #2 defined on the function body at 17:1...
|
|
|
|
--> $DIR/static-reference-to-fn-2.rs:17:1
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | / fn state1(self_: &mut StateMachineIter) -> Option<&'static str> {
|
|
|
|
LL | | self_.statefn = &id(state2 as StateMachineFunc);
|
|
|
|
LL | | //~^ ERROR borrowed value does not live long enough
|
|
|
|
LL | | return Some("state1");
|
|
|
|
LL | | }
|
|
|
|
| |_^
|
|
|
|
= note: consider using a `let` binding to increase its lifetime
|
|
|
|
|
|
|
|
error[E0597]: borrowed value does not live long enough
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/static-reference-to-fn-2.rs:24:22
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | self_.statefn = &id(state3 as StateMachineFunc);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value only lives until here
|
|
|
|
| |
|
|
|
|
| temporary value does not live long enough
|
|
|
|
|
|
2018-12-25 09:56:47 -06:00
|
|
|
note: borrowed value must be valid for the anonymous lifetime #2 defined on the function body at 23:1...
|
|
|
|
--> $DIR/static-reference-to-fn-2.rs:23:1
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | / fn state2(self_: &mut StateMachineIter) -> Option<(&'static str)> {
|
|
|
|
LL | | self_.statefn = &id(state3 as StateMachineFunc);
|
|
|
|
LL | | //~^ ERROR borrowed value does not live long enough
|
|
|
|
LL | | return Some("state2");
|
|
|
|
LL | | }
|
|
|
|
| |_^
|
|
|
|
= note: consider using a `let` binding to increase its lifetime
|
|
|
|
|
|
|
|
error[E0597]: borrowed value does not live long enough
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/static-reference-to-fn-2.rs:30:22
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | self_.statefn = &id(finished as StateMachineFunc);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value only lives until here
|
|
|
|
| |
|
|
|
|
| temporary value does not live long enough
|
|
|
|
|
|
2018-12-25 09:56:47 -06:00
|
|
|
note: borrowed value must be valid for the anonymous lifetime #2 defined on the function body at 29:1...
|
|
|
|
--> $DIR/static-reference-to-fn-2.rs:29:1
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | / fn state3(self_: &mut StateMachineIter) -> Option<(&'static str)> {
|
|
|
|
LL | | self_.statefn = &id(finished as StateMachineFunc);
|
|
|
|
LL | | //~^ ERROR borrowed value does not live long enough
|
|
|
|
LL | | return Some("state3");
|
|
|
|
LL | | }
|
|
|
|
| |_^
|
|
|
|
= note: consider using a `let` binding to increase its lifetime
|
|
|
|
|
|
|
|
error[E0597]: borrowed value does not live long enough
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/static-reference-to-fn-2.rs:41:19
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | statefn: &id(state1 as StateMachineFunc)
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
|
|
|
|
...
|
|
|
|
LL | }
|
|
|
|
| - temporary value only lives until here
|
|
|
|
|
|
|
|
|
= note: borrowed value must be valid for the static lifetime...
|
|
|
|
|
|
|
|
error: aborting due to 4 previous errors
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0597`.
|