You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The return value of one of my named! parsers has a lifetime parameter. I need to make the function take a lifetime parameter. Does nom currently support this?
My situation:
pubenumExpression<'a>{String(&'a str)// other stuff...}named!(pub string_parser<Expression<'a> >,
// other stuff...);
Cargo gives:
src/expressions.rs:15:22: 15:24 error: use of undeclared lifetime name `'a` [E0261]
src/expressions.rs:15 named!(pub string_parser<&'a str>,
^~
src/expressions.rs:15:1: 19:5 note: in this expansion of named! (defined in <nom macros>)
src/expressions.rs:15:22: 15:24 help: run `rustc --explain E0261` to see a detailed explanation
'a is equal to the lifetime of the data being parsed, if that helps. Rust was able to infer that when it wasn't public, but as public it can't make that assumption.
The text was updated successfully, but these errors were encountered:
Just a few days ago, this issue was fixed in the RFC rust-lang/rfcs#1590. The PR against rustc is coming soon. So it'll be in nightly soonish. At that point, I'll probably do a personal fork of nom to add the nightly feature, unless there's a way for nom to handle nightly.
you could at least leave me some time to answer before closing ;)
named! is just a helper, you can always write your own function definition. I probably wouldn't add something that only appears in nightly, or at least I would hide it behind a feature flag.
The return value of one of my named! parsers has a lifetime parameter. I need to make the function take a lifetime parameter. Does nom currently support this?
My situation:
Cargo gives:
The expanded macro definition:
'a is equal to the lifetime of the data being parsed, if that helps. Rust was able to infer that when it wasn't public, but as public it can't make that assumption.
The text was updated successfully, but these errors were encountered: