diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2024-03-13 03:41:41 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2024-04-11 16:41:41 +0000 |
| commit | 10c2fbec2437a873463382726d4815520430ff1f (patch) | |
| tree | d067beb0dbc809ca4fe64ad84be899c97b082d4c /tests/ui/trivial-bounds | |
| parent | bce78102c31c2e71313af1e8119eb882dea35fad (diff) | |
| download | rust-10c2fbec2437a873463382726d4815520430ff1f.tar.gz rust-10c2fbec2437a873463382726d4815520430ff1f.zip | |
Suggest `.clone()` in some move errors
``` error[E0507]: cannot move out of `*x` which is behind a shared reference --> $DIR/borrowck-fn-in-const-a.rs:6:16 | LL | return *x | ^^ move occurs because `*x` has type `String`, which does not implement the `Copy` trait | help: consider cloning the value if the performance cost is acceptable | LL - return *x LL + return x.clone() | ```
Diffstat (limited to 'tests/ui/trivial-bounds')
| -rw-r--r-- | tests/ui/trivial-bounds/trivial-bounds-leak-copy.stderr | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/ui/trivial-bounds/trivial-bounds-leak-copy.stderr b/tests/ui/trivial-bounds/trivial-bounds-leak-copy.stderr index e48d48a7271..4efb883ac74 100644 --- a/tests/ui/trivial-bounds/trivial-bounds-leak-copy.stderr +++ b/tests/ui/trivial-bounds/trivial-bounds-leak-copy.stderr @@ -3,6 +3,12 @@ error[E0507]: cannot move out of `*t` which is behind a shared reference | LL | *t | ^^ move occurs because `*t` has type `String`, which does not implement the `Copy` trait + | +help: consider cloning the value if the performance cost is acceptable + | +LL - *t +LL + t.clone() + | error: aborting due to 1 previous error |
