Skip to content

Migrate rustc_codegen_gcc to SessionDiagnostics - #101075

Merged
bors merged 16 commits into
rust-lang:masterfrom
ellishg:rustc_codegen_gcc_diagnostics
Sep 30, 2022
Merged

Migrate rustc_codegen_gcc to SessionDiagnostics #101075
bors merged 16 commits into
rust-lang:masterfrom
ellishg:rustc_codegen_gcc_diagnostics

Conversation

@ellishg

Copy link
Copy Markdown
Contributor

As part of #100717 this pr migrates diagnostics to SessionDiagnostics for the rustc_codegen_gcc crate.

@rustbot label +A-translation

@rust-highfive

Copy link
Copy Markdown
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nagisa (or someone else) soon.

Please see the contribution instructions for more information.

@rustbot

Copy link
Copy Markdown
Collaborator

Some changes occurred in compiler/rustc_codegen_gcc

cc @antoyo

rustc_error_messages was changed

cc @davidtwco, @compiler-errors, @JohnTitor, @estebank, @TaKO8Ki

@rustbotrustbot added A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 27, 2022
@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 27, 2022
@ellishg
ellishgforce-pushed the rustc_codegen_gcc_diagnostics branch from 24a7f55 to 913350eCompareAugust 27, 2022 04:26
@ellishg

Copy link
Copy Markdown
ContributorAuthor

The diagnostics I'm missing come from
https://github.com/rust-lang/rust/blob/913350ecaf6a0fc621c6c43f0764956e1c47cc15/compiler/rustc_codegen_gcc/src/context.rs#L478-L484

I saw something similar in rustc_codegen_llvm but #101005 has not finished yet.

I also found some calls to span_invalid_monomorphization_error() that I suspect need to be changed.

https://github.com/rust-lang/rust/blob/913350ecaf6a0fc621c6c43f0764956e1c47cc15/compiler/rustc_codegen_gcc/src/intrinsic/simd.rs#L27-L30
https://github.com/rust-lang/rust/blob/913350ecaf6a0fc621c6c43f0764956e1c47cc15/compiler/rustc_codegen_gcc/src/intrinsic/simd.rs#L453-L456

These were not caught by #![deny(...)] and I'm not sure if that means they don't need to be translated, or if this is an edge case.

@ellishgellishg mentioned this pull request Aug 28, 2022
@nagisa

Copy link
Copy Markdown
Member

r? @compiler-errors / @davidtwco

Comment threadcompiler/rustc_errors/src/diagnostic.rs Outdated
@davidtwco

Copy link
Copy Markdown
Member

The diagnostics I'm missing come from

https://github.com/rust-lang/rust/blob/913350ecaf6a0fc621c6c43f0764956e1c47cc15/compiler/rustc_codegen_gcc/src/context.rs#L478-L484

I saw something similar in rustc_codegen_llvm but #101005 has not finished yet.

I feel like LayoutError could basically implement SessionDiagnostic, maybe we could implement it for Spanned<LayoutError> (Spanned)?

I also found some calls to span_invalid_monomorphization_error() that I suspect need to be changed.

https://github.com/rust-lang/rust/blob/913350ecaf6a0fc621c6c43f0764956e1c47cc15/compiler/rustc_codegen_gcc/src/intrinsic/simd.rs#L27-L30

https://github.com/rust-lang/rust/blob/913350ecaf6a0fc621c6c43f0764956e1c47cc15/compiler/rustc_codegen_gcc/src/intrinsic/simd.rs#L453-L456

These were not caught by #![deny(...)] and I'm not sure if that means they don't need to be translated, or if this is an edge case.

These should be translated, and ideally the lint would fire on them, I've added a link to this to #100717 so someone can go fix that.

@davidtwcodavidtwco mentioned this pull request Aug 30, 2022
84 tasks

@davidtwcodavidtwco 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.

This is a great start, thanks!

Comment threadcompiler/rustc_codegen_gcc/src/errors.rs Outdated
Comment threadcompiler/rustc_codegen_gcc/src/errors.rs Outdated
@ellishg
ellishgforce-pushed the rustc_codegen_gcc_diagnostics branch from 6c8fa90 to 5765171CompareSeptember 1, 2022 22:25
@davidtwco

Copy link
Copy Markdown
Member

This is great progress, I'd like it if you could address the feedback from my earlier comment (#101075 (comment)) :)

@ellishg

Copy link
Copy Markdown
ContributorAuthor

The diagnostics I'm missing come from
https://github.com/rust-lang/rust/blob/913350ecaf6a0fc621c6c43f0764956e1c47cc15/compiler/rustc_codegen_gcc/src/context.rs#L478-L484

I saw something similar in rustc_codegen_llvm but #101005 has not finished yet.

I feel like LayoutError could basically implement SessionDiagnostic, maybe we could implement it for Spanned<LayoutError> (Spanned)?

I tried to implement SessionDiagnostic for LayoutError and Spanned<T>, but I ended up getting lifetime errors. I don't quite understand it, but I think it was related to 'gcc and tcx being different lifetimes.

I also found some calls to span_invalid_monomorphization_error() that I suspect need to be changed.
https://github.com/rust-lang/rust/blob/913350ecaf6a0fc621c6c43f0764956e1c47cc15/compiler/rustc_codegen_gcc/src/intrinsic/simd.rs#L27-L30

https://github.com/rust-lang/rust/blob/913350ecaf6a0fc621c6c43f0764956e1c47cc15/compiler/rustc_codegen_gcc/src/intrinsic/simd.rs#L453-L456

These were not caught by #![deny(...)] and I'm not sure if that means they don't need to be translated, or if this is an edge case.

These should be translated, and ideally the lint would fire on them, I've added a link to this to #100717 so someone can go fix that.

I'm still working on this. I think I need to create a new function similar to span_invalid_monomorphization_error() that takes a SessionDiagnostic. I also realized there are lots of other untranslatable strings in simd.rs that I would need to fix.

@davidtwco

Copy link
Copy Markdown
Member

I tried to implement SessionDiagnostic for LayoutError and Spanned<T>, but I ended up getting lifetime errors. I don't quite understand it, but I think it was related to 'gcc and tcx being different lifetimes.

If you share the code from your attempt then maybe we can work this out.

Comment threadcompiler/rustc_codegen_gcc/src/context.rs Outdated
@rust-log-analyzer

This comment has been minimized.

Comment threadcompiler/rustc_error_messages/locales/en-US/codegen_gcc.ftl Outdated
@ellishg
ellishgforce-pushed the rustc_codegen_gcc_diagnostics branch from 655c3fa to 1e3d953CompareSeptember 12, 2022 01:12
Comment threadcompiler/rustc_codegen_gcc/src/intrinsic/simd.rs Outdated
Comment threadcompiler/rustc_error_messages/locales/en-US/codegen_gcc.ftl Outdated
Comment threadcompiler/rustc_session/src/session.rs Outdated
@ellishg
ellishgforce-pushed the rustc_codegen_gcc_diagnostics branch from 1e3d953 to 22dbcb0CompareSeptember 13, 2022 21:21
@bors

This comment was marked as resolved.

@davidtwco

Copy link
Copy Markdown
Member

Apologies for the delay in responding to this, replied to the pending comments now.

@ellishg
ellishgforce-pushed the rustc_codegen_gcc_diagnostics branch from 22dbcb0 to 5c7e629CompareSeptember 24, 2022 18:09
@ellishg

Copy link
Copy Markdown
ContributorAuthor

I've finally figured out the lifetime error. Thanks @davidtwco for all your help! I believe I've migrated all the diagnostics so this is ready for review!

@antoyoantoyo left a comment

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.

LGTM

Comment threadcompiler/rustc_codegen_gcc/src/intrinsic/simd.rs Outdated

@davidtwcodavidtwco 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.

This looks great, left a few comments

Comment threadcompiler/rustc_codegen_gcc/src/errors.rs Outdated
Comment threadcompiler/rustc_codegen_gcc/src/errors.rs Outdated
Comment threadcompiler/rustc_codegen_gcc/src/errors.rs Outdated
Comment threadcompiler/rustc_error_messages/locales/en-US/codegen_gcc.ftl Outdated
@davidtwco

Copy link
Copy Markdown
Member

@bors r+

@bors

bors commented Sep 29, 2022

Copy link
Copy Markdown
Collaborator

📌 Commit 01439c9 has been approved by davidtwco

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 Sep 29, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Sep 30, 2022
…ics, r=davidtwco
Migrate rustc_codegen_gcc to SessionDiagnostics
As part of rust-lang#100717 this pr migrates diagnostics to `SessionDiagnostics` for the `rustc_codegen_gcc` crate.
`@rustbot` label +A-translation
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 30, 2022
…iaskrgr
Rollup of 5 pull requests
Successful merges:
- rust-lang#101075 (Migrate rustc_codegen_gcc to SessionDiagnostics )
- rust-lang#102350 (Improve errors for incomplete functions in struct definitions)
- rust-lang#102481 (rustdoc: remove unneeded CSS `.rust-example-rendered { position }`)
- rust-lang#102491 (rustdoc: remove no-op source sidebar `opacity`)
- rust-lang#102499 (Adjust the s390x data layout for LLVM 16)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit 25017f8 into rust-lang:masterSep 30, 2022
@rustbotrustbot added this to the 1.66.0 milestone Sep 30, 2022
@ellishg
ellishg deleted the rustc_codegen_gcc_diagnostics branch October 1, 2022 15:47
antoyo pushed a commit to antoyo/rust that referenced this pull request Jun 19, 2023
…ics, r=davidtwco
Migrate rustc_codegen_gcc to SessionDiagnostics
As part of rust-lang#100717 this pr migrates diagnostics to `SessionDiagnostics` for the `rustc_codegen_gcc` crate.
``@rustbot`` label +A-translation
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-translationArea: Translation infrastructure, and migrating existing diagnostics to SessionDiagnosticS-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.

9 participants

@ellishg@rust-highfive@rustbot@nagisa@davidtwco@rust-log-analyzer@bors@antoyo@compiler-errors