From 1486ae4159a9b83954f49d1504b5a9da0e8fa0b1 Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Sat, 6 Jul 2024 20:41:52 -0400 Subject: [PATCH] Change lock scope when decoding Allocations --- compiler/rustc_middle/src/mir/interpret/mod.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_middle/src/mir/interpret/mod.rs b/compiler/rustc_middle/src/mir/interpret/mod.rs index 4e95e600b5ab9..26ff9b0ac60ad 100644 --- a/compiler/rustc_middle/src/mir/interpret/mod.rs +++ b/compiler/rustc_middle/src/mir/interpret/mod.rs @@ -222,9 +222,8 @@ impl<'s> AllocDecodingSession<'s> { // Check the decoding state to see if it's already decoded or if we should // decode it here. + let mut entry = self.state.decoding_state[idx].lock(); let alloc_id = { - let mut entry = self.state.decoding_state[idx].lock(); - match *entry { State::Done(alloc_id) => { return alloc_id; @@ -317,9 +316,7 @@ impl<'s> AllocDecodingSession<'s> { } }); - self.state.decoding_state[idx].with_lock(|entry| { - *entry = State::Done(alloc_id); - }); + *entry = State::Done(alloc_id); alloc_id }