Repository navigation
cg_llvm: Avoid as_c_char_ptr in several places - #163789
Conversation
|
Some changes occurred in compiler/rustc_codegen_llvm/src/debuginfo cc @Walnut356 |
|
r? @davidtwco rustbot has assigned @davidtwco. Use Why was this reviewer chosen?The reviewer was selected based on:
|
There was a problem hiding this comment.
r=me with one question/nit for your consideration.
r? me @bors rollup
| passes_after_enzyme.map(|s| s.as_ptr()).unwrap_or(std::ptr::null()), | ||
| passes_after_enzyme.map(|s| s.len()).unwrap_or(0), |
There was a problem hiding this comment.
Is there a reason for changing from map_or to map().unwrap_or()? I don't care strongly one way or another, but this code used map_or before and the debug info changes in the earlier commit preserved map_or, so this change stood out to me.
There was a problem hiding this comment.
In the other cases I was just updating the call to as_c_char_ptr, so I didn’t even think about whether to change the enclosing map_or or not; I just left it as-is.
For this one I wanted to move the call site, so (after some intermediate edits) I rewrote the calls in the style that comes naturally to me, since I find map_or needlessly confusing.
|
@bors r+ |
…uppe cg_llvm: Avoid `as_c_char_ptr` in several places As noted in `rustc_codegen_llvm::ffi`: > Normally it's a good idea for Rust-side bindings to match the corresponding C-side function declarations as closely as possible. But when passing `&str` or `&[u8]` data as a pointer/length pair, it's more convenient to declare the Rust-side pointer as `*const c_uchar` instead of `*const c_char`. Both pointer types have the same ABI, and using `*const c_uchar` avoids the need for an extra cast from `*const u8` on the Rust side. The helper method `as_c_char_ptr` exists to make that extra cast more type-safe, but it's nicer to not need it all. In addition to making call sites a bit simpler, this adjustment also makes it harder to accidentally pass a nul-terminated string to a function expecting a pointer/length string, and vice-versa. There should be no change to compiler output.
|
@bors try jobs=test-various |
|
⌛ Trying commit ae54544 with merge a4521af… To cancel the try build, run the command Workflow: https://github.com/rust-lang/rust/actions/runs/37445703108 |
cg_llvm: Avoid `as_c_char_ptr` in several places try-job: test-various
…uppe cg_llvm: Avoid `as_c_char_ptr` in several places As noted in `rustc_codegen_llvm::ffi`: > Normally it's a good idea for Rust-side bindings to match the corresponding C-side function declarations as closely as possible. But when passing `&str` or `&[u8]` data as a pointer/length pair, it's more convenient to declare the Rust-side pointer as `*const c_uchar` instead of `*const c_char`. Both pointer types have the same ABI, and using `*const c_uchar` avoids the need for an extra cast from `*const u8` on the Rust side. The helper method `as_c_char_ptr` exists to make that extra cast more type-safe, but it's nicer to not need it all. In addition to making call sites a bit simpler, this adjustment also makes it harder to accidentally pass a nul-terminated string to a function expecting a pointer/length string, and vice-versa. There should be no change to compiler output.
…uppe cg_llvm: Avoid `as_c_char_ptr` in several places As noted in `rustc_codegen_llvm::ffi`: > Normally it's a good idea for Rust-side bindings to match the corresponding C-side function declarations as closely as possible. But when passing `&str` or `&[u8]` data as a pointer/length pair, it's more convenient to declare the Rust-side pointer as `*const c_uchar` instead of `*const c_char`. Both pointer types have the same ABI, and using `*const c_uchar` avoids the need for an extra cast from `*const u8` on the Rust side. The helper method `as_c_char_ptr` exists to make that extra cast more type-safe, but it's nicer to not need it all. In addition to making call sites a bit simpler, this adjustment also makes it harder to accidentally pass a nul-terminated string to a function expecting a pointer/length string, and vice-versa. There should be no change to compiler output.
…uwer Rollup of 13 pull requests Successful merges: - #163090 (Run LLDB debuginfo tests on `x86_64-pc-windows-msvc` in CI) - #163863 (use the type name instead of `Self` in constructor paths again) - #163864 (Remove CLAUDE.md) - #163877 (Add regression test for duplicated rustdoc search results between std and core) - #162000 (peel_transparent_wrappers only works on non-1ZST) - #163257 (abby DSL: sanity checks on forall where clauses) - #163348 (perf:cache FFI safety results in improper_ctypes lint) - #163768 (Move more `rustdoc-html` tests in the right location) - #163789 (cg_llvm: Avoid `as_c_char_ptr` in several places) - #163807 (Add `has_reliable_f16b` for Arm) - #163826 (Update books) - #163849 (ci: update to PowerShell 7.6.6) - #163870 (Add if-installed:auto:spellcheck to pre-push script)
…uppe cg_llvm: Avoid `as_c_char_ptr` in several places As noted in `rustc_codegen_llvm::ffi`: > Normally it's a good idea for Rust-side bindings to match the corresponding C-side function declarations as closely as possible. But when passing `&str` or `&[u8]` data as a pointer/length pair, it's more convenient to declare the Rust-side pointer as `*const c_uchar` instead of `*const c_char`. Both pointer types have the same ABI, and using `*const c_uchar` avoids the need for an extra cast from `*const u8` on the Rust side. The helper method `as_c_char_ptr` exists to make that extra cast more type-safe, but it's nicer to not need it all. In addition to making call sites a bit simpler, this adjustment also makes it harder to accidentally pass a nul-terminated string to a function expecting a pointer/length string, and vice-versa. There should be no change to compiler output.
|
💥 Test timed out after |
…uwer Rollup of 25 pull requests Successful merges: - #163090 (Run LLDB debuginfo tests on `x86_64-pc-windows-msvc` in CI) - #163806 (even more `tests/crashes` migration for `-Znext-solver`) - #162156 (add IBM f128 type) - #163508 (Document the `rustc_on_unimplemented` attribute.) - #163794 (Use `target_family = "wasm"` instead of `target_arch = "wasm32"`) - #163863 (use the type name instead of `Self` in constructor paths again) - #163864 (Remove CLAUDE.md) - #163877 (Add regression test for duplicated rustdoc search results between std and core) - #163916 (Shrink `PartialRes` and its alignment) - #149753 (On name resolution error in parameter list, suggest possible `const` typo and avoid unnecessary second error) - #152557 (Oneshot `is_ready`) - #157273 (Stabilize `optimize` attribute) - #162000 (peel_transparent_wrappers only works on non-1ZST) - #163257 (abby DSL: sanity checks on forall where clauses) - #163343 (`unit` and `[1 x unit]` layouts are incompatible on big-endian targets) - #163348 (perf:cache FFI safety results in improper_ctypes lint) - #163768 (Move more `rustdoc-html` tests in the right location) - #163778 (check is_indirect_first_projection when replacing in RefProp) - #163789 (cg_llvm: Avoid `as_c_char_ptr` in several places) - #163807 (Add `has_reliable_f16b` for Arm) - #163809 (Switch TLS implementation for wasi and bump SDK version to 34) - #163826 (Update books) - #163849 (ci: update to PowerShell 7.6.6) - #163869 (INSTALL.md: use UCRT64 instead of MINGW64 in MSYS2 section) - #163870 (Add if-installed:auto:spellcheck to pre-push script)
…uppe cg_llvm: Avoid `as_c_char_ptr` in several places As noted in `rustc_codegen_llvm::ffi`: > Normally it's a good idea for Rust-side bindings to match the corresponding C-side function declarations as closely as possible. But when passing `&str` or `&[u8]` data as a pointer/length pair, it's more convenient to declare the Rust-side pointer as `*const c_uchar` instead of `*const c_char`. Both pointer types have the same ABI, and using `*const c_uchar` avoids the need for an extra cast from `*const u8` on the Rust side. The helper method `as_c_char_ptr` exists to make that extra cast more type-safe, but it's nicer to not need it all. In addition to making call sites a bit simpler, this adjustment also makes it harder to accidentally pass a nul-terminated string to a function expecting a pointer/length string, and vice-versa. There should be no change to compiler output.
…uwer Rollup of 24 pull requests Successful merges: - #163090 (Run LLDB debuginfo tests on `x86_64-pc-windows-msvc` in CI) - #163806 (even more `tests/crashes` migration for `-Znext-solver`) - #163508 (Document the `rustc_on_unimplemented` attribute.) - #163794 (Use `target_family = "wasm"` instead of `target_arch = "wasm32"`) - #163863 (use the type name instead of `Self` in constructor paths again) - #163864 (Remove CLAUDE.md) - #163877 (Add regression test for duplicated rustdoc search results between std and core) - #163916 (Shrink `PartialRes` and its alignment) - #149753 (On name resolution error in parameter list, suggest possible `const` typo and avoid unnecessary second error) - #152557 (Oneshot `is_ready`) - #157273 (Stabilize `optimize` attribute) - #162000 (peel_transparent_wrappers only works on non-1ZST) - #163257 (abby DSL: sanity checks on forall where clauses) - #163343 (`unit` and `[1 x unit]` layouts are incompatible on big-endian targets) - #163348 (perf:cache FFI safety results in improper_ctypes lint) - #163768 (Move more `rustdoc-html` tests in the right location) - #163778 (check is_indirect_first_projection when replacing in RefProp) - #163789 (cg_llvm: Avoid `as_c_char_ptr` in several places) - #163807 (Add `has_reliable_f16b` for Arm) - #163809 (Switch TLS implementation for wasi and bump SDK version to 34) - #163826 (Update books) - #163849 (ci: update to PowerShell 7.6.6) - #163869 (INSTALL.md: use UCRT64 instead of MINGW64 in MSYS2 section) - #163870 (Add if-installed:auto:spellcheck to pre-push script)
…uwer Rollup of 24 pull requests Successful merges: - #163090 (Run LLDB debuginfo tests on `x86_64-pc-windows-msvc` in CI) - #163806 (even more `tests/crashes` migration for `-Znext-solver`) - #163508 (Document the `rustc_on_unimplemented` attribute.) - #163794 (Use `target_family = "wasm"` instead of `target_arch = "wasm32"`) - #163863 (use the type name instead of `Self` in constructor paths again) - #163864 (Remove CLAUDE.md) - #163877 (Add regression test for duplicated rustdoc search results between std and core) - #163916 (Shrink `PartialRes` and its alignment) - #149753 (On name resolution error in parameter list, suggest possible `const` typo and avoid unnecessary second error) - #152557 (Oneshot `is_ready`) - #157273 (Stabilize `optimize` attribute) - #162000 (peel_transparent_wrappers only works on non-1ZST) - #163257 (abby DSL: sanity checks on forall where clauses) - #163343 (`unit` and `[1 x unit]` layouts are incompatible on big-endian targets) - #163348 (perf:cache FFI safety results in improper_ctypes lint) - #163768 (Move more `rustdoc-html` tests in the right location) - #163778 (check is_indirect_first_projection when replacing in RefProp) - #163789 (cg_llvm: Avoid `as_c_char_ptr` in several places) - #163807 (Add `has_reliable_f16b` for Arm) - #163809 (Switch TLS implementation for wasi and bump SDK version to 34) - #163826 (Update books) - #163849 (ci: update to PowerShell 7.6.6) - #163869 (INSTALL.md: use UCRT64 instead of MINGW64 in MSYS2 section) - #163870 (Add if-installed:auto:spellcheck to pre-push script)
…uwer Rollup of 24 pull requests Successful merges: - #163090 (Run LLDB debuginfo tests on `x86_64-pc-windows-msvc` in CI) - #163806 (even more `tests/crashes` migration for `-Znext-solver`) - #163508 (Document the `rustc_on_unimplemented` attribute.) - #163794 (Use `target_family = "wasm"` instead of `target_arch = "wasm32"`) - #163863 (use the type name instead of `Self` in constructor paths again) - #163864 (Remove CLAUDE.md) - #163877 (Add regression test for duplicated rustdoc search results between std and core) - #163916 (Shrink `PartialRes` and its alignment) - #149753 (On name resolution error in parameter list, suggest possible `const` typo and avoid unnecessary second error) - #152557 (Oneshot `is_ready`) - #157273 (Stabilize `optimize` attribute) - #162000 (peel_transparent_wrappers only works on non-1ZST) - #163257 (abby DSL: sanity checks on forall where clauses) - #163343 (`unit` and `[1 x unit]` layouts are incompatible on big-endian targets) - #163348 (perf:cache FFI safety results in improper_ctypes lint) - #163768 (Move more `rustdoc-html` tests in the right location) - #163778 (check is_indirect_first_projection when replacing in RefProp) - #163789 (cg_llvm: Avoid `as_c_char_ptr` in several places) - #163807 (Add `has_reliable_f16b` for Arm) - #163809 (Switch TLS implementation for wasi and bump SDK version to 34) - #163826 (Update books) - #163849 (ci: update to PowerShell 7.6.6) - #163869 (INSTALL.md: use UCRT64 instead of MINGW64 in MSYS2 section) - #163870 (Add if-installed:auto:spellcheck to pre-push script)
…uwer Rollup of 24 pull requests Successful merges: - #163090 (Run LLDB debuginfo tests on `x86_64-pc-windows-msvc` in CI) - #163806 (even more `tests/crashes` migration for `-Znext-solver`) - #163508 (Document the `rustc_on_unimplemented` attribute.) - #163794 (Use `target_family = "wasm"` instead of `target_arch = "wasm32"`) - #163863 (use the type name instead of `Self` in constructor paths again) - #163864 (Remove CLAUDE.md) - #163877 (Add regression test for duplicated rustdoc search results between std and core) - #163916 (Shrink `PartialRes` and its alignment) - #149753 (On name resolution error in parameter list, suggest possible `const` typo and avoid unnecessary second error) - #152557 (Oneshot `is_ready`) - #157273 (Stabilize `optimize` attribute) - #162000 (peel_transparent_wrappers only works on non-1ZST) - #163257 (abby DSL: sanity checks on forall where clauses) - #163343 (`unit` and `[1 x unit]` layouts are incompatible on big-endian targets) - #163348 (perf:cache FFI safety results in improper_ctypes lint) - #163768 (Move more `rustdoc-html` tests in the right location) - #163778 (check is_indirect_first_projection when replacing in RefProp) - #163789 (cg_llvm: Avoid `as_c_char_ptr` in several places) - #163807 (Add `has_reliable_f16b` for Arm) - #163809 (Switch TLS implementation for wasi and bump SDK version to 34) - #163826 (Update books) - #163849 (ci: update to PowerShell 7.6.6) - #163869 (INSTALL.md: use UCRT64 instead of MINGW64 in MSYS2 section) - #163870 (Add if-installed:auto:spellcheck to pre-push script)
…uwer Rollup of 23 pull requests Successful merges: - #163090 (Run LLDB debuginfo tests on `x86_64-pc-windows-msvc` in CI) - #163806 (even more `tests/crashes` migration for `-Znext-solver`) - #163508 (Document the `rustc_on_unimplemented` attribute.) - #163794 (Use `target_family = "wasm"` instead of `target_arch = "wasm32"`) - #163863 (use the type name instead of `Self` in constructor paths again) - #163864 (Remove CLAUDE.md) - #163877 (Add regression test for duplicated rustdoc search results between std and core) - #163916 (Shrink `PartialRes` and its alignment) - #149753 (On name resolution error in parameter list, suggest possible `const` typo and avoid unnecessary second error) - #152557 (Oneshot `is_ready`) - #157273 (Stabilize `optimize` attribute) - #162000 (peel_transparent_wrappers only works on non-1ZST) - #163343 (`unit` and `[1 x unit]` layouts are incompatible on big-endian targets) - #163348 (perf:cache FFI safety results in improper_ctypes lint) - #163768 (Move more `rustdoc-html` tests in the right location) - #163778 (check is_indirect_first_projection when replacing in RefProp) - #163789 (cg_llvm: Avoid `as_c_char_ptr` in several places) - #163807 (Add `has_reliable_f16b` for Arm) - #163809 (Switch TLS implementation for wasi and bump SDK version to 34) - #163826 (Update books) - #163849 (ci: update to PowerShell 7.6.6) - #163869 (INSTALL.md: use UCRT64 instead of MINGW64 in MSYS2 section) - #163870 (Add if-installed:auto:spellcheck to pre-push script)
Rollup merge of #163789 - Zalathar:as-c-char-ptr, r=hanna-kruppe cg_llvm: Avoid `as_c_char_ptr` in several places As noted in `rustc_codegen_llvm::ffi`: > Normally it's a good idea for Rust-side bindings to match the corresponding C-side function declarations as closely as possible. But when passing `&str` or `&[u8]` data as a pointer/length pair, it's more convenient to declare the Rust-side pointer as `*const c_uchar` instead of `*const c_char`. Both pointer types have the same ABI, and using `*const c_uchar` avoids the need for an extra cast from `*const u8` on the Rust side. The helper method `as_c_char_ptr` exists to make that extra cast more type-safe, but it's nicer to not need it all. In addition to making call sites a bit simpler, this adjustment also makes it harder to accidentally pass a nul-terminated string to a function expecting a pointer/length string, and vice-versa. There should be no change to compiler output.
|
Note This PR was benchmarked as part of triage of its containing rollup: triage URL. Finished benchmarking commit (039c207): comparison URL. Overall result: ✅ improvements - no action needed@rustbot label: -perf-regression Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)This perf run didn't have relevant results for this metric. CyclesThis perf run didn't have relevant results for this metric. Binary sizeThis perf run didn't have relevant results for this metric. Artifact size: 408.59 MiB -> 408.69 MiB (0.02%) |
|
This is noise, all PRs in the rollup have the same results |
cg_llvm: Avoid some explicit casts to `*const c_char` - Follow-up to rust-lang#163789 --- This is another application of the general principle noted in `rustc_codegen_llvm::ffi`: > Normally it's a good idea for Rust-side bindings to match the corresponding C-side function declarations as closely as possible. But when passing `&str` or `&[u8]` data as a pointer/length pair, it's more convenient to declare the Rust-side pointer as `*const c_uchar` instead of `*const c_char`. Both pointer types have the same ABI, and using `*const c_uchar` avoids the need for an extra cast from `*const u8` on the Rust side. For the changes in the main commit, a pointer/length string was being passed with `*const c_char` as the pointer type. This PR changes the Rust-side declaration to take `*const c_uchar` instead. Changing the declared type avoids the need for explicit casts, making it easier to notice any accidental type errors. --- A second commit also removes some pointer casts that were completely unnecessary. There should be no change to compiler output.
cg_llvm: Avoid some explicit casts to `*const c_char` - Follow-up to rust-lang#163789 --- This is another application of the general principle noted in `rustc_codegen_llvm::ffi`: > Normally it's a good idea for Rust-side bindings to match the corresponding C-side function declarations as closely as possible. But when passing `&str` or `&[u8]` data as a pointer/length pair, it's more convenient to declare the Rust-side pointer as `*const c_uchar` instead of `*const c_char`. Both pointer types have the same ABI, and using `*const c_uchar` avoids the need for an extra cast from `*const u8` on the Rust side. For the changes in the main commit, a pointer/length string was being passed with `*const c_char` as the pointer type. This PR changes the Rust-side declaration to take `*const c_uchar` instead. Changing the declared type avoids the need for explicit casts, making it easier to notice any accidental type errors. --- A second commit also removes some pointer casts that were completely unnecessary. There should be no change to compiler output.
cg_llvm: Avoid some explicit casts to `*const c_char` - Follow-up to rust-lang#163789 --- This is another application of the general principle noted in `rustc_codegen_llvm::ffi`: > Normally it's a good idea for Rust-side bindings to match the corresponding C-side function declarations as closely as possible. But when passing `&str` or `&[u8]` data as a pointer/length pair, it's more convenient to declare the Rust-side pointer as `*const c_uchar` instead of `*const c_char`. Both pointer types have the same ABI, and using `*const c_uchar` avoids the need for an extra cast from `*const u8` on the Rust side. For the changes in the main commit, a pointer/length string was being passed with `*const c_char` as the pointer type. This PR changes the Rust-side declaration to take `*const c_uchar` instead. Changing the declared type avoids the need for explicit casts, making it easier to notice any accidental type errors. --- A second commit also removes some pointer casts that were completely unnecessary. There should be no change to compiler output.
cg_llvm: Avoid some explicit casts to `*const c_char` - Follow-up to rust-lang#163789 --- This is another application of the general principle noted in `rustc_codegen_llvm::ffi`: > Normally it's a good idea for Rust-side bindings to match the corresponding C-side function declarations as closely as possible. But when passing `&str` or `&[u8]` data as a pointer/length pair, it's more convenient to declare the Rust-side pointer as `*const c_uchar` instead of `*const c_char`. Both pointer types have the same ABI, and using `*const c_uchar` avoids the need for an extra cast from `*const u8` on the Rust side. For the changes in the main commit, a pointer/length string was being passed with `*const c_char` as the pointer type. This PR changes the Rust-side declaration to take `*const c_uchar` instead. Changing the declared type avoids the need for explicit casts, making it easier to notice any accidental type errors. --- A second commit also removes some pointer casts that were completely unnecessary. There should be no change to compiler output.
cg_llvm: Avoid some explicit casts to `*const c_char` - Follow-up to rust-lang#163789 --- This is another application of the general principle noted in `rustc_codegen_llvm::ffi`: > Normally it's a good idea for Rust-side bindings to match the corresponding C-side function declarations as closely as possible. But when passing `&str` or `&[u8]` data as a pointer/length pair, it's more convenient to declare the Rust-side pointer as `*const c_uchar` instead of `*const c_char`. Both pointer types have the same ABI, and using `*const c_uchar` avoids the need for an extra cast from `*const u8` on the Rust side. For the changes in the main commit, a pointer/length string was being passed with `*const c_char` as the pointer type. This PR changes the Rust-side declaration to take `*const c_uchar` instead. Changing the declared type avoids the need for explicit casts, making it easier to notice any accidental type errors. --- A second commit also removes some pointer casts that were completely unnecessary. There should be no change to compiler output.
cg_llvm: Avoid some explicit casts to `*const c_char` - Follow-up to rust-lang#163789 --- This is another application of the general principle noted in `rustc_codegen_llvm::ffi`: > Normally it's a good idea for Rust-side bindings to match the corresponding C-side function declarations as closely as possible. But when passing `&str` or `&[u8]` data as a pointer/length pair, it's more convenient to declare the Rust-side pointer as `*const c_uchar` instead of `*const c_char`. Both pointer types have the same ABI, and using `*const c_uchar` avoids the need for an extra cast from `*const u8` on the Rust side. For the changes in the main commit, a pointer/length string was being passed with `*const c_char` as the pointer type. This PR changes the Rust-side declaration to take `*const c_uchar` instead. Changing the declared type avoids the need for explicit casts, making it easier to notice any accidental type errors. --- A second commit also removes some pointer casts that were completely unnecessary. There should be no change to compiler output.
Rollup merge of #164017 - Zalathar:char-ptr-cast, r=mati865 cg_llvm: Avoid some explicit casts to `*const c_char` - Follow-up to #163789 --- This is another application of the general principle noted in `rustc_codegen_llvm::ffi`: > Normally it's a good idea for Rust-side bindings to match the corresponding C-side function declarations as closely as possible. But when passing `&str` or `&[u8]` data as a pointer/length pair, it's more convenient to declare the Rust-side pointer as `*const c_uchar` instead of `*const c_char`. Both pointer types have the same ABI, and using `*const c_uchar` avoids the need for an extra cast from `*const u8` on the Rust side. For the changes in the main commit, a pointer/length string was being passed with `*const c_char` as the pointer type. This PR changes the Rust-side declaration to take `*const c_uchar` instead. Changing the declared type avoids the need for explicit casts, making it easier to notice any accidental type errors. --- A second commit also removes some pointer casts that were completely unnecessary. There should be no change to compiler output.
…uppe cg_llvm: Avoid all remaining uses of `as_c_char_ptr` Follow-up to: - rust-lang#163789 - rust-lang#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.
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.
…uwer Rollup of 23 pull requests Successful merges: - rust-lang/rust#163090 (Run LLDB debuginfo tests on `x86_64-pc-windows-msvc` in CI) - rust-lang/rust#163806 (even more `tests/crashes` migration for `-Znext-solver`) - rust-lang/rust#163508 (Document the `rustc_on_unimplemented` attribute.) - rust-lang/rust#163794 (Use `target_family = "wasm"` instead of `target_arch = "wasm32"`) - rust-lang/rust#163863 (use the type name instead of `Self` in constructor paths again) - rust-lang/rust#163864 (Remove CLAUDE.md) - rust-lang/rust#163877 (Add regression test for duplicated rustdoc search results between std and core) - rust-lang/rust#163916 (Shrink `PartialRes` and its alignment) - rust-lang/rust#149753 (On name resolution error in parameter list, suggest possible `const` typo and avoid unnecessary second error) - rust-lang/rust#152557 (Oneshot `is_ready`) - rust-lang/rust#157273 (Stabilize `optimize` attribute) - rust-lang/rust#162000 (peel_transparent_wrappers only works on non-1ZST) - rust-lang/rust#163343 (`unit` and `[1 x unit]` layouts are incompatible on big-endian targets) - rust-lang/rust#163348 (perf:cache FFI safety results in improper_ctypes lint) - rust-lang/rust#163768 (Move more `rustdoc-html` tests in the right location) - rust-lang/rust#163778 (check is_indirect_first_projection when replacing in RefProp) - rust-lang/rust#163789 (cg_llvm: Avoid `as_c_char_ptr` in several places) - rust-lang/rust#163807 (Add `has_reliable_f16b` for Arm) - rust-lang/rust#163809 (Switch TLS implementation for wasi and bump SDK version to 34) - rust-lang/rust#163826 (Update books) - rust-lang/rust#163849 (ci: update to PowerShell 7.6.6) - rust-lang/rust#163869 (INSTALL.md: use UCRT64 instead of MINGW64 in MSYS2 section) - rust-lang/rust#163870 (Add if-installed:auto:spellcheck to pre-push script)
As noted in
rustc_codegen_llvm::ffi:The helper method
as_c_char_ptrexists to make that extra cast more type-safe, but it's nicer to not need it all.In addition to making call sites a bit simpler, this adjustment also makes it harder to accidentally pass a nul-terminated string to a function expecting a pointer/length string, and vice-versa.
There should be no change to compiler output.