Rust in the 6.2 kernel
Rust in the 6.2 kernel
Posted Nov 18, 2022 3:59 UTC (Fri) by ABCD (subscriber, #53650)In reply to: Rust in the 6.2 kernel by droundy
Parent article: Rust in the 6.2 kernel
CStr (both kernel::str::CStr and core::ffi::CStr) are implemented as dynamically-sized types (specifically, a newtype wrapper around [u8]), so a &CStr is a fat pointer containing both the pointer to the data and the length of that data, just like a &str or &[u8].
Posted Nov 18, 2022 14:21 UTC (Fri)
by xav (guest, #18536)
[Link]
Rust in the 6.2 kernel
It is yes, but AFAIK it's an oversight and could be replaced soon with a thin pointer - this is alluded to here for example: https://github.com/m-ou-se/rfcs/blob/c-str-literal/text/3...
