@@ -144,7 +144,7 @@ impl<'tcx> InherentCollect<'tcx> {
144144 let id = id. owner_id . def_id ;
145145 let item_span = self . tcx . def_span ( id) ;
146146 let self_ty = self . tcx . type_of ( id) . instantiate_identity ( ) ;
147- let self_ty = peel_off_weak_aliases ( self . tcx , self_ty) ;
147+ let self_ty = self . tcx . peel_off_weak_alias_tys ( self_ty) ;
148148 match * self_ty. kind ( ) {
149149 ty:: Adt ( def, _) => self . check_def_id ( id, self_ty, def. did ( ) ) ,
150150 ty:: Foreign ( did) => self . check_def_id ( id, self_ty, did) ,
@@ -186,30 +186,3 @@ impl<'tcx> InherentCollect<'tcx> {
186186 }
187187 }
188188}
189-
190- /// Peel off all weak alias types in this type until there are none left.
191- ///
192- /// <div class="warning">
193- ///
194- /// This assumes that `ty` gets normalized later and that any overflows occurring
195- /// during said normalization get reported.
196- ///
197- /// </div>
198- fn peel_off_weak_aliases < ' tcx > ( tcx : TyCtxt < ' tcx > , mut ty : Ty < ' tcx > ) -> Ty < ' tcx > {
199- let ty:: Alias ( ty:: Weak , _) = ty. kind ( ) else { return ty } ;
200-
201- let limit = tcx. recursion_limit ( ) ;
202- let mut depth = 0 ;
203-
204- while let ty:: Alias ( ty:: Weak , alias) = ty. kind ( ) {
205- if !limit. value_within_limit ( depth) {
206- let guar = tcx. dcx ( ) . delayed_bug ( "overflow expanding weak alias type" ) ;
207- return Ty :: new_error ( tcx, guar) ;
208- }
209-
210- ty = tcx. type_of ( alias. def_id ) . instantiate ( tcx, alias. args ) ;
211- depth += 1 ;
212- }
213-
214- ty
215- }
0 commit comments