@@ -340,55 +340,10 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for MarkUsedGenericParams<'a, 'tcx> {
340340 }
341341 ty:: Param ( param) => {
342342 debug ! ( ?param) ;
343- self . unused_parameters . clear ( param. index ) ;
343+ self . unused_parameters . mark_used ( param. index ) ;
344344 ControlFlow :: CONTINUE
345345 }
346346 _ => ty. super_visit_with ( self ) ,
347347 }
348348 }
349349}
350-
351- /// Visitor used to check if a generic parameter is used.
352- struct HasUsedGenericParams < ' a > {
353- unused_parameters : & ' a FiniteBitSet < u32 > ,
354- }
355-
356- impl < ' a , ' tcx > TypeVisitor < ' tcx > for HasUsedGenericParams < ' a > {
357- type BreakTy = ( ) ;
358-
359- #[ instrument( level = "debug" , skip( self ) ) ]
360- fn visit_const ( & mut self , c : Const < ' tcx > ) -> ControlFlow < Self :: BreakTy > {
361- if !c. has_non_region_param ( ) {
362- return ControlFlow :: CONTINUE ;
363- }
364-
365- match c. kind ( ) {
366- ty:: ConstKind :: Param ( param) => {
367- if self . unused_parameters . contains ( param. index ) . unwrap_or ( false ) {
368- ControlFlow :: CONTINUE
369- } else {
370- ControlFlow :: BREAK
371- }
372- }
373- _ => c. super_visit_with ( self ) ,
374- }
375- }
376-
377- #[ instrument( level = "debug" , skip( self ) ) ]
378- fn visit_ty ( & mut self , ty : Ty < ' tcx > ) -> ControlFlow < Self :: BreakTy > {
379- if !ty. has_non_region_param ( ) {
380- return ControlFlow :: CONTINUE ;
381- }
382-
383- match ty. kind ( ) {
384- ty:: Param ( param) => {
385- if self . unused_parameters . contains ( param. index ) . unwrap_or ( false ) {
386- ControlFlow :: CONTINUE
387- } else {
388- ControlFlow :: BREAK
389- }
390- }
391- _ => ty. super_visit_with ( self ) ,
392- }
393- }
394- }
0 commit comments