@@ -31,7 +31,6 @@ use rustc_span::hygiene::{AstPass, MacroKind};
3131use rustc_span:: symbol:: { kw, sym, Ident , Symbol } ;
3232use rustc_span:: { self , ExpnKind } ;
3333
34- use std:: assert_matches:: assert_matches;
3534use std:: collections:: hash_map:: Entry ;
3635use std:: collections:: BTreeMap ;
3736use std:: default:: Default ;
@@ -269,15 +268,7 @@ fn clean_where_predicate<'tcx>(
269268 let bound_params = wbp
270269 . bound_generic_params
271270 . iter ( )
272- . map ( |param| {
273- // Higher-ranked params must be lifetimes.
274- // Higher-ranked lifetimes can't have bounds.
275- assert_matches ! (
276- param,
277- hir:: GenericParam { kind: hir:: GenericParamKind :: Lifetime { .. } , .. }
278- ) ;
279- Lifetime ( param. name . ident ( ) . name )
280- } )
271+ . map ( |param| clean_generic_param ( cx, None , param) )
281272 . collect ( ) ;
282273 WherePredicate :: BoundPredicate {
283274 ty : clean_ty ( wbp. bounded_ty , cx) ,
@@ -409,7 +400,7 @@ fn clean_projection_predicate<'tcx>(
409400 . collect_referenced_late_bound_regions ( & pred)
410401 . into_iter ( )
411402 . filter_map ( |br| match br {
412- ty:: BrNamed ( _, name) if br. is_named ( ) => Some ( Lifetime ( name) ) ,
403+ ty:: BrNamed ( _, name) if br. is_named ( ) => Some ( GenericParamDef :: lifetime ( name) ) ,
413404 _ => None ,
414405 } )
415406 . collect ( ) ;
@@ -507,7 +498,6 @@ fn clean_generic_param_def<'tcx>(
507498 ty:: GenericParamDefKind :: Const { has_default } => (
508499 def. name ,
509500 GenericParamDefKind :: Const {
510- did : def. def_id ,
511501 ty : Box :: new ( clean_middle_ty (
512502 ty:: Binder :: dummy (
513503 cx. tcx
@@ -577,7 +567,6 @@ fn clean_generic_param<'tcx>(
577567 hir:: GenericParamKind :: Const { ty, default } => (
578568 param. name . ident ( ) . name ,
579569 GenericParamDefKind :: Const {
580- did : param. def_id . to_def_id ( ) ,
581570 ty : Box :: new ( clean_ty ( ty, cx) ) ,
582571 default : default
583572 . map ( |ct| Box :: new ( ty:: Const :: from_anon_const ( cx. tcx , ct. def_id ) . to_string ( ) ) ) ,
@@ -830,7 +819,7 @@ fn clean_ty_generics<'tcx>(
830819 p. get_bound_params ( )
831820 . into_iter ( )
832821 . flatten ( )
833- . map ( |param| GenericParamDef :: lifetime ( param . 0 ) )
822+ . cloned ( )
834823 . collect ( ) ,
835824 ) ) ;
836825 }
0 commit comments