diff --git a/compiler/rustc_mir_transform/src/check_alignment.rs b/compiler/rustc_mir_transform/src/check_alignment.rs index 694102388cff..ee5272749fec 100644 --- a/compiler/rustc_mir_transform/src/check_alignment.rs +++ b/compiler/rustc_mir_transform/src/check_alignment.rs @@ -111,7 +111,7 @@ fn split_block( // Drain every statement after this one and move the current terminator to a new basic block let new_block = BasicBlockData { - statements: block_data.statements.drain(location.statement_index..).collect(), + statements: block_data.statements.split_off(location.statement_index), terminator: block_data.terminator.take(), is_cleanup: block_data.is_cleanup, };