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 18:58:41 +01:00
error: captured variable cannot escape `FnMut` closure body
2018-12-25 08:56:47 -07:00
--> $DIR/regions-return-ref-to-upvar-issue-17403.rs:7:24
2018-08-08 14:28:26 +02:00
|
LL | let mut x = 0;
| ----- variable defined here
2019-03-09 15:03:44 +03: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 18:58:41 +01:00
| inferred to be a `FnMut` closure
2018-08-08 14:28:26 +02:00
|
2020-05-20 18:58:41 +01: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 14:28:26 +02:00
error: aborting due to previous error