Skip to content

Conversation

@dianne
Copy link
Contributor

@dianne dianne commented Jan 9, 2026

Occurrences of LintLevel in the THIR were always LintLevel::Explicit, containing a HirId, so we don't need to make it possible to put LintLevel::Inherited there. Removing the unused case where HirIds aren't present in the THIR slightly simplifies diagnostics/lints/tools that want to map from the THIR back to the HIR, e.g. #145569.

Since LintLevel is no longer present in the THIR, I've moved it in the second commit to live in rustc_mir_build; that's where it's actually used. I'm not sure exactly where exactly it should live there, but I put it in the builder::scope module since it's used by Builder::in_scope for determining when to introduce source scopes.

r? lcnr as the reviewer of #145569, since this was discussed there

@rustbot
Copy link
Collaborator

rustbot commented Jan 9, 2026

Some changes occurred in match checking

cc @Nadrieril

Some changes occurred in match lowering

cc @Nadrieril

@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 Jan 9, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 10, 2026

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

@rustbot
Copy link
Collaborator

rustbot commented Jan 10, 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Another option here would be to use ItemLocalId instead of HirId to maybe make thir::StmtKind and thir::Arm a bit smaller. I'm not really familiar with layout computation so I don't actually know for sure if it'd do anything. I don't think it'd affect thir::ExprKind's size.

LocalVarId is also a whole HirId despite local variables' scopes being stored by ItemLocalId in the ScopeTree, so maybe there's a stylistic reason to use HirIds instead of ItemLocalIds in the THIR? Not sure.

Copy link
Contributor

Choose a reason for hiding this comment

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

I personally feel in favor of using ItemLocalId in the THIR, the same as for TypeckResults. Could defer that to a later PR though. Feels like an unrelated change

} else {
f(self)
}
fn with_lint_level<T>(&mut self, new_lint_level: HirId, f: impl FnOnce(&mut Self) -> T) -> T {
Copy link
Contributor

@lcnr lcnr Jan 14, 2026

Choose a reason for hiding this comment

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

lint_level is a misnomer now 🤔 maybe just with_hir_source or whatever

Copy link
Contributor Author

Choose a reason for hiding this comment

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

with_hir_source sounds good to me. Renaming the lint_level field to hir_source also makes the other uses of it make more sense I think

@lcnr
Copy link
Contributor

lcnr commented Jan 14, 2026

👍 r=me with the naming fixed

@dianne
Copy link
Contributor Author

dianne commented Jan 15, 2026

@bors r+ r=lcnr

@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 Jan 15, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 15, 2026

📌 Commit 8868b47 has been approved by dianne

It is now in the queue for this repository.

@dianne
Copy link
Contributor Author

dianne commented Jan 15, 2026

@bors r-

@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 Jan 15, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 15, 2026

Commit 8868b47 has been unapproved.

@dianne
Copy link
Contributor Author

dianne commented Jan 15, 2026

@bors r=lcnr

I forgot the syntax, oops ^^;

@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 Jan 15, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 15, 2026

📌 Commit 8868b47 has been approved by lcnr

It is now in the queue for this repository.

rust-bors bot pushed a commit that referenced this pull request Jan 15, 2026
Rollup of 4 pull requests

Successful merges:

 - #150846 (include `HirId`s directly in the THIR, not wrapped in `LintLevel`s)
 - #150979 (Avoid ICEs after bad patterns, for the other syntactic variants)
 - #151103 (mir_build: Simplify length-determination and indexing for array/slice patterns)
 - #151130 (resolve: Downgrade `ambiguous_glob_imports` to warn-by-default)

r? @ghost
@rust-bors rust-bors bot merged commit eafe40e into rust-lang:main Jan 15, 2026
11 checks passed
@rustbot rustbot added this to the 1.94.0 milestone Jan 15, 2026
rust-timer added a commit that referenced this pull request Jan 15, 2026
Rollup merge of #150846 - thir-hir-id, r=lcnr

include `HirId`s directly in the THIR, not wrapped in `LintLevel`s

Occurrences of `LintLevel` in the THIR were always `LintLevel::Explicit`, containing a `HirId`, so we don't need to make it possible to put `LintLevel::Inherited` there. Removing the unused case where `HirId`s aren't present in the THIR slightly simplifies diagnostics/lints/tools that want to map from the THIR back to the HIR, e.g. #145569.

Since `LintLevel` is no longer present in the THIR, I've moved it in the second commit to live in `rustc_mir_build`; that's where it's actually used. I'm not sure exactly where exactly it should live there, but I put it in the `builder::scope` module since it's used by `Builder::in_scope` for determining when to introduce source scopes.

r? lcnr as the reviewer of #145569, since this was discussed there
@dianne dianne deleted the thir-hir-id branch January 15, 2026 20:15
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