Skip to content

Commit 0629445

Browse files
authored
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.
2 parents 9d5cd21 + bf18310 commit 0629445

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

compiler/rustc_infer/src/infer/mod.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub use self::ValuePairs::*;
88
use self::opaque_types::OpaqueTypeStorage;
99
pub(crate) use self::undo_log::{InferCtxtUndoLogs, Snapshot, UndoLog};
1010

11-
use crate::traits::{self, ObligationCause, PredicateObligations, TraitEngine};
11+
use crate::traits::{self, ObligationCause, PredicateObligations, TraitEngine, TraitEngineExt};
1212

1313
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
1414
use rustc_data_structures::sync::Lrc;
@@ -645,9 +645,7 @@ impl<'tcx, T> InferOk<'tcx, T> {
645645
fulfill_cx: &mut dyn TraitEngine<'tcx>,
646646
) -> T {
647647
let InferOk { value, obligations } = self;
648-
for obligation in obligations {
649-
fulfill_cx.register_predicate_obligation(infcx, obligation);
650-
}
648+
fulfill_cx.register_predicate_obligations(infcx, obligations);
651649
value
652650
}
653651
}

compiler/rustc_trait_selection/src/traits/codegen.rs

-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ pub fn codegen_fulfill_obligation<'tcx>(
2323
tcx: TyCtxt<'tcx>,
2424
(param_env, trait_ref): (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>),
2525
) -> Result<&'tcx ImplSource<'tcx, ()>, CodegenObligationError> {
26-
// Remove any references to regions; this helps improve caching.
27-
let trait_ref = tcx.erase_regions(trait_ref);
2826
// We expect the input to be fully normalized.
2927
debug_assert_eq!(trait_ref, tcx.normalize_erasing_regions(param_env, trait_ref));
3028

0 commit comments

Comments
 (0)