fix port for visit_statement

This commit is contained in:
Scott A Carr 2016-08-26 15:39:16 -04:00
parent 61c4f5b610
commit c043a27e42

View File

@ -36,6 +36,7 @@ use syntax_pos::Span;
use std::collections::hash_map::Entry; use std::collections::hash_map::Entry;
use std::fmt; use std::fmt;
use std::usize;
use super::promote_consts::{self, Candidate, TempState}; use super::promote_consts::{self, Candidate, TempState};
@ -393,8 +394,8 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> {
for index in 0..mir.var_decls.len() { for index in 0..mir.var_decls.len() {
if !self.const_fn_arg_vars.contains(index) { if !self.const_fn_arg_vars.contains(index) {
self.assign(&Lvalue::Var(Var::new(index)), Location { self.assign(&Lvalue::Var(Var::new(index)), Location {
block: BasicBlock::new(0), block: bb,
statement_index: 0 statement_index: usize::MAX,
}); });
} }
} }
@ -859,7 +860,17 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> {
} }
fn visit_statement(&mut self, bb: BasicBlock, statement: &Statement<'tcx>, location: Location) { 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, fn visit_terminator(&mut self,