@@ -28,31 +28,10 @@ rustc_index::newtype_index! {
2828
2929#[ derive_where( Debug ; X : Cx ) ]
3030pub ( super ) enum NodeKind < X : Cx > {
31- InProgress {
32- cycles_start : CycleId ,
33- } ,
34- Regular {
35- // The result of evaluating this node. This does not change between
36- // reruns and may get accessed multiple times when rerunning parent nodes.
37- encountered_overflow : bool ,
38- heads : CycleHeads ,
39- result : X :: Result ,
40-
41- // When reevaluating the current goal, we need to know all cyclic
42- // goals to check whether changing the provisional result changes the
43- // the final result. This is only accessed when reevaluating a goal
44- // and gets reset to the `tree.cycles.next_index()` at this point.
45- // Not all of the cycles encountered while evaluating this goal actually
46- // depend on this goal itself.
47- cycles_start : CycleId ,
48- } ,
49- CycleOnStack {
50- entry_node_id : NodeId ,
51- result : X :: Result ,
52- } ,
53- ProvisionalCacheHit {
54- entry_node_id : NodeId ,
55- } ,
31+ InProgress { cycles_start : CycleId } ,
32+ Finished { encountered_overflow : bool , heads : CycleHeads , result : X :: Result } ,
33+ CycleOnStack { entry_node_id : NodeId , result : X :: Result } ,
34+ ProvisionalCacheHit { entry_node_id : NodeId } ,
5635}
5736
5837#[ derive_where( Debug ; X : Cx ) ]
@@ -122,18 +101,17 @@ impl<X: Cx> SearchTree<X> {
122101 self . nodes [ node_id] . kind = NodeKind :: CycleOnStack { entry_node_id, result }
123102 }
124103
125- pub ( super ) fn finish_evaluate (
104+ pub ( super ) fn finish_evaluation (
126105 & mut self ,
127106 node_id : NodeId ,
128107 encountered_overflow : bool ,
129108 heads : CycleHeads ,
130109 result : X :: Result ,
131110 ) {
132- let NodeKind :: InProgress { cycles_start } = self . nodes [ node_id] . kind else {
111+ let NodeKind :: InProgress { cycles_start : _ } = self . nodes [ node_id] . kind else {
133112 panic ! ( "unexpected node kind: {:?}" , self . nodes[ node_id] ) ;
134113 } ;
135- self . nodes [ node_id] . kind =
136- NodeKind :: Regular { cycles_start, encountered_overflow, heads, result }
114+ self . nodes [ node_id] . kind = NodeKind :: Finished { encountered_overflow, heads, result }
137115 }
138116
139117 pub ( super ) fn get_cycle ( & self , cycle_id : CycleId ) -> & Cycle < X > {
@@ -147,17 +125,15 @@ impl<X: Cx> SearchTree<X> {
147125 pub ( super ) fn result_matches ( & self , prev : NodeId , new : NodeId ) -> bool {
148126 match ( & self . nodes [ prev] . kind , & self . nodes [ new] . kind ) {
149127 (
150- NodeKind :: Regular {
151- result : prev_result,
128+ NodeKind :: Finished {
152129 encountered_overflow : prev_overflow,
153130 heads : prev_heads,
154- cycles_start : _ ,
131+ result : prev_result ,
155132 } ,
156- NodeKind :: Regular {
133+ NodeKind :: Finished {
157134 encountered_overflow : new_overflow,
158135 heads : new_heads,
159136 result : new_result,
160- cycles_start : _,
161137 } ,
162138 ) => {
163139 prev_result == new_result
@@ -173,7 +149,7 @@ impl<X: Cx> SearchTree<X> {
173149 }
174150
175151 pub ( super ) fn rerun_get_and_reset_cycles ( & mut self , node_id : NodeId ) -> Range < CycleId > {
176- if let NodeKind :: Regular { cycles_start, .. } = & mut self . nodes [ node_id] . kind {
152+ if let NodeKind :: InProgress { cycles_start, .. } = & mut self . nodes [ node_id] . kind {
177153 let prev = * cycles_start;
178154 * cycles_start = self . cycles . next_index ( ) ;
179155 prev..self . cycles . next_index ( )
@@ -183,7 +159,7 @@ impl<X: Cx> SearchTree<X> {
183159 }
184160
185161 pub ( super ) fn get_heads ( & self , node_id : NodeId ) -> & CycleHeads {
186- if let NodeKind :: Regular { heads, .. } = & self . nodes [ node_id] . kind {
162+ if let NodeKind :: Finished { heads, .. } = & self . nodes [ node_id] . kind {
187163 heads
188164 } else {
189165 panic ! ( "unexpected node kind: {:?}" , self . nodes[ node_id] ) ;
0 commit comments