Closed shayne-fletcher closed 1 year ago
never mind, i think i'm just using the tool in an unexpected way :)
FWIW, I had a look using the quick start/calc example from the grmtools book, and rustc 1.64, and wasn't able to reproduce with RUSTFLAGS="-D rust-2018-idioms" cargo build
, so if it is something that we want to support, I haven't been able to reproduce it yet
I'd disable this by injecting
#![allow(elided_lifetimes_in_paths)]
at the start of the generated module but I can't find a way to do this (is there one?)
Forgot to respond to this, I think there used to be a hack (I'm not sure if it still works, I seem to recall it might not), that you could do something to the effect of:
mod _tmp_ {
#![allow(elided_lifetimes_in_paths)]
lrpar_mod!("calc.y");
}
use _tmp_::*;
To add attributes at the start of a module, it might be worth trying that.
thanks for taking a look!
i expect it would be nice to sort out.
i have straightened out my usage scheme and a workaround. here's how i'm doing it (in case it helps somebody in some way). i'm building a crate asdl
. the crate root is asdl.rs
:
// ---
// asdl.rs
#![allow(elided_lifetimes_in_paths)]
pub mod lexer;
pub mod parser;
// ---
// lexer.rs
include!(env!("asdl_l"));
pub use asdl_l::*;
// ---
// parser.rs
include!(env!("asdl_y"));
pub use asdl_y::*;
in the presence of the lint group -Drust-2018-idioms
(or equivalently the flag -Delided-lifetimes-in-paths
) and without the #![allow(elided_lifetimes_in_paths)]
the error manifests.
seems i'm using rustc 1.64.0-dev
.
thanks again @ratmice. i'm having a great experience with these tools! 😀
I'd disable this by injecting
#![allow(elided_lifetimes_in_paths)]
at the start of the generated module but I can't find a way to do this (is there one?)Forgot to respond to this, I think there used to be a hack (I'm not sure if it still works, I seem to recall it might not), that you could do something to the effect of:
mod _tmp_ { #![allow(elided_lifetimes_in_paths)] lrpar_mod!("calc.y"); } use _tmp_::*;
To add attributes at the start of a module, it might be worth trying that.
lol. great minds think alike! ;)
in #367 we did change the code generation so this should work with that lint without hacks in the next release.
With
-D rust-2018-idioms
and warnings as errors hidden lifetime parameters in generated code are causing compilation failures e.g.I'd disable this by injecting
#![allow(elided_lifetimes_in_paths)]
at the start of the generated module but I can't find a way to do this (is there one?)