Skip to content

Conversation

@Zalathar
Copy link
Member

@Zalathar Zalathar commented Feb 1, 2026

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.

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 1, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 1, 2026

r? @nnethercote

rustbot has assigned @nnethercote.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@Zalathar
Copy link
Member Author

Zalathar commented Feb 1, 2026

I suppose we can double-check that this doesn't affect perf.

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Feb 1, 2026
Use `#![feature(adt_const_params)]` for static query flags
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 1, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 1, 2026

☀️ Try build successful (CI)
Build commit: c060cb7 (c060cb7007f9a1a44b132a83850085c1fdf74e80, parent: a1db344c0829cb682df4174e9370b60915751605)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (c060cb7): comparison URL.

Overall result: ❌✅ regressions and improvements - no action needed

Benchmarking 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
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.1% [0.0%, 0.4%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.1%] 1
All ❌✅ (primary) - - 0

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.

mean range count
Regressions ❌
(primary)
2.2% [0.9%, 3.5%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-1.0% [-1.0%, -1.0%] 1
Improvements ✅
(secondary)
-4.4% [-6.2%, -2.6%] 4
All ❌✅ (primary) 1.1% [-1.0%, 3.5%] 3

Cycles

Results (secondary 0.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
5.0% [2.5%, 7.6%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.6% [-5.5%, -3.0%] 3
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 476.042s -> 475.156s (-0.19%)
Artifact size: 397.86 MiB -> 400.01 MiB (0.54%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 1, 2026
Copy link
Contributor

@nnethercote nnethercote left a 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.

View changes since this review

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
struct QueryFlags {
is_anon: bool,
is_depth_limit: bool,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

has_depth_limit?

Copy link
Member Author

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
Copy link
Contributor

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)*]),
Copy link
Contributor

@nnethercote nnethercote Feb 2, 2026

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.

@nnethercote nnethercote added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 2, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 2, 2026

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.

@Zalathar
Copy link
Member Author

Zalathar commented Feb 2, 2026

(Rebased and added some field docs to QueryFlags.)

@Zalathar
Copy link
Member Author

Zalathar commented Feb 2, 2026

I've decided to stick with the existing name is_depth_limit; we can always change it later if we have regrets.

@bors r=nnethercote

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 2, 2026

📌 Commit 09de0fd has been approved by nnethercote

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 2, 2026
@Zalathar
Copy link
Member Author

Zalathar commented Feb 2, 2026

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

jhpratt added a commit to jhpratt/rust that referenced this pull request Feb 2, 2026
…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.
rust-bors bot pushed a commit that referenced this pull request Feb 2, 2026
Rollup of 5 pull requests

Successful merges:

 - #151938 (Use `#![feature(adt_const_params)]` for static query flags)
 - #151825 (more float constants)
 - #151974 (Update documentation for `Result::ok()`)
 - #151978 (Query cleanups)
 - #151979 (Fix uninitialized UEFI globals in tests)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 2, 2026
…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.
rust-bors bot pushed a commit that referenced this pull request Feb 2, 2026
…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)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 2, 2026
…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.
rust-bors bot pushed a commit that referenced this pull request Feb 2, 2026
…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)
rust-bors bot pushed a commit that referenced this pull request Feb 2, 2026
…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)
rust-bors bot pushed a commit that referenced this pull request Feb 3, 2026
…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)
@rust-bors rust-bors bot merged commit 1c42fd4 into rust-lang:main Feb 3, 2026
11 checks passed
rust-timer added a commit that referenced this pull request Feb 3, 2026
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.
@Zalathar Zalathar deleted the adt-query-flags branch February 3, 2026 04:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants