Esteban Küber
11061831f7
Mention type that could be Clone but isn't in more cases
...
When encountering a moved value of a type that isn't `Clone` because of unmet obligations, but where all the unmet predicates reference crate-local types, mention them and suggest cloning, as we do in other cases already:
```
error[E0507]: cannot move out of `foo`, a captured variable in an `Fn` closure
--> f111.rs:14:25
|
13 | fn do_stuff(foo: Option<Foo>) {
| --- captured outer variable
14 | require_fn_trait(|| async {
| -- ^^^^^ `foo` is moved here
| |
| captured by this `Fn` closure
15 | if foo.map_or(false, |f| f.foo()) {
| ---
| |
| variable moved due to use in coroutine
| move occurs because `foo` has type `Option<Foo>`, which does not implement the `Copy` trait
|
note: if `Foo` implemented `Clone`, you could clone the value
--> f111.rs:4:1
|
4 | struct Foo;
| ^^^^^^^^^^ consider implementing `Clone` for this type
...
15 | if foo.map_or(false, |f| f.foo()) {
| --- you could clone this value
```
2025-07-25 18:34:10 +00:00
..
2025-05-03 17:22:52 +02:00
2025-04-17 11:21:54 +00:00
2025-05-06 18:53:55 -07:00
2025-07-25 18:34:10 +00:00
2025-04-30 10:44:24 +03:00
2025-05-21 15:38:08 +02:00
2025-06-30 07:49:20 -05:00
2024-09-23 02:12:53 +03:00
2024-09-23 02:12:53 +03:00
2025-07-04 23:47:31 -07:00
2025-07-04 23:47:31 -07:00
2024-06-13 06:16:12 +00:00
2024-06-13 06:16:12 +00:00
2024-05-20 19:55:59 -07:00
2024-05-20 19:55:59 -07:00
2024-02-16 20:02:50 +00:00
2025-04-30 10:44:24 +03:00
2025-04-30 10:44:24 +03:00
2025-03-14 14:51:58 +08:00
2025-03-14 14:51:58 +08:00
2025-02-17 09:30:40 +11:00
2024-03-03 13:10:15 +01:00
2025-05-03 17:22:52 +02:00
2024-05-20 19:55:59 -07:00
2024-11-23 08:57:25 -07:00
2024-02-16 20:02:50 +00:00
2024-05-20 19:55:59 -07:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2025-02-10 20:21:39 +00:00
2024-02-16 20:02:50 +00:00
2025-06-03 13:35:31 +02:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2025-06-03 13:35:31 +02:00
2024-08-19 21:39:57 +02:00
2024-02-16 20:02:50 +00:00
2025-07-10 23:39:54 +08:00
2024-02-16 20:02:50 +00:00
2024-02-09 15:43:08 -03:00
2024-02-09 15:43:08 -03:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2023-10-11 12:49:57 +00:00
2024-12-04 20:29:36 +00:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2024-02-16 20:02:50 +00:00
2025-02-10 20:21:39 +00:00
2024-02-16 20:02:50 +00:00
2024-04-29 14:53:38 +02:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2024-11-23 08:57:25 -07:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2025-01-29 15:45:13 +00:00
2024-12-04 20:29:36 +00:00
2024-12-04 20:29:36 +00:00
2024-02-16 20:02:50 +00:00
2025-06-03 13:35:31 +02:00
2024-06-13 06:14:32 +00:00
2024-05-15 16:55:54 -04:00
2024-04-15 23:27:22 -04:00
2024-11-22 11:12:15 -08:00
2024-03-27 11:20:28 -04:00
2024-07-04 02:02:21 +00:00
2024-03-22 20:53:42 -04:00
2024-03-22 20:53:42 -04:00
2024-03-22 20:53:42 -04:00
2024-05-20 19:55:59 -07:00
2024-05-20 19:55:59 -07:00
2024-05-20 19:55:59 -07:00
2024-05-20 19:55:59 -07:00
2024-12-04 20:29:36 +00:00
2025-04-08 00:34:40 +02:00
2025-04-08 00:34:40 +02:00
2025-04-08 00:34:40 +02:00
2025-04-08 00:34:40 +02:00
2025-05-08 15:00:17 +00:00
2025-02-05 11:28:24 +00:00
2025-02-05 11:28:24 +00:00
2023-11-24 19:15:52 +01:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2025-02-14 00:44:10 -08:00
2025-02-14 00:44:10 -08:00
2025-02-10 20:21:39 +00:00
2023-11-24 19:15:52 +01:00
2025-01-08 07:34:59 +00:00
2023-10-05 01:04:41 +00:00
2025-04-08 23:06:31 +03:00
2025-04-08 23:06:31 +03:00
2025-02-14 00:44:10 -08:00
2024-03-19 12:28:23 +08:00
2024-03-19 12:28:23 +08:00
2025-02-14 00:44:10 -08:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2025-02-10 20:21:39 +00:00
2024-02-08 08:10:43 +00:00
2024-11-23 08:57:25 -07:00
2025-04-30 10:44:24 +03:00
2025-04-30 10:44:24 +03:00
2023-11-24 19:15:52 +01:00
2025-06-03 07:38:06 +05:00
2025-06-03 07:38:06 +05:00
2025-06-03 07:38:06 +05:00
2024-06-25 10:00:30 +08:00
2023-11-24 19:15:52 +01:00
2024-08-26 18:30:15 -04:00
2024-05-02 19:42:31 -04:00
2025-02-10 20:21:39 +00:00
2025-04-03 21:41:58 +00:00
2024-01-13 12:46:58 -05:00
2024-11-21 18:40:36 +08:00
2024-11-21 18:40:36 +08:00
2024-02-16 20:02:50 +00:00
2024-11-22 11:12:15 -08:00
2024-11-22 11:12:15 -08:00
2025-06-11 15:30:15 +01:00
2025-02-10 20:21:39 +00:00
2025-02-10 20:21:39 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-07-11 00:18:47 +08:00
2024-07-11 00:18:47 +08:00
2025-01-08 00:13:43 +00:00
2025-01-08 00:13:43 +00:00
2025-01-08 00:10:16 +00:00
2025-01-08 00:10:16 +00:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-06-13 06:14:32 +00:00
2024-06-13 06:14:32 +00:00
2025-04-08 21:05:20 +00:00
2025-04-08 21:05:20 +00:00
2025-05-22 12:52:46 +01:00