rustc 1.67.0 (fc594f156 2023-01-24) (built from a source tarball) $ rustc --edition=2021 borrow_ends.rs exit=0 $ ./borrow_ends exit=0 next: resize:photo-1 owned: resize:photo-1 $ rustc --edition=2021 unscoped_borrow.rs exit=1 error[E0373]: closure may outlive the current function, but it borrows `jobs`, which is owned by the current function --> work/site-renewal/blog/experiments/rust-ownership/unscoped_borrow.rs:4:32 | 4 | let worker = thread::spawn(|| println!("{}", jobs[0])); | ^^ ---- `jobs` is borrowed here | | | may outlive borrowed value `jobs` | note: function requires argument type to outlive `'static` --> work/site-renewal/blog/experiments/rust-ownership/unscoped_borrow.rs:4:18 | 4 | let worker = thread::spawn(|| println!("{}", jobs[0])); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: to force the closure to take ownership of `jobs` (and any other referenced variables), use the `move` keyword | 4 | let worker = thread::spawn(move || println!("{}", jobs[0])); | ++++ error: aborting due to previous error For more information about this error, try `rustc --explain E0373`. $ rustc --edition=2021 scoped_partition.rs exit=0 $ ./scoped_partition exit=0 [10, 20, 300, 400]