]> git.lizzy.rs Git - rust.git/blob - src/test/ui/closures/closure-expected-type/expect-region-supply-region.stderr
Auto merge of #84267 - dtolnay:ptrunit, r=nagisa
[rust.git] / src / test / ui / closures / closure-expected-type / expect-region-supply-region.stderr
1 error[E0521]: borrowed data escapes outside of closure
2   --> $DIR/expect-region-supply-region.rs:20:9
3    |
4 LL |     let mut f: Option<&u32> = None;
5    |         ----- `f` declared here, outside of the closure body
6 LL |     closure_expecting_bound(|x| {
7    |                              - `x` is a reference that is only valid in the closure body
8 LL |         f = Some(x);
9    |         ^^^^^^^^^^^ `x` escapes the closure body here
10
11 error[E0521]: borrowed data escapes outside of closure
12   --> $DIR/expect-region-supply-region.rs:30:9
13    |
14 LL |     let mut f: Option<&u32> = None;
15    |         ----- `f` declared here, outside of the closure body
16 LL |     closure_expecting_bound(|x: &u32| {
17    |                              - `x` is a reference that is only valid in the closure body
18 LL |         f = Some(x);
19    |         ^^^^^^^^^^^ `x` escapes the closure body here
20
21 error: aborting due to 2 previous errors
22
23 For more information about this error, try `rustc --explain E0521`.