Skip to content

Commit 7082b20

Browse files
committed
rust: types: CStr: Allow cstr!() used in unsafe blocks
Signed-off-by: Boqun Feng <[email protected]>
1 parent f7c50eb commit 7082b20

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

rust/kernel/types.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ impl Deref for CStr<'_> {
6868
macro_rules! cstr {
6969
($str:expr) => {{
7070
let s = concat!($str, "\x00");
71-
unsafe { $crate::CStr::new_unchecked(s) }
71+
#[allow(unused_unsafe)] // This macro may be used in `unsafe`.
72+
unsafe {
73+
$crate::CStr::new_unchecked(s)
74+
}
7275
}};
7376
}

0 commit comments

Comments
 (0)