@@ -134,13 +134,13 @@ impl<Pat> Rule<Pat> {
134134// FIXME(eddyb) this should just work with `self: &Rc<Self>` on inherent methods,
135135// but that still requires `#![feature(arbitrary_self_types)]`.
136136trait 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 > ) ;
140140}
141141
142142impl < 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 {
144144 if let Rule :: Call ( r) = & * * self {
145145 return ParseNodeKind :: NamedRule ( r. clone ( ) ) ;
146146 }
@@ -152,7 +152,7 @@ impl<Pat: Ord + Hash + RustInputPat> RcRuleRuleMapMethods<Pat> for Rc<Rule<Pat>>
152152 rules. anon . borrow_mut ( ) . insert ( self . clone ( ) ) ;
153153 ParseNodeKind :: Anon ( i)
154154 }
155- fn parse_node_desc ( & self , rules : & RuleMap < Pat > ) -> String {
155+ fn parse_node_desc ( & self , rules : & RuleMap < ' _ , Pat > ) -> String {
156156 if let Some ( desc) = rules. desc . borrow ( ) . get ( self ) {
157157 return desc. clone ( ) ;
158158 }
@@ -163,7 +163,7 @@ impl<Pat: Ord + Hash + RustInputPat> RcRuleRuleMapMethods<Pat> for Rc<Rule<Pat>>
163163 }
164164 }
165165 // 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 > ) {
167167 if let Rule :: Call ( _) = * * self {
168168 return ;
169169 }
@@ -177,7 +177,7 @@ impl<Pat: Ord + Hash + RustInputPat> RcRuleRuleMapMethods<Pat> for Rc<Rule<Pat>>
177177}
178178
179179impl < 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 {
181181 match self {
182182 Rule :: Empty => "" . to_string ( ) ,
183183 Rule :: Eat ( pat) => pat. rust_matcher ( ) . to_pretty_string ( ) ,
@@ -215,7 +215,7 @@ impl<Pat: Ord + Hash + RustInputPat> Rule<Pat> {
215215
216216 fn parse_node_shape_uncached (
217217 rc_self : & Rc < Self > ,
218- rules : & RuleMap < Pat > ,
218+ rules : & RuleMap < ' _ , Pat > ,
219219 ) -> ParseNodeShape < ParseNodeKind > {
220220 match & * * rc_self {
221221 Rule :: Empty | Rule :: Eat ( _) | Rule :: NegativeLookahead ( _) => ParseNodeShape :: Opaque ,
@@ -288,7 +288,7 @@ enum CodeLabel {
288288}
289289
290290impl CodeLabel {
291- fn flattened_name ( & self ) -> Cow < str > {
291+ fn flattened_name ( & self ) -> Cow < ' _ , str > {
292292 match self {
293293 CodeLabel :: NamedRule ( r) => r. into ( ) ,
294294 CodeLabel :: Nested { parent, i } => {
@@ -357,7 +357,7 @@ impl<Pat: Ord + Hash + MatchesEmpty + RustInputPat> Grammar<Pat> {
357357 } else {
358358 ParseNodeShape :: Alias ( rule. rule . parse_node_kind ( rules) )
359359 } ,
360- ty : Some ( quote ! ( #ident<_>) ) ,
360+ ty : Some ( quote ! ( #ident<' _ , ' _ , _>) ) ,
361361 }
362362 } )
363363 . chain ( rules. anon . borrow ( ) . iter ( ) . map ( |rule| ParseNode {
@@ -369,7 +369,7 @@ impl<Pat: Ord + Hash + MatchesEmpty + RustInputPat> Grammar<Pat> {
369369 Rule :: Eat ( _) => Some ( quote ! ( [ ( ) ] ) ) ,
370370 Rule :: Call ( r) => {
371371 let ident = Src :: ident ( r) ;
372- Some ( quote ! ( [ #ident<_>] ) )
372+ Some ( quote ! ( [ #ident<' _ , ' _ , _>] ) )
373373 }
374374 _ => None ,
375375 } ,
@@ -413,7 +413,7 @@ impl Continuation<'_> {
413413 label
414414 }
415415
416- fn clone ( & mut self ) -> Continuation {
416+ fn clone ( & mut self ) -> Continuation < ' _ > {
417417 Continuation {
418418 code_labels : self . code_labels ,
419419 fn_code_label : self . fn_code_label ,
@@ -464,19 +464,19 @@ impl Continuation<'_> {
464464}
465465
466466trait ContFn {
467- fn apply ( self , cont : Continuation ) -> Continuation ;
467+ fn apply ( self , cont : Continuation < ' _ > ) -> Continuation < ' _ > ;
468468}
469469
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 < ' _ > {
472472 self ( cont)
473473 }
474474}
475475
476476struct Compose < F , G > ( F , G ) ;
477477
478478impl < F : ContFn , G : ContFn > ContFn for Compose < F , G > {
479- fn apply ( self , cont : Continuation ) -> Continuation {
479+ fn apply ( self , cont : Continuation < ' _ > ) -> Continuation < ' _ > {
480480 self . 1 . apply ( self . 0 . apply ( cont) )
481481 }
482482}
@@ -487,7 +487,7 @@ struct Thunk<F>(F);
487487impl < F > Thunk < F > {
488488 fn new ( f : F ) -> Self
489489 where
490- F : FnOnce ( Continuation ) -> Continuation ,
490+ F : FnOnce ( Continuation < ' _ > ) -> Continuation < ' _ > ,
491491 {
492492 Thunk ( f)
493493 }
@@ -501,7 +501,7 @@ impl<F, G> Add<Thunk<G>> for Thunk<F> {
501501}
502502
503503impl < F : ContFn > ContFn for Thunk < F > {
504- fn apply ( self , cont : Continuation ) -> Continuation {
504+ fn apply ( self , cont : Continuation < ' _ > ) -> Continuation < ' _ > {
505505 self . 0 . apply ( cont)
506506 }
507507}
@@ -591,14 +591,14 @@ fn sppf_add(parse_node_kind: &ParseNodeKind, child: Src) -> Thunk<impl ContFn> {
591591}
592592
593593trait 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 < ' _ > ) ) ;
595595}
596596
597597impl < F > ForEachThunk for Thunk < F >
598598where
599599 F : ContFn ,
600600{
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 < ' _ > ) ) {
602602 f ( self . apply ( cont. clone ( ) ) ) ;
603603 }
604604}
@@ -608,7 +608,7 @@ where
608608 T : ForEachThunk ,
609609 U : ForEachThunk ,
610610{
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 < ' _ > ) ) {
612612 self . 0 . for_each_thunk ( cont, & mut f) ;
613613 self . 1 . for_each_thunk ( cont, & mut f) ;
614614 }
@@ -621,7 +621,7 @@ where
621621 I : Iterator < Item = T > ,
622622 T : ForEachThunk ,
623623{
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 < ' _ > ) ) {
625625 self . 0 . for_each ( |x| {
626626 x. for_each_thunk ( cont, & mut f) ;
627627 } ) ;
@@ -701,7 +701,7 @@ impl<Pat: Ord + Hash + RustInputPat> Rule<Pat> {
701701 // but can't be `self` itself without `#![feature(arbitrary_self_types)]`.
702702 fn generate_parse < ' a > (
703703 & ' 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 > ) > ,
705705 ) -> Thunk < impl ContFn + ' a > {
706706 if let Some ( ( rc_self, _) ) = rc_self_and_rules {
707707 assert ! ( std:: ptr:: eq( self , & * * rc_self) ) ;
@@ -804,7 +804,7 @@ impl<Pat: Ord + Hash + RustInputPat> Rule<Pat> {
804804}
805805
806806impl < 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 {
808808 match self {
809809 Rule :: Empty
810810 | Rule :: Eat ( _)
@@ -884,7 +884,7 @@ where
884884 )
885885}
886886
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
888888where
889889 Pat : Ord + Hash + RustInputPat ,
890890{
@@ -921,7 +921,7 @@ where
921921 } ) ;
922922 quote ! (
923923 #[ 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 > {
925925 #( #variants) , *
926926 }
927927 )
@@ -938,7 +938,7 @@ where
938938 } ;
939939 quote ! (
940940 #[ 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 > {
942942 #( pub #fields_ident: #fields_ty) , *
943943 #marker_field
944944 }
@@ -954,7 +954,7 @@ fn impl_rule_from_sppf<Pat>(
954954 name : & str ,
955955 rule : & RuleWithNamedFields < Pat > ,
956956 variants : Option < & [ Variant < ' _ , Pat > ] > ,
957- rules : & RuleMap < Pat > ,
957+ rules : & RuleMap < ' _ , Pat > ,
958958) -> Src
959959where
960960 Pat : Ord + Hash + RustInputPat ,
@@ -1057,7 +1057,7 @@ fn impl_rule_one_and_all<Pat>(
10571057 name : & str ,
10581058 rule : & RuleWithNamedFields < Pat > ,
10591059 variants : Option < & [ Variant < ' _ , Pat > ] > ,
1060- rules : & RuleMap < Pat > ,
1060+ rules : & RuleMap < ' _ , Pat > ,
10611061) -> Src
10621062where
10631063 Pat : Ord + Hash + RustInputPat ,
@@ -1230,7 +1230,7 @@ fn rule_debug_impl<Pat>(
12301230 )
12311231 } ;
12321232 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 {
12341234 #body
12351235 }
12361236 } )
@@ -1255,23 +1255,23 @@ fn rule_handle_debug_impl(name: &str, has_fields: bool) -> Src {
12551255 } ;
12561256 quote ! (
12571257 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 {
12591259 write!( f, "{:?}" , self . source_info( ) ) ?;
12601260 #body
12611261 Ok ( ( ) )
12621262 }
12631263 }
12641264
12651265 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 {
12671267 self . with( |handle| handle. fmt( f) )
12681268 }
12691269 }
12701270 )
12711271}
12721272
12731273fn define_parse_fn < Pat > (
1274- rules : & RuleMap < Pat > ,
1274+ rules : & RuleMap < ' _ , Pat > ,
12751275 code_labels : & mut OrderMap < Rc < CodeLabel > , usize > ,
12761276) -> Src
12771277where
@@ -1343,7 +1343,7 @@ fn declare_parse_node_kind(all_parse_nodes: &[ParseNode]) -> Src {
13431343 ) *
13441344 }
13451345 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 {
13471347 let s = match * self {
13481348 #( #nodes_kind => #nodes_desc) , *
13491349 } ;
@@ -1380,7 +1380,7 @@ fn impl_debug_for_handle_any(all_parse_nodes: &[ParseNode]) -> Src {
13801380 } )
13811381 } ) ;
13821382 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 {
13841384 match self . node. kind {
13851385 #( #arms) *
13861386 _ => write!( f, "{:?}" , Handle :: <_, ( ) > {
@@ -1394,7 +1394,7 @@ fn impl_debug_for_handle_any(all_parse_nodes: &[ParseNode]) -> Src {
13941394}
13951395
13961396fn code_label_decl_and_impls < Pat > (
1397- rules : & RuleMap < Pat > ,
1397+ rules : & RuleMap < ' _ , Pat > ,
13981398 code_labels : & OrderMap < Rc < CodeLabel > , usize > ,
13991399) -> Src {
14001400 let all_labels = rules
0 commit comments