@@ -13,9 +13,9 @@ use syntax_pos::symbol::kw;
1313
1414/// The types of pointers
1515#[ derive( Clone ) ]
16- pub enum PtrTy < ' a > {
16+ pub enum PtrTy {
1717 /// &'lifetime mut
18- Borrowed ( Option < & ' a str > , ast:: Mutability ) ,
18+ Borrowed ( Option < Ident > , ast:: Mutability ) ,
1919 /// *mut
2020 #[ allow( dead_code) ]
2121 Raw ( ast:: Mutability ) ,
@@ -26,7 +26,7 @@ pub enum PtrTy<'a> {
2626#[ derive( Clone ) ]
2727pub struct Path < ' a > {
2828 path : Vec < & ' a str > ,
29- lifetime : Option < & ' a str > ,
29+ lifetime : Option < Ident > ,
3030 params : Vec < Box < Ty < ' a > > > ,
3131 kind : PathKind ,
3232}
@@ -46,7 +46,7 @@ impl<'a> Path<'a> {
4646 Path :: new_ ( vec ! [ path] , None , Vec :: new ( ) , PathKind :: Local )
4747 }
4848 pub fn new_ < ' r > ( path : Vec < & ' r str > ,
49- lifetime : Option < & ' r str > ,
49+ lifetime : Option < Ident > ,
5050 params : Vec < Box < Ty < ' r > > > ,
5151 kind : PathKind )
5252 -> Path < ' r > {
@@ -99,22 +99,22 @@ impl<'a> Path<'a> {
9999pub enum Ty < ' a > {
100100 Self_ ,
101101 /// &/Box/ Ty
102- Ptr ( Box < Ty < ' a > > , PtrTy < ' a > ) ,
102+ Ptr ( Box < Ty < ' a > > , PtrTy ) ,
103103 /// mod::mod::Type<[lifetime], [Params...]>, including a plain type
104104 /// parameter, and things like `i32`
105105 Literal ( Path < ' a > ) ,
106106 /// includes unit
107107 Tuple ( Vec < Ty < ' a > > ) ,
108108}
109109
110- pub fn borrowed_ptrty < ' r > ( ) -> PtrTy < ' r > {
110+ pub fn borrowed_ptrty ( ) -> PtrTy {
111111 Borrowed ( None , ast:: Mutability :: Immutable )
112112}
113113pub fn borrowed ( ty : Box < Ty < ' _ > > ) -> Ty < ' _ > {
114114 Ptr ( ty, borrowed_ptrty ( ) )
115115}
116116
117- pub fn borrowed_explicit_self < ' r > ( ) -> Option < Option < PtrTy < ' r > > > {
117+ pub fn borrowed_explicit_self ( ) -> Option < Option < PtrTy > > {
118118 Some ( Some ( borrowed_ptrty ( ) ) )
119119}
120120
@@ -126,13 +126,11 @@ pub fn nil_ty<'r>() -> Ty<'r> {
126126 Tuple ( Vec :: new ( ) )
127127}
128128
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) )
133131}
134132
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 > {
136134 mk_lifetime ( cx, span, lt) . into_iter ( ) . collect ( )
137135}
138136
@@ -265,7 +263,7 @@ impl<'a> LifetimeBounds<'a> {
265263
266264pub fn get_explicit_self ( cx : & ExtCtxt < ' _ > ,
267265 span : Span ,
268- self_ptr : & Option < PtrTy < ' _ > > )
266+ self_ptr : & Option < PtrTy > )
269267 -> ( P < Expr > , ast:: ExplicitSelf ) {
270268 // this constructs a fresh `self` path
271269 let self_path = cx. expr_self ( span) ;
@@ -276,7 +274,7 @@ pub fn get_explicit_self(cx: &ExtCtxt<'_>,
276274 respan ( span,
277275 match * ptr {
278276 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 ) ) ;
280278 SelfKind :: Region ( lt, mutbl)
281279 }
282280 Raw ( _) => {
0 commit comments