File tree Expand file tree Collapse file tree 1 file changed +28
-2
lines changed
src/librustc_traits/chalk_context Expand file tree Collapse file tree 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::{
2626 CanonicalVarValues ,
2727 OriginalQueryValues ,
2828 QueryResponse ,
29+ Certainty ,
2930} ;
3031use rustc:: traits:: {
3132 DomainGoal ,
@@ -132,9 +133,34 @@ impl context::AggregateOps<ChalkArenas<'gcx>> for ChalkContext<'cx, 'gcx> {
132133 fn make_solution (
133134 & self ,
134135 _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 > > ,
136137 ) -> 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+ } ) )
138164 }
139165}
140166
You can’t perform that action at this time.
0 commit comments