diff options
Diffstat (limited to 'src/librustc_codegen_llvm/lib.rs')
| -rw-r--r-- | src/librustc_codegen_llvm/lib.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs index f8f50326f0e..43942b0db85 100644 --- a/src/librustc_codegen_llvm/lib.rs +++ b/src/librustc_codegen_llvm/lib.rs @@ -72,7 +72,6 @@ use back::bytecode::RLIB_BYTECODE_EXTENSION; pub use llvm_util::target_features; use std::any::Any; use std::sync::mpsc; -use std::marker::PhantomData; use rustc_data_structures::sync::Lrc; use rustc::dep_graph::DepGraph; @@ -274,7 +273,7 @@ struct ModuleCodegen { /// as the crate name and disambiguator. /// We currently generate these names via CodegenUnit::build_cgu_name(). name: String, - module_llvm: ModuleLlvm<'static>, + module_llvm: ModuleLlvm, kind: ModuleKind, } @@ -316,17 +315,16 @@ impl ModuleCodegen { } } -struct ModuleLlvm<'ll> { +struct ModuleLlvm { llcx: &'static mut llvm::Context, llmod_raw: *const llvm::Module, tm: &'static mut llvm::TargetMachine, - phantom: PhantomData<&'ll ()> } -unsafe impl Send for ModuleLlvm<'ll> { } -unsafe impl Sync for ModuleLlvm<'ll> { } +unsafe impl Send for ModuleLlvm { } +unsafe impl Sync for ModuleLlvm { } -impl ModuleLlvm<'ll> { +impl ModuleLlvm { fn new(sess: &Session, mod_name: &str) -> Self { unsafe { let llcx = llvm::LLVMRustContextCreate(sess.fewer_names()); @@ -336,7 +334,6 @@ impl ModuleLlvm<'ll> { llmod_raw, llcx, tm: create_target_machine(sess, false), - phantom: PhantomData } } } @@ -348,7 +345,7 @@ impl ModuleLlvm<'ll> { } } -impl Drop for ModuleLlvm<'ll> { +impl Drop for ModuleLlvm { fn drop(&mut self) { unsafe { llvm::LLVMContextDispose(&mut *(self.llcx as *mut _)); |
