about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-07-10 16:41:26 +0000
committerbors <bors@rust-lang.org>2021-07-10 16:41:26 +0000
commita31431fce770ff90a347fd6114ac294e4568cbd8 (patch)
tree982527241e92f1ed9dc54d98595fa53678addb8d /library/std/src
parent3982eb35cabe3a99194d768d34a92347967c3fa2 (diff)
parent36b142f5c11014090b98028688f2580f1ce4b483 (diff)
downloadrust-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.rs3
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");
             }