@@ -252,10 +252,6 @@ struct Node<O: ForestObligation> {
252252 obligation : O ,
253253 state : Cell < NodeState > ,
254254
255- /// A predicate (and its key) can change during processing. If it does we need to register the
256- /// old predicate so that we can remove or mark it as done if this node errors or is done.
257- alternative_predicates : Vec < O :: CacheKey > ,
258-
259255 /// Obligations that depend on this obligation for their completion. They
260256 /// must all be in a non-pending state.
261257 dependents : Vec < NodeIndex > ,
@@ -291,7 +287,6 @@ where
291287 Node {
292288 obligation,
293289 state : Cell :: new ( NodeState :: Pending ) ,
294- alternative_predicates : vec ! [ ] ,
295290 dependents : if let Some ( parent_index) = parent { vec ! [ parent_index] } else { vec ! [ ] } ,
296291 reverse_dependents : vec ! [ ] ,
297292 has_parent : parent. is_some ( ) ,
@@ -316,7 +311,6 @@ where
316311 self . state
317312 ) ;
318313 self . state . set ( NodeState :: Pending ) ;
319- self . alternative_predicates . clear ( ) ;
320314 self . dependents . clear ( ) ;
321315 self . reverse_dependents . clear ( ) ;
322316 if let Some ( parent_index) = parent {
@@ -625,6 +619,7 @@ impl<O: ForestObligation> ObligationForest<O> {
625619 . drain ( ..)
626620 . map ( |index| Unblocked { index, order : nodes[ index] . node_number } ) ,
627621 ) ;
622+
628623 while let Some ( Unblocked { index, .. } ) = self . unblocked . pop ( ) {
629624 // Skip any duplicates since we only need to processes the node once
630625 if self . unblocked . peek ( ) . map ( |u| u. index ) == Some ( index) {
@@ -665,12 +660,7 @@ impl<O: ForestObligation> ObligationForest<O> {
665660 // `self.active_cache`. This means that `self.active_cache` can get
666661 // out of sync with `nodes`. It's not very common, but it does
667662 // happen, and code in `compress` has to allow for it.
668- let before = node. obligation . as_cache_key ( ) ;
669663 let result = processor. process_obligation ( & mut node. obligation ) ;
670- let after = node. obligation . as_cache_key ( ) ;
671- if before != after {
672- node. alternative_predicates . push ( before) ;
673- }
674664
675665 self . unblock_nodes ( processor) ;
676666 let node = & mut self . nodes [ index] ;
@@ -940,16 +930,10 @@ impl<O: ForestObligation> ObligationForest<O> {
940930 match node. state . get ( ) {
941931 NodeState :: Done => {
942932 // Mark as done
943- if let Some ( opt) = self . active_cache . get_mut ( & node. obligation . as_cache_key ( ) ) {
944- * opt = CacheState :: Done ;
945- }
946- // If the node's predicate changed at some point we mark all its alternate
947- // predicates as done as well
948- for alt in & node. alternative_predicates {
949- if let Some ( opt) = self . active_cache . get_mut ( alt) {
950- * opt = CacheState :: Done ;
951- }
952- }
933+ * self
934+ . active_cache
935+ . entry ( node. obligation . as_cache_key ( ) )
936+ . or_insert ( CacheState :: Done ) = CacheState :: Done ;
953937
954938 if do_completed == DoCompleted :: Yes {
955939 // Extract the success stories.
@@ -965,11 +949,6 @@ impl<O: ForestObligation> ObligationForest<O> {
965949 // tests must come up with a different type on every type error they
966950 // check against.
967951 self . active_cache . remove ( & node. obligation . as_cache_key ( ) ) ;
968- // If the node's predicate changed at some point we remove all its alternate
969- // predicates as well
970- for alt in & node. alternative_predicates {
971- self . active_cache . remove ( alt) ;
972- }
973952 self . insert_into_error_cache ( index) ;
974953 self . dead_nodes . push ( index) ;
975954 }
0 commit comments