Skip to content

Commit d340450

Browse files
committed
fold regions, don't erase
erase regions also anonymizes bound vars, which is undesirable
1 parent ee361e8 commit d340450

File tree

1 file changed

+2
-2
lines changed
  • compiler/rustc_middle/src/ty

1 file changed

+2
-2
lines changed

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -831,12 +831,12 @@ impl<'tcx> OpaqueHiddenType<'tcx> {
831831
//
832832
// We erase regions when doing this during HIR typeck.
833833
let this = match defining_scope_kind {
834-
DefiningScopeKind::HirTypeck => tcx.erase_regions(self),
834+
DefiningScopeKind::HirTypeck => fold_regions(tcx, self, |_, _| tcx.lifetimes.re_erased),
835835
DefiningScopeKind::MirBorrowck => self,
836836
};
837837
let result = this.fold_with(&mut opaque_types::ReverseMapper::new(tcx, map, self.span));
838838
if cfg!(debug_assertions) && matches!(defining_scope_kind, DefiningScopeKind::HirTypeck) {
839-
assert_eq!(result.ty, tcx.erase_regions(result.ty));
839+
assert_eq!(result.ty, fold_regions(tcx, result.ty, |_, _| tcx.lifetimes.re_erased));
840840
}
841841
result
842842
}

0 commit comments

Comments
 (0)