diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2024-03-17 21:25:38 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2024-04-11 16:41:42 +0000 |
| commit | d97d2fe7440ea3032a93fa3ebf8d62fea0337d04 (patch) | |
| tree | 84f778762a45c6c7820a0dcdd557292424e9d926 /tests/ui/union | |
| parent | d578ac9e476a376246320db1d934972601c5b0f5 (diff) | |
| download | rust-d97d2fe7440ea3032a93fa3ebf8d62fea0337d04.tar.gz rust-d97d2fe7440ea3032a93fa3ebf8d62fea0337d04.zip | |
Mention when the type of the moved value doesn't implement `Clone`
Diffstat (limited to 'tests/ui/union')
| -rw-r--r-- | tests/ui/union/union-borrow-move-parent-sibling.stderr | 5 | ||||
| -rw-r--r-- | tests/ui/union/union-move.stderr | 10 |
2 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/union/union-borrow-move-parent-sibling.stderr b/tests/ui/union/union-borrow-move-parent-sibling.stderr index c9a440a66cc..782fa63280e 100644 --- a/tests/ui/union/union-borrow-move-parent-sibling.stderr +++ b/tests/ui/union/union-borrow-move-parent-sibling.stderr @@ -50,6 +50,11 @@ error[E0507]: cannot move out of dereference of `ManuallyDrop<((MockVec<u8>, Moc LL | let a = (u.x.0).0; | ^^^^^^^^^ move occurs because value has type `MockVec<u8>`, which does not implement the `Copy` trait | +note: if `MockVec<u8>` implemented `Clone`, you could clone the value + --> $DIR/union-borrow-move-parent-sibling.rs:25:1 + | +LL | struct MockVec<T> { + | ^^^^^^^^^^^^^^^^^ help: consider borrowing here | LL | let a = &(u.x.0).0; diff --git a/tests/ui/union/union-move.stderr b/tests/ui/union/union-move.stderr index 7d13094fbed..5ebb2716e5a 100644 --- a/tests/ui/union/union-move.stderr +++ b/tests/ui/union/union-move.stderr @@ -16,6 +16,11 @@ LL | fn move_out<T>(x: T) {} | -------- ^ this parameter takes ownership of the value | | | in this function +note: if `U1` implemented `Clone`, you could clone the value + --> $DIR/union-move.rs:9:1 + | +LL | union U1 { + | ^^^^^^^^ error[E0382]: use of moved value: `x` --> $DIR/union-move.rs:42:18 @@ -35,6 +40,11 @@ LL | fn move_out<T>(x: T) {} | -------- ^ this parameter takes ownership of the value | | | in this function +note: if `U1` implemented `Clone`, you could clone the value + --> $DIR/union-move.rs:9:1 + | +LL | union U1 { + | ^^^^^^^^ error[E0509]: cannot move out of type `U2`, which implements the `Drop` trait --> $DIR/union-move.rs:49:18 |
