]> git.lizzy.rs Git - rust.git/blob - src/test/ui/closures/closure-expected-type/expect-region-supply-region.stderr
eb860f9aef243d1d7e5ecf8382e8b027a4ebbab0
[rust.git] / src / test / ui / closures / closure-expected-type / expect-region-supply-region.stderr
1 error: borrowed data cannot be stored outside of its closure
2   --> $DIR/expect-region-supply-region.rs:18:18
3    |
4 LL |     let mut f: Option<&u32> = None;
5    |         ----- borrowed data cannot be stored into here...
6 LL |     closure_expecting_bound(|x| {
7    |                             --- ...because it cannot outlive this closure
8 LL |         f = Some(x);
9    |                  ^ cannot be stored outside of its closure
10
11 error: borrowed data cannot be stored outside of its closure
12   --> $DIR/expect-region-supply-region.rs:28:18
13    |
14 LL |     let mut f: Option<&u32> = None;
15    |         ----- borrowed data cannot be stored into here...
16 LL |     closure_expecting_bound(|x: &u32| {
17    |                             --------- ...because it cannot outlive this closure
18 LL |         f = Some(x);
19    |                  ^ cannot be stored outside of its closure
20
21 error[E0308]: mismatched types
22   --> $DIR/expect-region-supply-region.rs:37:33
23    |
24 LL |     closure_expecting_bound(|x: &'x u32| {
25    |                                 ^^^^^^^ lifetime mismatch
26    |
27    = note: expected reference `&u32`
28               found reference `&'x u32`
29 note: the anonymous lifetime #2 defined on the body at 37:29...
30   --> $DIR/expect-region-supply-region.rs:37:29
31    |
32 LL |       closure_expecting_bound(|x: &'x u32| {
33    |  _____________________________^
34 LL | |
35 LL | |
36 LL | |
37 ...  |
38 LL | |
39 LL | |     });
40    | |_____^
41 note: ...does not necessarily outlive the lifetime `'x` as defined on the function body at 32:30
42   --> $DIR/expect-region-supply-region.rs:32:30
43    |
44 LL | fn expect_bound_supply_named<'x>() {
45    |                              ^^
46
47 error[E0308]: mismatched types
48   --> $DIR/expect-region-supply-region.rs:37:33
49    |
50 LL |     closure_expecting_bound(|x: &'x u32| {
51    |                                 ^^^^^^^ lifetime mismatch
52    |
53    = note: expected reference `&u32`
54               found reference `&'x u32`
55 note: the lifetime `'x` as defined on the function body at 32:30...
56   --> $DIR/expect-region-supply-region.rs:32:30
57    |
58 LL | fn expect_bound_supply_named<'x>() {
59    |                              ^^
60 note: ...does not necessarily outlive the anonymous lifetime #2 defined on the body at 37:29
61   --> $DIR/expect-region-supply-region.rs:37:29
62    |
63 LL |       closure_expecting_bound(|x: &'x u32| {
64    |  _____________________________^
65 LL | |
66 LL | |
67 LL | |
68 ...  |
69 LL | |
70 LL | |     });
71    | |_____^
72
73 error: borrowed data cannot be stored outside of its closure
74   --> $DIR/expect-region-supply-region.rs:42:18
75    |
76 LL |     let mut f: Option<&u32> = None;
77    |         ----- borrowed data cannot be stored into here...
78 ...
79 LL |     closure_expecting_bound(|x: &'x u32| {
80    |                             ------------ ...because it cannot outlive this closure
81 ...
82 LL |         f = Some(x);
83    |                  ^ cannot be stored outside of its closure
84
85 error: aborting due to 5 previous errors
86
87 For more information about this error, try `rustc --explain E0308`.