Skip to content

Pass on the feedable query modifier to macros#151546

Merged
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
Zoxc:feedable-macro-fix
Feb 4, 2026
Merged

Pass on the feedable query modifier to macros#151546
rust-bors[bot] merged 1 commit intorust-lang:mainfrom
Zoxc:feedable-macro-fix

Conversation

@Zoxc
Copy link
Contributor

@Zoxc Zoxc commented Jan 23, 2026

This passes on the feedable query modifier to macros so QueryConfig.feedable gives the correct result. Currently it's always false even for feedable queries.

Fixing this bug enables some consistency checks for feedable queries that were previously not being performed, which has a perf impact.

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 23, 2026
@Zoxc Zoxc marked this pull request as ready for review January 23, 2026 20:49
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 23, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 23, 2026

r? @madsmtm

rustbot has assigned @madsmtm.
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

@Zoxc
Copy link
Contributor Author

Zoxc commented Jan 23, 2026

cc @cjgillot as this presumedly runs previously untested feedable code.

@Zoxc
Copy link
Contributor Author

Zoxc commented Jan 24, 2026

@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 Jan 24, 2026
Pass on the `feedable` query modifier to macros
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 24, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 24, 2026

☀️ Try build successful (CI)
Build commit: 916de6d (916de6dcaa7f609d89ba28a816ecb6f8d0c106e4, parent: d222ddc4d90743dfc1e53b610be8fc9d95893d2c)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (916de6d): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

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.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@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.4% [0.2%, 0.9%] 15
Regressions ❌
(secondary)
0.5% [0.0%, 0.9%] 42
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.0% [-0.1%, -0.0%] 2
All ❌✅ (primary) 0.4% [0.2%, 0.9%] 15

Max RSS (memory usage)

Results (primary -1.8%, secondary -2.9%)

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)
4.0% [3.0%, 4.9%] 2
Improvements ✅
(primary)
-1.8% [-1.8%, -1.8%] 1
Improvements ✅
(secondary)
-4.7% [-6.7%, -1.7%] 8
All ❌✅ (primary) -1.8% [-1.8%, -1.8%] 1

Cycles

Results (secondary -0.6%)

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)
3.0% [1.5%, 5.0%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.2% [-4.5%, -3.5%] 4
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 470.684s -> 471.728s (0.22%)
Artifact size: 383.48 MiB -> 385.81 MiB (0.61%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jan 24, 2026
@Zoxc
Copy link
Contributor Author

Zoxc commented Feb 3, 2026

r? @Zalathar

@rustbot rustbot assigned Zalathar and unassigned madsmtm Feb 3, 2026
@Zalathar
Copy link
Member

Zalathar commented Feb 3, 2026

It's scary that feedable! was wrong this whole time, but I think the only code that's actually affected is the if query.feedable() in execute_job, which just performs some additional assertions (and was previously dead).

@Zalathar
Copy link
Member

Zalathar commented Feb 4, 2026

We should definitely forward the feedable modifier, but I'm not sure what we should do about the currently-dead code.

@Zalathar
Copy link
Member

Zalathar commented Feb 4, 2026

This is the formerly-dead code that gets enabled by properly forwarding the feedable modifier:

if query.feedable() {
// We should not compute queries that also got a value via feeding.
// This can't happen, as query feeding adds the very dependencies to the fed query
// as its feeding query had. So if the fed query is red, so is its feeder, which will
// get evaluated first, and re-feed the query.
if let Some((cached_result, _)) = cache.lookup(&key) {
let Some(hasher) = query.hash_result() else {
panic!(
"no_hash fed query later has its value computed.\n\
Remove `no_hash` modifier to allow recomputation.\n\
The already cached value: {}",
(query.format_value())(&cached_result)
);
};
let (old_hash, new_hash) = qcx.dep_context().with_stable_hashing_context(|mut hcx| {
(hasher(&mut hcx, &cached_result), hasher(&mut hcx, &result))
});
let formatter = query.format_value();
if old_hash != new_hash {
// We have an inconsistency. This can happen if one of the two
// results is tainted by errors.
assert!(
qcx.dep_context().sess().dcx().has_errors().is_some(),
"Computed query value for {:?}({:?}) is inconsistent with fed value,\n\
computed={:#?}\nfed={:#?}",
query.dep_kind(),
key,
formatter(&result),
formatter(&cached_result),
);
}
}
}

@Zoxc
Copy link
Contributor Author

Zoxc commented Feb 4, 2026

It looks reasonable to me, checking that computed and fed results match, if that happens. Presumedly resuming from a query cycle can cause an edge case causing them to diverge. We probably want to know if that doesn't hold and it's already approved / merged.

@Zalathar
Copy link
Member

Zalathar commented Feb 4, 2026

I guess it's the compute-side equivalent of the hash consistency check in query_feed, which runs when feeding a value that was previously fed/computed.

And to some extent we can consider the perf hit to be offsetting the gains from #96840, which expanded these checks.

@Zalathar
Copy link
Member

Zalathar commented Feb 4, 2026

OK, let's merge this. The perf impact seems in line with what we would accept for correctness fixes, and the no-longer-dead code was reviewed and approved in the past, and matches what we do when feeding values that have already been fed/computed.

We can always consider a revert if objections come up.

I'll edit the PR description to add a bit more context on the consistency checks.

@bors r+

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 4, 2026

📌 Commit 33b77c8 has been approved by Zalathar

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-review Status: Awaiting review from the assignee but also interested parties. labels Feb 4, 2026
@rust-bors

This comment has been minimized.

@rust-bors rust-bors bot added the merged-by-bors This PR was explicitly merged by bors. label Feb 4, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 4, 2026

☀️ Test successful - CI
Approved by: Zalathar
Duration: 4h 28s
Pushing 794495e to main...

@rust-bors rust-bors bot removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Feb 4, 2026
@rust-bors rust-bors bot merged commit 794495e into rust-lang:main Feb 4, 2026
13 checks passed
@rustbot rustbot added this to the 1.95.0 milestone Feb 4, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 1d05e3c (parent) -> 794495e (this PR)

Test differences

No test diffs found

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 794495e2b4a1353cf7b66ffc55f0e755490af2cc --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. aarch64-apple: 2h 58m -> 3h 53m (+31.0%)
  2. dist-aarch64-llvm-mingw: 1h 35m -> 1h 53m (+18.5%)
  3. aarch64-gnu-llvm-20-1: 1h 2m -> 1h 10m (+12.7%)
  4. dist-apple-various: 1h 3m -> 1h 11m (+12.1%)
  5. x86_64-gnu-llvm-20-1: 1h 7m -> 1h 14m (+10.8%)
  6. dist-arm-linux-gnueabi: 1h 21m -> 1h 29m (+10.4%)
  7. dist-aarch64-apple: 2h 21m -> 2h 8m (-9.4%)
  8. dist-arm-linux-musl: 1h 41m -> 1h 33m (-7.6%)
  9. x86_64-msvc-ext1: 2h 13m -> 2h 3m (-7.5%)
  10. pr-check-2: 40m 46s -> 43m 43s (+7.3%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@Zoxc Zoxc deleted the feedable-macro-fix branch February 4, 2026 09:31
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (794495e): comparison URL.

Overall result: ❌ regressions - please read the text below

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

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.4% [0.2%, 0.9%] 20
Regressions ❌
(secondary)
0.5% [0.0%, 1.0%] 47
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.0% [-0.0%, -0.0%] 2
All ❌✅ (primary) 0.4% [0.2%, 0.9%] 20

Max RSS (memory usage)

Results (secondary 2.5%)

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)
2.5% [2.5%, 2.5%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Cycles

Results (primary -1.7%, secondary -3.1%)

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)
4.4% [3.9%, 4.9%] 2
Improvements ✅
(primary)
-1.7% [-2.1%, -1.4%] 2
Improvements ✅
(secondary)
-4.9% [-8.4%, -3.6%] 8
All ❌✅ (primary) -1.7% [-2.1%, -1.4%] 2

Binary size

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

Bootstrap: 476.238s -> 475.808s (-0.09%)
Artifact size: 397.76 MiB -> 398.08 MiB (0.08%)

@lqd
Copy link
Member

lqd commented Feb 4, 2026

Fixing this bug enables some consistency checks for feedable queries that were previously not being performed, which has a perf impact.

Are these checks part of incremental hash verification? If so, the results will look worse on rustc-perf than in the real world, due to its use of -Zincremental-verify-ich.

@Zalathar
Copy link
Member

Zalathar commented Feb 4, 2026

I think it's a separate consistency check for feedable queries, not tied to -Zincremental-verify-ich.

@lqd
Copy link
Member

lqd commented Feb 4, 2026

Ah, unfortunate, thank you. So it is a correctness fix and it's fine.

While we're at it, let's mark it @rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Feb 4, 2026
@Zalathar
Copy link
Member

Zalathar commented Feb 4, 2026

To clarify a bit, the perf difference comes from correctness assertions that were accidentally not being checked.

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) merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. 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.

6 participants