@@ -184,7 +184,7 @@ impl fmt::Debug for CStr {
184
184
/// ```
185
185
/// #![feature(cstr_macro)]
186
186
///
187
- /// use core::ffi::CStr;
187
+ /// use core::ffi::{cstr, CStr} ;
188
188
///
189
189
/// const HELLO: &CStr = cstr!("Hello, world!");
190
190
/// assert_eq!(HELLO.to_bytes_with_nul(), b"Hello, world!\0");
@@ -196,16 +196,17 @@ impl fmt::Debug for CStr {
196
196
/// ```compile_fail
197
197
/// #![feature(const_cstr_from_bytes)]
198
198
///
199
- /// use core::ffi::CStr;
199
+ /// use core::ffi::{cstr, CStr} ;
200
200
///
201
201
/// const HELLO: &CStr = cstr!("Hello, world!\0"); // compile fail!
202
202
/// ```
203
- #[ macro_export]
203
+ #[ macro_export( local_inner_macros ) ]
204
204
#[ unstable( feature = "cstr_macro" , issue = "101607" ) ]
205
205
#[ rustc_diagnostic_item = "core_cstr_macro" ]
206
- macro_rules! cstr {
206
+ #[ doc( hidden) ]
207
+ macro_rules! __cstr_macro_impl {
207
208
( ) => {
208
- cstr !( "" )
209
+ __cstr_macro_impl !( "" )
209
210
} ;
210
211
( $s: literal) => { {
211
212
const BYTES : & [ u8 ] = $crate:: ffi:: __cstr_macro_impl_as_bytes( $s) ;
@@ -216,6 +217,9 @@ macro_rules! cstr {
216
217
CSTR
217
218
} } ;
218
219
}
220
+ #[ unstable( feature = "cstr_macro" , issue = "101607" ) ]
221
+ #[ doc( inline) ]
222
+ pub use __cstr_macro_impl as cstr;
219
223
220
224
#[ unstable( feature = "cstr_macro" , issue = "101607" ) ]
221
225
#[ doc( hidden) ]
0 commit comments