Rollup merge of #128735 - jieyouxu:pr-120176-revive, r=cjgillot · patricklam/verify-rust-std@112ebc4

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 numberDiff line numberDiff line change

@@ -91,6 +91,7 @@ use crate::{fmt, intrinsics, ops, slice, str};

9191

/// [str]: prim@str "str"

9292

#[derive(PartialEq, Eq, Hash)]

9393

#[stable(feature = "core_c_str", since = "1.64.0")]

94+

#[rustc_diagnostic_item = "cstr_type"]

9495

#[rustc_has_incoherent_inherent_impls]

9596

#[lang = "CStr"]

9697

// `fn from` in `impl From<&CStr> for Box<CStr>` current implementation relies

0 commit comments