]> git.lizzy.rs Git - rust.git/blob - src/test/ui/closure-expected-type/expect-region-supply-region.stderr
Add an unstable FileTypeExt extension trait for Windows
[rust.git] / src / test / ui / 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:28:18
3    |
4 26 |     let mut f: Option<&u32> = None;
5    |         ----- borrowed data cannot be stored into here...
6 27 |     closure_expecting_bound(|x| {
7    |                             --- ...because it cannot outlive this closure
8 28 |         f = Some(x); //~ ERROR borrowed data cannot be stored outside of its closure
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:38:18
13    |
14 36 |     let mut f: Option<&u32> = None;
15    |         ----- borrowed data cannot be stored into here...
16 37 |     closure_expecting_bound(|x: &u32| {
17    |                             --------- ...because it cannot outlive this closure
18 38 |         f = Some(x); //~ ERROR borrowed data cannot be stored outside of its closure
19    |                  ^ cannot be stored outside of its closure
20
21 error[E0308]: mismatched types
22   --> $DIR/expect-region-supply-region.rs:47:33
23    |
24 47 |     closure_expecting_bound(|x: &'x u32| {
25    |                                 ^^^^^^^ lifetime mismatch
26    |
27    = note: expected type `&u32`
28               found type `&'x u32`
29 note: the anonymous lifetime #2 defined on the body at 47:29...
30   --> $DIR/expect-region-supply-region.rs:47:29
31    |
32 47 |       closure_expecting_bound(|x: &'x u32| {
33    |  _____________________________^
34 48 | |         //~^ ERROR mismatched types
35 49 | |         //~| ERROR mismatched types
36 50 | |
37 ...  |
38 53 | |         //~^ ERROR borrowed data cannot be stored outside of its closure
39 54 | |     });
40    | |_____^
41 note: ...does not necessarily outlive the lifetime 'x as defined on the function body at 42:1
42   --> $DIR/expect-region-supply-region.rs:42:1
43    |
44 42 | / fn expect_bound_supply_named<'x>() {
45 43 | |     let mut f: Option<&u32> = None;
46 44 | |
47 45 | |     // Here we give a type annotation that `x` should be free. We get
48 ...  |
49 54 | |     });
50 55 | | }
51    | |_^
52
53 error[E0308]: mismatched types
54   --> $DIR/expect-region-supply-region.rs:47:33
55    |
56 47 |     closure_expecting_bound(|x: &'x u32| {
57    |                                 ^^^^^^^ lifetime mismatch
58    |
59    = note: expected type `&u32`
60               found type `&'x u32`
61 note: the lifetime 'x as defined on the function body at 42:1...
62   --> $DIR/expect-region-supply-region.rs:42:1
63    |
64 42 | / fn expect_bound_supply_named<'x>() {
65 43 | |     let mut f: Option<&u32> = None;
66 44 | |
67 45 | |     // Here we give a type annotation that `x` should be free. We get
68 ...  |
69 54 | |     });
70 55 | | }
71    | |_^
72 note: ...does not necessarily outlive the anonymous lifetime #2 defined on the body at 47:29
73   --> $DIR/expect-region-supply-region.rs:47:29
74    |
75 47 |       closure_expecting_bound(|x: &'x u32| {
76    |  _____________________________^
77 48 | |         //~^ ERROR mismatched types
78 49 | |         //~| ERROR mismatched types
79 50 | |
80 ...  |
81 53 | |         //~^ ERROR borrowed data cannot be stored outside of its closure
82 54 | |     });
83    | |_____^
84
85 error: borrowed data cannot be stored outside of its closure
86   --> $DIR/expect-region-supply-region.rs:52:18
87    |
88 43 |     let mut f: Option<&u32> = None;
89    |         ----- borrowed data cannot be stored into here...
90 ...
91 47 |     closure_expecting_bound(|x: &'x u32| {
92    |                             ------------ ...because it cannot outlive this closure
93 ...
94 52 |         f = Some(x);
95    |                  ^ cannot be stored outside of its closure
96
97 error: aborting due to 5 previous errors
98