Repository navigation
cg_llvm: Assorted cleanups to LLVM diagnostic handling - #164205
Merged
Merged
Conversation
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.
Collaborator
|
r? @folkertdev rustbot has assigned @folkertdev. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
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.
Zalathar
force-pushed
the
diagnostic-handler
branch
from
October 12, 2026 11:53
48fa9d7 to
b8148fc
Compare
Contributor
|
@bors r+ |
Contributor
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 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.
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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.