Reduce rightward drift.
This commit is contained in:
parent
dd452ae70e
commit
dd78b997b5
1 changed files with 35 additions and 37 deletions
|
@ -110,11 +110,10 @@ impl<'tcx> ValueAnalysis<'tcx> for ConstAnalysis<'_, 'tcx> {
|
|||
// we must make sure that all `target as Variant#i` are `Top`.
|
||||
state.flood(target.as_ref(), self.map());
|
||||
|
||||
if let Some(target_idx) = self.map().find(target.as_ref()) {
|
||||
let Some(target_idx) = self.map().find(target.as_ref()) else { return };
|
||||
|
||||
let (variant_target, variant_index) = match **kind {
|
||||
AggregateKind::Tuple | AggregateKind::Closure(..) => {
|
||||
(Some(target_idx), None)
|
||||
}
|
||||
AggregateKind::Tuple | AggregateKind::Closure(..) => (Some(target_idx), None),
|
||||
AggregateKind::Adt(def_id, variant_index, ..) => {
|
||||
match self.tcx.def_kind(def_id) {
|
||||
DefKind::Struct => (Some(target_idx), None),
|
||||
|
@ -122,10 +121,10 @@ impl<'tcx> ValueAnalysis<'tcx> for ConstAnalysis<'_, 'tcx> {
|
|||
self.map.apply(target_idx, TrackElem::Variant(variant_index)),
|
||||
Some(variant_index),
|
||||
),
|
||||
_ => (None, None),
|
||||
_ => return,
|
||||
}
|
||||
}
|
||||
_ => (None, None),
|
||||
_ => return,
|
||||
};
|
||||
if let Some(variant_target_idx) = variant_target {
|
||||
for (field_index, operand) in operands.iter().enumerate() {
|
||||
|
@ -152,7 +151,6 @@ impl<'tcx> ValueAnalysis<'tcx> for ConstAnalysis<'_, 'tcx> {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Rvalue::CheckedBinaryOp(op, box (left, right)) => {
|
||||
// Flood everything now, so we can use `insert_value_idx` directly later.
|
||||
state.flood(target.as_ref(), self.map());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue