diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2024-05-01 20:46:06 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2025-06-24 18:44:41 +0000 |
| commit | 904652b2d05d967deadf201fc35e8343a822c7a6 (patch) | |
| tree | e65168be3671177481e56d53511ed50b8fc3d6c4 /tests/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs | |
| parent | 36b21637e93b038453924d3c66821089e71d8baa (diff) | |
| download | rust-904652b2d05d967deadf201fc35e8343a822c7a6.tar.gz rust-904652b2d05d967deadf201fc35e8343a822c7a6.zip | |
Suggest cloning `Arc` moved into closure
```
error[E0382]: borrow of moved value: `x`
--> $DIR/moves-based-on-type-capture-clause-bad.rs:9:20
|
LL | let x = "Hello world!".to_string();
| - move occurs because `x` has type `String`, which does not implement the `Copy` trait
LL | thread::spawn(move || {
| ------- value moved into closure here
LL | println!("{}", x);
| - variable moved due to use in closure
LL | });
LL | println!("{}", x);
| ^ 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)
help: consider cloning the value before moving it into the closure
|
LL ~ let value = x.clone();
LL ~ thread::spawn(move || {
LL ~ println!("{}", value);
|
```
Diffstat (limited to 'tests/codegen/src-hash-algorithm/src-hash-algorithm-md5.rs')
0 files changed, 0 insertions, 0 deletions
