Skip to content

Pass TyCtxt to early diagostics decoration - #134339

Merged
bors merged 4 commits into
rust-lang:masterfrom
Urgau:tcx-in-early-diag
Dec 15, 2024
Merged

Pass TyCtxt to early diagostics decoration#134339
bors merged 4 commits into
rust-lang:masterfrom
Urgau:tcx-in-early-diag

Conversation

@Urgau

Copy link
Copy Markdown
Member

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

@rustbotrustbot 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

@jieyouxujieyouxu left a comment

Copy link
Copy Markdown
Member

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).

Comment threadcompiler/rustc_lint/src/early.rs
Comment threadcompiler/rustc_lint/src/early.rs Outdated
Comment threadcompiler/rustc_lint/src/early.rs Outdated
@rustbotrustbot 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

Copy link
Copy Markdown
MemberAuthor

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

@rustbot ready

@rustbotrustbot 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

@jieyouxujieyouxu left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
MemberAuthor

@bors r=jieyouxu rollup

@bors

bors commented Dec 15, 2024

Copy link
Copy Markdown
Collaborator

📌 Commit 291c519 has been approved by jieyouxu

It is now in the queue for this repository.

@borsbors 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
@jieyouxujieyouxu mentioned this pull request 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:masterDec 15, 2024
@rustbotrustbot added this to the 1.85.0 milestone Dec 15, 2024
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant 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

@Urgau@bors@jieyouxu@rustbot