Skip to content

Commit

Permalink
Allow lifetimes in function pointer return values
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Feb 1, 2025
1 parent d15bdea commit 4307f64
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ impl<'a> ParseBuffer<'a> {
/// }
/// }
/// ```
pub fn call<T>(&self, function: fn(ParseStream) -> Result<T>) -> Result<T> {
pub fn call<T>(&'a self, function: fn(ParseStream<'a>) -> Result<T>) -> Result<T> {
function(self)
}

Expand Down Expand Up @@ -732,8 +732,8 @@ impl<'a> ParseBuffer<'a> {
/// }
/// ```
pub fn parse_terminated<T, P>(
&self,
parser: fn(ParseStream) -> Result<T>,
&'a self,
parser: fn(ParseStream<'a>) -> Result<T>,
separator: P,
) -> Result<Punctuated<T, P::Token>>
where
Expand Down
12 changes: 6 additions & 6 deletions src/punctuated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,9 @@ impl<T, P> Punctuated<T, P> {
/// [`parse_terminated`]: Punctuated::parse_terminated
#[cfg(feature = "parsing")]
#[cfg_attr(docsrs, doc(cfg(feature = "parsing")))]
pub fn parse_terminated_with(
input: ParseStream,
parser: fn(ParseStream) -> Result<T>,
pub fn parse_terminated_with<'a>(
input: ParseStream<'a>,
parser: fn(ParseStream<'a>) -> Result<T>,
) -> Result<Self>
where
P: Parse,
Expand Down Expand Up @@ -357,9 +357,9 @@ impl<T, P> Punctuated<T, P> {
/// [`parse_separated_nonempty`]: Punctuated::parse_separated_nonempty
#[cfg(feature = "parsing")]
#[cfg_attr(docsrs, doc(cfg(feature = "parsing")))]
pub fn parse_separated_nonempty_with(
input: ParseStream,
parser: fn(ParseStream) -> Result<T>,
pub fn parse_separated_nonempty_with<'a>(
input: ParseStream<'a>,
parser: fn(ParseStream<'a>) -> Result<T>,
) -> Result<Self>
where
P: Token + Parse,
Expand Down

0 comments on commit 4307f64

Please sign in to comment.