#![allow(unused_variables)] fn main() { use std::ffi::CString; let bytes = b"f\0oo".to_vec(); let value = CString::from_vec_with_nul(bytes.clone()); assert_eq!(& bytes[..], value.unwrap_err().as_bytes()); }