Skip to content

Commit 0d56034

Browse files
committed
Make comment more explicit.
1 parent b55c4f8 commit 0d56034

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

compiler/rustc_mir_transform/src/const_prop.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,8 @@ impl<'tcx> MutVisitor<'tcx> for ConstPropagator<'_, 'tcx> {
891891
fn visit_statement(&mut self, statement: &mut Statement<'tcx>, location: Location) {
892892
trace!("visit_statement: {:?}", statement);
893893

894-
// Recurse into statement before applying the assignment.
894+
// We want to evaluate operands before any change to the assigned-to value,
895+
// so we recurse first.
895896
self.super_statement(statement, location);
896897

897898
match statement.kind {

compiler/rustc_mir_transform/src/const_prop_lint.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,8 @@ impl<'tcx> Visitor<'tcx> for ConstPropagator<'_, 'tcx> {
556556
let source_info = statement.source_info;
557557
self.source_info = Some(source_info);
558558

559-
// Recurse into statement before applying the assignment.
559+
// We want to evaluate operands before any change to the assigned-to value,
560+
// so we recurse first.
560561
self.super_statement(statement, location);
561562

562563
match statement.kind {

0 commit comments

Comments
 (0)