rustc_codegen_llvm: fix ownership of Builder.

This commit is contained in:
Irina Popa 2018-07-17 18:33:09 +03:00
parent 265f2fa4de
commit 54c98ab0dd
2 changed files with 105 additions and 96 deletions

View file

@ -27,14 +27,14 @@ use std::ptr;
// All Builders must have an llfn associated with them
#[must_use]
pub struct Builder<'a, 'll: 'a, 'tcx: 'll> {
pub llbuilder: &'ll llvm::Builder,
pub llbuilder: &'ll mut llvm::Builder<'ll>,
pub cx: &'a CodegenCx<'ll, 'tcx>,
}
impl Drop for Builder<'a, 'll, 'tcx> {
fn drop(&mut self) {
unsafe {
llvm::LLVMDisposeBuilder(self.llbuilder);
llvm::LLVMDisposeBuilder(&mut *(self.llbuilder as *mut _));
}
}
}