about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDenis Merigoux <denis.merigoux@gmail.com>2018-09-06 16:04:20 -0700
committerEduard-Mihai Burtescu <edy.burt@gmail.com>2018-11-16 14:11:59 +0200
commit4787b7cac9da73a2c1c9cb2683e7f904a01f563c (patch)
tree0064102c97d347aa09fdf5315b8c943d00e08de5
parenta1d0d4f9439640d8694ebb7fa905f4e328d5febd (diff)
downloadrust-4787b7cac9da73a2c1c9cb2683e7f904a01f563c.tar.gz
rust-4787b7cac9da73a2c1c9cb2683e7f904a01f563c.zip
Removed phantomdata no longer necessary
Because CodegenContext doesn't implement Backend anymore
-rw-r--r--src/librustc_codegen_llvm/back/lto.rs2
-rw-r--r--src/librustc_codegen_llvm/back/write.rs17
-rw-r--r--src/librustc_codegen_llvm/lib.rs15
3 files changed, 12 insertions, 22 deletions
diff --git a/src/librustc_codegen_llvm/back/lto.rs b/src/librustc_codegen_llvm/back/lto.rs
index 95b1b6ff3ce..60b06c579cb 100644
--- a/src/librustc_codegen_llvm/back/lto.rs
+++ b/src/librustc_codegen_llvm/back/lto.rs
@@ -26,7 +26,6 @@ use rustc_data_structures::fx::FxHashMap;
 use rustc_codegen_utils::symbol_export;
 use time_graph::Timeline;
 use {ModuleCodegen, ModuleLlvm, ModuleKind};
-use std::marker::PhantomData;
 
 use libc;
 
@@ -768,7 +767,6 @@ impl ThinModule {
                 llmod_raw,
                 llcx,
                 tm,
-                phantom: PhantomData
             },
             name: self.name().to_string(),
             kind: ModuleKind::Regular,
diff --git a/src/librustc_codegen_llvm/back/write.rs b/src/librustc_codegen_llvm/back/write.rs
index 8972a7e8f99..bb490c58285 100644
--- a/src/librustc_codegen_llvm/back/write.rs
+++ b/src/librustc_codegen_llvm/back/write.rs
@@ -49,7 +49,6 @@ use context::{is_pie_binary, get_reloc_model};
 use common;
 use jobserver::{Client, Acquired};
 use rustc_demangle;
-use std::marker::PhantomData;
 
 use std::any::Any;
 use std::ffi::{CString, CStr};
@@ -352,7 +351,7 @@ struct AssemblerCommand {
 
 /// Additional resources used by optimize_and_codegen (not module specific)
 #[derive(Clone)]
-pub struct CodegenContext<'ll> {
+pub struct CodegenContext {
     // Resources needed when running LTO
     pub time_passes: bool,
     pub lto: Lto,
@@ -393,13 +392,10 @@ pub struct CodegenContext<'ll> {
     // measuring is disabled.
     time_graph: Option<TimeGraph>,
     // The assembler command if no_integrated_as option is enabled, None otherwise
-    assembler_cmd: Option<Arc<AssemblerCommand>>,
-    // This field is used to give a lifetime parameter to the struct so that it can implement
-    // the Backend trait.
-    phantom: PhantomData<&'ll ()>
+    assembler_cmd: Option<Arc<AssemblerCommand>>
 }
 
-impl CodegenContext<'ll> {
+impl CodegenContext {
     pub fn create_diag_handler(&self) -> Handler {
         Handler::with_emitter(true, false, Box::new(self.diag_emitter.clone()))
     }
@@ -428,12 +424,12 @@ impl CodegenContext<'ll> {
 }
 
 pub struct DiagnosticHandlers<'a> {
-    data: *mut (&'a CodegenContext<'a>, &'a Handler),
+    data: *mut (&'a CodegenContext, &'a Handler),
     llcx: &'a llvm::Context,
 }
 
 impl<'a> DiagnosticHandlers<'a> {
-    pub fn new(cgcx: &'a CodegenContext<'a>,
+    pub fn new(cgcx: &'a CodegenContext,
                handler: &'a Handler,
                llcx: &'a llvm::Context) -> Self {
         let data = Box::into_raw(Box::new((cgcx, handler)));
@@ -1618,7 +1614,6 @@ fn start_executing_work(tcx: TyCtxt,
         target_pointer_width: tcx.sess.target.target.target_pointer_width.clone(),
         debuginfo: tcx.sess.opts.debuginfo,
         assembler_cmd,
-        phantom: PhantomData
     };
 
     // This is the "main loop" of parallel work happening for parallel codegen.
@@ -2113,7 +2108,7 @@ pub const CODEGEN_WORK_PACKAGE_KIND: time_graph::WorkPackageKind =
 const LLVM_WORK_PACKAGE_KIND: time_graph::WorkPackageKind =
     time_graph::WorkPackageKind(&["#7DB67A", "#C6EEC4", "#ACDAAA", "#579354", "#3E6F3C"]);
 
-fn spawn_work(cgcx: CodegenContext<'static>, work: WorkItem) {
+fn spawn_work(cgcx: CodegenContext, work: WorkItem) {
     let depth = time_depth();
 
     thread::spawn(move || {
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 _));