Skip to content

Use a dummy TypeckResults instead of Option<TypeckResults> when linting#158000

Open
Jarcho wants to merge 6 commits into
rust-lang:mainfrom
Jarcho:ownerless_typeck
Open

Use a dummy TypeckResults instead of Option<TypeckResults> when linting#158000
Jarcho wants to merge 6 commits into
rust-lang:mainfrom
Jarcho:ownerless_typeck

Conversation

@Jarcho

@Jarcho Jarcho commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Based on #157928

This brings the typeck results when linting back to what it was before #73743. The first four commits are from the first PR and handle eagerly fetching the typeck results and the workaround needed for rustdoc. The fifth commit adds a dummy ownerless typeck results and uses that as the initial value for the lint pass. The final commit just removes the now useless typeck_results method.

The dummy table is added to the global context more for convenience. It can't be a static since the lifetime argument is invariant. It could be created just for the linting, but that would need to add an extra lifetime parameter to LateContext and a lot of places downstream of that which would be a huge pain.

@rustbot

rustbot commented Jun 17, 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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jun 17, 2026
@rustbot

rustbot commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

r? @folkertdev

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

@folkertdev

Copy link
Copy Markdown
Contributor

r? types

@rustbot rustbot added the T-types Relevant to the types team, which will review and decide on the PR/issue. label Jun 17, 2026
@rustbot rustbot assigned nikomatsakis and unassigned folkertdev Jun 17, 2026
@Jarcho

Jarcho commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

The line the error is complaining about doesn't even exist anywhere. What is the miri test even building?

@rust-bors

This comment has been minimized.

@Jarcho Jarcho force-pushed the ownerless_typeck branch from 27bc424 to 93e8014 Compare June 18, 2026 10:36
@rustbot

rustbot commented Jun 18, 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.

@rust-log-analyzer

This comment has been minimized.

@Jarcho Jarcho force-pushed the ownerless_typeck branch from 93e8014 to ad83973 Compare June 18, 2026 10:47
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job pr-check-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Checking rustc_codegen_ssa v0.0.0 (/checkout/compiler/rustc_codegen_ssa)
error[E0599]: no method named `typeck_results` found for reference `&LateContext<'tcx>` in the current scope
   --> compiler/rustc_lint/src/noop_method_call.rs:149:41
    |
149 |             let unadjusted_expr_ty = cx.typeck_results().expr_ty(expr);
    |                                         ^^^^^^^^^^^^^^ field, not a method
    |
help: remove the arguments
    |
149 -             let unadjusted_expr_ty = cx.typeck_results().expr_ty(expr);
149 +             let unadjusted_expr_ty = cx.typeck_results.expr_ty(expr);
    |
help: there is a method `to_result` with a similar name
    |
149 -             let unadjusted_expr_ty = cx.typeck_results().expr_ty(expr);
149 +             let unadjusted_expr_ty = cx.to_result().expr_ty(expr);
    |

For more information about this error, try `rustc --explain E0599`.
[RUSTC-TIMING] rustc_lint test:false 3.126
error: could not compile `rustc_lint` (lib) due to 1 previous error

@rust-bors

rust-bors Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

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

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-clippy Relevant to the Clippy team. 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. T-types Relevant to the types 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