Esteban Küber
5082e6a300
Generalize logic pointing at binding moved into closure
...
Account not only for `fn` parameters when moving non-`Copy` values into closure, but also for let bindings.
```
error[E0507]: cannot move out of `bar`, a captured variable in an `FnMut` closure
--> $DIR/borrowck-move-by-capture.rs:9:29
|
LL | let bar: Box<_> = Box::new(3);
| --- ------ move occurs because `bar` has type `Box<isize>`, which does not implement the `Copy` trait
| |
| captured outer variable
LL | let _g = to_fn_mut(|| {
| -- captured by this `FnMut` closure
LL | let _h = to_fn_once(move || -> isize { *bar });
| ^^^^^^^^^^^^^^^^ ---- variable moved due to use in closure
| |
| `bar` is moved here
|
help: consider cloning the value before moving it into the closure
|
LL ~ let value = bar.clone();
LL ~ let _h = to_fn_once(move || -> isize { value });
|
```
```
error[E0507]: cannot move out of `y`, a captured variable in an `Fn` closure
--> $DIR/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:12:9
|
LL | let y = vec![format!("World")];
| - ---------------------- move occurs because `y` has type `Vec<String>`, which does not implement the `Copy` trait
| |
| captured outer variable
LL | call(|| {
| -- captured by this `Fn` closure
LL | y.into_iter();
| ^ ----------- `y` moved due to this method call
| |
| `y` is moved here
|
note: `into_iter` takes ownership of the receiver `self`, which moves `y`
--> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
help: you can `clone` the value and consume it, but this might not be your desired behavior
|
LL | <Vec<String> as Clone>::clone(&y).into_iter();
| +++++++++++++++++++++++++++++++ +
help: consider cloning the value if the performance cost is acceptable
|
LL | y.clone().into_iter();
| ++++++++
```
2025-07-21 16:21:23 +00:00
..
2025-06-03 13:28:38 +02:00
2025-02-10 20:21:39 +00:00
2025-03-04 00:21:02 +08:00
2025-02-14 00:44:10 -08:00
2025-02-14 00:44:10 -08:00
2025-02-21 00:41:17 +00:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-01-23 20:51:29 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-01-23 20:51:29 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-06-04 10:40:04 -04:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-01-23 20:51:29 +08:00
2025-04-08 23:06:31 +03:00
2025-04-30 10:44:24 +03:00
2025-04-30 10:44:24 +03:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-01-23 20:51:29 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-06-09 19:55:00 +00:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-04-30 10:44:24 +03:00
2024-11-26 02:50:48 +08:00
2025-02-10 20:21:39 +00:00
2024-11-26 02:50:48 +08:00
2025-04-30 10:44:24 +03:00
2025-02-10 20:21:39 +00:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-07-21 16:21:23 +00:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-04-30 10:44:24 +03:00
2025-04-30 10:44:24 +03:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-09-13 14:10:56 +03:00
2024-11-26 02:50:48 +08:00
2025-02-10 20:21:39 +00:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-04-30 10:44:24 +03:00
2025-02-05 10:36:32 -05:00
2025-04-30 10:44:24 +03:00
2025-04-30 10:44:24 +03:00
2025-04-30 10:44:24 +03:00
2025-04-30 10:44:24 +03:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-04-30 10:44:24 +03:00
2025-02-14 00:44:10 -08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-06-04 10:40:04 -04:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-02-03 19:00:22 +00:00
2025-02-10 20:21:39 +00:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-12-07 21:29:58 +00:00
2024-09-13 14:10:56 +03:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-06-03 13:35:31 +02:00
2025-06-03 13:35:31 +02:00
2025-04-30 10:44:24 +03:00
2025-04-30 10:44:24 +03:00
2025-04-30 10:44:24 +03:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-12-23 22:15:32 +00:00
2025-07-07 08:13:12 +00:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-06-03 13:35:31 +02:00
2024-11-26 02:50:48 +08:00
2025-04-30 10:44:24 +03:00
2025-04-30 10:44:24 +03:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-03-04 00:21:02 +08:00
2025-03-04 00:21:02 +08:00
2025-04-08 23:06:31 +03:00
2025-02-10 20:21:39 +00:00
2024-11-26 02:50:48 +08:00
2024-09-13 14:10:56 +03:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-02-25 16:56:04 +00:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-09-13 14:10:56 +03:00
2024-11-26 02:50:48 +08:00
2025-06-03 11:45:58 +02:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-04-17 06:25:15 +02:00
2025-04-03 21:41:58 +00:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-09-22 13:55:06 -04:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-09-30 20:43:51 +03:00
2024-11-25 20:29:04 -08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-06-03 11:45:58 +02:00
2024-11-26 02:50:48 +08:00
2025-01-23 20:51:29 +08:00
2025-06-09 19:55:00 +00:00
2025-06-03 11:45:58 +02:00
2024-11-26 02:50:48 +08:00
2025-01-23 20:51:29 +08:00
2024-11-26 02:50:48 +08:00
2025-04-30 10:44:24 +03:00
2025-04-30 10:44:24 +03:00
2024-11-26 02:50:48 +08:00
2025-04-30 10:44:24 +03:00
2025-04-30 10:44:24 +03:00
2025-03-03 05:57:55 +00:00
2025-03-03 05:57:55 +00:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-06-03 11:45:58 +02:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-03-14 19:50:03 +00:00
2024-11-26 02:50:48 +08:00
2025-06-09 19:55:00 +00:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-04-30 10:44:24 +03:00
2025-04-08 23:06:31 +03:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-06-09 19:55:00 +00:00
2024-11-26 02:50:48 +08:00
2025-04-30 10:44:24 +03:00
2025-04-30 10:44:24 +03:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-06-13 01:16:36 +02:00
2025-06-03 11:45:58 +02:00
2025-04-30 10:44:24 +03:00
2025-04-30 10:44:24 +03:00
2024-09-13 14:10:56 +03:00
2024-09-13 14:10:56 +03:00
2025-06-06 19:53:12 +00:00
2024-09-13 14:10:56 +03:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-04-30 10:44:24 +03:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-08-16 14:10:06 -04:00
2024-11-26 02:50:48 +08:00
2025-04-03 21:41:58 +00:00
2024-11-26 02:50:48 +08:00
2025-04-30 10:44:24 +03:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-02-25 16:56:04 +00:00
2025-06-06 20:52:34 +00:00
2025-02-10 20:21:39 +00:00
2024-08-08 17:35:40 +00:00
2024-11-26 02:50:48 +08:00
2025-04-30 10:44:24 +03:00
2025-04-30 10:44:24 +03:00
2024-11-26 02:50:48 +08:00
2025-02-10 20:21:39 +00:00
2024-11-26 02:50:48 +08:00
2025-02-04 10:57:49 +00:00
2025-02-03 19:00:22 +00:00
2025-02-10 20:21:39 +00:00
2024-11-26 02:50:48 +08:00
2025-03-12 16:56:26 +00:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-07-22 22:51:53 +00:00
2025-02-10 20:21:39 +00:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-01-06 17:58:30 +00:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-05-27 08:18:11 +00:00
2025-05-27 08:18:11 +00:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-05-26 10:57:54 +00:00
2025-05-26 10:57:54 +00:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-04-30 10:44:24 +03:00
2025-04-30 10:44:24 +03:00
2024-11-26 02:50:48 +08:00
2025-02-21 00:41:17 +00:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-03-04 00:21:02 +08:00
2025-03-04 00:21:02 +08:00
2024-11-26 02:50:48 +08:00
2025-06-03 13:35:31 +02:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-02-15 12:18:30 +08:00
2025-01-23 20:51:29 +08:00
2024-11-26 02:50:48 +08:00
2025-03-14 19:50:03 +00:00
2024-11-26 02:50:48 +08:00
2025-04-30 10:44:24 +03:00
2025-02-10 20:21:39 +00:00
2024-11-26 02:50:48 +08:00
2024-12-27 19:58:16 +11:00
2024-10-29 16:26:57 +00:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-30 17:05:47 +00:00
2024-11-30 17:05:47 +00:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2025-01-24 04:07:10 +00:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-11-26 02:50:48 +08:00
2024-07-12 21:16:09 -04:00
2024-07-12 21:16:09 -04:00
2024-11-26 02:50:48 +08:00
2024-10-29 16:26:57 +00:00
2024-10-29 16:26:57 +00:00
2024-11-23 23:31:30 +00:00
2024-11-23 23:31:30 +00:00
2025-02-10 20:21:39 +00:00
2025-02-21 00:41:17 +00:00
2025-02-10 20:21:39 +00:00
2025-04-08 23:06:31 +03:00
2025-01-23 20:51:29 +08:00
2025-01-23 20:51:29 +08:00
2025-02-10 20:21:39 +00:00
2024-09-22 13:55:06 -04:00
2025-04-08 23:06:31 +03:00
2025-04-08 23:06:31 +03:00
2025-04-30 10:44:24 +03:00
2025-04-30 10:44:24 +03:00
2025-01-23 20:51:29 +08:00
2025-04-24 13:14:36 +07:00
2025-01-14 18:52:42 +00:00
2025-01-14 18:52:42 +00:00
2025-01-26 21:20:31 +01:00
2025-01-23 20:51:29 +08:00
2025-03-12 16:56:26 +00:00
2025-03-12 16:56:26 +00:00
2025-04-08 23:06:31 +03:00
2025-03-14 19:50:03 +00:00
2024-07-11 20:39:24 +00:00
2024-07-11 20:39:24 +00:00
2025-02-10 20:21:39 +00:00
2025-03-14 19:50:03 +00:00
2025-04-30 10:44:24 +03:00
2025-04-30 10:44:24 +03:00
2024-11-30 17:05:47 +00:00
2024-12-11 19:53:40 +00:00
2025-06-12 07:35:05 +02:00
2024-12-27 19:58:16 +11:00
2025-02-10 20:21:39 +00:00
2025-06-03 13:35:31 +02:00
2025-01-23 20:51:29 +08:00
2025-01-23 20:51:29 +08:00
2025-05-24 23:31:07 +02:00
2025-01-23 20:51:29 +08:00
2025-04-30 10:44:24 +03:00
2025-04-30 10:44:24 +03:00
2024-10-04 14:06:48 +02:00
2024-10-04 14:06:48 +02:00
2025-06-03 13:35:31 +02:00
2025-04-30 10:44:24 +03:00
2025-04-30 10:44:24 +03:00
2025-02-14 00:44:10 -08:00
2024-12-27 19:58:16 +11:00
2025-06-03 13:35:31 +02:00
2025-01-24 01:19:50 +00:00
2025-01-24 01:19:50 +00:00
2025-01-23 20:51:29 +08:00
2025-01-22 07:04:53 +00:00
2025-01-22 07:04:53 +00:00
2025-01-22 07:04:53 +00:00
2025-06-03 11:45:58 +02:00
2025-02-10 20:21:39 +00:00
2025-03-14 19:50:03 +00:00
2024-11-02 03:08:04 +00:00
2025-06-03 13:28:38 +02:00
2025-06-03 13:28:38 +02:00
2025-01-06 17:58:30 +00:00
2025-04-13 21:48:53 +03:00
2025-07-18 12:13:30 +02:00
2025-07-18 12:13:30 +02:00
2025-04-30 10:44:24 +03:00
2025-04-30 10:44:24 +03:00
2025-01-23 20:51:29 +08:00
2024-09-27 00:45:02 +00:00
2024-07-10 17:15:02 -04:00
2024-07-10 17:15:02 -04:00
2024-11-27 03:34:58 +00:00
2024-11-27 03:34:58 +00:00
2025-04-26 14:48:30 +09:00
2025-04-26 14:48:30 +09:00
2024-11-16 20:03:31 +00:00
2025-06-09 19:55:00 +00:00
2025-06-03 13:35:31 +02:00
2024-09-27 00:45:02 +00:00
2025-02-10 20:21:39 +00:00
2025-05-24 23:31:07 +02:00
2025-02-10 20:21:39 +00:00
2025-06-04 10:40:04 -04:00
2025-04-30 10:44:24 +03:00
2025-04-30 10:44:24 +03:00
2025-06-17 23:19:31 +02:00
2025-06-18 13:48:42 +02:00
2025-03-07 17:55:08 +00:00
2025-01-23 20:51:29 +08:00
2025-01-23 20:51:29 +08:00
2025-01-23 20:51:29 +08:00
2025-02-10 20:21:39 +00:00
2024-11-02 03:08:04 +00:00
2025-06-27 17:03:48 +02:00
2025-06-27 17:03:48 +02:00
2025-02-10 20:21:39 +00:00
2024-08-06 11:17:26 +02:00
2025-06-03 13:35:31 +02:00
2024-11-21 15:49:55 -08:00
2025-05-03 22:49:23 +03:00
2025-05-03 22:49:23 +03:00
2024-10-15 13:11:00 +02:00
2025-06-03 13:35:31 +02:00
2024-11-22 02:32:26 +00:00
2024-11-22 02:32:26 +00:00
2024-11-22 02:32:26 +00:00
2024-11-22 02:32:26 +00:00
2025-06-03 13:35:31 +02:00
2025-05-26 10:57:54 +00:00
2025-05-27 08:18:11 +00:00
2025-04-08 23:06:31 +03:00
2024-12-12 23:36:27 +00:00
2025-02-14 00:44:10 -08:00
2024-11-03 13:55:52 -08:00
2024-11-03 13:55:52 -08:00
2024-07-22 22:51:53 +00:00
2024-09-13 14:10:56 +03:00
2025-06-30 08:45:43 +00:00
2024-12-02 18:43:37 +01:00
2024-11-23 08:57:25 -07:00
2025-02-14 00:44:10 -08:00
2024-12-13 15:40:37 +00:00
2025-05-27 08:18:11 +00:00
2025-05-27 08:18:11 +00:00
2025-06-22 10:58:25 +02:00
2024-07-22 22:51:53 +00:00
2024-08-28 22:55:57 +09:00
2024-09-27 00:45:02 +00:00
2024-11-02 03:08:04 +00:00
2024-10-16 13:44:56 -04:00
2024-09-26 17:17:11 +00:00
2025-03-04 00:21:02 +08:00
2025-03-04 00:21:02 +08:00
2025-04-08 23:06:31 +03:00
2025-02-10 20:21:39 +00:00
2025-06-22 10:58:25 +02:00
2025-06-02 15:37:15 +00:00
2025-06-07 13:42:30 +02:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2024-10-09 20:58:27 +11:00
2025-06-03 11:45:58 +02:00
2025-06-03 11:45:58 +02:00
2025-07-18 12:13:30 +02:00
2025-07-18 12:13:30 +02:00
2025-01-01 15:58:29 +01:00
2025-06-23 21:30:56 +03:00
2025-03-04 17:45:18 +00:00
2025-03-04 17:45:18 +00:00