Skip to content

Commit c043a27

Browse files
committed
fix port for visit_statement
1 parent 61c4f5b commit c043a27

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/librustc_mir/transform/qualify_consts.rs

+14-3
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ use syntax_pos::Span;
3636

3737
use std::collections::hash_map::Entry;
3838
use std::fmt;
39+
use std::usize;
3940

4041
use super::promote_consts::{self, Candidate, TempState};
4142

@@ -393,8 +394,8 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> {
393394
for index in 0..mir.var_decls.len() {
394395
if !self.const_fn_arg_vars.contains(index) {
395396
self.assign(&Lvalue::Var(Var::new(index)), Location {
396-
block: BasicBlock::new(0),
397-
statement_index: 0
397+
block: bb,
398+
statement_index: usize::MAX,
398399
});
399400
}
400401
}
@@ -859,7 +860,17 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> {
859860
}
860861

861862
fn visit_statement(&mut self, bb: BasicBlock, statement: &Statement<'tcx>, location: Location) {
862-
self.nest(|this| this.super_statement(bb, statement, location));
863+
self.nest(|this| {
864+
this.visit_source_info(&statement.source_info);
865+
match statement.kind {
866+
StatementKind::Assign(ref lvalue, ref rvalue) => {
867+
this.visit_assign(bb, lvalue, rvalue, location);
868+
}
869+
StatementKind::SetDiscriminant { .. } |
870+
StatementKind::StorageLive(_) |
871+
StatementKind::StorageDead(_) => {}
872+
}
873+
});
863874
}
864875

865876
fn visit_terminator(&mut self,

0 commit comments

Comments
 (0)