use std::collections::hash_map::Entry;
use std::fmt;
+use std::usize;
use super::promote_consts::{self, Candidate, TempState};
for index in 0..mir.var_decls.len() {
if !self.const_fn_arg_vars.contains(index) {
self.assign(&Lvalue::Var(Var::new(index)), Location {
- block: BasicBlock::new(0),
- statement_index: 0
+ block: bb,
+ statement_index: usize::MAX,
});
}
}
}
fn visit_statement(&mut self, bb: BasicBlock, statement: &Statement<'tcx>, location: Location) {
- self.nest(|this| this.super_statement(bb, statement, location));
+ self.nest(|this| {
+ this.visit_source_info(&statement.source_info);
+ match statement.kind {
+ StatementKind::Assign(ref lvalue, ref rvalue) => {
+ this.visit_assign(bb, lvalue, rvalue, location);
+ }
+ StatementKind::SetDiscriminant { .. } |
+ StatementKind::StorageLive(_) |
+ StatementKind::StorageDead(_) => {}
+ }
+ });
}
fn visit_terminator(&mut self,