File tree 1 file changed +28
-2
lines changed
src/librustc_traits/chalk_context
1 file changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ use rustc::infer::canonical::{
26
26
CanonicalVarValues ,
27
27
OriginalQueryValues ,
28
28
QueryResponse ,
29
+ Certainty ,
29
30
} ;
30
31
use rustc:: traits:: {
31
32
DomainGoal ,
@@ -132,9 +133,34 @@ impl context::AggregateOps<ChalkArenas<'gcx>> for ChalkContext<'cx, 'gcx> {
132
133
fn make_solution (
133
134
& self ,
134
135
_root_goal : & Canonical < ' gcx , InEnvironment < ' gcx , Goal < ' gcx > > > ,
135
- _simplified_answers : impl context:: AnswerStream < ChalkArenas < ' gcx > > ,
136
+ mut simplified_answers : impl context:: AnswerStream < ChalkArenas < ' gcx > > ,
136
137
) -> Option < Canonical < ' gcx , QueryResponse < ' gcx , ( ) > > > {
137
- unimplemented ! ( )
138
+ use chalk_engine:: SimplifiedAnswer ;
139
+
140
+ if simplified_answers. peek_answer ( ) . is_none ( ) {
141
+ return None ;
142
+ }
143
+
144
+ let SimplifiedAnswer { subst, ambiguous } = simplified_answers
145
+ . next_answer ( )
146
+ . unwrap ( ) ;
147
+
148
+ let ambiguous = simplified_answers. peek_answer ( ) . is_some ( ) || ambiguous;
149
+
150
+ Some ( subst. unchecked_map ( |subst| {
151
+ QueryResponse {
152
+ var_values : subst. subst ,
153
+ region_constraints : subst. constraints
154
+ . into_iter ( )
155
+ . map ( |c| ty:: Binder :: bind ( c) )
156
+ . collect ( ) ,
157
+ certainty : match ambiguous {
158
+ true => Certainty :: Ambiguous ,
159
+ false => Certainty :: Proven ,
160
+ } ,
161
+ value : ( ) ,
162
+ }
163
+ } ) )
138
164
}
139
165
}
140
166
You can’t perform that action at this time.
0 commit comments