-
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? |
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 ;) ) .. |
If we don't skip versions, we'll need to do the update 40+ times. Someone could reimplement this PR in |
e59670b
to
5e848a7
Compare
I've moved the script* to |
@powerboat9 I think we will be skipping versions honestly, I don't think there is much point trying to have every single version implemented at different stages during the project's life. Since the main difference between versions is unstable features, if we try and implement every single version, we will run into situations where we implement a feature and then disable it in a few version bumps. This can also happen with doing big updates obviously, but less often |
This code just makes sure that the list of recognized features is up to date |
gcc/rust/ChangeLog: * Make-lang.in: Handle source files in checks/errors/feature. * checks/errors/rust-feature-gate.cc: Move to... * checks/errors/feature/rust-feature-gate.cc: ...here. * 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. * checks/errors/rust-feature.h: Move to... * checks/errors/feature/rust-feature.h: ...here. Signed-off-by: Owen Avery <[email protected]>
This includes a program, written using flex and bison, to extract information on unstable features from rustc source code and save it to a header file. The script does fetch files from https://github.com/rust-lang/rust (the official rustc git repository), which should be alright, as it's only intended to be run by maintainers. See https://doc.rust-lang.org/unstable-book/ for information on unstable features. gcc/rust/ChangeLog: * checks/errors/feature/rust-feature-gate.cc (FeatureGate::gate): Handle removal of Feature::create. (FeatureGate::visit): Refer to AUTO_TRAITS as OPTIN_BUILTIN_TRAITS. * checks/errors/feature/rust-feature.cc (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/feature/rust-feature.h (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 member function declaration. (Feature::create): Remove static member function declaration. (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-defs.h: New file. contrib/ChangeLog: * rust/feature-fetch/parse.y: New file. * rust/feature-fetch/scan.l: New file. * rust/feature-fetch/.gitignore: New file. * rust/feature-fetch/Makefile: New file. * rust/feature-fetch/fetch: New file. * rust/feature-fetch/regen: New file. * rust/feature-fetch/copyright-stub.h: New file. Signed-off-by: Owen Avery <[email protected]>
5e848a7
to
0649f04
Compare
Now depends on #4107 |
Would it be better if I left the script out-of-tree? |
This includes a program, written using flex and bison, to extract information on unstable features from
rustc
source code and save it to a header file.The script does fetch files from https://github.com/rust-lang/rust (the official
rustc
git repository), which should be alright, as it's only intended to be run by maintainers.See https://doc.rust-lang.org/unstable-book/ for information on unstable features.