Skip to content

reveal_actual_level improvements#156536

Merged
rust-bors[bot] merged 4 commits into
rust-lang:mainfrom
nnethercote:reveal_actual_level-improvements
May 13, 2026
Merged

reveal_actual_level improvements#156536
rust-bors[bot] merged 4 commits into
rust-lang:mainfrom
nnethercote:reveal_actual_level-improvements

Conversation

@nnethercote
Copy link
Copy Markdown
Contributor

Details in individual commits.

r? @GuillaumeGomez

`reveal_actual_level` has two call sites, which look like this:
```
let (level, mut src) = self.raw_lint_id_level(lint, idx, aux);
let (level, lint_id) = reveal_actual_level(level, &mut src, sess, lint, |id| {
    self.raw_lint_id_level(id, idx, aux)
});
```
and:
```
let (level, mut src) = self.probe_for_lint_level(tcx, lint, cur);
let (level, lint_id) = reveal_actual_level(level, &mut src, tcx.sess, lint, |lint| {
    self.probe_for_lint_level(tcx, lint, cur)
});
```
They both have the same pattern: there's a prior call expression that is then
repeated within a closure passed to `reveal_actual_level`.

This commit moves that prior call inside `reveal_actual_level`, making things
simpler.
It currently returns a triple: `(Level, Option<LintExpectationId>,
LintLevelSource)`. That's structurally identical to `LevelAndSource`, so
this commit changes it accordingly.
It's currrently `(Option<(Level, Option<LintExpectationId>)>,
LintLevelSource)`. But when the first element of the pair is `None` the
second element is always `LintLevelSource::Default`. So this commit
moves the `LintLevelSource` within the `Option`, which simplifies
things a bit.
Again, the returned triple is equivalent to `LevelAndSource`.
@rustbot rustbot added 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 May 13, 2026
@GuillaumeGomez
Copy link
Copy Markdown
Member

Thanks!

@bors r+ rollup

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 13, 2026

📌 Commit b86ef89 has been approved by GuillaumeGomez

It is now in the queue for this repository.

🌲 The tree is currently closed for pull requests below priority 1000. This pull request will be tested once the tree is reopened.

@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 May 13, 2026
rust-bors Bot pushed a commit that referenced this pull request May 13, 2026
…uwer

Rollup of 4 pull requests

Successful merges:

 - #155815 (Add Swift function call ABI)
 - #156425 (Fix unused assignments in diverging branches)
 - #156536 (`reveal_actual_level` improvements)
 - #156543 (Update rustbook dependencies to remove windows-targets dependency)
rust-bors Bot pushed a commit that referenced this pull request May 13, 2026
…uwer

Rollup of 4 pull requests

Successful merges:

 - #155815 (Add Swift function call ABI)
 - #156425 (Fix unused assignments in diverging branches)
 - #156536 (`reveal_actual_level` improvements)
 - #156543 (Update rustbook dependencies to remove windows-targets dependency)
@rust-bors rust-bors Bot merged commit 68e98f0 into rust-lang:main May 13, 2026
11 checks passed
@rustbot rustbot added this to the 1.97.0 milestone May 13, 2026
rust-timer added a commit that referenced this pull request May 13, 2026
Rollup merge of #156536 - nnethercote:reveal_actual_level-improvements, r=GuillaumeGomez

`reveal_actual_level` improvements

Details in individual commits.

r? @GuillaumeGomez
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

3 participants