-
Notifications
You must be signed in to change notification settings - Fork 185
Improve feature handling #4082
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
base: master
Are you sure you want to change the base?
Improve feature handling #4082
Conversation
ab44d03
to
56d724e
Compare
Note that the movements of |
I think the covering note would usefully contain more information;
maybe? |
56d724e
to
191f938
Compare
This vendors some of rustc_feature 1.49 (part of rustc) and generates a list of features by parsing the vendored code. This ensures that our list of unstable rust features can be more easily kept in sync with rustc. I wrote https://github.com/powerboat9/feature-scan before I wrote this patch, but that program has a lot of unnecessary dependencies. This patch only uses flex and bison to parse the included files, instead of trying to compile them as part of a rust project that will only work with a 5 year old version of rustc. See https://doc.rust-lang.org/unstable-book/. gcc/rust/ChangeLog: * Make-lang.in: Compile feature-related source files, including a flex/bison based parser for the vendored rust files. * checks/errors/rust-feature-gate.cc: Move to... * checks/errors/feature/rust-feature-gate.cc: ...here. (FeatureGate::gate): Handle removal of Feature::create. (FeatureGate::visit): Refer to AUTO_TRAITS as OPTIN_BUILTIN_TRAITS. * checks/errors/rust-feature-gate.h: Move to... * checks/errors/feature/rust-feature-gate.h: ...here. * checks/errors/rust-feature.cc: Move to... * checks/errors/feature/rust-feature.cc: ...here. (Feature::create): Remove. (Feature::feature_list): New static member variable. (Feature::name_hash_map): Use "rust-feature-defs.h" to define. (Feature::lookup): New member function definition. * checks/errors/rust-feature.h: Move to... * checks/errors/feature/rust-feature.h: ...here. (Feature::State): Add comments. (Feature::Name): Use "rust-feature-defs.h" to define. (Feature::as_string): Make const. (Feature::name): Likewise. (Feature::state): Likewise. (Feature::issue): Likewise. (Feature::description): Remove. (Feature::create): Remove. (Feature::lookup): New member function declarations. (Feature::Feature): Adjust arguments. (Feature::m_rustc_since): Rename to... (Feature::m_rust_since): ...here. (Feature::m_description): Remove. (Feature::m_reason): New member variable. (Feature::feature_list): New static member variable. * checks/errors/feature/rust-feature-gen.l: New file. * checks/errors/feature/rust-feature-gen.y: New file. * checks/errors/feature/vendor/LICENSE-APACHE: New file. * checks/errors/feature/vendor/LICENSE-MIT: New file. * checks/errors/feature/vendor/README: New file. * checks/errors/feature/vendor/accepted.rs: New file. * checks/errors/feature/vendor/active.rs: New file. * checks/errors/feature/vendor/removed.rs: New file. Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
191f938
to
e53bff9
Compare
@iains I've added a link (https://doc.rust-lang.org/unstable-book/) and added a bit to the first paragraph of the commit message |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is the best way to go about this. The format used by rustc for declaring features is not stable, so it might as well change in version 1.90 and the parser will require modifications. I think I would rather see something simpler, but if everyone agrees with this PR's approach then I'm okay with it too
The parser will almost certainly need modifications in the future -- I'm just not sure how else to do this, aside from trying to manually update |
personally I think that manually updating I'm really not a fan of yacc/lex but as I said if others are okay with it then that's fine with me - but my opinion is that I'd rather be the one to manually update our features every time rather than maintain a yacc/lex parser |
I'd imagine that a manual process could use awk, if sed was not enough - and perhaps if it's a "once every two years" and "the result is committed to the repo" then having a built tool to do it is overkill (not a particular fan of flex/bison either .. not really a fan of awk ;) ) .. |
This vendors some of
rustc_feature 1.49
and generates a list of features by parsing the vendored code.