@@ -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:: borrow:: Cow ;
3635use std:: collections:: hash_map:: Entry ;
3736use std:: collections:: BTreeMap ;
@@ -270,15 +269,7 @@ fn clean_where_predicate<'tcx>(
270269 let bound_params = wbp
271270 . bound_generic_params
272271 . iter ( )
273- . map ( |param| {
274- // Higher-ranked params must be lifetimes.
275- // Higher-ranked lifetimes can't have bounds.
276- assert_matches ! (
277- param,
278- hir:: GenericParam { kind: hir:: GenericParamKind :: Lifetime { .. } , .. }
279- ) ;
280- Lifetime ( param. name . ident ( ) . name )
281- } )
272+ . map ( |param| clean_generic_param ( cx, None , param) )
282273 . collect ( ) ;
283274 WherePredicate :: BoundPredicate {
284275 ty : clean_ty ( wbp. bounded_ty , cx) ,
@@ -410,7 +401,7 @@ fn clean_projection_predicate<'tcx>(
410401 . collect_referenced_late_bound_regions ( & pred)
411402 . into_iter ( )
412403 . filter_map ( |br| match br {
413- ty:: BrNamed ( _, name) if br. is_named ( ) => Some ( Lifetime ( name) ) ,
404+ ty:: BrNamed ( _, name) if br. is_named ( ) => Some ( GenericParamDef :: lifetime ( name) ) ,
414405 _ => None ,
415406 } )
416407 . collect ( ) ;
@@ -508,7 +499,6 @@ fn clean_generic_param_def<'tcx>(
508499 ty:: GenericParamDefKind :: Const { has_default } => (
509500 def. name ,
510501 GenericParamDefKind :: Const {
511- did : def. def_id ,
512502 ty : Box :: new ( clean_middle_ty (
513503 ty:: Binder :: dummy (
514504 cx. tcx
@@ -578,7 +568,6 @@ fn clean_generic_param<'tcx>(
578568 hir:: GenericParamKind :: Const { ty, default } => (
579569 param. name . ident ( ) . name ,
580570 GenericParamDefKind :: Const {
581- did : param. def_id . to_def_id ( ) ,
582571 ty : Box :: new ( clean_ty ( ty, cx) ) ,
583572 default : default
584573 . map ( |ct| Box :: new ( ty:: Const :: from_anon_const ( cx. tcx , ct. def_id ) . to_string ( ) ) ) ,
@@ -831,7 +820,7 @@ fn clean_ty_generics<'tcx>(
831820 p. get_bound_params ( )
832821 . into_iter ( )
833822 . flatten ( )
834- . map ( |param| GenericParamDef :: lifetime ( param . 0 ) )
823+ . cloned ( )
835824 . collect ( ) ,
836825 ) ) ;
837826 }
0 commit comments