Handle recursive obligations without exiting the inference probe

Conflicts:
	src/librustc/middle/traits/select.rs
This commit is contained in:
Niko Matsakis 2015-01-02 13:59:32 -05:00 committed by Jorge Aparicio
parent 45468f37c8
commit fc7d8faba8
1 changed files with 13 additions and 16 deletions

View File

@ -338,24 +338,21 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
}
ty::Predicate::Projection(ref data) => {
let result = self.infcx.probe(|_| {
self.infcx.probe(|_| {
let project_obligation = obligation.with(data.clone());
project::poly_project_and_unify_type(self, &project_obligation)
});
match result {
Ok(Some(_subobligations)) => {
// TODO we should evaluate _subobligations, but doing so leads to an ICE
// self.evaluate_predicates_recursively(previous_stack,
// subobligations.iter())
EvaluatedToAmbig
match project::poly_project_and_unify_type(self, &project_obligation) {
Ok(Some(subobligations)) => {
self.evaluate_predicates_recursively(previous_stack,
subobligations.iter())
}
Ok(None) => {
EvaluatedToAmbig
}
Err(_) => {
EvaluatedToErr(Unimplemented)
}
}
Ok(None) => {
EvaluatedToAmbig
}
Err(_) => {
EvaluatedToErr(Unimplemented)
}
}
})
}
}
}