Skip to content

cg_llvm: Avoid all remaining uses of as_c_char_ptr - #164071

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
Zalathar:as-c-char-ptr
Oct 10, 2026
Merged

rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
Zalathar:as-c-char-ptr

Conversation

@Zalathar

Copy link
Copy Markdown
Member

Follow-up to:


As explained in the previous PRs (and in the comments for PTR_LEN_STR), we can avoid the need for these casts by declaring the relevant FFI bindings to take *const c_uchar, which has the same ABI as *const c_char. This is more convenient at the call site, and makes it harder to mix up pointer/length strings and nul-terminated strings.

There should be no change to compiler output.

@rustbot

rustbot commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs

cc @ZuseZ4

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. F-autodiff `#![feature(autodiff)]` 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 10, 2026
@rustbot

rustbot commented Oct 10, 2026

Copy link
Copy Markdown
Collaborator

r? @oli-obk

rustbot has assigned @oli-obk.
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 17 candidates

@hanna-kruppe

Copy link
Copy Markdown
Contributor

r? me @bors r+ rollup

@rust-bors

rust-bors Bot commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

📌 Commit f935b44 has been tentatively approved by hanna-kruppe

It will be put into the queue for this repository once PR CI succeeds.

@rust-bors rust-bors Bot added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Oct 10, 2026
@rust-bors rust-bors Bot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 10, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 10, 2026
Rollup of 4 pull requests

Successful merges:

 - #163434 (Add documentation for the `crate_name` attribute)
 - #163917 (Re-enable extension of bool return values on x86_64)
 - #163242 (Expose regular argument attributes in rustc_public)
 - #164071 (cg_llvm: Avoid all remaining uses of `as_c_char_ptr`)
@rust-bors
rust-bors Bot merged commit f43347e into rust-lang:main Oct 10, 2026
14 checks passed
@rustbot rustbot added this to the 1.101.0 milestone Oct 10, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 10, 2026
Rollup merge of #164071 - Zalathar:as-c-char-ptr, r=hanna-kruppe

cg_llvm: Avoid all remaining uses of `as_c_char_ptr`

Follow-up to:
- #163789
- #164017
---

As explained in the previous PRs (and in the comments for `PTR_LEN_STR`), we can avoid the need for these casts by declaring the relevant FFI bindings to take `*const c_uchar`, which has the same ABI as `*const c_char`. This is more convenient at the call site, and makes it harder to mix up pointer/length strings and nul-terminated strings.

There should be no change to compiler output.
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. F-autodiff `#![feature(autodiff)]` 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