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