Skip to content

Commit d459b92

Browse files
committed
fix: propagate owner_fn_id of type parameters
1 parent 97ac7b1 commit d459b92

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/analyze.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ impl<'tcx> Analyzer<'tcx> {
435435
owner_fn_id,
436436
)
437437
.with_generic_args(generic_args)
438-
.with_def_id_cache(self.def_ids());
438+
.with_def_id_cache(self.def_ids(), owner_fn_id);
439439
let formula_fn = translator.to_formula_fn();
440440
deferred_formula_fn_cache
441441
.borrow_mut()

src/analyze/annot_fn.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,12 @@ impl<'tcx> AnnotFnTranslator<'tcx> {
191191
self
192192
}
193193

194-
pub fn with_def_id_cache(mut self, def_ids: DefIdCache<'tcx>) -> Self {
194+
pub fn with_def_id_cache(mut self, def_ids: DefIdCache<'tcx>, owner_fn_id: DefId) -> Self {
195195
self.def_ids = def_ids;
196196
self.type_builder = TypeBuilder::new(
197197
self.tcx,
198198
self.def_ids.clone(),
199-
self.local_def_id.to_def_id(),
199+
owner_fn_id,
200200
self.type_params.clone(),
201201
self.system.clone(),
202202
);
@@ -253,7 +253,7 @@ impl<'tcx> AnnotFnTranslator<'tcx> {
253253
.instantiate_generics(ty, self.generic_args)
254254
.unwrap_or(ty);
255255
let typing_env = mir_ty::TypingEnv::fully_monomorphized();
256-
self.tcx.normalize_erasing_regions(typing_env, instantiated)
256+
self.tcx.try_normalize_erasing_regions(typing_env, instantiated).unwrap_or(instantiated)
257257
}
258258

259259
fn pat_ty(&self, pat: &'tcx rustc_hir::Pat<'tcx>) -> mir_ty::Ty<'tcx> {
@@ -572,6 +572,7 @@ impl<'tcx> AnnotFnTranslator<'tcx> {
572572
self.type_builder.build(ty).to_sort()
573573
})
574574
.collect();
575+
tracing::debug!("register ForallPred {:?} with signature {:?}", pred, sig);
575576
self.system
576577
.borrow_mut()
577578
.register_forall_pred(pred.clone(), sig);

0 commit comments

Comments
 (0)