Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass TyCtxt to early diagostics decoration #134339

Merged
merged 4 commits into from
Dec 15, 2024
Merged

Conversation

Urgau
Copy link
Member

@Urgau Urgau commented Dec 15, 2024

This PR pass a TyCtxt to the early diagnostics decoration code so that diagnostics code that take advantage of (a very limited but still useful) TyCtxt in their note, help, suggestions, ...

This is particulary useful for #133221 which wants to get the crate name of a DefId, which is possible with tcx.crate_name(...).

I highly recommend reviewing this PR commit by commit.

r? @jieyouxu

@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 Dec 15, 2024
Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

Thanks, I think this seems reasonable. I have some suggestions regarding the lifetime names (random 'a, 'b and 'c are really confusing).

compiler/rustc_lint/src/early.rs Outdated Show resolved Hide resolved
compiler/rustc_lint/src/early.rs Outdated Show resolved Hide resolved
compiler/rustc_lint/src/early.rs Outdated Show resolved Hide resolved
@rustbot rustbot 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-review Status: Awaiting review from the assignee but also interested parties. labels Dec 15, 2024
@Urgau Urgau force-pushed the tcx-in-early-diag branch from 51263a3 to 291c519 Compare December 15, 2024 16:19
@Urgau
Copy link
Member Author

Urgau commented Dec 15, 2024

I agree the lifetimes are confusing, so as suggested I cleaned them up (including some bounds). Pushed that cleanup in e3e5bd9.

@rustbot ready

@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 Dec 15, 2024
Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

Thanks, r=me once PR CI is green.

@Urgau
Copy link
Member Author

Urgau commented Dec 15, 2024

@bors r=jieyouxu rollup

@bors
Copy link
Contributor

bors commented Dec 15, 2024

📌 Commit 291c519 has been approved by jieyouxu

It is now in the queue for this repository.

@bors bors 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 Dec 15, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 15, 2024
Rollup of 4 pull requests

Successful merges:

 - rust-lang#134111 (Fix `--nocapture` for run-make tests)
 - rust-lang#134329 (Add m68k_target_feature)
 - rust-lang#134331 (bootstrap: make ./x test error-index work)
 - rust-lang#134339 (Pass `TyCtxt` to early diagostics decoration)

r? `@ghost`
`@rustbot` modify labels: rollup
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 15, 2024
Rollup merge of rust-lang#134339 - Urgau:tcx-in-early-diag, r=jieyouxu

Pass `TyCtxt` to early diagostics decoration

This PR pass a `TyCtxt` to the early diagnostics decoration code so that diagnostics code that take advantage of (a very limited but still useful) `TyCtxt` in their note, help, suggestions, ...

This is particulary useful for rust-lang#133221 which wants to get the crate name of a `DefId`, which is possible with `tcx.crate_name(...)`.

I highly recommend reviewing this PR commit by commit.

r? `@jieyouxu`
@bors bors merged commit 56545ca into rust-lang:master Dec 15, 2024
6 checks passed
@rustbot rustbot added this to the 1.85.0 milestone Dec 15, 2024
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.

4 participants