@@ -46,8 +46,16 @@ impl<I: Interner> AggregateOps<I> for SlgContextOps<'_, I> {
46
46
}
47
47
} ;
48
48
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
+
49
56
// Exactly 1 unconditional answer?
50
57
let next_answer = answers. peek_answer ( & should_continue) ;
58
+ tracing:: debug!( "next_answer = {:?}" , next_answer) ;
51
59
if next_answer. is_quantum_exceeded ( ) {
52
60
if subst. value . subst . is_identity_subst ( interner) {
53
61
return Some ( Solution :: Ambig ( Guidance :: Unknown ) ) ;
@@ -83,9 +91,11 @@ impl<I: Interner> AggregateOps<I> for SlgContextOps<'_, I> {
83
91
break Guidance :: Unknown ;
84
92
}
85
93
94
+ // FIXME: This may cause us to miss some "trivially true" answers maybe? Haven't investigated very deeply.
86
95
if !answers
87
96
. any_future_answer ( |ref mut new_subst| new_subst. may_invalidate ( interner, & subst) )
88
97
{
98
+ tracing:: debug!( "any_future_answer: false" ) ;
89
99
break Guidance :: Definite ( subst) ;
90
100
}
91
101
@@ -96,7 +106,17 @@ impl<I: Interner> AggregateOps<I> for SlgContextOps<'_, I> {
96
106
}
97
107
98
108
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
+ }
100
120
AnswerResult :: Floundered => {
101
121
// FIXME: this doesn't trigger for any current tests
102
122
self . identity_constrained_subst ( root_goal)
@@ -108,6 +128,7 @@ impl<I: Interner> AggregateOps<I> for SlgContextOps<'_, I> {
108
128
break Guidance :: Suggested ( subst) ;
109
129
}
110
130
} ;
131
+ tracing:: debug!( "new_subst = {:?}" , new_subst) ;
111
132
subst = merge_into_guidance ( interner, & root_goal. canonical , subst, & new_subst) ;
112
133
num_answers += 1 ;
113
134
} ;
0 commit comments