Auto merge of #77908 - bugadani:obl-forest, r=nnethercote

Try to make ObligationForest more efficient

This PR tries to decrease the number of allocations in ObligationForest, as well as moves some cold path code to an uninlined function.
This commit is contained in:
bors 2020-10-19 15:14:15 +00:00
commit f90e617305
3 changed files with 329 additions and 356 deletions

View file

@ -1,6 +1,6 @@
use crate::infer::{InferCtxt, TyOrConstInferVar};
use rustc_data_structures::obligation_forest::ProcessResult;
use rustc_data_structures::obligation_forest::{DoCompleted, Error, ForestObligation};
use rustc_data_structures::obligation_forest::{Error, ForestObligation, Outcome};
use rustc_data_structures::obligation_forest::{ObligationForest, ObligationProcessor};
use rustc_errors::ErrorReported;
use rustc_infer::traits::{TraitEngine, TraitEngineExt as _, TraitObligation};
@ -129,13 +129,11 @@ impl<'a, 'tcx> FulfillmentContext<'tcx> {
debug!("select: starting another iteration");
// Process pending obligations.
let outcome = self.predicates.process_obligations(
&mut FulfillProcessor {
let outcome: Outcome<_, _> =
self.predicates.process_obligations(&mut FulfillProcessor {
selcx,
register_region_obligations: self.register_region_obligations,
},
DoCompleted::No,
);
});
debug!("select: outcome={:#?}", outcome);
// FIXME: if we kept the original cache key, we could mark projection