2020-05-20 17:58:41 +00:00
|
|
|
error[E0521]: borrowed data escapes outside of closure
|
|
|
|
--> $DIR/issue-7573.rs:17:9
|
2018-01-15 18:55:10 +00:00
|
|
|
|
|
2018-02-23 00:42:32 +00:00
|
|
|
LL | let mut lines_to_use: Vec<&CrateId> = Vec::new();
|
2020-05-20 17:58:41 +00:00
|
|
|
| ---------------- `lines_to_use` declared here, outside of the closure body
|
2019-03-09 12:03:44 +00:00
|
|
|
LL |
|
2018-02-23 00:42:32 +00:00
|
|
|
LL | let push_id = |installed_id: &CrateId| {
|
2020-05-20 17:58:41 +00:00
|
|
|
| ------------ `installed_id` is a reference that is only valid in the closure body
|
|
|
|
LL |
|
2018-02-23 00:42:32 +00:00
|
|
|
LL | lines_to_use.push(installed_id);
|
2020-05-20 17:58:41 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `installed_id` escapes the closure body here
|
2018-01-15 18:55:10 +00:00
|
|
|
|
2023-11-21 15:44:16 +00:00
|
|
|
error: aborting due to 1 previous error
|
2018-01-15 18:55:10 +00:00
|
|
|
|
2021-02-01 17:23:12 +00:00
|
|
|
For more information about this error, try `rustc --explain E0521`.
|