1
Fork 0

Dangling pointer fix

This commit is contained in:
Artyom Pavlov 2018-02-11 15:57:07 +03:00 committed by GitHub
parent 7c6adb475a
commit c2a31dee83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -118,8 +118,8 @@ pub fn target_features(sess: &Session) -> Vec<Symbol> {
.iter()
.filter(|feature| {
let llvm_feature = to_llvm_feature(feature);
let ptr = CString::new(llvm_feature).unwrap().as_ptr();
unsafe { llvm::LLVMRustHasFeature(target_machine, ptr) }
let cstr = CString::new(llvm_feature).unwrap();
unsafe { llvm::LLVMRustHasFeature(target_machine, cstr.as_ptr()) }
})
.map(|feature| Symbol::intern(feature)).collect()
}