rust/tests/ui/binop
Esteban Küber d68f2a6b71 Mention when type parameter could be Clone
```
error[E0382]: use of moved value: `t`
  --> $DIR/use_of_moved_value_copy_suggestions.rs:7:9
   |
LL | fn duplicate_t<T>(t: T) -> (T, T) {
   |                   - move occurs because `t` has type `T`, which does not implement the `Copy` trait
...
LL |     (t, t)
   |      -  ^ value used here after move
   |      |
   |      value moved here
   |
help: if `T` implemented `Clone`, you could clone the value
  --> $DIR/use_of_moved_value_copy_suggestions.rs:4:16
   |
LL | fn duplicate_t<T>(t: T) -> (T, T) {
   |                ^ consider constraining this type parameter with `Clone`
...
LL |     (t, t)
   |      - you could clone this value
help: consider restricting type parameter `T`
   |
LL | fn duplicate_t<T: Copy>(t: T) -> (T, T) {
   |                 ++++++
```

The `help` is new. On ADTs, we also extend the output with span labels:

```
error[E0507]: cannot move out of static item `FOO`
  --> $DIR/issue-17718-static-move.rs:6:14
   |
LL |     let _a = FOO;
   |              ^^^ move occurs because `FOO` has type `Foo`, which does not implement the `Copy` trait
   |
note: if `Foo` implemented `Clone`, you could clone the value
  --> $DIR/issue-17718-static-move.rs:1:1
   |
LL | struct Foo;
   | ^^^^^^^^^^ consider implementing `Clone` for this type
...
LL |     let _a = FOO;
   |              --- you could clone this value
help: consider borrowing here
   |
LL |     let _a = &FOO;
   |              +
```
2024-04-24 22:21:15 +00:00
..
binary-minus-without-space.rs
binary-op-on-double-ref.fixed
binary-op-on-double-ref.rs
binary-op-on-double-ref.stderr
binary-op-on-fn-ptr-eq.rs
binary-op-suggest-deref.rs
binary-op-suggest-deref.stderr Add basic trait impls for f16 and f128 2024-03-28 15:02:51 -04:00
binop-bitxor-str.rs
binop-bitxor-str.stderr
binop-consume-args.rs
binop-consume-args.stderr Mention when type parameter could be Clone 2024-04-24 22:21:15 +00:00
binop-fail-3.rs
binop-logic-float.rs
binop-logic-float.stderr
binop-logic-int.rs
binop-logic-int.stderr
binop-move-semantics.rs
binop-move-semantics.stderr Mention when type parameter could be Clone 2024-04-24 22:21:15 +00:00
binop-mul-bool.rs
binop-mul-bool.stderr
binop-mul-i32-f32.rs
binop-mul-i32-f32.stderr
binop-panic.rs
binop-typeck.rs
binop-typeck.stderr
binops-issue-22743.rs
binops.rs
borrow-suggestion-109352-2.rs
borrow-suggestion-109352-2.stderr
borrow-suggestion-109352.fixed
borrow-suggestion-109352.rs
borrow-suggestion-109352.stderr
eq-arr.rs
eq-arr.stderr
eq-vec.rs
eq-vec.stderr
false-binop-caused-by-missing-semi.fixed
false-binop-caused-by-missing-semi.rs
false-binop-caused-by-missing-semi.stderr
issue-3820.rs
issue-3820.stderr
issue-25916.rs
issue-28837.rs
issue-28837.stderr
issue-62375.rs
issue-62375.stderr
issue-77910-1.rs
issue-77910-1.stderr Handle more cases of value suggestions 2024-04-10 20:36:14 +00:00
issue-77910-2.rs
issue-77910-2.stderr Handle more cases of value suggestions 2024-04-10 20:36:14 +00:00
issue-93927.rs
issue-93927.stderr
multiply-is-deref-on-rhs.rs Don't delay a bug if we suggest adding a semicolon to the RHS of an assign operator 2024-04-10 15:07:13 -04:00
multiply-is-deref-on-rhs.stderr Don't delay a bug if we suggest adding a semicolon to the RHS of an assign operator 2024-04-10 15:07:13 -04:00
operator-multidispatch.rs
operator-overloading.rs
placement-syntax.rs
placement-syntax.stderr
shift-various-bad-types.rs
shift-various-bad-types.stderr
structured-compare.rs