diff --git a/pest/src/pratt_parser.rs b/pest/src/pratt_parser.rs index be75f7fa..76ffdf75 100644 --- a/pest/src/pratt_parser.rs +++ b/pest/src/pratt_parser.rs @@ -235,10 +235,10 @@ impl PrattParser { } /// Maps primary expressions with a closure `primary`. - pub fn map_primary<'pratt, 'i, X, T>( + pub fn map_primary<'pratt, 'a, 'i, X, T>( &'pratt self, primary: X, - ) -> PrattParserMap<'pratt, 'i, R, X, T> + ) -> PrattParserMap<'pratt, 'a, 'i, R, X, T> where X: FnMut(Pair<'i, R>) -> T, R: 'pratt, @@ -254,29 +254,29 @@ impl PrattParser { } } -type PrefixFn<'i, R, T> = Box, T) -> T + 'i>; -type PostfixFn<'i, R, T> = Box) -> T + 'i>; -type InfixFn<'i, R, T> = Box, T) -> T + 'i>; +type PrefixFn<'a, 'i, R, T> = Box, T) -> T + 'a>; +type PostfixFn<'a, 'i, R, T> = Box) -> T + 'a>; +type InfixFn<'a, 'i, R, T> = Box, T) -> T + 'a>; /// Product of calling [`map_primary`] on [`PrattParser`], defines how expressions should /// be mapped. /// /// [`map_primary`]: struct.PrattParser.html#method.map_primary /// [`PrattParser`]: struct.PrattParser.html -pub struct PrattParserMap<'pratt, 'i, R, F, T> +pub struct PrattParserMap<'pratt, 'a, 'i, R, F, T> where R: RuleType, F: FnMut(Pair<'i, R>) -> T, { pratt: &'pratt PrattParser, primary: F, - prefix: Option>, - postfix: Option>, - infix: Option>, + prefix: Option>, + postfix: Option>, + infix: Option>, phantom: PhantomData, } -impl<'pratt, 'i, R, F, T> PrattParserMap<'pratt, 'i, R, F, T> +impl<'pratt, 'a, 'i, R, F, T> PrattParserMap<'pratt, 'a, 'i, R, F, T> where R: RuleType + 'pratt, F: FnMut(Pair<'i, R>) -> T, @@ -284,7 +284,7 @@ where /// Maps prefix operators with closure `prefix`. pub fn map_prefix(mut self, prefix: X) -> Self where - X: FnMut(Pair<'i, R>, T) -> T + 'i, + X: FnMut(Pair<'i, R>, T) -> T + 'a, { self.prefix = Some(Box::new(prefix)); self @@ -293,7 +293,7 @@ where /// Maps postfix operators with closure `postfix`. pub fn map_postfix(mut self, postfix: X) -> Self where - X: FnMut(T, Pair<'i, R>) -> T + 'i, + X: FnMut(T, Pair<'i, R>) -> T + 'a, { self.postfix = Some(Box::new(postfix)); self @@ -302,7 +302,7 @@ where /// Maps infix operators with a closure `infix`. pub fn map_infix(mut self, infix: X) -> Self where - X: FnMut(T, Pair<'i, R>, T) -> T + 'i, + X: FnMut(T, Pair<'i, R>, T) -> T + 'a, { self.infix = Some(Box::new(infix)); self