Return nested obligations from canonical response var unification
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
use std::mem;
|
||||
|
||||
use rustc_infer::infer::InferCtxt;
|
||||
use rustc_infer::traits::Obligation;
|
||||
use rustc_infer::traits::{
|
||||
query::NoSolution, FulfillmentError, FulfillmentErrorCode, MismatchedProjectionTypes,
|
||||
PredicateObligation, SelectionError, TraitEngine,
|
||||
@@ -61,7 +62,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentCtxt<'tcx> {
|
||||
let mut has_changed = false;
|
||||
for obligation in mem::take(&mut self.obligations) {
|
||||
let goal = obligation.clone().into();
|
||||
let (changed, certainty) = match infcx.evaluate_root_goal(goal) {
|
||||
let (changed, certainty, nested_goals) = match infcx.evaluate_root_goal(goal) {
|
||||
Ok(result) => result,
|
||||
Err(NoSolution) => {
|
||||
errors.push(FulfillmentError {
|
||||
@@ -125,7 +126,16 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentCtxt<'tcx> {
|
||||
continue;
|
||||
}
|
||||
};
|
||||
|
||||
// Push any nested goals that we get from unifying our canonical response
|
||||
// with our obligation onto the fulfillment context.
|
||||
self.obligations.extend(nested_goals.into_iter().map(|goal| {
|
||||
Obligation::new(
|
||||
infcx.tcx,
|
||||
obligation.cause.clone(),
|
||||
goal.param_env,
|
||||
goal.predicate,
|
||||
)
|
||||
}));
|
||||
has_changed |= changed;
|
||||
match certainty {
|
||||
Certainty::Yes => {}
|
||||
|
||||
Reference in New Issue
Block a user