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
No known key found for this signature in database
30 changed files with 295 additions and 330 deletions

View file

@ -259,13 +259,13 @@ fn remap_mir_for_const_eval_select<'tcx>(
// (const generic stuff) so we just create a temporary and deconstruct
// that.
let local = body.local_decls.push(LocalDecl::new(ty, fn_span));
bb.statements.push(Statement {
source_info: SourceInfo::outermost(fn_span),
kind: StatementKind::Assign(Box::new((
bb.statements.push(Statement::new(
SourceInfo::outermost(fn_span),
StatementKind::Assign(Box::new((
local.into(),
Rvalue::Use(tupled_args.node.clone()),
))),
});
));
(Operand::Move, local.into())
}
Operand::Move(place) => (Operand::Move, place),