Rollup merge of #94644 - m-ou-se:scoped-threads-drop-soundness, r=joshtriplett

Fix soundness issue in scoped threads.

This was discovered in https://github.com/rust-lang/rust/pull/94559#discussion_r820116323

The `scope()` function returns when all threads are finished, but I accidentally considered a thread 'finished' before dropping their panic payload or ignored return value.

So if a thread returned (or panics with) something that in its `Drop` implementation still uses borrowed stuff, it goes wrong.

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=2a1f19ac4676cdabe43e24e536ff9358
This commit is contained in:
Matthias Krüger
2022-03-10 19:00:07 +01:00
committed by GitHub
3 changed files with 52 additions and 12 deletions

View File

@@ -364,6 +364,11 @@ extern crate std as realstd;
#[macro_use]
mod macros;
// The runtime entry point and a few unstable public functions used by the
// compiler
#[macro_use]
pub mod rt;
// The Rust prelude
pub mod prelude;
@@ -548,11 +553,6 @@ pub mod arch {
#[stable(feature = "simd_x86", since = "1.27.0")]
pub use std_detect::is_x86_feature_detected;
// The runtime entry point and a few unstable public functions used by the
// compiler
#[macro_use]
pub mod rt;
// Platform-abstraction modules
mod sys;
mod sys_common;