Skip to content

Various small query cleanups#153169

Open
nnethercote wants to merge 10 commits intorust-lang:mainfrom
nnethercote:rm-is_anon-etc
Open

Various small query cleanups#153169
nnethercote wants to merge 10 commits intorust-lang:mainfrom
nnethercote:rm-is_anon-etc

Conversation

@nnethercote
Copy link
Contributor

I found these while doing a close read of the query code.

r? @oli-obk

@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 27, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 27, 2026

oli-obk is not on the review rotation at the moment.
They may take a while to respond.

}
}

impl<'tcx> FromCycleError<'tcx> for ty::SymbolName<'_> {
Copy link
Contributor

Choose a reason for hiding this comment

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

These impl are used with the default CycleErrorHandling::Error, so they don't need a query modifier to make use of them. We don't seem to have a test for the use case of this, so it's probably fine to remove anyway.

@rust-bors

This comment has been minimized.

This makes it clear the `CycleError` is not used after the call.
When there are two cases of equal size and importance, I find an if/else
expression easier to read than an early return.
It's an unnecessary level of indirection.
Calling `abort_if_errors` after emitting an error is guaranteed to call
`raise_fatal`, so just do that directly instead.
This exact comment block also appears in
`compiler/rustc_middle/src/queries.rs`, which is a better place for it.
`Value` is an unhelpfully generic name. Standard naming procedure for a
trait with a single method is for the trait name to match the method
name, which is what this commit does. Likewise, the enclosing module is
renamed from `values` to `from_cycle_error`.

Also add a comment about some non-obvious behaviour.
It has no effect.

`symbol_name` is the only query that produces a `SymbolName`. If it was
marked with `cycle_delayed_bug`/`cycle_stash` then this `FromCycleError`
impl would make sense, but that's not the case. Maybe it was the case in
the past.
@rustbot
Copy link
Collaborator

rustbot commented Mar 1, 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.

@nnethercote
Copy link
Contributor Author

I rebased.

@bors r=petrochenkov

@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 1, 2026

📌 Commit fa5138b has been approved by petrochenkov

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 Mar 1, 2026
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 1, 2026
…ochenkov

Various small query cleanups

I found these while doing a close read of the query code.

r? @oli-obk
@rust-bors rust-bors bot 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 1, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 1, 2026

☔ The latest upstream changes (presumably #153114) made this pull request unmergeable. Please resolve the merge conflicts.

This pull request was unapproved.

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-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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants