@@ -46,8 +46,16 @@ impl<I: Interner> AggregateOps<I> for SlgContextOps<'_, I> {
4646 }
4747 } ;
4848
49+ // If the answer is trivially true and thus subsumes all others, then that's a unique-enough answer for us :)
50+ if subst. value . is_identity_subst_with_no_constraints ( interner) {
51+ return Some ( Solution :: Unique ( subst) ) ;
52+ }
53+
54+ tracing:: debug!( "subst = {:?}" , subst) ;
55+
4956 // Exactly 1 unconditional answer?
5057 let next_answer = answers. peek_answer ( & should_continue) ;
58+ tracing:: debug!( "next_answer = {:?}" , next_answer) ;
5159 if next_answer. is_quantum_exceeded ( ) {
5260 if subst. value . subst . is_identity_subst ( interner) {
5361 return Some ( Solution :: Ambig ( Guidance :: Unknown ) ) ;
@@ -83,9 +91,11 @@ impl<I: Interner> AggregateOps<I> for SlgContextOps<'_, I> {
8391 break Guidance :: Unknown ;
8492 }
8593
94+ // FIXME: This may cause us to miss some "trivially true" answers maybe? Haven't investigated very deeply.
8695 if !answers
8796 . any_future_answer ( |ref mut new_subst| new_subst. may_invalidate ( interner, & subst) )
8897 {
98+ tracing:: debug!( "any_future_answer: false" ) ;
8999 break Guidance :: Definite ( subst) ;
90100 }
91101
@@ -96,7 +106,17 @@ impl<I: Interner> AggregateOps<I> for SlgContextOps<'_, I> {
96106 }
97107
98108 let new_subst = match answers. next_answer ( & should_continue) {
99- AnswerResult :: Answer ( answer1) => answer1. subst ,
109+ AnswerResult :: Answer ( answer1) => {
110+ if answer1
111+ . subst
112+ . value
113+ . is_identity_subst_with_no_constraints ( interner)
114+ {
115+ // If the answer is trivially true and thus subsumes all others, then that's a unique-enough answer for us :)
116+ return Some ( Solution :: Unique ( answer1. subst ) ) ;
117+ }
118+ answer1. subst
119+ }
100120 AnswerResult :: Floundered => {
101121 // FIXME: this doesn't trigger for any current tests
102122 self . identity_constrained_subst ( root_goal)
@@ -108,6 +128,7 @@ impl<I: Interner> AggregateOps<I> for SlgContextOps<'_, I> {
108128 break Guidance :: Suggested ( subst) ;
109129 }
110130 } ;
131+ tracing:: debug!( "new_subst = {:?}" , new_subst) ;
111132 subst = merge_into_guidance ( interner, & root_goal. canonical , subst, & new_subst) ;
112133 num_answers += 1 ;
113134 } ;
0 commit comments