diff --git a/ptx/src/pass/emit_llvm.rs b/ptx/src/pass/emit_llvm.rs index 20f9891..bd5c277 100644 --- a/ptx/src/pass/emit_llvm.rs +++ b/ptx/src/pass/emit_llvm.rs @@ -27,7 +27,7 @@ use std::array::TryFromSliceError; use std::convert::TryInto; use std::ffi::{CStr, NulError}; -use std::mem; +use std::mem::MaybeUninit; use std::ops::Deref; use std::{i8, ptr}; @@ -153,9 +153,10 @@ pub struct MemoryBuffer(LLVMMemoryBufferRef); impl MemoryBuffer { pub fn print_as_asm(&self) -> &str { unsafe { - let mut module: LLVMModuleRef = mem::zeroed(); let context = Context::new(); - LLVMParseBitcodeInContext2(context.0, self.0, &mut module); + let mut module = MaybeUninit::uninit(); + LLVMParseBitcodeInContext2(context.0, self.0, module.as_mut_ptr()); + let module = module.assume_init(); let asm = LLVMPrintModuleToString(module); LLVMDisposeModule(module); let asm = CStr::from_ptr(asm);