remove unneccessary uses of drain_fulfillment_cx
There were various places that we are invoking `drain_fulfillment_cx` with a "result" of `()`. This is kind of pointless, since it amounts to just a call to `select_all_or_error` along with some extra overhead.
This commit is contained in:
parent
52c2d87aa9
commit
b44d94a516
2 changed files with 20 additions and 17 deletions
|
|
@ -207,24 +207,27 @@ fn fulfill_implication<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>,
|
|||
for oblig in obligations.into_iter() {
|
||||
fulfill_cx.register_predicate_obligation(&infcx, oblig);
|
||||
}
|
||||
match fulfill_cx.select_all_or_error(infcx) {
|
||||
Err(errors) => {
|
||||
// no dice!
|
||||
debug!("fulfill_implication: for impls on {:?} and {:?}, could not fulfill: {:?} given \
|
||||
{:?}",
|
||||
source_trait_ref,
|
||||
target_trait_ref,
|
||||
errors,
|
||||
infcx.parameter_environment.caller_bounds);
|
||||
Err(())
|
||||
}
|
||||
|
||||
if let Err(errors) = infcx.drain_fulfillment_cx(&mut fulfill_cx, &()) {
|
||||
// no dice!
|
||||
debug!("fulfill_implication: for impls on {:?} and {:?}, could not fulfill: {:?} given \
|
||||
{:?}",
|
||||
source_trait_ref,
|
||||
target_trait_ref,
|
||||
errors,
|
||||
infcx.parameter_environment.caller_bounds);
|
||||
Err(())
|
||||
} else {
|
||||
debug!("fulfill_implication: an impl for {:?} specializes {:?}",
|
||||
source_trait_ref,
|
||||
target_trait_ref);
|
||||
Ok(()) => {
|
||||
debug!("fulfill_implication: an impl for {:?} specializes {:?}",
|
||||
source_trait_ref,
|
||||
target_trait_ref);
|
||||
|
||||
// Now resolve the *substitution* we built for the target earlier, replacing
|
||||
// the inference variables inside with whatever we got from fulfillment.
|
||||
Ok(infcx.resolve_type_vars_if_possible(&target_substs))
|
||||
// Now resolve the *substitution* we built for the target earlier, replacing
|
||||
// the inference variables inside with whatever we got from fulfillment.
|
||||
Ok(infcx.resolve_type_vars_if_possible(&target_substs))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1028,7 +1028,7 @@ pub fn normalize_and_test_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
fulfill_cx.register_predicate_obligation(&infcx, obligation);
|
||||
}
|
||||
|
||||
infcx.drain_fulfillment_cx(&mut fulfill_cx, &()).is_ok()
|
||||
fulfill_cx.select_all_or_error(infcx).is_ok()
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue