@@ -11,7 +11,7 @@ use crate::ty::{self, DebruijnIndex, DefIdTree, List, Ty, TyCtxt, TypeFoldable};
11
11
use rustc_apfloat:: Float as _;
12
12
use rustc_ast as ast;
13
13
use rustc_attr:: { self as attr, SignedInt , UnsignedInt } ;
14
- use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
14
+ use rustc_data_structures:: fx:: FxHashSet ;
15
15
use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
16
16
use rustc_errors:: ErrorReported ;
17
17
use rustc_hir as hir;
@@ -537,7 +537,6 @@ impl<'tcx> TyCtxt<'tcx> {
537
537
) -> Result < Ty < ' tcx > , Ty < ' tcx > > {
538
538
let mut visitor = OpaqueTypeExpander {
539
539
seen_opaque_tys : FxHashSet :: default ( ) ,
540
- expanded_cache : FxHashMap :: default ( ) ,
541
540
primary_def_id : Some ( def_id) ,
542
541
found_recursion : false ,
543
542
check_recursion : true ,
@@ -557,7 +556,6 @@ struct OpaqueTypeExpander<'tcx> {
557
556
seen_opaque_tys : FxHashSet < DefId > ,
558
557
// Cache of all expansions we've seen so far. This is a critical
559
558
// optimization for some large types produced by async fn trees.
560
- expanded_cache : FxHashMap < ( DefId , SubstsRef < ' tcx > ) , Ty < ' tcx > > ,
561
559
primary_def_id : Option < DefId > ,
562
560
found_recursion : bool ,
563
561
/// Whether or not to check for recursive opaque types.
@@ -574,16 +572,9 @@ impl<'tcx> OpaqueTypeExpander<'tcx> {
574
572
}
575
573
let substs = substs. fold_with ( self ) ;
576
574
if !self . check_recursion || self . seen_opaque_tys . insert ( def_id) {
577
- let expanded_ty = match self . expanded_cache . get ( & ( def_id, substs) ) {
578
- Some ( expanded_ty) => expanded_ty,
579
- None => {
580
- let generic_ty = self . tcx . type_of ( def_id) ;
581
- let concrete_ty = generic_ty. subst ( self . tcx , substs) ;
582
- let expanded_ty = self . fold_ty ( concrete_ty) ;
583
- self . expanded_cache . insert ( ( def_id, substs) , expanded_ty) ;
584
- expanded_ty
585
- }
586
- } ;
575
+ let generic_ty = self . tcx . type_of ( def_id) ;
576
+ let concrete_ty = generic_ty. subst ( self . tcx , substs) ;
577
+ let expanded_ty = self . fold_ty ( concrete_ty) ;
587
578
if self . check_recursion {
588
579
self . seen_opaque_tys . remove ( & def_id) ;
589
580
}
@@ -1075,7 +1066,6 @@ pub fn normalize_opaque_types(
1075
1066
) -> & ' tcx List < ty:: Predicate < ' tcx > > {
1076
1067
let mut visitor = OpaqueTypeExpander {
1077
1068
seen_opaque_tys : FxHashSet :: default ( ) ,
1078
- expanded_cache : FxHashMap :: default ( ) ,
1079
1069
primary_def_id : None ,
1080
1070
found_recursion : false ,
1081
1071
check_recursion : false ,
0 commit comments