@@ -28,31 +28,10 @@ rustc_index::newtype_index! {
28
28
29
29
#[ derive_where( Debug ; X : Cx ) ]
30
30
pub ( 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 } ,
56
35
}
57
36
58
37
#[ derive_where( Debug ; X : Cx ) ]
@@ -122,18 +101,17 @@ impl<X: Cx> SearchTree<X> {
122
101
self . nodes [ node_id] . kind = NodeKind :: CycleOnStack { entry_node_id, result }
123
102
}
124
103
125
- pub ( super ) fn finish_evaluate (
104
+ pub ( super ) fn finish_evaluation (
126
105
& mut self ,
127
106
node_id : NodeId ,
128
107
encountered_overflow : bool ,
129
108
heads : CycleHeads ,
130
109
result : X :: Result ,
131
110
) {
132
- let NodeKind :: InProgress { cycles_start } = self . nodes [ node_id] . kind else {
111
+ let NodeKind :: InProgress { cycles_start : _ } = self . nodes [ node_id] . kind else {
133
112
panic ! ( "unexpected node kind: {:?}" , self . nodes[ node_id] ) ;
134
113
} ;
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 }
137
115
}
138
116
139
117
pub ( super ) fn get_cycle ( & self , cycle_id : CycleId ) -> & Cycle < X > {
@@ -147,17 +125,15 @@ impl<X: Cx> SearchTree<X> {
147
125
pub ( super ) fn result_matches ( & self , prev : NodeId , new : NodeId ) -> bool {
148
126
match ( & self . nodes [ prev] . kind , & self . nodes [ new] . kind ) {
149
127
(
150
- NodeKind :: Regular {
151
- result : prev_result,
128
+ NodeKind :: Finished {
152
129
encountered_overflow : prev_overflow,
153
130
heads : prev_heads,
154
- cycles_start : _ ,
131
+ result : prev_result ,
155
132
} ,
156
- NodeKind :: Regular {
133
+ NodeKind :: Finished {
157
134
encountered_overflow : new_overflow,
158
135
heads : new_heads,
159
136
result : new_result,
160
- cycles_start : _,
161
137
} ,
162
138
) => {
163
139
prev_result == new_result
@@ -173,7 +149,7 @@ impl<X: Cx> SearchTree<X> {
173
149
}
174
150
175
151
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 {
177
153
let prev = * cycles_start;
178
154
* cycles_start = self . cycles . next_index ( ) ;
179
155
prev..self . cycles . next_index ( )
@@ -183,7 +159,7 @@ impl<X: Cx> SearchTree<X> {
183
159
}
184
160
185
161
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 {
187
163
heads
188
164
} else {
189
165
panic ! ( "unexpected node kind: {:?}" , self . nodes[ node_id] ) ;
0 commit comments