Skip to content

Commit

Permalink
erase regions less eagerly for method calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Aurel300 committed Jul 22, 2022
1 parent 8ed4eb2 commit 1a06b91
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions prusti-interface/src/environment/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,10 +510,14 @@ impl<'tcx> Environment<'tcx> {
let param_env = self.tcx.param_env(caller_def_id);

// `resolve_instance` below requires normalized substs.
let call_substs = self.tcx.normalize_erasing_regions(param_env, call_substs);
let normalized_call_substs = self.tcx.normalize_erasing_regions(param_env, call_substs);

traits::resolve_instance(self.tcx, param_env.and((called_def_id, call_substs)))
traits::resolve_instance(self.tcx, param_env.and((called_def_id, normalized_call_substs)))
.map(|opt_instance| opt_instance
// if the resolved instance is the same as what we queried for
// anyway, ignore it: this way we keep the regions in substs
// at least for non-trait-impl method calls
.filter(|instance| instance.def_id() != called_def_id)
.map(|instance| (instance.def_id(), instance.substs))
.unwrap_or((called_def_id, call_substs)))
.unwrap_or((called_def_id, call_substs))
Expand Down

0 comments on commit 1a06b91

Please sign in to comment.