Skip to content

Commit 98255cc

Browse files
committed
Comment logic around worklist.
1 parent 7d47a91 commit 98255cc

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

compiler/rustc_mir_transform/src/const_prop_lint.rs

+3
Original file line numberDiff line numberDiff line change
@@ -675,10 +675,13 @@ impl<'tcx> Visitor<'tcx> for ConstPropagator<'_, 'tcx> {
675675
&& let Ok(constant) = value_const.try_to_int()
676676
&& let Ok(constant) = constant.to_bits(constant.size())
677677
{
678+
// We managed to evaluate the discriminant, so we know we only need to visit
679+
// one target.
678680
let target = targets.target_for_value(constant);
679681
self.worklist.push(target);
680682
return;
681683
}
684+
// We failed to evaluate the discriminant, fallback to visiting all successors.
682685
}
683686
// None of these have Operands to const-propagate.
684687
TerminatorKind::Goto { .. }

0 commit comments

Comments
 (0)