each_affected_by_dirty
This commit is contained in:
parent
9bd2a63f29
commit
4b44db126e
2 changed files with 20 additions and 16 deletions
|
@ -8,10 +8,10 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
|
|
||||||
use rustc_data_structures::fx::FxHashSet;
|
|
||||||
use rustc::ty::RegionVid;
|
|
||||||
use rustc::mir::Location;
|
use rustc::mir::Location;
|
||||||
|
use rustc::ty::RegionVid;
|
||||||
|
use rustc_data_structures::fx::FxHashSet;
|
||||||
|
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
|
||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use syntax_pos::Span;
|
use syntax_pos::Span;
|
||||||
|
@ -23,15 +23,11 @@ crate struct ConstraintSet {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ConstraintSet {
|
impl ConstraintSet {
|
||||||
pub fn new() -> Self {
|
|
||||||
Default::default()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn push(&mut self, constraint: OutlivesConstraint) {
|
pub fn push(&mut self, constraint: OutlivesConstraint) {
|
||||||
debug!("add_outlives({:?}: {:?} @ {:?}",
|
debug!(
|
||||||
constraint.sup,
|
"add_outlives({:?}: {:?} @ {:?}",
|
||||||
constraint.sub,
|
constraint.sup, constraint.sub, constraint.point
|
||||||
constraint.point);
|
);
|
||||||
if constraint.sup == constraint.sub {
|
if constraint.sup == constraint.sub {
|
||||||
// 'a: 'a is pretty uninteresting
|
// 'a: 'a is pretty uninteresting
|
||||||
return;
|
return;
|
||||||
|
@ -57,6 +53,17 @@ impl ConstraintSet {
|
||||||
|
|
||||||
map
|
map
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn each_affected_by_dirty(
|
||||||
|
&self,
|
||||||
|
mut opt_dep_idx: Option<ConstraintIndex>,
|
||||||
|
mut op: impl FnMut(ConstraintIndex),
|
||||||
|
) {
|
||||||
|
while let Some(dep_idx) = opt_dep_idx {
|
||||||
|
op(dep_idx);
|
||||||
|
opt_dep_idx = self.constraints[dep_idx].next;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
|
@ -105,4 +112,3 @@ impl fmt::Debug for OutlivesConstraint {
|
||||||
}
|
}
|
||||||
|
|
||||||
newtype_index!(ConstraintIndex { DEBUG_FORMAT = "ConstraintIndex({})" });
|
newtype_index!(ConstraintIndex { DEBUG_FORMAT = "ConstraintIndex({})" });
|
||||||
|
|
||||||
|
|
|
@ -466,13 +466,11 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
||||||
debug!("propagate_constraints: sub={:?}", constraint.sub);
|
debug!("propagate_constraints: sub={:?}", constraint.sub);
|
||||||
debug!("propagate_constraints: sup={:?}", constraint.sup);
|
debug!("propagate_constraints: sup={:?}", constraint.sup);
|
||||||
|
|
||||||
let mut opt_dep_idx = dependency_map[constraint.sup];
|
self.constraints.each_affected_by_dirty(dependency_map[constraint.sup], |dep_idx| {
|
||||||
while let Some(dep_idx) = opt_dep_idx {
|
|
||||||
if clean_bit_vec.remove(dep_idx.index()) {
|
if clean_bit_vec.remove(dep_idx.index()) {
|
||||||
dirty_list.push(dep_idx);
|
dirty_list.push(dep_idx);
|
||||||
}
|
}
|
||||||
opt_dep_idx = self.constraints.inner()[dep_idx].next;
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
debug!("\n");
|
debug!("\n");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue