mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 09:14:20 +00:00
10c2fbec24
``` 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() | ```
12 lines
186 B
Rust
12 lines
186 B
Rust
//@ run-rustfix
|
|
|
|
#[derive(Clone)]
|
|
struct Foo;
|
|
impl Foo {
|
|
fn foo(self) {}
|
|
}
|
|
fn main() {
|
|
let foo = &Foo;
|
|
<Foo as Clone>::clone(&foo.clone()).foo(); //~ ERROR cannot move out
|
|
}
|