Skip to content

Commit

Permalink
Auto merge of #127442 - saethlin:alloc-decoding-lock, r=<try>
Browse files Browse the repository at this point in the history
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`
  • Loading branch information
bors committed Jul 7, 2024
2 parents ed7e35f + 1486ae4 commit 32ec295
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions compiler/rustc_middle/src/mir/interpret/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 32ec295

Please sign in to comment.