@@ -134,13 +134,13 @@ impl<Pat> Rule<Pat> {
134
134
// FIXME(eddyb) this should just work with `self: &Rc<Self>` on inherent methods,
135
135
// but that still requires `#![feature(arbitrary_self_types)]`.
136
136
trait RcRuleRuleMapMethods < Pat > : Sized {
137
- fn parse_node_kind ( & self , rules : & RuleMap < Pat > ) -> ParseNodeKind ;
138
- fn parse_node_desc ( & self , rules : & RuleMap < Pat > ) -> String ;
139
- fn fill_parse_node_shape ( & self , rules : & RuleMap < Pat > ) ;
137
+ fn parse_node_kind ( & self , rules : & RuleMap < ' _ , Pat > ) -> ParseNodeKind ;
138
+ fn parse_node_desc ( & self , rules : & RuleMap < ' _ , Pat > ) -> String ;
139
+ fn fill_parse_node_shape ( & self , rules : & RuleMap < ' _ , Pat > ) ;
140
140
}
141
141
142
142
impl < Pat : Ord + Hash + RustInputPat > RcRuleRuleMapMethods < Pat > for Rc < Rule < Pat > > {
143
- fn parse_node_kind ( & self , rules : & RuleMap < Pat > ) -> ParseNodeKind {
143
+ fn parse_node_kind ( & self , rules : & RuleMap < ' _ , Pat > ) -> ParseNodeKind {
144
144
if let Rule :: Call ( r) = & * * self {
145
145
return ParseNodeKind :: NamedRule ( r. clone ( ) ) ;
146
146
}
@@ -152,7 +152,7 @@ impl<Pat: Ord + Hash + RustInputPat> RcRuleRuleMapMethods<Pat> for Rc<Rule<Pat>>
152
152
rules. anon . borrow_mut ( ) . insert ( self . clone ( ) ) ;
153
153
ParseNodeKind :: Anon ( i)
154
154
}
155
- fn parse_node_desc ( & self , rules : & RuleMap < Pat > ) -> String {
155
+ fn parse_node_desc ( & self , rules : & RuleMap < ' _ , Pat > ) -> String {
156
156
if let Some ( desc) = rules. desc . borrow ( ) . get ( self ) {
157
157
return desc. clone ( ) ;
158
158
}
@@ -163,7 +163,7 @@ impl<Pat: Ord + Hash + RustInputPat> RcRuleRuleMapMethods<Pat> for Rc<Rule<Pat>>
163
163
}
164
164
}
165
165
// FIXME(eddyb) this probably doesn't need the "fill" API anymore.
166
- fn fill_parse_node_shape ( & self , rules : & RuleMap < Pat > ) {
166
+ fn fill_parse_node_shape ( & self , rules : & RuleMap < ' _ , Pat > ) {
167
167
if let Rule :: Call ( _) = * * self {
168
168
return ;
169
169
}
@@ -177,7 +177,7 @@ impl<Pat: Ord + Hash + RustInputPat> RcRuleRuleMapMethods<Pat> for Rc<Rule<Pat>>
177
177
}
178
178
179
179
impl < Pat : Ord + Hash + RustInputPat > Rule < Pat > {
180
- fn parse_node_desc_uncached ( & self , rules : & RuleMap < Pat > ) -> String {
180
+ fn parse_node_desc_uncached ( & self , rules : & RuleMap < ' _ , Pat > ) -> String {
181
181
match self {
182
182
Rule :: Empty => "" . to_string ( ) ,
183
183
Rule :: Eat ( pat) => pat. rust_matcher ( ) . to_pretty_string ( ) ,
@@ -215,7 +215,7 @@ impl<Pat: Ord + Hash + RustInputPat> Rule<Pat> {
215
215
216
216
fn parse_node_shape_uncached (
217
217
rc_self : & Rc < Self > ,
218
- rules : & RuleMap < Pat > ,
218
+ rules : & RuleMap < ' _ , Pat > ,
219
219
) -> ParseNodeShape < ParseNodeKind > {
220
220
match & * * rc_self {
221
221
Rule :: Empty | Rule :: Eat ( _) | Rule :: NegativeLookahead ( _) => ParseNodeShape :: Opaque ,
@@ -288,7 +288,7 @@ enum CodeLabel {
288
288
}
289
289
290
290
impl CodeLabel {
291
- fn flattened_name ( & self ) -> Cow < str > {
291
+ fn flattened_name ( & self ) -> Cow < ' _ , str > {
292
292
match self {
293
293
CodeLabel :: NamedRule ( r) => r. into ( ) ,
294
294
CodeLabel :: Nested { parent, i } => {
@@ -357,7 +357,7 @@ impl<Pat: Ord + Hash + MatchesEmpty + RustInputPat> Grammar<Pat> {
357
357
} else {
358
358
ParseNodeShape :: Alias ( rule. rule . parse_node_kind ( rules) )
359
359
} ,
360
- ty : Some ( quote ! ( #ident<_>) ) ,
360
+ ty : Some ( quote ! ( #ident<' _ , ' _ , _>) ) ,
361
361
}
362
362
} )
363
363
. chain ( rules. anon . borrow ( ) . iter ( ) . map ( |rule| ParseNode {
@@ -369,7 +369,7 @@ impl<Pat: Ord + Hash + MatchesEmpty + RustInputPat> Grammar<Pat> {
369
369
Rule :: Eat ( _) => Some ( quote ! ( [ ( ) ] ) ) ,
370
370
Rule :: Call ( r) => {
371
371
let ident = Src :: ident ( r) ;
372
- Some ( quote ! ( [ #ident<_>] ) )
372
+ Some ( quote ! ( [ #ident<' _ , ' _ , _>] ) )
373
373
}
374
374
_ => None ,
375
375
} ,
@@ -413,7 +413,7 @@ impl Continuation<'_> {
413
413
label
414
414
}
415
415
416
- fn clone ( & mut self ) -> Continuation {
416
+ fn clone ( & mut self ) -> Continuation < ' _ > {
417
417
Continuation {
418
418
code_labels : self . code_labels ,
419
419
fn_code_label : self . fn_code_label ,
@@ -464,19 +464,19 @@ impl Continuation<'_> {
464
464
}
465
465
466
466
trait ContFn {
467
- fn apply ( self , cont : Continuation ) -> Continuation ;
467
+ fn apply ( self , cont : Continuation < ' _ > ) -> Continuation < ' _ > ;
468
468
}
469
469
470
- impl < F : FnOnce ( Continuation ) -> Continuation > ContFn for F {
471
- fn apply ( self , cont : Continuation ) -> Continuation {
470
+ impl < F : FnOnce ( Continuation < ' _ > ) -> Continuation < ' _ > > ContFn for F {
471
+ fn apply ( self , cont : Continuation < ' _ > ) -> Continuation < ' _ > {
472
472
self ( cont)
473
473
}
474
474
}
475
475
476
476
struct Compose < F , G > ( F , G ) ;
477
477
478
478
impl < F : ContFn , G : ContFn > ContFn for Compose < F , G > {
479
- fn apply ( self , cont : Continuation ) -> Continuation {
479
+ fn apply ( self , cont : Continuation < ' _ > ) -> Continuation < ' _ > {
480
480
self . 1 . apply ( self . 0 . apply ( cont) )
481
481
}
482
482
}
@@ -487,7 +487,7 @@ struct Thunk<F>(F);
487
487
impl < F > Thunk < F > {
488
488
fn new ( f : F ) -> Self
489
489
where
490
- F : FnOnce ( Continuation ) -> Continuation ,
490
+ F : FnOnce ( Continuation < ' _ > ) -> Continuation < ' _ > ,
491
491
{
492
492
Thunk ( f)
493
493
}
@@ -501,7 +501,7 @@ impl<F, G> Add<Thunk<G>> for Thunk<F> {
501
501
}
502
502
503
503
impl < F : ContFn > ContFn for Thunk < F > {
504
- fn apply ( self , cont : Continuation ) -> Continuation {
504
+ fn apply ( self , cont : Continuation < ' _ > ) -> Continuation < ' _ > {
505
505
self . 0 . apply ( cont)
506
506
}
507
507
}
@@ -591,14 +591,14 @@ fn sppf_add(parse_node_kind: &ParseNodeKind, child: Src) -> Thunk<impl ContFn> {
591
591
}
592
592
593
593
trait ForEachThunk {
594
- fn for_each_thunk ( self , cont : & mut Continuation , f : impl FnMut ( Continuation ) ) ;
594
+ fn for_each_thunk ( self , cont : & mut Continuation < ' _ > , f : impl FnMut ( Continuation < ' _ > ) ) ;
595
595
}
596
596
597
597
impl < F > ForEachThunk for Thunk < F >
598
598
where
599
599
F : ContFn ,
600
600
{
601
- fn for_each_thunk ( self , cont : & mut Continuation , mut f : impl FnMut ( Continuation ) ) {
601
+ fn for_each_thunk ( self , cont : & mut Continuation < ' _ > , mut f : impl FnMut ( Continuation < ' _ > ) ) {
602
602
f ( self . apply ( cont. clone ( ) ) ) ;
603
603
}
604
604
}
@@ -608,7 +608,7 @@ where
608
608
T : ForEachThunk ,
609
609
U : ForEachThunk ,
610
610
{
611
- fn for_each_thunk ( self , cont : & mut Continuation , mut f : impl FnMut ( Continuation ) ) {
611
+ fn for_each_thunk ( self , cont : & mut Continuation < ' _ > , mut f : impl FnMut ( Continuation < ' _ > ) ) {
612
612
self . 0 . for_each_thunk ( cont, & mut f) ;
613
613
self . 1 . for_each_thunk ( cont, & mut f) ;
614
614
}
@@ -621,7 +621,7 @@ where
621
621
I : Iterator < Item = T > ,
622
622
T : ForEachThunk ,
623
623
{
624
- fn for_each_thunk ( self , cont : & mut Continuation , mut f : impl FnMut ( Continuation ) ) {
624
+ fn for_each_thunk ( self , cont : & mut Continuation < ' _ > , mut f : impl FnMut ( Continuation < ' _ > ) ) {
625
625
self . 0 . for_each ( |x| {
626
626
x. for_each_thunk ( cont, & mut f) ;
627
627
} ) ;
@@ -701,7 +701,7 @@ impl<Pat: Ord + Hash + RustInputPat> Rule<Pat> {
701
701
// but can't be `self` itself without `#![feature(arbitrary_self_types)]`.
702
702
fn generate_parse < ' a > (
703
703
& ' a self ,
704
- rc_self_and_rules : Option < ( & ' a Rc < Self > , & ' a RuleMap < Pat > ) > ,
704
+ rc_self_and_rules : Option < ( & ' a Rc < Self > , & ' a RuleMap < ' _ , Pat > ) > ,
705
705
) -> Thunk < impl ContFn + ' a > {
706
706
if let Some ( ( rc_self, _) ) = rc_self_and_rules {
707
707
assert ! ( std:: ptr:: eq( self , & * * rc_self) ) ;
@@ -804,7 +804,7 @@ impl<Pat: Ord + Hash + RustInputPat> Rule<Pat> {
804
804
}
805
805
806
806
impl < Pat : Ord + Hash + RustInputPat > Rule < Pat > {
807
- fn generate_traverse_shape ( & self , refutable : bool , rules : & RuleMap < Pat > ) -> Src {
807
+ fn generate_traverse_shape ( & self , refutable : bool , rules : & RuleMap < ' _ , Pat > ) -> Src {
808
808
match self {
809
809
Rule :: Empty
810
810
| Rule :: Eat ( _)
@@ -884,7 +884,7 @@ where
884
884
)
885
885
}
886
886
887
- fn declare_rule < Pat > ( name : & str , rule : & RuleWithNamedFields < Pat > , rules : & RuleMap < Pat > ) -> Src
887
+ fn declare_rule < Pat > ( name : & str , rule : & RuleWithNamedFields < Pat > , rules : & RuleMap < ' _ , Pat > ) -> Src
888
888
where
889
889
Pat : Ord + Hash + RustInputPat ,
890
890
{
@@ -921,7 +921,7 @@ where
921
921
} ) ;
922
922
quote ! (
923
923
#[ allow( non_camel_case_types) ]
924
- pub enum #ident<' a, ' i: ' a , I : ' a + :: gll:: runtime:: Input > {
924
+ pub enum #ident<' a, ' i, I : :: gll:: runtime:: Input > {
925
925
#( #variants) , *
926
926
}
927
927
)
@@ -938,7 +938,7 @@ where
938
938
} ;
939
939
quote ! (
940
940
#[ allow( non_camel_case_types) ]
941
- pub struct #ident<' a, ' i: ' a , I : ' a + :: gll:: runtime:: Input > {
941
+ pub struct #ident<' a, ' i, I : :: gll:: runtime:: Input > {
942
942
#( pub #fields_ident: #fields_ty) , *
943
943
#marker_field
944
944
}
@@ -954,7 +954,7 @@ fn impl_rule_from_sppf<Pat>(
954
954
name : & str ,
955
955
rule : & RuleWithNamedFields < Pat > ,
956
956
variants : Option < & [ Variant < ' _ , Pat > ] > ,
957
- rules : & RuleMap < Pat > ,
957
+ rules : & RuleMap < ' _ , Pat > ,
958
958
) -> Src
959
959
where
960
960
Pat : Ord + Hash + RustInputPat ,
@@ -1057,7 +1057,7 @@ fn impl_rule_one_and_all<Pat>(
1057
1057
name : & str ,
1058
1058
rule : & RuleWithNamedFields < Pat > ,
1059
1059
variants : Option < & [ Variant < ' _ , Pat > ] > ,
1060
- rules : & RuleMap < Pat > ,
1060
+ rules : & RuleMap < ' _ , Pat > ,
1061
1061
) -> Src
1062
1062
where
1063
1063
Pat : Ord + Hash + RustInputPat ,
@@ -1230,7 +1230,7 @@ fn rule_debug_impl<Pat>(
1230
1230
)
1231
1231
} ;
1232
1232
quote ! ( impl <I : :: gll:: runtime:: Input > fmt:: Debug for #ident<' _, ' _, I > {
1233
- fn fmt( & self , f: & mut fmt:: Formatter ) -> fmt:: Result {
1233
+ fn fmt( & self , f: & mut fmt:: Formatter < ' _> ) -> fmt:: Result {
1234
1234
#body
1235
1235
}
1236
1236
} )
@@ -1255,23 +1255,23 @@ fn rule_handle_debug_impl(name: &str, has_fields: bool) -> Src {
1255
1255
} ;
1256
1256
quote ! (
1257
1257
impl <' a, ' i, I : :: gll:: runtime:: Input > fmt:: Debug for Handle <' a, ' i, I , #ident<' a, ' i, I >> {
1258
- fn fmt( & self , f: & mut fmt:: Formatter ) -> fmt:: Result {
1258
+ fn fmt( & self , f: & mut fmt:: Formatter < ' _> ) -> fmt:: Result {
1259
1259
write!( f, "{:?}" , self . source_info( ) ) ?;
1260
1260
#body
1261
1261
Ok ( ( ) )
1262
1262
}
1263
1263
}
1264
1264
1265
1265
impl <I : :: gll:: runtime:: Input > fmt:: Debug for OwnedHandle <I , #ident<' _, ' _, I >> {
1266
- fn fmt( & self , f: & mut fmt:: Formatter ) -> fmt:: Result {
1266
+ fn fmt( & self , f: & mut fmt:: Formatter < ' _> ) -> fmt:: Result {
1267
1267
self . with( |handle| handle. fmt( f) )
1268
1268
}
1269
1269
}
1270
1270
)
1271
1271
}
1272
1272
1273
1273
fn define_parse_fn < Pat > (
1274
- rules : & RuleMap < Pat > ,
1274
+ rules : & RuleMap < ' _ , Pat > ,
1275
1275
code_labels : & mut OrderMap < Rc < CodeLabel > , usize > ,
1276
1276
) -> Src
1277
1277
where
@@ -1343,7 +1343,7 @@ fn declare_parse_node_kind(all_parse_nodes: &[ParseNode]) -> Src {
1343
1343
) *
1344
1344
}
1345
1345
impl fmt:: Display for _P {
1346
- fn fmt( & self , f: & mut fmt:: Formatter ) -> fmt:: Result {
1346
+ fn fmt( & self , f: & mut fmt:: Formatter < ' _> ) -> fmt:: Result {
1347
1347
let s = match * self {
1348
1348
#( #nodes_kind => #nodes_desc) , *
1349
1349
} ;
@@ -1380,7 +1380,7 @@ fn impl_debug_for_handle_any(all_parse_nodes: &[ParseNode]) -> Src {
1380
1380
} )
1381
1381
} ) ;
1382
1382
quote ! ( impl <I : :: gll:: runtime:: Input > fmt:: Debug for Handle <' _, ' _, I , Any > {
1383
- fn fmt( & self , f: & mut fmt:: Formatter ) -> fmt:: Result {
1383
+ fn fmt( & self , f: & mut fmt:: Formatter < ' _> ) -> fmt:: Result {
1384
1384
match self . node. kind {
1385
1385
#( #arms) *
1386
1386
_ => write!( f, "{:?}" , Handle :: <_, ( ) > {
@@ -1394,7 +1394,7 @@ fn impl_debug_for_handle_any(all_parse_nodes: &[ParseNode]) -> Src {
1394
1394
}
1395
1395
1396
1396
fn code_label_decl_and_impls < Pat > (
1397
- rules : & RuleMap < Pat > ,
1397
+ rules : & RuleMap < ' _ , Pat > ,
1398
1398
code_labels : & OrderMap < Rc < CodeLabel > , usize > ,
1399
1399
) -> Src {
1400
1400
let all_labels = rules
0 commit comments