Skip to content

Commit 32ec295

Browse files
committed
Auto merge of #127442 - saethlin:alloc-decoding-lock, r=<try>
Try to fix ICE from re-interning an AllocId with different allocation contents I'm trying to fix the ICE in #126741 and just based on println-debugging this lock scoping looks strange. r? `@ghost`
2 parents ed7e35f + 1486ae4 commit 32ec295

File tree

1 file changed

+2
-5
lines changed
  • compiler/rustc_middle/src/mir/interpret

1 file changed

+2
-5
lines changed

compiler/rustc_middle/src/mir/interpret/mod.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,8 @@ impl<'s> AllocDecodingSession<'s> {
222222

223223
// Check the decoding state to see if it's already decoded or if we should
224224
// decode it here.
225+
let mut entry = self.state.decoding_state[idx].lock();
225226
let alloc_id = {
226-
let mut entry = self.state.decoding_state[idx].lock();
227-
228227
match *entry {
229228
State::Done(alloc_id) => {
230229
return alloc_id;
@@ -317,9 +316,7 @@ impl<'s> AllocDecodingSession<'s> {
317316
}
318317
});
319318

320-
self.state.decoding_state[idx].with_lock(|entry| {
321-
*entry = State::Done(alloc_id);
322-
});
319+
*entry = State::Done(alloc_id);
323320

324321
alloc_id
325322
}

0 commit comments

Comments
 (0)