@@ -10,7 +10,7 @@ use syntax::{
1010} ;
1111
1212#[ derive( Default ) ]
13- struct Substs {
13+ struct AstSubsts {
1414 types : Vec < ast:: TypeArg > ,
1515 lifetimes : Vec < ast:: LifetimeArg > ,
1616}
@@ -42,7 +42,7 @@ type LifetimeName = String;
4242/// ```
4343pub struct PathTransform < ' a > {
4444 generic_def : Option < hir:: GenericDef > ,
45- substs : Substs ,
45+ substs : AstSubsts ,
4646 target_scope : & ' a SemanticsScope < ' a > ,
4747 source_scope : & ' a SemanticsScope < ' a > ,
4848}
@@ -80,7 +80,12 @@ impl<'a> PathTransform<'a> {
8080 target_scope : & ' a SemanticsScope < ' a > ,
8181 source_scope : & ' a SemanticsScope < ' a > ,
8282 ) -> PathTransform < ' a > {
83- PathTransform { source_scope, target_scope, generic_def : None , substs : Substs :: default ( ) }
83+ PathTransform {
84+ source_scope,
85+ target_scope,
86+ generic_def : None ,
87+ substs : AstSubsts :: default ( ) ,
88+ }
8489 }
8590
8691 pub fn apply ( & self , syntax : & SyntaxNode ) {
@@ -134,7 +139,7 @@ impl<'a> PathTransform<'a> {
134139 . into_iter ( )
135140 . flat_map ( |it| it. lifetime_params ( db) )
136141 . zip ( self . substs . lifetimes . clone ( ) )
137- . filter_map ( |( k, v) | Some ( ( k. name ( db) . to_string ( ) , v. lifetime ( ) ?) ) )
142+ . filter_map ( |( k, v) | Some ( ( k. name ( db) . display ( db . upcast ( ) ) . to_string ( ) , v. lifetime ( ) ?) ) )
138143 . collect ( ) ;
139144 Ctx { type_substs, lifetime_substs, target_module, source_scope : self . source_scope }
140145 }
@@ -279,7 +284,7 @@ impl<'a> Ctx<'a> {
279284
280285// FIXME: It would probably be nicer if we could get this via HIR (i.e. get the
281286// trait ref, and then go from the types in the substs back to the syntax).
282- fn get_syntactic_substs ( impl_def : ast:: Impl ) -> Option < Substs > {
287+ fn get_syntactic_substs ( impl_def : ast:: Impl ) -> Option < AstSubsts > {
283288 let target_trait = impl_def. trait_ ( ) ?;
284289 let path_type = match target_trait {
285290 ast:: Type :: PathType ( path) => path,
@@ -290,8 +295,8 @@ fn get_syntactic_substs(impl_def: ast::Impl) -> Option<Substs> {
290295 get_type_args_from_arg_list ( generic_arg_list)
291296}
292297
293- fn get_type_args_from_arg_list ( generic_arg_list : ast:: GenericArgList ) -> Option < Substs > {
294- let mut result = Substs :: default ( ) ;
298+ fn get_type_args_from_arg_list ( generic_arg_list : ast:: GenericArgList ) -> Option < AstSubsts > {
299+ let mut result = AstSubsts :: default ( ) ;
295300 generic_arg_list. generic_args ( ) . for_each ( |generic_arg| match generic_arg {
296301 ast:: GenericArg :: TypeArg ( type_arg) => result. types . push ( type_arg) ,
297302 ast:: GenericArg :: LifetimeArg ( l_arg) => result. lifetimes . push ( l_arg) ,
0 commit comments