2019-01-02 16:56:45 -08:00
|
|
|
error[E0382]: use of moved value: `x`
|
2019-11-19 16:43:24 -08:00
|
|
|
--> $DIR/issue-34721.rs:27:9
|
2019-01-02 16:56:45 -08:00
|
|
|
|
|
|
|
|
LL | pub fn baz<T: Foo>(x: T) -> T {
|
2019-12-26 13:43:33 +01:00
|
|
|
| - move occurs because `x` has type `T`, which does not implement the `Copy` trait
|
2019-01-02 16:56:45 -08:00
|
|
|
LL | if 0 == 1 {
|
|
|
|
LL | bar::bar(x.zero())
|
2020-06-11 13:48:46 -04:00
|
|
|
| ------ `x` moved due to this method call
|
2019-01-02 16:56:45 -08:00
|
|
|
LL | } else {
|
|
|
|
LL | x.zero()
|
2020-06-11 13:48:46 -04:00
|
|
|
| ------ `x` moved due to this method call
|
2019-01-02 16:56:45 -08:00
|
|
|
LL | };
|
|
|
|
LL | x.zero()
|
|
|
|
| ^ value used here after move
|
2019-12-26 13:43:33 +01:00
|
|
|
|
|
2022-12-12 12:07:09 +00:00
|
|
|
note: `Foo::zero` takes ownership of the receiver `self`, which moves `x`
|
2020-06-11 13:48:46 -04:00
|
|
|
--> $DIR/issue-34721.rs:4:13
|
|
|
|
|
|
|
|
|
LL | fn zero(self) -> Self;
|
|
|
|
| ^^^^
|
2020-03-13 19:28:14 -07:00
|
|
|
help: consider further restricting this bound
|
2019-12-26 13:43:33 +01:00
|
|
|
|
|
2020-03-13 19:28:14 -07:00
|
|
|
LL | pub fn baz<T: Foo + Copy>(x: T) -> T {
|
2021-06-21 19:07:19 -07:00
|
|
|
| ++++++
|
2019-01-02 16:56:45 -08:00
|
|
|
|
|
|
|
error: aborting due to previous error
|
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0382`.
|