mir: Add a new method to statement

Avoid introducing a large number of changes when adding optional initialization fields.
This commit is contained in:
dianqk
2025-06-08 15:30:18 +08:00
parent 5ca574e85b
commit 9f9cd5e283
30 changed files with 295 additions and 330 deletions

View File

@@ -240,15 +240,15 @@ impl<'tcx> InstSimplifyContext<'_, 'tcx> {
let Some(arg_place) = arg.node.place() else { return };
statements.push(Statement {
source_info: terminator.source_info,
kind: StatementKind::Assign(Box::new((
statements.push(Statement::new(
terminator.source_info,
StatementKind::Assign(Box::new((
*destination,
Rvalue::Use(Operand::Copy(
arg_place.project_deeper(&[ProjectionElem::Deref], self.tcx),
)),
))),
});
));
terminator.kind = TerminatorKind::Goto { target: *destination_block };
}