rust/tests/ui/regions/regions-return-ref-to-upvar-issue-17403.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

18 lines
752 B
Plaintext
Raw Normal View History

2020-05-20 12:58:41 -05:00
error: captured variable cannot escape `FnMut` closure body
2018-12-25 09:56:47 -06:00
--> $DIR/regions-return-ref-to-upvar-issue-17403.rs:7:24
2018-08-08 07:28:26 -05:00
|
LL | let mut x = 0;
| ----- variable defined here
2019-03-09 06:03:44 -06:00
LL | let mut f = || &mut x;
| - ^^^^^-
| | | |
| | | variable captured here
| | returns a reference to a captured variable which escapes the closure body
2020-05-20 12:58:41 -05:00
| inferred to be a `FnMut` closure
2018-08-08 07:28:26 -05:00
|
2020-05-20 12:58:41 -05:00
= note: `FnMut` closures only have access to their captured variables while they are executing...
= note: ...therefore, they cannot allow references to captured variables to escape
2018-08-08 07:28:26 -05:00
error: aborting due to previous error