Members of the Rust development team introduced an important new feature to be added to the Rust 1.63 standard library: scoped thread. This is described as a system-level thread, and unlike
thread::spawn(), scoped thread supports the use of local variables by threads, not just static variables.
Specifically, the function passed to the scope will provide a
Scope object, which can be used to create a scoped thread via spawn to create a scoped thread. Unlike non-scoped threads, scoped threads support non-static variables because scopes guarantee that all threads will join at the end of the scope. All threads generated in the scope that are not manually joined will be joined automatically until this function returns.
see documentation for details. As planned, Rust 1.63 will be released on August 11.