@@ -124,8 +124,8 @@ impl<'tcx> ReuseableProvisionalCacheEntry<'tcx> {
124124 let actual = match stack[ stack_depth] . provisional_result {
125125 Some ( actual) => actual,
126126 None => {
127- let is_coinductive_cycle =
128- self . is_coinductive && SearchGraph :: stack_coinductive_from ( tcx, stack, stack_depth) ;
127+ let is_coinductive_cycle = self . is_coinductive
128+ && SearchGraph :: stack_coinductive_from ( tcx, stack, stack_depth) ;
129129 let input = stack[ stack_depth] . input ;
130130 if is_coinductive_cycle {
131131 SearchGraph :: response_no_constraints ( tcx, input, Certainty :: Yes )
@@ -265,20 +265,24 @@ impl<'tcx> CycleData<'tcx> {
265265 let mut heads = entry. heads ;
266266
267267 for head in heads. iter ( ) . copied ( ) {
268- let is_coinductive_cycle =
269- entry . is_coinductive && SearchGraph :: stack_coinductive_from ( tcx, stack, head) ;
270-
268+ let is_coinductive_cycle = entry . is_coinductive
269+ && SearchGraph :: stack_coinductive_from ( tcx, stack, head) ;
270+
271271 if is_coinductive_cycle {
272272 stack[ head] . has_been_used |= HasBeenUsed :: COINDUCTIVE_CYCLE
273273 } else {
274274 stack[ head] . has_been_used |= HasBeenUsed :: INDUCTIVE_CYCLE
275275 } ;
276276 }
277277 heads. push ( stack. next_index ( ) ) ;
278- cache_entry. with_inductive_stack =
279- Some ( DetachedEntry { heads : heads. clone ( ) , result : entry. result } ) ;
280- cache_entry. with_coinductive_stack =
281- Some ( DetachedEntry { heads, result : entry. result } ) ;
278+
279+ if entry. is_coinductive {
280+ cache_entry. with_coinductive_stack =
281+ Some ( DetachedEntry { heads, result : entry. result } ) ;
282+ } else {
283+ cache_entry. with_inductive_stack =
284+ Some ( DetachedEntry { heads : heads. clone ( ) , result : entry. result } ) ;
285+ }
282286 }
283287 }
284288 Some ( result. result )
0 commit comments