diff options
| author | bors <bors@rust-lang.org> | 2021-07-10 16:41:26 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-07-10 16:41:26 +0000 |
| commit | a31431fce770ff90a347fd6114ac294e4568cbd8 (patch) | |
| tree | 982527241e92f1ed9dc54d98595fa53678addb8d /library/std/src | |
| parent | 3982eb35cabe3a99194d768d34a92347967c3fa2 (diff) | |
| parent | 36b142f5c11014090b98028688f2580f1ce4b483 (diff) | |
| download | rust-a31431fce770ff90a347fd6114ac294e4568cbd8.tar.gz rust-a31431fce770ff90a347fd6114ac294e4568cbd8.zip | |
Auto merge of #87029 - JohnTitor:rollup-0yapv7z, r=JohnTitor
Rollup of 5 pull requests Successful merges: - #87006 (Revert the revert of renaming traits::VTable to ImplSource) - #87011 (avoid reentrant lock acquire when ThreadIds run out) - #87013 (Fix several ICEs related to malformed `#[repr(...)]` attributes) - #87020 (remove const_raw_ptr_to_usize_cast feature) - #87028 (Fix type: `'satic` -> `'static`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/thread/mod.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/library/std/src/thread/mod.rs b/library/std/src/thread/mod.rs index da2d1160493..9f7e6b95dfb 100644 --- a/library/std/src/thread/mod.rs +++ b/library/std/src/thread/mod.rs @@ -999,11 +999,12 @@ impl ThreadId { static mut COUNTER: u64 = 1; unsafe { - let _guard = GUARD.lock(); + let guard = GUARD.lock(); // If we somehow use up all our bits, panic so that we're not // covering up subtle bugs of IDs being reused. if COUNTER == u64::MAX { + drop(guard); // in case the panic handler ends up calling `ThreadId::new()`, avoid reentrant lock acquire. panic!("failed to generate unique thread ID: bitspace exhausted"); } |
