Skip to content

Make rustc_hir_analysis not depend on rustc_lint.#154361

Open
nnethercote wants to merge 1 commit intorust-lang:mainfrom
nnethercote:rustc_hir_analysis-rustc_lint
Open

Make rustc_hir_analysis not depend on rustc_lint.#154361
nnethercote wants to merge 1 commit intorust-lang:mainfrom
nnethercote:rustc_hir_analysis-rustc_lint

Conversation

@nnethercote
Copy link
Contributor

@nnethercote nnethercote commented Mar 25, 2026

rustc_hir_analysis depends on rustc_lint in just a single function: emit_delayed_lint, which is used by the
"emit_ast_lowering_delayed_lints" checking section within rustc_hir_analysis::check_crate.

This commit moves that function and section to out of rustc_hir_analysis::check_crate, into rustc_interface, eliminating the dependency. This seems reasonable because the delayed lint errors aren't really related to HIR analysis, they were in there just because HIR analysis is what follows AST lowering.

This means rustc_hir_analysis and rustc_lint can both start compiling as soon as rustc_trait_selection finishes. This also changes the error order in one test, which doesn't matter.

The commit also changes emit_delayed_lint to emit_delayed_lints, factoring out some code duplicated in rustdoc.

r? @davidtwco

@rustbot rustbot added 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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Mar 25, 2026
@nnethercote
Copy link
Contributor Author

@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 Mar 25, 2026
…<try>

Make `rustc_hir_analysis` not depend on `rustc_lint`.
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 25, 2026
@rust-bors
Copy link
Contributor

rust-bors bot commented Mar 25, 2026

☀️ Try build successful (CI)
Build commit: f563964 (f563964173ddaf1ed3e37d5d0de92ec538aa79c2, parent: 212ef7770dfad656782207fda799bdae28fc5b7b)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f563964): comparison URL.

Overall result: no relevant changes - 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

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

Max RSS (memory usage)

Results (secondary -3.0%)

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)
-4.9% [-6.5%, -2.0%] 3
All ❌✅ (primary) - - 0

Cycles

Results (secondary 2.8%)

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

Binary size

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

Bootstrap: 484.064s -> 483.055s (-0.21%)
Artifact size: 396.84 MiB -> 394.95 MiB (-0.48%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 26, 2026
@nnethercote nnethercote force-pushed the rustc_hir_analysis-rustc_lint branch from 1eac51a to b7be8e4 Compare March 26, 2026 02:54
`rustc_hir_analysis` depends on `rustc_lint` in just a single function:
`emit_delayed_lint`, which is used by the
"emit_ast_lowering_delayed_lints" checking section within
`rustc_hir_analysis::check_crate`.

This commit moves that function and section to out of
`rustc_hir_analysis::check_crate`, into `rustc_interface`, eliminating
the dependency. This seems reasonable because the delayed lint errors
aren't really related to HIR analysis. They were in there just because
HIR analysis follows AST lowering.

This means `rustc_hir_analysis` and `rustc_lint` can both start
compiling as soon as `rustc_trait_selection` finishes. This also changes
the error order in one test, which doesn't matter.

The commit also changes `emit_delayed_lint` to `emit_delayed_lints`,
factoring out some code duplicated in rustdoc.
@nnethercote nnethercote force-pushed the rustc_hir_analysis-rustc_lint branch from b7be8e4 to a733192 Compare March 26, 2026 03:32
@nnethercote nnethercote marked this pull request as ready for review March 26, 2026 03:33
@rustbot
Copy link
Collaborator

rustbot commented Mar 26, 2026

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@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 Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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. T-rustdoc Relevant to the rustdoc 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