mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 16:54:01 +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() | ```
271 lines
13 KiB
Plaintext
271 lines
13 KiB
Plaintext
error[E0507]: cannot move out of `self` which is behind a shared reference
|
|
--> $DIR/deriving-with-repr-packed-move-errors.rs:13:16
|
|
|
|
|
LL | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
|
|
| ----- in this derive macro expansion
|
|
LL | struct StructA(String);
|
|
| ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
|
|
|
|
|
= note: `#[derive(Debug)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
|
|
= note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
help: consider cloning the value if the performance cost is acceptable
|
|
|
|
|
LL | struct StructA(String.clone());
|
|
| ++++++++
|
|
|
|
error[E0507]: cannot move out of `self` which is behind a shared reference
|
|
--> $DIR/deriving-with-repr-packed-move-errors.rs:13:16
|
|
|
|
|
LL | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
|
|
| --------- in this derive macro expansion
|
|
LL | struct StructA(String);
|
|
| ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
|
|
|
|
|
= note: `#[derive(PartialEq)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
|
|
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
help: consider cloning the value if the performance cost is acceptable
|
|
|
|
|
LL | struct StructA(String.clone());
|
|
| ++++++++
|
|
|
|
error[E0507]: cannot move out of `other` which is behind a shared reference
|
|
--> $DIR/deriving-with-repr-packed-move-errors.rs:13:16
|
|
|
|
|
LL | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
|
|
| --------- in this derive macro expansion
|
|
LL | struct StructA(String);
|
|
| ^^^^^^ move occurs because `other.0` has type `String`, which does not implement the `Copy` trait
|
|
|
|
|
= note: `#[derive(PartialEq)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
|
|
= note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
help: consider cloning the value if the performance cost is acceptable
|
|
|
|
|
LL | struct StructA(String.clone());
|
|
| ++++++++
|
|
|
|
error[E0507]: cannot move out of `self` which is behind a shared reference
|
|
--> $DIR/deriving-with-repr-packed-move-errors.rs:13:16
|
|
|
|
|
LL | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
|
|
| ---------- in this derive macro expansion
|
|
LL | struct StructA(String);
|
|
| ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
|
|
|
|
|
= note: `#[derive(PartialOrd)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
|
|
= note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
help: consider cloning the value if the performance cost is acceptable
|
|
|
|
|
LL | struct StructA(String.clone());
|
|
| ++++++++
|
|
|
|
error[E0507]: cannot move out of `other` which is behind a shared reference
|
|
--> $DIR/deriving-with-repr-packed-move-errors.rs:13:16
|
|
|
|
|
LL | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
|
|
| ---------- in this derive macro expansion
|
|
LL | struct StructA(String);
|
|
| ^^^^^^ move occurs because `other.0` has type `String`, which does not implement the `Copy` trait
|
|
|
|
|
= note: `#[derive(PartialOrd)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
|
|
= note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
help: consider cloning the value if the performance cost is acceptable
|
|
|
|
|
LL | struct StructA(String.clone());
|
|
| ++++++++
|
|
|
|
error[E0507]: cannot move out of `self` which is behind a shared reference
|
|
--> $DIR/deriving-with-repr-packed-move-errors.rs:13:16
|
|
|
|
|
LL | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
|
|
| --- in this derive macro expansion
|
|
LL | struct StructA(String);
|
|
| ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
|
|
|
|
|
= note: `#[derive(Ord)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
|
|
= note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
help: consider cloning the value if the performance cost is acceptable
|
|
|
|
|
LL | struct StructA(String.clone());
|
|
| ++++++++
|
|
|
|
error[E0507]: cannot move out of `other` which is behind a shared reference
|
|
--> $DIR/deriving-with-repr-packed-move-errors.rs:13:16
|
|
|
|
|
LL | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
|
|
| --- in this derive macro expansion
|
|
LL | struct StructA(String);
|
|
| ^^^^^^ move occurs because `other.0` has type `String`, which does not implement the `Copy` trait
|
|
|
|
|
= note: `#[derive(Ord)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
|
|
= note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
help: consider cloning the value if the performance cost is acceptable
|
|
|
|
|
LL | struct StructA(String.clone());
|
|
| ++++++++
|
|
|
|
error[E0507]: cannot move out of `self` which is behind a shared reference
|
|
--> $DIR/deriving-with-repr-packed-move-errors.rs:13:16
|
|
|
|
|
LL | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
|
|
| ---- in this derive macro expansion
|
|
LL | struct StructA(String);
|
|
| ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
|
|
|
|
|
= note: `#[derive(Hash)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
|
|
= note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
help: consider cloning the value if the performance cost is acceptable
|
|
|
|
|
LL | struct StructA(String.clone());
|
|
| ++++++++
|
|
|
|
error[E0507]: cannot move out of `self` which is behind a shared reference
|
|
--> $DIR/deriving-with-repr-packed-move-errors.rs:13:16
|
|
|
|
|
LL | #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Default)]
|
|
| ----- in this derive macro expansion
|
|
LL | struct StructA(String);
|
|
| ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
|
|
|
|
|
= note: `#[derive(Clone)]` triggers a move because taking references to the fields of a packed struct is undefined behaviour
|
|
= note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
help: consider cloning the value if the performance cost is acceptable
|
|
|
|
|
LL | struct StructA(String.clone());
|
|
| ++++++++
|
|
|
|
error[E0507]: cannot move out of `self` which is behind a shared reference
|
|
--> $DIR/deriving-with-repr-packed-move-errors.rs:28:9
|
|
|
|
|
LL | self.0
|
|
| ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
|
|
|
|
|
help: consider cloning the value if the performance cost is acceptable
|
|
|
|
|
LL | self.0.clone()
|
|
| ++++++++
|
|
|
|
error[E0507]: cannot move out of `self` which is behind a shared reference
|
|
--> $DIR/deriving-with-repr-packed-move-errors.rs:38:20
|
|
|
|
|
LL | let x = &{ self.0 };
|
|
| ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
|
|
|
|
|
help: consider cloning the value if the performance cost is acceptable
|
|
|
|
|
LL | let x = &{ self.0.clone() };
|
|
| ++++++++
|
|
|
|
error[E0507]: cannot move out of `self` which is behind a shared reference
|
|
--> $DIR/deriving-with-repr-packed-move-errors.rs:45:12
|
|
|
|
|
LL | ({ self.0 }) == ({ other.0 })
|
|
| ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
|
|
|
|
|
help: consider cloning the value if the performance cost is acceptable
|
|
|
|
|
LL | ({ self.0.clone() }) == ({ other.0 })
|
|
| ++++++++
|
|
|
|
error[E0507]: cannot move out of `other` which is behind a shared reference
|
|
--> $DIR/deriving-with-repr-packed-move-errors.rs:45:28
|
|
|
|
|
LL | ({ self.0 }) == ({ other.0 })
|
|
| ^^^^^^^ move occurs because `other.0` has type `String`, which does not implement the `Copy` trait
|
|
|
|
|
help: consider cloning the value if the performance cost is acceptable
|
|
|
|
|
LL | ({ self.0 }) == ({ other.0.clone() })
|
|
| ++++++++
|
|
|
|
error[E0507]: cannot move out of `self` which is behind a shared reference
|
|
--> $DIR/deriving-with-repr-packed-move-errors.rs:53:36
|
|
|
|
|
LL | PartialOrd::partial_cmp(&{ self.0 }, &{ other.0 })
|
|
| ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
|
|
|
|
|
help: consider cloning the value if the performance cost is acceptable
|
|
|
|
|
LL | PartialOrd::partial_cmp(&{ self.0.clone() }, &{ other.0 })
|
|
| ++++++++
|
|
|
|
error[E0507]: cannot move out of `other` which is behind a shared reference
|
|
--> $DIR/deriving-with-repr-packed-move-errors.rs:53:49
|
|
|
|
|
LL | PartialOrd::partial_cmp(&{ self.0 }, &{ other.0 })
|
|
| ^^^^^^^ move occurs because `other.0` has type `String`, which does not implement the `Copy` trait
|
|
|
|
|
help: consider cloning the value if the performance cost is acceptable
|
|
|
|
|
LL | PartialOrd::partial_cmp(&{ self.0 }, &{ other.0.clone() })
|
|
| ++++++++
|
|
|
|
error[E0507]: cannot move out of `self` which is behind a shared reference
|
|
--> $DIR/deriving-with-repr-packed-move-errors.rs:68:20
|
|
|
|
|
LL | let x = &{ self.0 };
|
|
| ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
|
|
|
|
|
help: consider cloning the value if the performance cost is acceptable
|
|
|
|
|
LL | let x = &{ self.0.clone() };
|
|
| ++++++++
|
|
|
|
error[E0507]: cannot move out of `self` which is behind a shared reference
|
|
--> $DIR/deriving-with-repr-packed-move-errors.rs:75:12
|
|
|
|
|
LL | ({ self.0 }) == ({ other.0 })
|
|
| ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
|
|
|
|
|
help: consider cloning the value if the performance cost is acceptable
|
|
|
|
|
LL | ({ self.0.clone() }) == ({ other.0 })
|
|
| ++++++++
|
|
|
|
error[E0507]: cannot move out of `other` which is behind a shared reference
|
|
--> $DIR/deriving-with-repr-packed-move-errors.rs:75:28
|
|
|
|
|
LL | ({ self.0 }) == ({ other.0 })
|
|
| ^^^^^^^ move occurs because `other.0` has type `String`, which does not implement the `Copy` trait
|
|
|
|
|
help: consider cloning the value if the performance cost is acceptable
|
|
|
|
|
LL | ({ self.0 }) == ({ other.0.clone() })
|
|
| ++++++++
|
|
|
|
error[E0507]: cannot move out of `self` which is behind a shared reference
|
|
--> $DIR/deriving-with-repr-packed-move-errors.rs:83:36
|
|
|
|
|
LL | PartialOrd::partial_cmp(&{ self.0 }, &{ other.0 })
|
|
| ^^^^^^ move occurs because `self.0` has type `String`, which does not implement the `Copy` trait
|
|
|
|
|
help: consider cloning the value if the performance cost is acceptable
|
|
|
|
|
LL | PartialOrd::partial_cmp(&{ self.0.clone() }, &{ other.0 })
|
|
| ++++++++
|
|
|
|
error[E0507]: cannot move out of `other` which is behind a shared reference
|
|
--> $DIR/deriving-with-repr-packed-move-errors.rs:83:49
|
|
|
|
|
LL | PartialOrd::partial_cmp(&{ self.0 }, &{ other.0 })
|
|
| ^^^^^^^ move occurs because `other.0` has type `String`, which does not implement the `Copy` trait
|
|
|
|
|
help: consider cloning the value if the performance cost is acceptable
|
|
|
|
|
LL | PartialOrd::partial_cmp(&{ self.0 }, &{ other.0.clone() })
|
|
| ++++++++
|
|
|
|
error[E0507]: cannot move out of `arg` which is behind a shared reference
|
|
--> $DIR/deriving-with-repr-packed-move-errors.rs:92:5
|
|
|
|
|
LL | arg.0
|
|
| ^^^^^ move occurs because `arg.0` has type `String`, which does not implement the `Copy` trait
|
|
|
|
|
help: consider cloning the value if the performance cost is acceptable
|
|
|
|
|
LL | arg.0.clone()
|
|
| ++++++++
|
|
|
|
error: aborting due to 21 previous errors
|
|
|
|
For more information about this error, try `rustc --explain E0507`.
|