Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/mir/lower.rs')
-rw-r--r--crates/hir-ty/src/mir/lower.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/crates/hir-ty/src/mir/lower.rs b/crates/hir-ty/src/mir/lower.rs
index 95c93b5f3e..43d04b6823 100644
--- a/crates/hir-ty/src/mir/lower.rs
+++ b/crates/hir-ty/src/mir/lower.rs
@@ -1635,10 +1635,12 @@ impl<'ctx> MirLowerCtx<'ctx> {
f: impl FnOnce(&mut MirLowerCtx<'_>, BasicBlockId) -> Result<()>,
) -> Result<Option<BasicBlockId>> {
let begin = self.new_basic_block();
- let prev = mem::replace(
- &mut self.current_loop_blocks,
- Some(LoopBlocks { begin, end: None, place, drop_scope_index: self.drop_scopes.len() }),
- );
+ let prev = self.current_loop_blocks.replace(LoopBlocks {
+ begin,
+ end: None,
+ place,
+ drop_scope_index: self.drop_scopes.len(),
+ });
let prev_label = if let Some(label) = label {
// We should generate the end now, to make sure that it wouldn't change later. It is
// bad as we may emit end (unnecessary unreachable block) for unterminating loop, but