diff --git a/src/concurrency/scoped-threads.md b/src/concurrency/scoped-threads.md index 1f58a828..95680e06 100644 --- a/src/concurrency/scoped-threads.md +++ b/src/concurrency/scoped-threads.md @@ -5,13 +5,16 @@ Normal threads cannot borrow from their environment: ```rust,editable,compile_fail use std::thread; -fn main() { +fn foo() { let s = String::from("Hello"); - thread::spawn(|| { println!("Length: {}", s.len()); }); } + +fn main() { + foo(); +} ``` However, you can use a [scoped thread][1] for this: