This function just sets an internal flag on the handle object, which is then checked in the drop implementation to .join().unwrap() the thread (propagating a panic).
This seems like a quick win for structured concurrency, much lighter weight than using a custom library for this pattern.
Was this suggested in the past? The idea seems obvious in retrospect, but I don't recall any discussions
I believe that this is how the old, unsound, scoped-thread API worked. In any case, std::thread::scope does something very similar, in a more-robust-but-less-flexible manner.
I'm a big fan of implicit panic propagation - that's how we handle panics with normal function calls. But double panic abort in this case would significantly hurt DX. To keep the metaphor that scope.spawn(func) is just a function call but in parallel, I believe the right strategy is to propagate panic from spawned threads by default but skip it during panic unwinding. But I understand that it can be considered too smart and surprising for stdlib impl.