Skip to content

cg_llvm: Assorted cleanups to LLVM diagnostic handling - #164205

Merged
rust-bors[bot] merged 3 commits into
rust-lang:mainfrom
Zalathar:diagnostic-handler
Oct 13, 2026
Merged

rust-bors[bot] merged 3 commits into
rust-lang:mainfrom
Zalathar:diagnostic-handler

Conversation

@Zalathar

Copy link
Copy Markdown
Member

While investigating some other changes to the LLVM bindings, I noticed a few opportunities for improvement here. Details in individual commits.

There should be no change to compiler output.

The old-handler pointer is an owning pointer to an arbitrary handler, so giving
it a lifetime of `&'a` is more misleading than helpful.

This commit also renames the function to `LLVMRustContextTakeContextHandler`,
to clarify that it removes and takes ownership of the old handler.
There is no reason to use LLVM's `DiagnosticHandlerTy` typedef here, since we
control both sides of the call.

This also avoids having a type with a bare `LLVM` prefix that is not actually
part of the LLVM-C API.
@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. 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 Oct 12, 2026
@rustbot

rustbot commented Oct 12, 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 77 candidates
  • Random selection from 20 candidates

@rust-log-analyzer

This comment has been minimized.

Using a named struct instead of a tuple makes it easier to see how this
callback data is used. The more verbose variable name also helps.
@folkertdev

Copy link
Copy Markdown
Contributor

@bors r+

@rust-bors

rust-bors Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

📌 Commit b8148fc has been approved by folkertdev

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 Oct 13, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 13, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #163258 (Move `rustc_middle::ty::Const` to `rustc_type_ir` Part 2)
 - #164173 (don't drop `AnyOpaqueHasInferAsHidden` when merging with `OpaqueInStorageOrAnyOpaqueHasInferAsHidden`)
 - #160230 (CFI: Cover each InstanceKind explicitly)
 - #163713 (codegen Propagate reported errors from ABI checks)
 - #164205 (cg_llvm: Assorted cleanups to LLVM diagnostic handling)
 - #164114 (restore the old behavior for `derive(Default)` on fieldless types)
 - #164127 (core: Ignore explicit_tail_calls doc tests on PowerPC)
 - #164204 (explicitly mark next-solver ICE in test suite)
@rust-bors
rust-bors Bot merged commit 90b0c3d into rust-lang:main Oct 13, 2026
14 checks passed
@rustbot rustbot added this to the 1.101.0 milestone Oct 13, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 13, 2026
Rollup merge of #164205 - Zalathar:diagnostic-handler, r=folkertdev

cg_llvm: Assorted cleanups to LLVM diagnostic handling

While investigating some other changes to the LLVM bindings, I noticed a few opportunities for improvement here. Details in individual commits.

There should be no change to compiler output.
@Zalathar
Zalathar deleted the diagnostic-handler branch October 13, 2026 22:06
bjorn3 pushed a commit to rust-lang/rustc_codegen_cranelift that referenced this pull request Oct 14, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#163258 (Move `rustc_middle::ty::Const` to `rustc_type_ir` Part 2)
 - rust-lang/rust#164173 (don't drop `AnyOpaqueHasInferAsHidden` when merging with `OpaqueInStorageOrAnyOpaqueHasInferAsHidden`)
 - rust-lang/rust#160230 (CFI: Cover each InstanceKind explicitly)
 - rust-lang/rust#163713 (codegen Propagate reported errors from ABI checks)
 - rust-lang/rust#164205 (cg_llvm: Assorted cleanups to LLVM diagnostic handling)
 - rust-lang/rust#164114 (restore the old behavior for `derive(Default)` on fieldless types)
 - rust-lang/rust#164127 (core: Ignore explicit_tail_calls doc tests on PowerPC)
 - rust-lang/rust#164204 (explicitly mark next-solver ICE in test suite)
antoyo pushed a commit to rust-lang/rustc_codegen_gcc that referenced this pull request Oct 19, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#163258 (Move `rustc_middle::ty::Const` to `rustc_type_ir` Part 2)
 - rust-lang/rust#164173 (don't drop `AnyOpaqueHasInferAsHidden` when merging with `OpaqueInStorageOrAnyOpaqueHasInferAsHidden`)
 - rust-lang/rust#160230 (CFI: Cover each InstanceKind explicitly)
 - rust-lang/rust#163713 (codegen Propagate reported errors from ABI checks)
 - rust-lang/rust#164205 (cg_llvm: Assorted cleanups to LLVM diagnostic handling)
 - rust-lang/rust#164114 (restore the old behavior for `derive(Default)` on fieldless types)
 - rust-lang/rust#164127 (core: Ignore explicit_tail_calls doc tests on PowerPC)
 - rust-lang/rust#164204 (explicitly mark next-solver ICE in test suite)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. 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