]> git.lizzy.rs Git - rust.git/blob - tests/ui/moves/moves-based-on-type-capture-clause-bad.stderr
Auto merge of #106520 - ehuss:update-mdbook, r=Mark-Simulacrum
[rust.git] / tests / ui / moves / moves-based-on-type-capture-clause-bad.stderr
1 error[E0382]: borrow of moved value: `x`
2   --> $DIR/moves-based-on-type-capture-clause-bad.rs:8:20
3    |
4 LL |     let x = "Hello world!".to_string();
5    |         - move occurs because `x` has type `String`, which does not implement the `Copy` trait
6 LL |     thread::spawn(move|| {
7    |                   ------ value moved into closure here
8 LL |         println!("{}", x);
9    |                        - variable moved due to use in closure
10 LL |     });
11 LL |     println!("{}", x);
12    |                    ^ value borrowed here after move
13    |
14    = 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)
15
16 error: aborting due to previous error
17
18 For more information about this error, try `rustc --explain E0382`.