Skip to content

Eagerly fetch typeck results when linting - #157928

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
Jarcho:eager_typeck
Aug 1, 2026
Merged

Eagerly fetch typeck results when linting#157928
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
Jarcho:eager_typeck

Conversation

@Jarcho

@Jarcho Jarcho commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

View all comments

The first commit avoids running the lint visitor if all lints were filtered out. In every other case the typeck results are accessed on every body making the delayed load pointless overhead.

@rustbot

rustbot commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

clippy is developed in its own repository. If possible, consider making this change to rust-lang/rust-clippy instead.

cc @rust-lang/clippy

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jun 15, 2026
@rustbot

rustbot commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

r? @Kivooeo

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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 73 candidates
  • Random selection from 20 candidates

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@Jarcho

Jarcho commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

Turns out that was load bearing for rustdoc. That's now been worked around and documented properly.

@rust-bors

This comment has been minimized.

@fmease

fmease commented Jun 17, 2026

Copy link
Copy Markdown
Member

@bors try parent=4fc35880d9636c5a2679d18b034038123b09b294 @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 17, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jun 17, 2026
Eagerly fetch typeck results when linting
@rust-bors

rust-bors Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 0b2216b (0b2216bdab7b8a5d0d896736af184122a08d45de)
Base parent: 4fc3588 (4fc35880d9636c5a2679d18b034038123b09b294)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Error occured while categorizing benchmark run:

could not find start commit for bound Commit("4fc35880d9636c5a2679d18b034038123b09b294")

@rustbot

This comment has been minimized.

@fmease

fmease commented Jun 18, 2026

Copy link
Copy Markdown
Member

@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 Jun 18, 2026
Eagerly fetch typeck results when linting
@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-bors Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 1444460 (14444609e8e293e12bab60ce6cd32f4b81c9adcf)
Base parent: 9639eef (9639eefc07db282b25e9c83cdfebb10688ed5114)

@rust-bors

This comment has been minimized.

@rustbot

rustbot commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

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.

@Kivooeo

Kivooeo commented Jul 21, 2026

Copy link
Copy Markdown
Member

@rustbot reroll

@rustbot rustbot assigned adwinwhite and unassigned Kivooeo Jul 21, 2026
Comment thread compiler/rustc_lint/src/late.rs Outdated
Comment thread compiler/rustc_lint/src/late.rs Outdated
@Jarcho
Jarcho force-pushed the eager_typeck branch 2 times, most recently from 80ae54c to 6883244 Compare July 25, 2026 11:51
@rust-log-analyzer

This comment has been minimized.

Comment thread compiler/rustc_lint/src/late.rs Outdated
/// Runs only the `MissingDoc` lint pass without type checking bodies.
///
/// **DO NOT** use this for anything other than rustdoc. This exists solely to workaround
/// the fact that rustdoc parses functions which would not pass type checking. See:

@adwinwhite adwinwhite Jul 27, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We can just check sess.opts.actually_rustdoc instead? If it's rustdoc then we don't typeck.
Seems a much smaller code change.

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Did it that way so you can see it. It's smaller, but it was already small to start with.

This has the (very small) cost of actually checking if it's rustdoc. PGO will make it so the default branch prediction is correct so it's only a couple of extra instructions per body. MissingDocs is given it's own dedicated monomorphization of the visitor in both cases so there's no code size savings with the dynamic approach. Again, these are minor code size and instruction count costs, but they are there.

@rust-log-analyzer

This comment has been minimized.

@adwinwhite

Copy link
Copy Markdown
Contributor

@bors r+ rollup

@rust-bors

rust-bors Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 102b6fd has been approved by adwinwhite

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 Jul 31, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 1, 2026
Eagerly fetch typeck results when linting

The first commit avoids running the lint visitor if all lints were filtered out. In every other case the typeck results are accessed on every body making the delayed load pointless overhead.
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 1, 2026
Eagerly fetch typeck results when linting

The first commit avoids running the lint visitor if all lints were filtered out. In every other case the typeck results are accessed on every body making the delayed load pointless overhead.
rust-bors Bot pushed a commit that referenced this pull request Aug 1, 2026
Rollup of 14 pull requests

Successful merges:

 - #159245 (Emit retags in codegen to support BorrowSanitizer (part 5))
 - #159864 (Report "capacity overflow" for oversized Rc<[T]>/Arc<[T]>)
 - #160079 (make atomic operations const)
 - #160124 (Structurally prevent zero-count `BackendRepr::SimdVector`s)
 - #160162 (Make `#[fundamental]` only apply to the first argument of `Box`)
 - #160210 (Remove an outdated FIXME)
 - #160282 (Improve diagnostic for patterns in function pointer types)
 - #157928 (Eagerly fetch typeck results when linting)
 - #159672 (Improve suggestions when multiples tuples implement the same trait)
 - #159861 (Add documentation for the `non_exhaustive` attribute)
 - #159907 (Fix `hidden_glob_reexports` in `rustc_ast`)
 - #159998 (Align expect messages with guidance)
 - #160145 (Expand checks for register_tool)
 - #160307 (Update `minifier` version to `0.4.0`)
@rust-bors
rust-bors Bot merged commit 00b2bc4 into rust-lang:main Aug 1, 2026
13 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Aug 1, 2026
rust-timer added a commit that referenced this pull request Aug 1, 2026
Rollup merge of #157928 - Jarcho:eager_typeck, r=adwinwhite

Eagerly fetch typeck results when linting

The first commit avoids running the lint visitor if all lints were filtered out. In every other case the typeck results are accessed on every body making the delayed load pointless overhead.
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-clippy Relevant to the Clippy team. 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.

7 participants