/
expect-region-supply-region.stderr
87 lines (81 loc) · 3.29 KB
/
expect-region-supply-region.stderr
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
error: borrowed data cannot be stored outside of its closure
--> $DIR/expect-region-supply-region.rs:28:18
|
LL | let mut f: Option<&u32> = None;
| ----- borrowed data cannot be stored into here...
LL | closure_expecting_bound(|x| {
| --- ...because it cannot outlive this closure
LL | f = Some(x); //~ ERROR borrowed data cannot be stored outside of its closure
| ^ cannot be stored outside of its closure
error: borrowed data cannot be stored outside of its closure
--> $DIR/expect-region-supply-region.rs:38:18
|
LL | let mut f: Option<&u32> = None;
| ----- borrowed data cannot be stored into here...
LL | closure_expecting_bound(|x: &u32| {
| --------- ...because it cannot outlive this closure
LL | f = Some(x); //~ ERROR borrowed data cannot be stored outside of its closure
| ^ cannot be stored outside of its closure
error[E0308]: mismatched types
--> $DIR/expect-region-supply-region.rs:47:33
|
LL | closure_expecting_bound(|x: &'x u32| {
| ^^^^^^^ lifetime mismatch
|
= note: expected type `&u32`
found type `&'x u32`
note: the anonymous lifetime #2 defined on the body at 47:29...
--> $DIR/expect-region-supply-region.rs:47:29
|
LL | closure_expecting_bound(|x: &'x u32| {
| _____________________________^
LL | | //~^ ERROR mismatched types
LL | | //~| ERROR mismatched types
LL | |
... |
LL | | //~^ ERROR borrowed data cannot be stored outside of its closure
LL | | });
| |_____^
note: ...does not necessarily outlive the lifetime 'x as defined on the function body at 42:1
--> $DIR/expect-region-supply-region.rs:42:1
|
LL | fn expect_bound_supply_named<'x>() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
--> $DIR/expect-region-supply-region.rs:47:33
|
LL | closure_expecting_bound(|x: &'x u32| {
| ^^^^^^^ lifetime mismatch
|
= note: expected type `&u32`
found type `&'x u32`
note: the lifetime 'x as defined on the function body at 42:1...
--> $DIR/expect-region-supply-region.rs:42:1
|
LL | fn expect_bound_supply_named<'x>() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...does not necessarily outlive the anonymous lifetime #2 defined on the body at 47:29
--> $DIR/expect-region-supply-region.rs:47:29
|
LL | closure_expecting_bound(|x: &'x u32| {
| _____________________________^
LL | | //~^ ERROR mismatched types
LL | | //~| ERROR mismatched types
LL | |
... |
LL | | //~^ ERROR borrowed data cannot be stored outside of its closure
LL | | });
| |_____^
error: borrowed data cannot be stored outside of its closure
--> $DIR/expect-region-supply-region.rs:52:18
|
LL | let mut f: Option<&u32> = None;
| ----- borrowed data cannot be stored into here...
...
LL | closure_expecting_bound(|x: &'x u32| {
| ------------ ...because it cannot outlive this closure
...
LL | f = Some(x);
| ^ cannot be stored outside of its closure
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0308`.