Skip to content

Commit fc7d8fa

Browse files
nikomatsakisJorge Aparicio
authored and
Jorge Aparicio
committed
Handle recursive obligations without exiting the inference probe
Conflicts: src/librustc/middle/traits/select.rs
1 parent 45468f3 commit fc7d8fa

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

src/librustc/middle/traits/select.rs

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -338,24 +338,21 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
338338
}
339339

340340
ty::Predicate::Projection(ref data) => {
341-
let result = self.infcx.probe(|_| {
341+
self.infcx.probe(|_| {
342342
let project_obligation = obligation.with(data.clone());
343-
project::poly_project_and_unify_type(self, &project_obligation)
344-
});
345-
match result {
346-
Ok(Some(_subobligations)) => {
347-
// TODO we should evaluate _subobligations, but doing so leads to an ICE
348-
// self.evaluate_predicates_recursively(previous_stack,
349-
// subobligations.iter())
350-
EvaluatedToAmbig
351-
}
352-
Ok(None) => {
353-
EvaluatedToAmbig
354-
}
355-
Err(_) => {
356-
EvaluatedToErr(Unimplemented)
343+
match project::poly_project_and_unify_type(self, &project_obligation) {
344+
Ok(Some(subobligations)) => {
345+
self.evaluate_predicates_recursively(previous_stack,
346+
subobligations.iter())
347+
}
348+
Ok(None) => {
349+
EvaluatedToAmbig
350+
}
351+
Err(_) => {
352+
EvaluatedToErr(Unimplemented)
353+
}
357354
}
358-
}
355+
})
359356
}
360357
}
361358
}

0 commit comments

Comments
 (0)