mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 16:54:01 +00:00
d68f2a6b71
``` 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; | + ``` |
||
---|---|---|
.. | ||
auxiliary | ||
unnamed-fields | ||
field_checks.rs | ||
field_checks.stderr | ||
issue-41073.rs | ||
issue-41073.stderr | ||
issue-81199.rs | ||
issue-81199.stderr | ||
issue-99375.rs | ||
projection-as-union-type-error-2.rs | ||
projection-as-union-type-error-2.stderr | ||
projection-as-union-type-error.rs | ||
projection-as-union-type-error.stderr | ||
projection-as-union-type.rs | ||
union-align.rs | ||
union-backcomp.rs | ||
union-basic.rs | ||
union-borrow-move-parent-sibling.rs | ||
union-borrow-move-parent-sibling.stderr | ||
union-const-codegen.rs | ||
union-const-eval-field.rs | ||
union-const-eval.rs | ||
union-const-pat.rs | ||
union-const-pat.stderr | ||
union-copy.rs | ||
union-copy.stderr | ||
union-deref.rs | ||
union-deref.stderr | ||
union-derive-clone.rs | ||
union-derive-clone.stderr | ||
union-derive-eq.rs | ||
union-derive-eq.stderr | ||
union-derive-rpass.rs | ||
union-derive.rs | ||
union-derive.stderr | ||
union-drop-assign.rs | ||
union-drop.rs | ||
union-empty.rs | ||
union-empty.stderr | ||
union-fields-1.rs | ||
union-fields-1.stderr | ||
union-fields-2.rs | ||
union-fields-2.stderr | ||
union-generic-rpass.rs | ||
union-generic.rs | ||
union-generic.stderr | ||
union-inherent-method.rs | ||
union-lint-dead-code.rs | ||
union-lint-dead-code.stderr | ||
union-macro.rs | ||
union-manuallydrop-rpass.rs | ||
union-move.rs | ||
union-move.stderr | ||
union-nodrop.rs | ||
union-nonrepresentable.rs | ||
union-nonrepresentable.stderr | ||
union-nonzero.rs | ||
union-overwrite.rs | ||
union-packed.rs | ||
union-pat-refutability.rs | ||
union-repr-c.rs | ||
union-repr-c.stderr | ||
union-sized-field.rs | ||
union-sized-field.stderr | ||
union-suggest-field.rs | ||
union-suggest-field.stderr | ||
union-trait-impl.rs | ||
union-transmute.rs | ||
union-unsafe.rs | ||
union-unsafe.stderr | ||
union-unsized.rs | ||
union-unsized.stderr | ||
union-with-drop-fields.rs | ||
union-with-drop-fields.stderr | ||
unresolved-field-isnt-copy.rs | ||
unresolved-field-isnt-copy.stderr |