We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9f4d198 commit 878cf8aCopy full SHA for 878cf8a
src/module.rs
@@ -739,7 +739,8 @@ impl Module {
739
740
/// Prints the content of the `Module` to a file.
741
pub fn print_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), LLVMString> {
742
- let path = path.as_ref().to_str().expect("Did not find a valid Unicode path string");
+ let path_str = path.as_ref().to_str().expect("Did not find a valid Unicode path string");
743
+ let path = CString::new(path_str).expect("Could not convert path to CString");
744
let mut err_string = unsafe { zeroed() };
745
let return_code = unsafe {
746
LLVMPrintModuleToFile(self.module.get(), path.as_ptr() as *const i8, &mut err_string)
0 commit comments