summary refs log tree commit diff
path: root/src/test/ui/static/static-reference-to-fn-2.stderr
blob: a01ab4cef818547c368f07d89d3ccb243d70990c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
error[E0597]: borrowed value does not live long enough
  --> $DIR/static-reference-to-fn-2.rs:28:22
   |
LL |     self_.statefn = &id(state2 as StateMachineFunc);
   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value only lives until here
   |                      |
   |                      temporary value does not live long enough
   |
note: borrowed value must be valid for the anonymous lifetime #2 defined on the function body at 27:1...
  --> $DIR/static-reference-to-fn-2.rs:27:1
   |
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
  --> $DIR/static-reference-to-fn-2.rs:34:22
   |
LL |     self_.statefn = &id(state3 as StateMachineFunc);
   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value only lives until here
   |                      |
   |                      temporary value does not live long enough
   |
note: borrowed value must be valid for the anonymous lifetime #2 defined on the function body at 33:1...
  --> $DIR/static-reference-to-fn-2.rs:33:1
   |
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
  --> $DIR/static-reference-to-fn-2.rs:40:22
   |
LL |     self_.statefn = &id(finished as StateMachineFunc);
   |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value only lives until here
   |                      |
   |                      temporary value does not live long enough
   |
note: borrowed value must be valid for the anonymous lifetime #2 defined on the function body at 39:1...
  --> $DIR/static-reference-to-fn-2.rs:39:1
   |
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
  --> $DIR/static-reference-to-fn-2.rs:51:19
   |
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`.