This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed
compiler/rustc_middle/src/ty Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,13 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for RegionEraserVisitor<'tcx> {
44
44
}
45
45
46
46
fn fold_ty ( & mut self , ty : Ty < ' tcx > ) -> Ty < ' tcx > {
47
- if ty. has_infer ( ) { ty. super_fold_with ( self ) } else { self . tcx . erase_regions_ty ( ty) }
47
+ if !ty. has_type_flags ( TypeFlags :: HAS_BINDER_VARS | TypeFlags :: HAS_FREE_REGIONS ) {
48
+ ty
49
+ } else if ty. has_infer ( ) {
50
+ ty. super_fold_with ( self )
51
+ } else {
52
+ self . tcx . erase_regions_ty ( ty)
53
+ }
48
54
}
49
55
50
56
fn fold_binder < T > ( & mut self , t : ty:: Binder < ' tcx , T > ) -> ty:: Binder < ' tcx , T >
@@ -64,4 +70,20 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for RegionEraserVisitor<'tcx> {
64
70
_ => self . tcx . lifetimes . re_erased ,
65
71
}
66
72
}
73
+
74
+ fn fold_const ( & mut self , ct : ty:: Const < ' tcx > ) -> ty:: Const < ' tcx > {
75
+ if ct. has_type_flags ( TypeFlags :: HAS_BINDER_VARS | TypeFlags :: HAS_FREE_REGIONS ) {
76
+ ct. super_fold_with ( self )
77
+ } else {
78
+ ct
79
+ }
80
+ }
81
+
82
+ fn fold_predicate ( & mut self , p : ty:: Predicate < ' tcx > ) -> ty:: Predicate < ' tcx > {
83
+ if p. has_type_flags ( TypeFlags :: HAS_BINDER_VARS | TypeFlags :: HAS_FREE_REGIONS ) {
84
+ p. super_fold_with ( self )
85
+ } else {
86
+ p
87
+ }
88
+ }
67
89
}
You can’t perform that action at this time.
0 commit comments