about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/base.rs10
-rw-r--r--src/common.rs2
-rw-r--r--src/debuginfo/emit.rs2
-rw-r--r--src/debuginfo/line_info.rs10
-rw-r--r--src/debuginfo/mod.rs13
-rw-r--r--src/driver/aot.rs2
-rw-r--r--src/driver/jit.rs8
-rw-r--r--src/lib.rs8
8 files changed, 28 insertions, 27 deletions
diff --git a/src/base.rs b/src/base.rs
index b35f02e2d2d..b2026f30d17 100644
--- a/src/base.rs
+++ b/src/base.rs
@@ -24,7 +24,7 @@ struct CodegenedFunction<'tcx> {
 
 pub(crate) fn codegen_and_compile_fn<'tcx>(
     tcx: TyCtxt<'tcx>,
-    cx: &mut crate::CodegenCx<'tcx>,
+    cx: &mut crate::CodegenCx,
     cached_context: &mut Context,
     module: &mut dyn Module,
     instance: Instance<'tcx>,
@@ -35,12 +35,12 @@ pub(crate) fn codegen_and_compile_fn<'tcx>(
     let cached_func = std::mem::replace(&mut cached_context.func, Function::new());
     let codegened_func = codegen_fn(tcx, cx, cached_func, module, instance);
 
-    compile_fn(cx, cached_context, module, codegened_func);
+    compile_fn(tcx, cx, cached_context, module, codegened_func);
 }
 
 fn codegen_fn<'tcx>(
     tcx: TyCtxt<'tcx>,
-    cx: &mut crate::CodegenCx<'tcx>,
+    cx: &mut crate::CodegenCx,
     cached_func: Function,
     module: &mut dyn Module,
     instance: Instance<'tcx>,
@@ -132,7 +132,8 @@ fn codegen_fn<'tcx>(
 }
 
 fn compile_fn<'tcx>(
-    cx: &mut crate::CodegenCx<'tcx>,
+    tcx: TyCtxt<'tcx>,
+    cx: &mut crate::CodegenCx,
     cached_context: &mut Context,
     module: &mut dyn Module,
     codegened_func: CodegenedFunction<'tcx>,
@@ -214,6 +215,7 @@ fn compile_fn<'tcx>(
     cx.profiler.verbose_generic_activity("generate debug info").run(|| {
         if let Some(debug_context) = debug_context {
             debug_context.define_function(
+                tcx,
                 codegened_func.func_id,
                 codegened_func.symbol_name.name,
                 context,
diff --git a/src/common.rs b/src/common.rs
index fc4953cea6f..1adb64da8bd 100644
--- a/src/common.rs
+++ b/src/common.rs
@@ -232,7 +232,7 @@ pub(crate) fn type_sign(ty: Ty<'_>) -> bool {
 }
 
 pub(crate) struct FunctionCx<'m, 'clif, 'tcx: 'm> {
-    pub(crate) cx: &'clif mut crate::CodegenCx<'tcx>,
+    pub(crate) cx: &'clif mut crate::CodegenCx,
     pub(crate) module: &'m mut dyn Module,
     pub(crate) tcx: TyCtxt<'tcx>,
     pub(crate) target_config: TargetFrontendConfig, // Cached from module
diff --git a/src/debuginfo/emit.rs b/src/debuginfo/emit.rs
index 589910ede96..9583cd2ec60 100644
--- a/src/debuginfo/emit.rs
+++ b/src/debuginfo/emit.rs
@@ -9,7 +9,7 @@ use gimli::{RunTimeEndian, SectionId};
 use super::object::WriteDebugInfo;
 use super::DebugContext;
 
-impl DebugContext<'_> {
+impl DebugContext {
     pub(crate) fn emit(&mut self, product: &mut ObjectProduct) {
         let unit_range_list_id = self.dwarf.unit.ranges.add(self.unit_range_list.clone());
         let root = self.dwarf.unit.root();
diff --git a/src/debuginfo/line_info.rs b/src/debuginfo/line_info.rs
index bbcb9591373..de402a4c713 100644
--- a/src/debuginfo/line_info.rs
+++ b/src/debuginfo/line_info.rs
@@ -96,9 +96,9 @@ fn line_program_add_file(
     }
 }
 
-impl<'tcx> DebugContext<'tcx> {
-    pub(super) fn emit_location(&mut self, entry_id: UnitEntryId, span: Span) {
-        let loc = self.tcx.sess.source_map().lookup_char_pos(span.lo());
+impl DebugContext {
+    fn emit_location(&mut self, tcx: TyCtxt<'_>, entry_id: UnitEntryId, span: Span) {
+        let loc = tcx.sess.source_map().lookup_char_pos(span.lo());
 
         let file_id = line_program_add_file(
             &mut self.dwarf.unit.line_program,
@@ -115,13 +115,13 @@ impl<'tcx> DebugContext<'tcx> {
 
     pub(super) fn create_debug_lines(
         &mut self,
+        tcx: TyCtxt<'_>,
         symbol: usize,
         entry_id: UnitEntryId,
         context: &Context,
         function_span: Span,
         source_info_set: &indexmap::IndexSet<SourceInfo>,
     ) -> CodeOffset {
-        let tcx = self.tcx;
         let line_program = &mut self.dwarf.unit.line_program;
 
         let line_strings = &mut self.dwarf.line_strings;
@@ -211,7 +211,7 @@ impl<'tcx> DebugContext<'tcx> {
         );
         entry.set(gimli::DW_AT_high_pc, AttributeValue::Udata(u64::from(func_end)));
 
-        self.emit_location(entry_id, function_span);
+        self.emit_location(tcx, entry_id, function_span);
 
         func_end
     }
diff --git a/src/debuginfo/mod.rs b/src/debuginfo/mod.rs
index 9a0787508b7..3e42905c840 100644
--- a/src/debuginfo/mod.rs
+++ b/src/debuginfo/mod.rs
@@ -16,17 +16,15 @@ use gimli::{Encoding, Format, LineEncoding, RunTimeEndian};
 pub(crate) use emit::{DebugReloc, DebugRelocName};
 pub(crate) use unwind::UnwindContext;
 
-pub(crate) struct DebugContext<'tcx> {
-    tcx: TyCtxt<'tcx>,
-
+pub(crate) struct DebugContext {
     endian: RunTimeEndian,
 
     dwarf: DwarfUnit,
     unit_range_list: RangeList,
 }
 
-impl<'tcx> DebugContext<'tcx> {
-    pub(crate) fn new(tcx: TyCtxt<'tcx>, isa: &dyn TargetIsa) -> Self {
+impl DebugContext {
+    pub(crate) fn new(tcx: TyCtxt<'_>, isa: &dyn TargetIsa) -> Self {
         let encoding = Encoding {
             format: Format::Dwarf32,
             // FIXME this should be configurable
@@ -92,11 +90,12 @@ impl<'tcx> DebugContext<'tcx> {
             root.set(gimli::DW_AT_low_pc, AttributeValue::Address(Address::Constant(0)));
         }
 
-        DebugContext { tcx, endian, dwarf, unit_range_list: RangeList(Vec::new()) }
+        DebugContext { endian, dwarf, unit_range_list: RangeList(Vec::new()) }
     }
 
     pub(crate) fn define_function(
         &mut self,
+        tcx: TyCtxt<'_>,
         func_id: FuncId,
         name: &str,
         context: &Context,
@@ -116,7 +115,7 @@ impl<'tcx> DebugContext<'tcx> {
         entry.set(gimli::DW_AT_linkage_name, AttributeValue::StringRef(name_id));
 
         let end =
-            self.create_debug_lines(symbol, entry_id, context, function_span, source_info_set);
+            self.create_debug_lines(tcx, symbol, entry_id, context, function_span, source_info_set);
 
         self.unit_range_list.0.push(Range::StartLength {
             begin: Address::Symbol { symbol, addend: 0 },
diff --git a/src/driver/aot.rs b/src/driver/aot.rs
index b2ad3cc4c4c..971e5eeea87 100644
--- a/src/driver/aot.rs
+++ b/src/driver/aot.rs
@@ -120,7 +120,7 @@ fn emit_cgu(
     prof: &SelfProfilerRef,
     name: String,
     module: ObjectModule,
-    debug: Option<DebugContext<'_>>,
+    debug: Option<DebugContext>,
     unwind_context: UnwindContext,
     global_asm_object_file: Option<PathBuf>,
 ) -> Result<ModuleCodegenResult, String> {
diff --git a/src/driver/jit.rs b/src/driver/jit.rs
index 00e7263446b..0e77e4004c0 100644
--- a/src/driver/jit.rs
+++ b/src/driver/jit.rs
@@ -61,11 +61,11 @@ impl UnsafeMessage {
     }
 }
 
-fn create_jit_module<'tcx>(
-    tcx: TyCtxt<'tcx>,
+fn create_jit_module(
+    tcx: TyCtxt<'_>,
     backend_config: &BackendConfig,
     hotswap: bool,
-) -> (JITModule, CodegenCx<'tcx>) {
+) -> (JITModule, CodegenCx) {
     let crate_info = CrateInfo::new(tcx, "dummy_target_cpu".to_string());
     let imported_symbols = load_imported_symbols_for_jit(tcx.sess, crate_info);
 
@@ -353,7 +353,7 @@ fn load_imported_symbols_for_jit(
 
 fn codegen_shim<'tcx>(
     tcx: TyCtxt<'tcx>,
-    cx: &mut CodegenCx<'tcx>,
+    cx: &mut CodegenCx,
     cached_context: &mut Context,
     module: &mut JITModule,
     inst: Instance<'tcx>,
diff --git a/src/lib.rs b/src/lib.rs
index f4ffbbcf86e..40dab58523c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -122,20 +122,20 @@ impl<F: Fn() -> String> Drop for PrintOnPanic<F> {
 
 /// The codegen context holds any information shared between the codegen of individual functions
 /// inside a single codegen unit with the exception of the Cranelift [`Module`](cranelift_module::Module).
-struct CodegenCx<'tcx> {
+struct CodegenCx {
     profiler: SelfProfilerRef,
     output_filenames: Arc<OutputFilenames>,
     should_write_ir: bool,
     global_asm: String,
     inline_asm_index: Cell<usize>,
-    debug_context: Option<DebugContext<'tcx>>,
+    debug_context: Option<DebugContext>,
     unwind_context: UnwindContext,
     cgu_name: Symbol,
 }
 
-impl<'tcx> CodegenCx<'tcx> {
+impl CodegenCx {
     fn new(
-        tcx: TyCtxt<'tcx>,
+        tcx: TyCtxt<'_>,
         backend_config: BackendConfig,
         isa: &dyn TargetIsa,
         debug_info: bool,