Jonah SC HW 9 - TheEvergreenStateCollege/upper-division-cs-23-24 GitHub Wiki
Reading and Quizzes
Rust Book Ch. 16
16.1
When used with closures, the move keyword passes the variables in the environment to the closure by value, so the value of n in the outer scope remains unaffected by modifications made in any child threads.
Threads in Rust require that objects used in threads live for as long as the thread might exist. A variable initialized in a function scope is automatically uninitialized once execution leaves that scope, and so accessing v (which has a lifetime limited to the end of main()) in the child thread causes a compilation error.