@@ -4,9 +4,9 @@ use crate::search_graph::SearchGraph;
4
4
use crate :: solve:: { SolveDatabase , SolveIteration } ;
5
5
use crate :: stack:: { Stack , StackDepth } ;
6
6
use crate :: { Minimums , UCanonicalGoal } ;
7
- use chalk_ir:: Fallible ;
8
7
use chalk_ir:: { interner:: Interner , NoSolution } ;
9
8
use chalk_ir:: { Canonical , ConstrainedSubst , Goal , InEnvironment , UCanonical } ;
9
+ use chalk_ir:: { Constraints , Fallible } ;
10
10
use chalk_solve:: { coinductive_goal:: IsCoinductive , RustIrDatabase , Solution } ;
11
11
use std:: fmt;
12
12
use tracing:: debug;
@@ -234,12 +234,21 @@ impl<'me, I: Interner> SolveDatabase<I> for Solver<'me, I> {
234
234
// The initial result for this table depends on whether the goal is coinductive.
235
235
let coinductive_goal = goal. is_coinductive ( self . program ) ;
236
236
let depth = self . context . stack . push ( coinductive_goal) ;
237
- let dfn = self . context . search_graph . insert (
238
- & goal,
239
- depth,
240
- coinductive_goal,
241
- self . program . interner ( ) ,
242
- ) ;
237
+ let initial_solution = if coinductive_goal {
238
+ Ok ( Solution :: Unique ( Canonical {
239
+ value : ConstrainedSubst {
240
+ subst : goal. trivial_substitution ( self . interner ( ) ) ,
241
+ constraints : Constraints :: empty ( self . interner ( ) ) ,
242
+ } ,
243
+ binders : goal. canonical . binders . clone ( ) ,
244
+ } ) )
245
+ } else {
246
+ Err ( NoSolution )
247
+ } ;
248
+ let dfn =
249
+ self . context
250
+ . search_graph
251
+ . insert ( & goal, depth, coinductive_goal, initial_solution) ;
243
252
let subgoal_minimums = self . solve_new_subgoal ( goal, depth, dfn) ;
244
253
self . context . search_graph [ dfn] . links = subgoal_minimums;
245
254
self . context . search_graph [ dfn] . stack_depth = None ;
0 commit comments