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/span | |
| 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/span')
| -rw-r--r-- | tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr b/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr index bac7801f7f4..f37dc320fa3 100644 --- a/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr +++ b/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr @@ -43,6 +43,11 @@ LL | f(Box::new(|a| { LL | LL | foo(f); | ^ move occurs because `f` has type `{closure@$DIR/borrowck-call-is-borrow-issue-12224.rs:52:17: 52:58}`, which does not implement the `Copy` trait + | +help: consider cloning the value if the performance cost is acceptable + | +LL | foo(f.clone()); + | ++++++++ error[E0505]: cannot move out of `f` because it is borrowed --> $DIR/borrowck-call-is-borrow-issue-12224.rs:55:16 |
