@@ -36,12 +36,13 @@ use crate::{
3636 consteval:: try_const_usize,
3737 db:: { HirDatabase , InternedClosure } ,
3838 from_assoc_type_id, from_foreign_def_id, from_placeholder_idx,
39+ generics:: generics,
3940 layout:: Layout ,
4041 lt_from_placeholder_idx,
4142 mapping:: from_chalk,
4243 mir:: pad16,
4344 primitive, to_assoc_type_id,
44- utils:: { self , detect_variant_from_bytes, generics , ClosureSubst } ,
45+ utils:: { self , detect_variant_from_bytes, ClosureSubst } ,
4546 AdtId , AliasEq , AliasTy , Binders , CallableDefId , CallableSig , ConcreteConst , Const ,
4647 ConstScalar , ConstValue , DomainGoal , FnAbi , GenericArg , ImplTraitId , Interner , Lifetime ,
4748 LifetimeData , LifetimeOutlives , MemoryMap , Mutability , OpaqueTy , ProjectionTy , ProjectionTyExt ,
@@ -493,7 +494,7 @@ impl HirDisplay for Const {
493494 ConstValue :: Placeholder ( idx) => {
494495 let id = from_placeholder_idx ( f. db , * idx) ;
495496 let generics = generics ( f. db . upcast ( ) , id. parent ) ;
496- let param_data = & generics. params [ id. local_id ] ;
497+ let param_data = & generics[ id. local_id ] ;
497498 write ! ( f, "{}" , param_data. name( ) . unwrap( ) . display( f. db. upcast( ) ) ) ?;
498499 Ok ( ( ) )
499500 }
@@ -988,15 +989,15 @@ impl HirDisplay for Ty {
988989
989990 if parameters. len ( Interner ) > 0 {
990991 let generics = generics ( db. upcast ( ) , def. into ( ) ) ;
991- let ( parent_len, self_ , type_, const_, impl_, lifetime) =
992+ let ( parent_len, self_param , type_, const_, impl_, lifetime) =
992993 generics. provenance_split ( ) ;
993994 let parameters = parameters. as_slice ( Interner ) ;
994995 // We print all params except implicit impl Trait params. Still a bit weird; should we leave out parent and self?
995996 if parameters. len ( ) - impl_ > 0 {
996997 // `parameters` are in the order of fn's params (including impl traits), fn's lifetimes
997998 // parent's params (those from enclosing impl or trait, if any).
998999 let ( fn_params, other) =
999- parameters. split_at ( self_ + type_ + const_ + lifetime) ;
1000+ parameters. split_at ( self_param as usize + type_ + const_ + lifetime) ;
10001001 let ( _impl, parent_params) = other. split_at ( impl_) ;
10011002 debug_assert_eq ! ( parent_params. len( ) , parent_len) ;
10021003
@@ -1215,7 +1216,7 @@ impl HirDisplay for Ty {
12151216 TyKind :: Placeholder ( idx) => {
12161217 let id = from_placeholder_idx ( db, * idx) ;
12171218 let generics = generics ( db. upcast ( ) , id. parent ) ;
1218- let param_data = & generics. params [ id. local_id ] ;
1219+ let param_data = & generics[ id. local_id ] ;
12191220 match param_data {
12201221 TypeOrConstParamData :: TypeParamData ( p) => match p. provenance {
12211222 TypeParamProvenance :: TypeParamList | TypeParamProvenance :: TraitSelf => {
@@ -1797,7 +1798,7 @@ impl HirDisplay for LifetimeData {
17971798 LifetimeData :: Placeholder ( idx) => {
17981799 let id = lt_from_placeholder_idx ( f. db , * idx) ;
17991800 let generics = generics ( f. db . upcast ( ) , id. parent ) ;
1800- let param_data = & generics. params [ id. local_id ] ;
1801+ let param_data = & generics[ id. local_id ] ;
18011802 write ! ( f, "{}" , param_data. name. display( f. db. upcast( ) ) ) ?;
18021803 Ok ( ( ) )
18031804 }
0 commit comments