Rollup merge of #128735 - jieyouxu:pr-120176-revive, r=cjgillot · patricklam/verify-rust-std@112ebc4 (original) (raw)
Navigation Menu
- GitHub Copilot Write better code with AI
- GitHub Models New Manage and compare prompts
- GitHub Advanced Security Find and fix vulnerabilities
- Actions Automate any workflow
- Codespaces Instant dev environments
- Issues Plan and track work
- Code Review Manage code changes
- Discussions Collaborate outside of code
- Code Search Find more, search less
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Commit 112ebc4
Rollup merge of rust-lang#128735 - jieyouxu:pr-120176-revive, r=cjgillot
Add a special case for `CStr`/`CString` in the `improper_ctypes` lint Revives rust-lang#120176. Just needed to bless a test and fix an argument, but seemed reasonable to me otherwise. Instead of saying to "consider adding a `#[repr(C)]` or `#[repr(transparent)]` attribute to this struct", we now tell users to "Use `*const ffi::c_char` instead, and pass the value from `CStr::as_ptr()`" when the type involved is a `CStr` or a `CString`. The suggestion is not made for `&mut CString` or `*mut CString`. r? ``````@cjgillot`````` (since you were the reviewer of the original PR rust-lang#120176, but feel free to reroll)
File tree
1 file changed
lines changed
1 file changed
lines changed
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -91,6 +91,7 @@ use crate::{fmt, intrinsics, ops, slice, str}; | ||
91 | 91 | /// [str]: prim@str "str" |
92 | 92 | #[derive(PartialEq, Eq, Hash)] |
93 | 93 | #[stable(feature = "core_c_str", since = "1.64.0")] |
94 | +#[rustc_diagnostic_item = "cstr_type"] | |
94 | 95 | #[rustc_has_incoherent_inherent_impls] |
95 | 96 | #[lang = "CStr"] |
96 | 97 | // `fn from` in `impl From<&CStr> for Box` current implementation relies |