]> git.lizzy.rs Git - rust.git/blob - src/test/ui/regions/region-borrow-params-issue-29793-big.mir.stderr
Rollup merge of #57107 - mjbshaw:thread_local_test, r=nikomatsakis
[rust.git] / src / test / ui / regions / region-borrow-params-issue-29793-big.mir.stderr
1 error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
2   --> $DIR/region-borrow-params-issue-29793-big.rs:71:26
3    |
4 LL |         WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
5    |                          ^^^^^^^^^        - `x` is borrowed here
6    |                          |
7    |                          may outlive borrowed value `x`
8    |
9 note: closure is returned here
10   --> $DIR/region-borrow-params-issue-29793-big.rs:71:9
11    |
12 LL |         WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
13    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
14 help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
15    |
16 LL |         WrapB::new().set(move |t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
17    |                          ^^^^^^^^^^^^^^
18
19 error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function
20   --> $DIR/region-borrow-params-issue-29793-big.rs:71:26
21    |
22 LL |         WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
23    |                          ^^^^^^^^^                   - `y` is borrowed here
24    |                          |
25    |                          may outlive borrowed value `y`
26    |
27 note: closure is returned here
28   --> $DIR/region-borrow-params-issue-29793-big.rs:71:9
29    |
30 LL |         WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
31    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
32 help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
33    |
34 LL |         WrapB::new().set(move |t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
35    |                          ^^^^^^^^^^^^^^
36
37 error: aborting due to 2 previous errors
38
39 For more information about this error, try `rustc --explain E0373`.