Skip to content

Commit 772566b

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

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
@@ -832,12 +832,12 @@ impl<'tcx> OpaqueHiddenType<'tcx> {
832832
//
833833
// We erase regions when doing this during HIR typeck.
834834
let this = match defining_scope_kind {
835-
DefiningScopeKind::HirTypeck => tcx.erase_regions(self),
835+
DefiningScopeKind::HirTypeck => fold_regions(tcx, self, |_, _| tcx.lifetimes.re_erased),
836836
DefiningScopeKind::MirBorrowck => self,
837837
};
838838
let result = this.fold_with(&mut opaque_types::ReverseMapper::new(tcx, map, self.span));
839839
if cfg!(debug_assertions) && matches!(defining_scope_kind, DefiningScopeKind::HirTypeck) {
840-
assert_eq!(result.ty, tcx.erase_regions(result.ty));
840+
assert_eq!(result.ty, fold_regions(tcx, result.ty, |_, _| tcx.lifetimes.re_erased));
841841
}
842842
result
843843
}

0 commit comments

Comments
 (0)