summaryrefslogtreecommitdiffstats
path: root/src/doc/book/listings/ch04-understanding-ownership/no-listing-04-cant-use-after-move/output.txt
blob: 05987f7c8dc86e872a08d89723176a63f4f2fa46 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
$ cargo run
   Compiling ownership v0.1.0 (file:///projects/ownership)
error[E0382]: borrow of moved value: `s1`
 --> src/main.rs:5:28
  |
2 |     let s1 = String::from("hello");
  |         -- move occurs because `s1` has type `String`, which does not implement the `Copy` trait
3 |     let s2 = s1;
  |              -- value moved here
4 |
5 |     println!("{}, world!", s1);
  |                            ^^ value borrowed here after move
  |
  = 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)

For more information about this error, try `rustc --explain E0382`.
error: could not compile `ownership` due to previous error