Skip to content

Commit 878cf8a

Browse files
committed
Fixes rust-lang#63
1 parent 9f4d198 commit 878cf8a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: src/module.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,8 @@ impl Module {
739739

740740
/// Prints the content of the `Module` to a file.
741741
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");
742+
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");
743744
let mut err_string = unsafe { zeroed() };
744745
let return_code = unsafe {
745746
LLVMPrintModuleToFile(self.module.get(), path.as_ptr() as *const i8, &mut err_string)

0 commit comments

Comments
 (0)