mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 14:01:51 +00:00
Rollup merge of #99156 - lcnr:omoe-wa, r=wesleywiser
`codegen_fulfill_obligation` expect erased regions it's a query, so by erasing regions before calling it, we get better caching. This doesn't actually change anything as its already the status quo.
This commit is contained in:
commit
0629445300
@ -8,7 +8,7 @@ pub use self::ValuePairs::*;
|
||||
use self::opaque_types::OpaqueTypeStorage;
|
||||
pub(crate) use self::undo_log::{InferCtxtUndoLogs, Snapshot, UndoLog};
|
||||
|
||||
use crate::traits::{self, ObligationCause, PredicateObligations, TraitEngine};
|
||||
use crate::traits::{self, ObligationCause, PredicateObligations, TraitEngine, TraitEngineExt};
|
||||
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
@ -645,9 +645,7 @@ impl<'tcx, T> InferOk<'tcx, T> {
|
||||
fulfill_cx: &mut dyn TraitEngine<'tcx>,
|
||||
) -> T {
|
||||
let InferOk { value, obligations } = self;
|
||||
for obligation in obligations {
|
||||
fulfill_cx.register_predicate_obligation(infcx, obligation);
|
||||
}
|
||||
fulfill_cx.register_predicate_obligations(infcx, obligations);
|
||||
value
|
||||
}
|
||||
}
|
||||
|
@ -23,8 +23,6 @@ pub fn codegen_fulfill_obligation<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
(param_env, trait_ref): (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>),
|
||||
) -> Result<&'tcx ImplSource<'tcx, ()>, CodegenObligationError> {
|
||||
// Remove any references to regions; this helps improve caching.
|
||||
let trait_ref = tcx.erase_regions(trait_ref);
|
||||
// We expect the input to be fully normalized.
|
||||
debug_assert_eq!(trait_ref, tcx.normalize_erasing_regions(param_env, trait_ref));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user