-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Use #![feature(adt_const_params)] for static query flags
#151938
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
Conversation
|
r? @nnethercote rustbot has assigned @nnethercote. Use |
|
I suppose we can double-check that this doesn't affect perf. @bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Use `#![feature(adt_const_params)]` for static query flags
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (c060cb7): comparison URL. Overall result: ❌✅ regressions and improvements - no action neededBenchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf. @bors rollup=never Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 1.1%, secondary -4.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (secondary 0.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 476.042s -> 475.156s (-0.19%) |
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.
Seems fine. r=me after considering the suggested name change.
| #[derive(Clone, Copy, Debug, PartialEq, Eq)] | ||
| struct QueryFlags { | ||
| is_anon: bool, | ||
| is_depth_limit: bool, |
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.
has_depth_limit?
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 went with is_depth_limit on purpose (in the sense of “does this query have the depth_limit modifier) because I didn't want to have to think too hard about whether the more natural has_depth_limit is actually correct or subtly misleading, which would require a deeper investigation of the modifier itself.
So I think it's preferable to land this PR with is_depth_limit, because this PR makes it easier to change the name again later anyway.
| #[inline(always)] | ||
| fn anon(self) -> bool { | ||
| ANON | ||
| FLAGS.is_anon |
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.
Hmm, these methods don't have is_ prefixes...
| const FLAGS: QueryFlags = QueryFlags { | ||
| is_anon: is_anon!([$($modifiers)*]), | ||
| is_depth_limit: depth_limit!([$($modifiers)*]), | ||
| is_feedable: feedable!([$($modifiers)*]), |
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.
... but here is_anon! has an is_ prefix but the other two macros don't. More consistency would be nice.
cfdddc2 to
d91d5dd
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
d91d5dd to
09de0fd
Compare
|
(Rebased and added some field docs to |
|
I've decided to stick with the existing name @bors r=nnethercote |
|
This theoretically shouldn’t have perf impact, and the perf results look like typical noise to me, so I think this is fine for rollup. @bors rollup=maybe |
…rcote Use `#![feature(adt_const_params)]` for static query flags As suggested by rust-lang#151633 (comment), this replaces multiple clunky const booleans with a single const struct, which is a bit nicer. This should also make it easier to experiment with statically resolving other flags, like `eval_always`. There are currently no other compiler crates using `feature(adt_const_params)`, so hopefully it's mature enough for a simple use-case like this one.
…rcote Use `#![feature(adt_const_params)]` for static query flags As suggested by rust-lang#151633 (comment), this replaces multiple clunky const booleans with a single const struct, which is a bit nicer. This should also make it easier to experiment with statically resolving other flags, like `eval_always`. There are currently no other compiler crates using `feature(adt_const_params)`, so hopefully it's mature enough for a simple use-case like this one.
…uwer Rollup of 11 pull requests Successful merges: - #150992 (link modifier `export-symbols`: export all global symbols from selected uptream c static libraries) - #151695 (compiletest: Support `--extern` modifiers with `proc-macro` directive) - #151938 (Use `#![feature(adt_const_params)]` for static query flags) - #151172 (Use default field values in a few more cases) - #151825 (more float constants) - #151870 (regression test for alias-relate changes in lub) - #151902 (explain why we dont skip some of this work when there are field projections) - #151974 (Update documentation for `Result::ok()`) - #151978 (Query cleanups) - #151979 (Fix uninitialized UEFI globals in tests) - #151992 (Port `#[rustc_hidden_type_of_opaque]` to attribute parser)
…rcote Use `#![feature(adt_const_params)]` for static query flags As suggested by rust-lang#151633 (comment), this replaces multiple clunky const booleans with a single const struct, which is a bit nicer. This should also make it easier to experiment with statically resolving other flags, like `eval_always`. There are currently no other compiler crates using `feature(adt_const_params)`, so hopefully it's mature enough for a simple use-case like this one.
…uwer Rollup of 12 pull requests Successful merges: - #149596 (resolve: Report more visibility-related early resolution ambiguities for imports) - #151695 (compiletest: Support `--extern` modifiers with `proc-macro` directive) - #151938 (Use `#![feature(adt_const_params)]` for static query flags) - #151172 (Use default field values in a few more cases) - #151825 (more float constants) - #151870 (regression test for alias-relate changes in lub) - #151872 (Add inline syntax for diagnostic messages) - #151902 (explain why we dont skip some of this work when there are field projections) - #151909 (Skip overlapping spans in argument error suggestions) - #151978 (Query cleanups) - #151979 (Fix uninitialized UEFI globals in tests) - #151992 (Port `#[rustc_hidden_type_of_opaque]` to attribute parser)
…uwer Rollup of 12 pull requests Successful merges: - #149596 (resolve: Report more visibility-related early resolution ambiguities for imports) - #151695 (compiletest: Support `--extern` modifiers with `proc-macro` directive) - #151938 (Use `#![feature(adt_const_params)]` for static query flags) - #151172 (Use default field values in a few more cases) - #151825 (more float constants) - #151870 (regression test for alias-relate changes in lub) - #151872 (Add inline syntax for diagnostic messages) - #151902 (explain why we dont skip some of this work when there are field projections) - #151909 (Skip overlapping spans in argument error suggestions) - #151978 (Query cleanups) - #151979 (Fix uninitialized UEFI globals in tests) - #151992 (Port `#[rustc_hidden_type_of_opaque]` to attribute parser)
…uwer Rollup of 12 pull requests Successful merges: - #149596 (resolve: Report more visibility-related early resolution ambiguities for imports) - #151695 (compiletest: Support `--extern` modifiers with `proc-macro` directive) - #151938 (Use `#![feature(adt_const_params)]` for static query flags) - #151172 (Use default field values in a few more cases) - #151825 (more float constants) - #151870 (regression test for alias-relate changes in lub) - #151872 (Add inline syntax for diagnostic messages) - #151902 (explain why we dont skip some of this work when there are field projections) - #151909 (Skip overlapping spans in argument error suggestions) - #151978 (Query cleanups) - #151979 (Fix uninitialized UEFI globals in tests) - #151992 (Port `#[rustc_hidden_type_of_opaque]` to attribute parser)
Rollup merge of #151938 - Zalathar:adt-query-flags, r=nnethercote Use `#![feature(adt_const_params)]` for static query flags As suggested by #151633 (comment), this replaces multiple clunky const booleans with a single const struct, which is a bit nicer. This should also make it easier to experiment with statically resolving other flags, like `eval_always`. There are currently no other compiler crates using `feature(adt_const_params)`, so hopefully it's mature enough for a simple use-case like this one.
As suggested by #151633 (comment), this replaces multiple clunky const booleans with a single const struct, which is a bit nicer.
This should also make it easier to experiment with statically resolving other flags, like
eval_always.There are currently no other compiler crates using
feature(adt_const_params), so hopefully it's mature enough for a simple use-case like this one.