PathBuf to CString

I shall add that this problem exists in rustc itself. LLVM takes char* for paths, and rustc uses things like:

CString::new(format!("{}", path.display())
CString::new(path_buf.to_string_lossy().as_bytes())

which is incorrect on all platforms. It's unfixable on Windows, but it's unnecessarily broken on Unix.

2 Likes