1 #![warn(clippy::strlen_on_c_strings)]
3 #![feature(rustc_private)]
6 use std::ffi::{CStr, CString};
10 let cstring = CString::new("foo").expect("CString::new failed");
11 let len = unsafe { libc::strlen(cstring.as_ptr()) };
14 let cstr = CStr::from_bytes_with_nul(b"foo\0").expect("CStr::from_bytes_with_nul failed");
15 let len = unsafe { libc::strlen(cstr.as_ptr()) };