@@ -9,11 +9,12 @@ use hir_expand::{
99 hygiene:: Hygiene ,
1010 name:: { name, AsName } ,
1111} ;
12- use ra_syntax:: ast:: { self , AstNode , TypeAscriptionOwner } ;
12+ use ra_syntax:: ast:: { self , AstNode , TypeAscriptionOwner , TypeBoundsOwner } ;
1313
14+ use super :: AssociatedTypeBinding ;
1415use crate :: {
1516 path:: { GenericArg , GenericArgs , ModPath , Path , PathKind } ,
16- type_ref:: TypeRef ,
17+ type_ref:: { TypeBound , TypeRef } ,
1718} ;
1819
1920pub ( super ) use lower_use:: lower_use_tree;
@@ -136,10 +137,16 @@ pub(super) fn lower_generic_args(node: ast::TypeArgList) -> Option<GenericArgs>
136137 // lifetimes ignored for now
137138 let mut bindings = Vec :: new ( ) ;
138139 for assoc_type_arg in node. assoc_type_args ( ) {
140+ let assoc_type_arg: ast:: AssocTypeArg = assoc_type_arg;
139141 if let Some ( name_ref) = assoc_type_arg. name_ref ( ) {
140142 let name = name_ref. as_name ( ) ;
141- let type_ref = TypeRef :: from_ast_opt ( assoc_type_arg. type_ref ( ) ) ;
142- bindings. push ( ( name, type_ref) ) ;
143+ let type_ref = assoc_type_arg. type_ref ( ) . map ( TypeRef :: from_ast) ;
144+ let bounds = if let Some ( l) = assoc_type_arg. type_bound_list ( ) {
145+ l. bounds ( ) . map ( TypeBound :: from_ast) . collect ( )
146+ } else {
147+ Vec :: new ( )
148+ } ;
149+ bindings. push ( AssociatedTypeBinding { name, type_ref, bounds } ) ;
143150 }
144151 }
145152 if args. is_empty ( ) && bindings. is_empty ( ) {
@@ -168,7 +175,11 @@ fn lower_generic_args_from_fn_path(
168175 }
169176 if let Some ( ret_type) = ret_type {
170177 let type_ref = TypeRef :: from_ast_opt ( ret_type. type_ref ( ) ) ;
171- bindings. push ( ( name ! [ Output ] , type_ref) )
178+ bindings. push ( AssociatedTypeBinding {
179+ name : name ! [ Output ] ,
180+ type_ref : Some ( type_ref) ,
181+ bounds : Vec :: new ( ) ,
182+ } ) ;
172183 }
173184 if args. is_empty ( ) && bindings. is_empty ( ) {
174185 None
0 commit comments