-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generated code incompatible with -D rust-2018-idioms
#364
Comments
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 |
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),
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.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 seems i'm using |
thanks again @ratmice. i'm having a great experience with these tools! 😀 |
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. |
The unsafe code test was triggering a clippy lint, in fixing that it became apparent that unsafe code in the program section was being denied inadvertently. Reorganize the codegen so the generated parse tables and parse functions are in their own `mod` separate from user actions. That module now denies unsafe. User actions are kept in the parent module where unsafe is still allowed. The user provided program section is now placed at the top of the module so it may contain it's own `#![inner_attributes]`. This is a desired feature see softdevteam#364 for one instance. While this can be used it also applies the attribute to the generated code in the submodule in ways that could compilation failure. Since there is not currently a way to isolate the attributes of the parser module from the user code section, it isn't currently a documented or well supported feature.
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?)The text was updated successfully, but these errors were encountered: