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 }