@@ -13,9 +13,9 @@ use syntax_pos::symbol::kw;
13
13
14
14
/// The types of pointers
15
15
#[ derive( Clone ) ]
16
- pub enum PtrTy < ' a > {
16
+ pub enum PtrTy {
17
17
/// &'lifetime mut
18
- Borrowed ( Option < & ' a str > , ast:: Mutability ) ,
18
+ Borrowed ( Option < Ident > , ast:: Mutability ) ,
19
19
/// *mut
20
20
#[ allow( dead_code) ]
21
21
Raw ( ast:: Mutability ) ,
@@ -26,7 +26,7 @@ pub enum PtrTy<'a> {
26
26
#[ derive( Clone ) ]
27
27
pub struct Path < ' a > {
28
28
path : Vec < & ' a str > ,
29
- lifetime : Option < & ' a str > ,
29
+ lifetime : Option < Ident > ,
30
30
params : Vec < Box < Ty < ' a > > > ,
31
31
kind : PathKind ,
32
32
}
@@ -46,7 +46,7 @@ impl<'a> Path<'a> {
46
46
Path :: new_ ( vec ! [ path] , None , Vec :: new ( ) , PathKind :: Local )
47
47
}
48
48
pub fn new_ < ' r > ( path : Vec < & ' r str > ,
49
- lifetime : Option < & ' r str > ,
49
+ lifetime : Option < Ident > ,
50
50
params : Vec < Box < Ty < ' r > > > ,
51
51
kind : PathKind )
52
52
-> Path < ' r > {
@@ -99,22 +99,22 @@ impl<'a> Path<'a> {
99
99
pub enum Ty < ' a > {
100
100
Self_ ,
101
101
/// &/Box/ Ty
102
- Ptr ( Box < Ty < ' a > > , PtrTy < ' a > ) ,
102
+ Ptr ( Box < Ty < ' a > > , PtrTy ) ,
103
103
/// mod::mod::Type<[lifetime], [Params...]>, including a plain type
104
104
/// parameter, and things like `i32`
105
105
Literal ( Path < ' a > ) ,
106
106
/// includes unit
107
107
Tuple ( Vec < Ty < ' a > > ) ,
108
108
}
109
109
110
- pub fn borrowed_ptrty < ' r > ( ) -> PtrTy < ' r > {
110
+ pub fn borrowed_ptrty ( ) -> PtrTy {
111
111
Borrowed ( None , ast:: Mutability :: Immutable )
112
112
}
113
113
pub fn borrowed ( ty : Box < Ty < ' _ > > ) -> Ty < ' _ > {
114
114
Ptr ( ty, borrowed_ptrty ( ) )
115
115
}
116
116
117
- pub fn borrowed_explicit_self < ' r > ( ) -> Option < Option < PtrTy < ' r > > > {
117
+ pub fn borrowed_explicit_self ( ) -> Option < Option < PtrTy > > {
118
118
Some ( Some ( borrowed_ptrty ( ) ) )
119
119
}
120
120
@@ -126,13 +126,11 @@ pub fn nil_ty<'r>() -> Ty<'r> {
126
126
Tuple ( Vec :: new ( ) )
127
127
}
128
128
129
- fn mk_lifetime ( cx : & ExtCtxt < ' _ > , span : Span , lt : & Option < & str > ) -> Option < ast:: Lifetime > {
130
- lt. map ( |s|
131
- cx. lifetime ( span, Ident :: from_str ( s) )
132
- )
129
+ fn mk_lifetime ( cx : & ExtCtxt < ' _ > , span : Span , lt : & Option < Ident > ) -> Option < ast:: Lifetime > {
130
+ lt. map ( |ident| cx. lifetime ( span, ident) )
133
131
}
134
132
135
- fn mk_lifetimes ( cx : & ExtCtxt < ' _ > , span : Span , lt : & Option < & str > ) -> Vec < ast:: Lifetime > {
133
+ fn mk_lifetimes ( cx : & ExtCtxt < ' _ > , span : Span , lt : & Option < Ident > ) -> Vec < ast:: Lifetime > {
136
134
mk_lifetime ( cx, span, lt) . into_iter ( ) . collect ( )
137
135
}
138
136
@@ -265,7 +263,7 @@ impl<'a> LifetimeBounds<'a> {
265
263
266
264
pub fn get_explicit_self ( cx : & ExtCtxt < ' _ > ,
267
265
span : Span ,
268
- self_ptr : & Option < PtrTy < ' _ > > )
266
+ self_ptr : & Option < PtrTy > )
269
267
-> ( P < Expr > , ast:: ExplicitSelf ) {
270
268
// this constructs a fresh `self` path
271
269
let self_path = cx. expr_self ( span) ;
@@ -276,7 +274,7 @@ pub fn get_explicit_self(cx: &ExtCtxt<'_>,
276
274
respan ( span,
277
275
match * ptr {
278
276
Borrowed ( ref lt, mutbl) => {
279
- let lt = lt. map ( |s| cx. lifetime ( span, Ident :: from_str ( s ) ) ) ;
277
+ let lt = lt. map ( |s| cx. lifetime ( span, s ) ) ;
280
278
SelfKind :: Region ( lt, mutbl)
281
279
}
282
280
Raw ( _) => {
0 commit comments