From da594a74999ed626605b30de67cd78da939e33e1 Mon Sep 17 00:00:00 2001 From: petevine Date: Sun, 3 Jan 2016 14:09:48 +0100 Subject: [PATCH 1/2] Update llvm.rs --- src/llvm.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/llvm.rs b/src/llvm.rs index bf547b6b..f6d4a191 100644 --- a/src/llvm.rs +++ b/src/llvm.rs @@ -49,7 +49,7 @@ impl Module { // LLVM gives us a *char pointer, so wrap it in a CStr to mark it // as borrowed. let llvm_ir_ptr = LLVMPrintModuleToString(self.module); - let llvm_ir = CStr::from_ptr(llvm_ir_ptr); + let llvm_ir = CStr::from_ptr(llvm_ir_ptr as *const _); // Make an owned copy of the string in our memory space. let module_string = CString::new(llvm_ir.to_bytes().clone()).unwrap(); @@ -266,7 +266,7 @@ fn create_module(module_name: &str, target_triple: Option) -> Module { // This is necessary for maximum LLVM performance, see // http://llvm.org/docs/Frontend/PerformanceTips.html unsafe { - LLVMSetTarget(llvm_module, target_triple_cstring.as_ptr()); + LLVMSetTarget(llvm_module, target_triple_cstring.as_ptr() as *const _); } // TODO: add a function to the LLVM C API that gives us the // data layout from the target machine. @@ -769,7 +769,7 @@ pub fn get_default_target_triple() -> CString { let target_triple; unsafe { let target_triple_ptr = LLVMGetDefaultTargetTriple(); - target_triple = CStr::from_ptr(target_triple_ptr).to_owned(); + target_triple = CStr::from_ptr(target_triple_ptr as *const _).to_owned(); LLVMDisposeMessage(target_triple_ptr); } @@ -799,8 +799,8 @@ impl TargetMachine { target_machine = LLVMCreateTargetMachine(target, target_triple, - cpu.as_ptr(), - features.as_ptr(), + cpu.as_ptr() as *const _, + features.as_ptr() as *const _, LLVMCodeGenOptLevel::LLVMCodeGenLevelAggressive, LLVMRelocMode::LLVMRelocDefault, LLVMCodeModel::LLVMCodeModelDefault); @@ -839,7 +839,7 @@ pub fn write_object_file(module: &mut Module, path: &str) { &mut obj_error); if result != 0 { - println!("obj_error: {:?}", CStr::from_ptr(obj_error)); + println!("obj_error: {:?}", CStr::from_ptr(obj_error as *const _)); assert!(false); } } From 5d8198cf4e38461924dfc35b1abe158c4fdeb1d8 Mon Sep 17 00:00:00 2001 From: petevine Date: Sun, 3 Jan 2016 14:12:18 +0100 Subject: [PATCH 2/2] Update Cargo.toml --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 0c644d6f..0a2f5798 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ llvm-sys = "*" itertools = "*" rand = "*" quickcheck = "*" -tempfile = "*" +tempfile = "1.1.3" libc = "0.2" getopts = "*" matches = "*"