@@ -11,11 +11,10 @@ use rustc_span::symbol::{kw, Ident, Symbol};
11
11
use rustc_span:: Span ;
12
12
13
13
/// A path, e.g., `::std::option::Option::<i32>` (global). Has support
14
- /// for type parameters and a lifetime .
14
+ /// for type parameters.
15
15
#[ derive( Clone ) ]
16
16
pub struct Path {
17
17
path : Vec < Symbol > ,
18
- lifetime : Option < Ident > ,
19
18
params : Vec < Box < Ty > > ,
20
19
kind : PathKind ,
21
20
}
@@ -29,18 +28,13 @@ pub enum PathKind {
29
28
30
29
impl Path {
31
30
pub fn new ( path : Vec < Symbol > ) -> Path {
32
- Path :: new_ ( path, None , Vec :: new ( ) , PathKind :: Std )
31
+ Path :: new_ ( path, Vec :: new ( ) , PathKind :: Std )
33
32
}
34
33
pub fn new_local ( path : Symbol ) -> Path {
35
- Path :: new_ ( vec ! [ path] , None , Vec :: new ( ) , PathKind :: Local )
34
+ Path :: new_ ( vec ! [ path] , Vec :: new ( ) , PathKind :: Local )
36
35
}
37
- pub fn new_ (
38
- path : Vec < Symbol > ,
39
- lifetime : Option < Ident > ,
40
- params : Vec < Box < Ty > > ,
41
- kind : PathKind ,
42
- ) -> Path {
43
- Path { path, lifetime, params, kind }
36
+ pub fn new_ ( path : Vec < Symbol > , params : Vec < Box < Ty > > , kind : PathKind ) -> Path {
37
+ Path { path, params, kind }
44
38
}
45
39
46
40
pub fn to_ty (
@@ -60,10 +54,8 @@ impl Path {
60
54
self_generics : & Generics ,
61
55
) -> ast:: Path {
62
56
let mut idents = self . path . iter ( ) . map ( |s| Ident :: new ( * s, span) ) . collect ( ) ;
63
- let lt = mk_lifetimes ( cx, span, & self . lifetime ) ;
64
57
let tys = self . params . iter ( ) . map ( |t| t. to_ty ( cx, span, self_ty, self_generics) ) ;
65
- let params =
66
- lt. into_iter ( ) . map ( GenericArg :: Lifetime ) . chain ( tys. map ( GenericArg :: Type ) ) . collect ( ) ;
58
+ let params = tys. map ( GenericArg :: Type ) . collect ( ) ;
67
59
68
60
match self . kind {
69
61
PathKind :: Global => cx. path_all ( span, true , idents, params) ,
@@ -98,14 +90,6 @@ pub fn nil_ty() -> Ty {
98
90
Tuple ( Vec :: new ( ) )
99
91
}
100
92
101
- fn mk_lifetime ( cx : & ExtCtxt < ' _ > , span : Span , lt : & Option < Ident > ) -> Option < ast:: Lifetime > {
102
- lt. map ( |ident| cx. lifetime ( span, ident) )
103
- }
104
-
105
- fn mk_lifetimes ( cx : & ExtCtxt < ' _ > , span : Span , lt : & Option < Ident > ) -> Vec < ast:: Lifetime > {
106
- mk_lifetime ( cx, span, lt) . into_iter ( ) . collect ( )
107
- }
108
-
109
93
impl Ty {
110
94
pub fn to_ty (
111
95
& self ,
0 commit comments