rust/tests/ui/moves/issue-34721.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
953 B
Plaintext
Raw Normal View History

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