Skip to content

Commit

Permalink
Fix incorrect source in 16.1
Browse files Browse the repository at this point in the history
In the book, I should get a compilation error, but the source now passes compilation.

modifies the source as in the book.
  • Loading branch information
boojongmin committed Dec 2, 2023
1 parent 71352de commit 5b57dd6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions listings/ch16-fearless-concurrency/listing-16-05/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ use std::thread;
fn main() {
let v = vec![1, 2, 3];

let handle = thread::spawn(move || {
let handle = thread::spawn(|| {
println!("Here's a vector: {:?}", v);
});

drop(v); // oh no!

handle.join().unwrap();
}
}
4 changes: 3 additions & 1 deletion nostarch/chapter16.md
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,12 @@ use std::thread;
fn main() {
let v = vec![1, 2, 3];
let handle = thread::spawn(move || {
let handle = thread::spawn(|| {
println!("Here's a vector: {:?}", v);
});
drop(v); // oh no!
handle.join().unwrap();
}
```
Expand Down

0 comments on commit 5b57dd6

Please sign in to comment.