@@ -187,6 +187,7 @@ impl GenericParams {
187187 GenericDefId :: AdtId ( AdtId :: EnumId ( id) ) => id_to_generics ! ( id) ,
188188 GenericDefId :: AdtId ( AdtId :: UnionId ( id) ) => id_to_generics ! ( id) ,
189189 GenericDefId :: TraitId ( id) => id_to_generics ! ( id) ,
190+ GenericDefId :: TraitAliasId ( id) => id_to_generics ! ( id) ,
190191 GenericDefId :: TypeAliasId ( id) => id_to_generics ! ( id) ,
191192 GenericDefId :: ImplId ( id) => id_to_generics ! ( id) ,
192193 GenericDefId :: EnumVariantId ( _) | GenericDefId :: ConstId ( _) => {
@@ -207,12 +208,10 @@ impl GenericParams {
207208 pub ( crate ) fn fill_bounds (
208209 & mut self ,
209210 lower_ctx : & LowerCtx < ' _ > ,
210- node : & dyn ast:: HasTypeBounds ,
211+ type_bounds : Option < ast:: TypeBoundList > ,
211212 target : Either < TypeRef , LifetimeRef > ,
212213 ) {
213- for bound in
214- node. type_bound_list ( ) . iter ( ) . flat_map ( |type_bound_list| type_bound_list. bounds ( ) )
215- {
214+ for bound in type_bounds. iter ( ) . flat_map ( |type_bound_list| type_bound_list. bounds ( ) ) {
216215 self . add_where_predicate_from_bound ( lower_ctx, bound, None , target. clone ( ) ) ;
217216 }
218217 }
@@ -233,7 +232,11 @@ impl GenericParams {
233232 } ;
234233 self . type_or_consts . alloc ( param. into ( ) ) ;
235234 let type_ref = TypeRef :: Path ( name. into ( ) ) ;
236- self . fill_bounds ( lower_ctx, & type_param, Either :: Left ( type_ref) ) ;
235+ self . fill_bounds (
236+ lower_ctx,
237+ type_param. type_bound_list ( ) ,
238+ Either :: Left ( type_ref) ,
239+ ) ;
237240 }
238241 ast:: TypeOrConstParam :: Const ( const_param) => {
239242 let name = const_param. name ( ) . map_or_else ( Name :: missing, |it| it. as_name ( ) ) ;
@@ -255,7 +258,11 @@ impl GenericParams {
255258 let param = LifetimeParamData { name : name. clone ( ) } ;
256259 self . lifetimes . alloc ( param) ;
257260 let lifetime_ref = LifetimeRef :: new_name ( name) ;
258- self . fill_bounds ( lower_ctx, & lifetime_param, Either :: Right ( lifetime_ref) ) ;
261+ self . fill_bounds (
262+ lower_ctx,
263+ lifetime_param. type_bound_list ( ) ,
264+ Either :: Right ( lifetime_ref) ,
265+ ) ;
259266 }
260267 }
261268
@@ -421,6 +428,10 @@ fn file_id_and_params_of(
421428 let src = it. lookup ( db) . source ( db) ;
422429 ( src. file_id , src. value . generic_param_list ( ) )
423430 }
431+ GenericDefId :: TraitAliasId ( it) => {
432+ let src = it. lookup ( db) . source ( db) ;
433+ ( src. file_id , src. value . generic_param_list ( ) )
434+ }
424435 GenericDefId :: TypeAliasId ( it) => {
425436 let src = it. lookup ( db) . source ( db) ;
426437 ( src. file_id , src. value . generic_param_list ( ) )
@@ -435,7 +446,7 @@ fn file_id_and_params_of(
435446}
436447
437448impl HasChildSource < LocalTypeOrConstParamId > for GenericDefId {
438- type Value = Either < ast:: TypeOrConstParam , ast:: Trait > ;
449+ type Value = Either < ast:: TypeOrConstParam , ast:: TraitOrAlias > ;
439450 fn child_source (
440451 & self ,
441452 db : & dyn DefDatabase ,
@@ -447,11 +458,20 @@ impl HasChildSource<LocalTypeOrConstParamId> for GenericDefId {
447458
448459 let mut params = ArenaMap :: default ( ) ;
449460
450- // For traits the first type index is `Self`, we need to add it before the other params.
451- if let GenericDefId :: TraitId ( id) = * self {
452- let trait_ref = id. lookup ( db) . source ( db) . value ;
453- let idx = idx_iter. next ( ) . unwrap ( ) ;
454- params. insert ( idx, Either :: Right ( trait_ref) ) ;
461+ // For traits and trait aliases the first type index is `Self`, we need to add it before
462+ // the other params.
463+ match * self {
464+ GenericDefId :: TraitId ( id) => {
465+ let trait_ref = id. lookup ( db) . source ( db) . value ;
466+ let idx = idx_iter. next ( ) . unwrap ( ) ;
467+ params. insert ( idx, Either :: Right ( ast:: TraitOrAlias :: Trait ( trait_ref) ) ) ;
468+ }
469+ GenericDefId :: TraitAliasId ( id) => {
470+ let alias = id. lookup ( db) . source ( db) . value ;
471+ let idx = idx_iter. next ( ) . unwrap ( ) ;
472+ params. insert ( idx, Either :: Right ( ast:: TraitOrAlias :: TraitAlias ( alias) ) ) ;
473+ }
474+ _ => { }
455475 }
456476
457477 if let Some ( generic_params_list) = generic_params_list {
0 commit comments