@@ -10,7 +10,7 @@ use syntax::{
10
10
} ;
11
11
12
12
#[ derive( Default ) ]
13
- struct Substs {
13
+ struct AstSubsts {
14
14
types : Vec < ast:: TypeArg > ,
15
15
lifetimes : Vec < ast:: LifetimeArg > ,
16
16
}
@@ -42,7 +42,7 @@ type LifetimeName = String;
42
42
/// ```
43
43
pub struct PathTransform < ' a > {
44
44
generic_def : Option < hir:: GenericDef > ,
45
- substs : Substs ,
45
+ substs : AstSubsts ,
46
46
target_scope : & ' a SemanticsScope < ' a > ,
47
47
source_scope : & ' a SemanticsScope < ' a > ,
48
48
}
@@ -80,7 +80,12 @@ impl<'a> PathTransform<'a> {
80
80
target_scope : & ' a SemanticsScope < ' a > ,
81
81
source_scope : & ' a SemanticsScope < ' a > ,
82
82
) -> 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
+ }
84
89
}
85
90
86
91
pub fn apply ( & self , syntax : & SyntaxNode ) {
@@ -134,7 +139,7 @@ impl<'a> PathTransform<'a> {
134
139
. into_iter ( )
135
140
. flat_map ( |it| it. lifetime_params ( db) )
136
141
. 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 ( ) ?) ) )
138
143
. collect ( ) ;
139
144
Ctx { type_substs, lifetime_substs, target_module, source_scope : self . source_scope }
140
145
}
@@ -279,7 +284,7 @@ impl<'a> Ctx<'a> {
279
284
280
285
// FIXME: It would probably be nicer if we could get this via HIR (i.e. get the
281
286
// 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 > {
283
288
let target_trait = impl_def. trait_ ( ) ?;
284
289
let path_type = match target_trait {
285
290
ast:: Type :: PathType ( path) => path,
@@ -290,8 +295,8 @@ fn get_syntactic_substs(impl_def: ast::Impl) -> Option<Substs> {
290
295
get_type_args_from_arg_list ( generic_arg_list)
291
296
}
292
297
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 ( ) ;
295
300
generic_arg_list. generic_args ( ) . for_each ( |generic_arg| match generic_arg {
296
301
ast:: GenericArg :: TypeArg ( type_arg) => result. types . push ( type_arg) ,
297
302
ast:: GenericArg :: LifetimeArg ( l_arg) => result. lifetimes . push ( l_arg) ,
0 commit comments