Rustacean Station  cover image

What's New in Rust 1.62, 1.63, and 1.64

Rustacean Station

CHAPTER

What Are Scoped Threads?

Scoped threads are something that used to exist in rust and then got removed in what's known as the leak apocalypse, which I think Ben has some context on. So scoped threads are essentially let's contrast them with regular threads. When you use the regular standard thread spawn function, you provide a closure and that closure has to be static. What that means is you're only allowed to give it references that live for the entirety of the program or give it ownership of anything that you move into the closure you pass to spawn. The reason why the API has to be a little bit weird like this is to actually guarantee that we can't pull shenanigans inside of the closures to make those references leak

00:00
Transcript
Play full episode

Remember Everything You Learn from Podcasts

Save insights instantly, chat with episodes, and build lasting knowledge - all powered by AI.
App store bannerPlay store banner