about summary refs log tree commit diff
path: root/compiler/rustc_span/src
diff options
context:
space:
mode:
authorTrevor Gross <t.gross35@gmail.com>2024-08-24 21:03:31 -0500
committerGitHub <noreply@github.com>2024-08-24 21:03:31 -0500
commit198a68df1ceba3817c5a19c0451e8ddf74690060 (patch)
treeb7fdee2d4021755bff45ebb3ebae1a04c422b52c /compiler/rustc_span/src
parentdfe7d5c31e51d61c866a294393e4d839d4b42131 (diff)
parentb335ec9ec8d1132efee4e900a1c173efc7f4a357 (diff)
downloadrust-198a68df1ceba3817c5a19c0451e8ddf74690060.tar.gz
rust-198a68df1ceba3817c5a19c0451e8ddf74690060.zip
Rollup merge of #128735 - jieyouxu:pr-120176-revive, r=cjgillot
Add a special case for `CStr`/`CString` in the `improper_ctypes` lint

Revives #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 #120176, but feel free to reroll)
Diffstat (limited to 'compiler/rustc_span/src')
-rw-r--r--compiler/rustc_span/src/symbol.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs
index a2e94492f8c..b16951a1868 100644
--- a/compiler/rustc_span/src/symbol.rs
+++ b/compiler/rustc_span/src/symbol.rs
@@ -673,6 +673,7 @@ symbols! {
         crate_visibility_modifier,
         crt_dash_static: "crt-static",
         csky_target_feature,
+        cstr_type,
         cstring_type,
         ctlz,
         ctlz_nonzero,