don't replace opaque types under binders with infer vars

This commit is contained in:
Ali MJ Al-Nasrawy 2023-07-13 10:12:30 +00:00 committed by Oli Scherer
parent 11467b1c2a
commit 2e83a72964
5 changed files with 27 additions and 31 deletions

View file

@ -64,7 +64,7 @@ impl<'tcx> InferCtxt<'tcx> {
ct_op: |ct| ct,
ty_op: |ty| match *ty.kind() {
ty::Alias(ty::Opaque, ty::AliasTy { def_id, .. })
if replace_opaque_type(def_id) =>
if replace_opaque_type(def_id) && !ty.has_escaping_bound_vars() =>
{
let def_span = self.tcx.def_span(def_id);
let span = if span.contains(def_span) { def_span } else { span };