rust/tests/ui/unsafe-binders
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
..
binder-sized-crit.rs Fix sized constraint for unsafe binder 2025-02-28 03:17:36 +00:00
binder-sized-crit.stderr Fix sized constraint for unsafe binder 2025-02-28 03:17:36 +00:00
cat-projection.rs Handle e2021 precise capturing of unsafe binder 2025-05-28 12:17:18 +00:00
expr.rs Implement MIR, CTFE, and codegen for unsafe binders 2025-01-31 17:19:53 +00:00
expr.stderr Implement MIR, CTFE, and codegen for unsafe binders 2025-01-31 17:19:53 +00:00
lifetime-resolution.rs UI tests: add missing diagnostic kinds where possible 2025-04-08 23:06:31 +03:00
lifetime-resolution.stderr Begin to implement type system layer of unsafe binders 2024-12-22 21:57:57 +00:00
mismatch.rs Implement MIR, CTFE, and codegen for unsafe binders 2025-01-31 17:19:53 +00:00
mismatch.stderr Implement MIR, CTFE, and codegen for unsafe binders 2025-01-31 17:19:53 +00:00
moves.rs Use BikeshedGuaranteedNotDrop in unsafe binder type WF too 2025-02-13 03:45:07 +00:00
moves.stderr Mention type that could be Clone but isn't in more cases 2025-07-25 18:34:10 +00:00
non-strucutral-type-diag.rs Dont walk into unsafe binders when emiting error for non-structural type match 2025-05-23 10:10:50 +00:00
non-strucutral-type-diag.stderr Dont walk into unsafe binders when emiting error for non-structural type match 2025-05-23 10:10:50 +00:00
simple.rs Begin to implement type system layer of unsafe binders 2024-12-22 21:57:57 +00:00
simple.stderr Begin to implement type system layer of unsafe binders 2024-12-22 21:57:57 +00:00
type-mismatch.rs Fix pretty printing of unsafe binders 2025-03-03 01:34:09 +00:00
type-mismatch.stderr Fix pretty printing of unsafe binders 2025-03-03 01:34:09 +00:00
unused-lifetimes-2.fixed Fix spans for unsafe binders 2025-05-30 16:58:48 +00:00
unused-lifetimes-2.rs Fix spans for unsafe binders 2025-05-30 16:58:48 +00:00
unused-lifetimes-2.stderr Fix spans for unsafe binders 2025-05-30 16:58:48 +00:00
unused-lifetimes.fixed Fix spans for unsafe binders 2025-05-30 16:58:48 +00:00
unused-lifetimes.rs Fix spans for unsafe binders 2025-05-30 16:58:48 +00:00
unused-lifetimes.stderr Fix spans for unsafe binders 2025-05-30 16:58:48 +00:00