fat vec
This commit is contained in:
@@ -141,8 +141,7 @@ impl<'tcx> MirPatch<'tcx> {
|
|||||||
|
|
||||||
let mut delta = 0;
|
let mut delta = 0;
|
||||||
let mut last_bb = START_BLOCK;
|
let mut last_bb = START_BLOCK;
|
||||||
let mut terminator_targets = Vec::new();
|
let mut stmts_and_targets: Vec<(Statement<'_>, BasicBlock)> = Vec::new();
|
||||||
let mut statements: Vec<Statement<'_>> = Vec::new();
|
|
||||||
for (mut loc, stmt) in new_statements {
|
for (mut loc, stmt) in new_statements {
|
||||||
if loc.block != last_bb {
|
if loc.block != last_bb {
|
||||||
delta = 0;
|
delta = 0;
|
||||||
@@ -159,8 +158,8 @@ impl<'tcx> MirPatch<'tcx> {
|
|||||||
let successors = term.successors().clone();
|
let successors = term.successors().clone();
|
||||||
|
|
||||||
for i in successors {
|
for i in successors {
|
||||||
statements.push(Statement { source_info, kind: stmt.clone() });
|
stmts_and_targets
|
||||||
terminator_targets.push(i.clone());
|
.push((Statement { source_info, kind: stmt.clone() }, i.clone()));
|
||||||
}
|
}
|
||||||
delta += 1;
|
delta += 1;
|
||||||
continue;
|
continue;
|
||||||
@@ -172,9 +171,8 @@ impl<'tcx> MirPatch<'tcx> {
|
|||||||
delta += 1;
|
delta += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for target in terminator_targets.iter().rev() {
|
for (stmt, target) in stmts_and_targets.iter().rev() {
|
||||||
let stmt = statements.pop().unwrap();
|
body[*target].statements.insert(0, stmt.clone());
|
||||||
body[*target].statements.insert(0, stmt);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user