rust/tests/ui/walk-struct-literal-with.st...

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

21 lines
1.0 KiB
Plaintext
Raw Normal View History

error[E0382]: borrow of moved value: `start`
2018-12-25 23:56:47 +08:00
--> $DIR/walk-struct-literal-with.rs:16:20
2018-08-08 20:28:26 +08:00
|
LL | let start = Mine{test:"Foo".to_string(), other_val:0};
| ----- move occurs because `start` has type `Mine`, which does not implement the `Copy` trait
2018-08-08 20:28:26 +08:00
LL | let end = Mine{other_val:1, ..start.make_string_bar()};
| ----------------- `start` moved due to this method call
2019-03-09 20:03:44 +08:00
LL | println!("{}", start.test);
| ^^^^^^^^^^ value borrowed here after move
|
2022-12-12 20:07:09 +08:00
note: `Mine::make_string_bar` takes ownership of the receiver `self`, which moves `start`
--> $DIR/walk-struct-literal-with.rs:7:28
|
LL | fn make_string_bar(mut self) -> Mine{
| ^^^^
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
2018-08-08 20:28:26 +08:00
error: aborting due to 1 previous error
2018-08-08 20:28:26 +08:00
For more information about this error, try `rustc --explain E0382`.