From c59d45b2ac5d2871c38ed20b57fc3547de5ecc1d Mon Sep 17 00:00:00 2001 From: Deadbeef Date: Sun, 5 Mar 2023 15:03:22 +0000 Subject: [PATCH 1/3] initial step towards implementing C string literals --- core/src/ffi/c_str.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/core/src/ffi/c_str.rs b/core/src/ffi/c_str.rs index bd2b2c36c..2ac679b6b 100644 --- a/core/src/ffi/c_str.rs +++ b/core/src/ffi/c_str.rs @@ -82,6 +82,7 @@ use crate::str; #[cfg_attr(not(test), rustc_diagnostic_item = "CStr")] #[stable(feature = "core_c_str", since = "1.64.0")] #[rustc_has_incoherent_inherent_impls] +#[cfg_attr(not(bootstrap), lang = "CStr")] // FIXME: // `fn from` in `impl From<&CStr> for Box` current implementation relies // on `CStr` being layout-compatible with `[u8]`. From ab8185477d2f1fbae8cdb92ca81b692329c16062 Mon Sep 17 00:00:00 2001 From: Deadbeef Date: Mon, 6 Mar 2023 07:42:04 +0000 Subject: [PATCH 2/3] fix TODO comments --- proc_macro/src/bridge/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/proc_macro/src/bridge/mod.rs b/proc_macro/src/bridge/mod.rs index 54b11c543..caecda1bc 100644 --- a/proc_macro/src/bridge/mod.rs +++ b/proc_macro/src/bridge/mod.rs @@ -337,6 +337,8 @@ pub enum LitKind { StrRaw(u8), ByteStr, ByteStrRaw(u8), + CStr, + CStrRaw(u8), Err, } @@ -350,6 +352,8 @@ rpc_encode_decode!( StrRaw(n), ByteStr, ByteStrRaw(n), + CStr, + CStrRaw(n), Err, } ); From 4582b0f5aa9fb43115bc60d31541954e9829cbec Mon Sep 17 00:00:00 2001 From: Deadbeef Date: Mon, 6 Mar 2023 14:09:28 +0000 Subject: [PATCH 3/3] rm diag item, use lang item --- core/src/ffi/c_str.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/core/src/ffi/c_str.rs b/core/src/ffi/c_str.rs index 2ac679b6b..07b11814f 100644 --- a/core/src/ffi/c_str.rs +++ b/core/src/ffi/c_str.rs @@ -79,7 +79,6 @@ use crate::str; /// /// [str]: prim@str "str" #[derive(Hash)] -#[cfg_attr(not(test), rustc_diagnostic_item = "CStr")] #[stable(feature = "core_c_str", since = "1.64.0")] #[rustc_has_incoherent_inherent_impls] #[cfg_attr(not(bootstrap), lang = "CStr")]