Closed mcandre closed 1 year ago
Hi,
I am able to use a regex initialized in lazy_static, in my grammar for some tricky {? ... } logic.
lazy_static
{? ... }
However, rustc warns that the regex is "unused". Even though it is used by the peg grammar.
I tried moving the extern crate regex; and use regex::Regex; lines into the grammar. That causes compilation to completely fail.
extern crate regex;
use regex::Regex;
I tried moving the imports into lazy_static. Same behavior: Compilation fails.
Alternatively, I could construct the regex in the grammar rule every time, but that dampens performance.
How can we get rustc to witness a grammar using a lazy_static member?
Please provide a complete example and the compiler error.
Hi,
I am able to use a regex initialized in
lazy_static
, in my grammar for some tricky{? ... }
logic.However, rustc warns that the regex is "unused". Even though it is used by the peg grammar.
I tried moving the
extern crate regex;
anduse regex::Regex;
lines into the grammar. That causes compilation to completely fail.I tried moving the imports into
lazy_static
. Same behavior: Compilation fails.Alternatively, I could construct the regex in the grammar rule every time, but that dampens performance.
How can we get rustc to witness a grammar using a
lazy_static
member?