Skip to content

Commit

Permalink
Rollup merge of #99156 - lcnr:omoe-wa, r=wesleywiser
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
matthiaskrgr authored Aug 2, 2022
2 parents 9d5cd21 + bf18310 commit 0629445
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 2 additions & 4 deletions compiler/rustc_infer/src/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
}
}
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_trait_selection/src/traits/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down

0 comments on commit 0629445

Please sign in to comment.