diff --git a/src/abi.rs b/src/abi.rs index 7bb3b1b56b9..033d41c5f20 100644 --- a/src/abi.rs +++ b/src/abi.rs @@ -39,8 +39,8 @@ pub fn scalar_to_clif_type(tcx: TyCtxt, scalar: Scalar) -> Type { } } -fn get_pass_mode<'a, 'tcx: 'a>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn get_pass_mode<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>, ) -> PassMode { let layout = tcx.layout_of(ParamEnv::reveal_all().and(ty)).unwrap(); @@ -76,7 +76,7 @@ fn adjust_arg_for_abi<'a, 'tcx: 'a>( } } -fn clif_sig_from_fn_sig<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sig: FnSig<'tcx>) -> Signature { +fn clif_sig_from_fn_sig<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, sig: FnSig<'tcx>) -> Signature { let (call_conv, inputs, output): (CallConv, Vec, Ty) = match sig.abi { Abi::Rust => (CallConv::SystemV, sig.inputs().to_vec(), sig.output()), Abi::C => (CallConv::SystemV, sig.inputs().to_vec(), sig.output()), @@ -128,8 +128,8 @@ fn clif_sig_from_fn_sig<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sig: FnSig<'t } } -pub fn get_function_name_and_sig<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub fn get_function_name_and_sig<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, inst: Instance<'tcx>, support_vararg: bool, ) -> (String, Signature) { @@ -143,8 +143,8 @@ pub fn get_function_name_and_sig<'a, 'tcx>( } /// Instance must be monomorphized -pub fn import_function<'a, 'tcx: 'a>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub fn import_function<'tcx>( + tcx: TyCtxt<'tcx, 'tcx>, module: &mut Module, inst: Instance<'tcx>, ) -> FuncId { diff --git a/src/base.rs b/src/base.rs index 73444173c65..aec7f3f77e8 100644 --- a/src/base.rs +++ b/src/base.rs @@ -3,7 +3,7 @@ use crate::prelude::*; pub fn trans_fn<'a, 'clif, 'tcx: 'a, B: Backend + 'static>( - cx: &mut crate::CodegenCx<'a, 'clif, 'tcx, B>, + cx: &mut crate::CodegenCx<'clif, 'tcx, B>, instance: Instance<'tcx>, linkage: Linkage, ) { @@ -18,9 +18,9 @@ pub fn trans_fn<'a, 'clif, 'tcx: 'a, B: Backend + 'static>( // Check sig for u128 and i128 let fn_sig = tcx.normalize_erasing_late_bound_regions(ParamEnv::reveal_all(), &instance.fn_sig(tcx)); - struct UI128Visitor<'a, 'tcx: 'a>(TyCtxt<'a, 'tcx, 'tcx>, bool); + struct UI128Visitor<'tcx>(TyCtxt<'tcx, 'tcx>, bool); - impl<'a, 'tcx: 'a> rustc::ty::fold::TypeVisitor<'tcx> for UI128Visitor<'a, 'tcx> { + impl<'tcx> rustc::ty::fold::TypeVisitor<'tcx> for UI128Visitor<'tcx> { fn visit_ty(&mut self, t: Ty<'tcx>) -> bool { if t.sty == self.0.types.u128.sty || t.sty == self.0.types.i128.sty { self.1 = true; diff --git a/src/common.rs b/src/common.rs index 00135d2c033..700c6ec75ec 100644 --- a/src/common.rs +++ b/src/common.rs @@ -18,7 +18,7 @@ pub fn pointer_ty(tcx: TyCtxt) -> types::Type { } pub fn clif_type_from_ty<'a, 'tcx: 'a>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>, ) -> Option { Some(match ty.sty { @@ -95,7 +95,7 @@ pub fn clif_intcast<'a, 'tcx: 'a>( pub struct FunctionCx<'a, 'tcx: 'a, B: Backend> { // FIXME use a reference to `CodegenCx` instead of `tcx`, `module` and `constants` and `caches` - pub tcx: TyCtxt<'a, 'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'tcx>, pub module: &'a mut Module, pub pointer_type: Type, // Cached from module @@ -123,7 +123,7 @@ fn layout_of(&self, ty: Ty<'tcx>) -> TyLayout<'tcx> { } impl<'a, 'tcx, B: Backend + 'a> layout::HasTyCtxt<'tcx> for FunctionCx<'a, 'tcx, B> { - fn tcx<'b>(&'b self) -> TyCtxt<'b, 'tcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'tcx> { self.tcx } } diff --git a/src/constant.rs b/src/constant.rs index 0403f8d0d1b..068d08097dd 100644 --- a/src/constant.rs +++ b/src/constant.rs @@ -28,7 +28,7 @@ enum TodoItem { impl ConstantCx { pub fn finalize<'a, 'tcx: 'a, B: Backend>( mut self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, module: &mut Module, ) { //println!("todo {:?}", self.todo); @@ -184,7 +184,7 @@ fn data_id_for_alloc_id(module: &mut Module, alloc_id: AllocId) - } fn data_id_for_static<'a, 'tcx: 'a, B: Backend>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, module: &mut Module, def_id: DefId, linkage: Linkage, @@ -238,7 +238,7 @@ fn cplace_for_dataid<'a, 'tcx: 'a>( } fn define_all_allocs<'a, 'tcx: 'a, B: Backend + 'a>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, module: &mut Module, cx: &mut ConstantCx, ) { @@ -336,7 +336,7 @@ fn pop_set(set: &mut HashSet) -> Option struct TransPlaceInterpreter; -impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for TransPlaceInterpreter { +impl<'mir, 'tcx> Machine<'mir, 'tcx> for TransPlaceInterpreter { type MemoryKinds = !; type PointerTag = (); type AllocExtra = (); @@ -345,16 +345,16 @@ impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for TransPlaceInterpreter { type MemoryMap = FxHashMap, Allocation<()>)>; const STATIC_KIND: Option = None; - fn enforce_validity(_: &InterpretCx<'a, 'mir, 'tcx, Self>) -> bool { + fn enforce_validity(_: &InterpretCx<'mir, 'tcx, Self>) -> bool { false } - fn before_terminator(_: &mut InterpretCx<'a, 'mir, 'tcx, Self>) -> InterpResult<'tcx> { + fn before_terminator(_: &mut InterpretCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> { panic!(); } fn find_fn( - _: &mut InterpretCx<'a, 'mir, 'tcx, Self>, + _: &mut InterpretCx<'mir, 'tcx, Self>, _: Instance<'tcx>, _: &[OpTy<'tcx>], _: Option>, @@ -364,7 +364,7 @@ fn find_fn( } fn call_intrinsic( - _: &mut InterpretCx<'a, 'mir, 'tcx, Self>, + _: &mut InterpretCx<'mir, 'tcx, Self>, _: Instance<'tcx>, _: &[OpTy<'tcx>], _: PlaceTy<'tcx>, @@ -374,13 +374,13 @@ fn call_intrinsic( fn find_foreign_static( _: DefId, - _: ::rustc::ty::query::TyCtxtAt<'a, 'tcx, 'tcx>, + _: ::rustc::ty::query::TyCtxtAt<'tcx, 'tcx>, ) -> InterpResult<'tcx, Cow<'tcx, Allocation>> { panic!(); } fn ptr_op( - _: &InterpretCx<'a, 'mir, 'tcx, Self>, + _: &InterpretCx<'mir, 'tcx, Self>, _: mir::BinOp, _: ImmTy<'tcx>, _: ImmTy<'tcx>, @@ -388,7 +388,7 @@ fn ptr_op( panic!(); } - fn box_alloc(_: &mut InterpretCx<'a, 'mir, 'tcx, Self>, _: PlaceTy<'tcx>) -> InterpResult<'tcx> { + fn box_alloc(_: &mut InterpretCx<'mir, 'tcx, Self>, _: PlaceTy<'tcx>) -> InterpResult<'tcx> { panic!(); } @@ -405,11 +405,11 @@ fn tag_static_base_pointer(_: AllocId, _: &()) -> Self::PointerTag { () } - fn stack_push(_: &mut InterpretCx<'a, 'mir, 'tcx, Self>) -> InterpResult<'tcx> { + fn stack_push(_: &mut InterpretCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> { Ok(()) } - fn stack_pop(_: &mut InterpretCx<'a, 'mir, 'tcx, Self>, _: ()) -> InterpResult<'tcx> { + fn stack_pop(_: &mut InterpretCx<'mir, 'tcx, Self>, _: ()) -> InterpResult<'tcx> { Ok(()) } } diff --git a/src/debuginfo.rs b/src/debuginfo.rs index e379a7829f4..6d1726dd7b4 100644 --- a/src/debuginfo.rs +++ b/src/debuginfo.rs @@ -155,7 +155,7 @@ pub fn new(tcx: TyCtxt, address_size: u8) -> Self { } } - fn emit_location(&mut self, tcx: TyCtxt<'a, 'tcx, 'tcx>, entry_id: UnitEntryId, span: Span) { + fn emit_location(&mut self, tcx: TyCtxt<'tcx, 'tcx>, entry_id: UnitEntryId, span: Span) { let loc = tcx.sess.source_map().lookup_char_pos(span.lo()); let file_id = line_program_add_file( @@ -232,7 +232,7 @@ pub struct FunctionDebugContext<'a, 'tcx> { impl<'a, 'b, 'tcx: 'b> FunctionDebugContext<'a, 'tcx> { pub fn new( - tcx: TyCtxt<'b, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, debug_context: &'a mut DebugContext<'tcx>, mir: &Body, name: &str, diff --git a/src/driver.rs b/src/driver.rs index 391154f80c1..81c8100d3da 100644 --- a/src/driver.rs +++ b/src/driver.rs @@ -14,7 +14,7 @@ use crate::prelude::*; pub fn codegen_crate<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, metadata: EncodedMetadata, need_metadata_module: bool, ) -> Box { @@ -45,7 +45,7 @@ pub fn codegen_crate<'a, 'tcx>( } #[cfg(not(target_arch = "wasm32"))] -fn run_jit<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>, log: &mut Option) -> ! { +fn run_jit<'a, 'tcx: 'a>(tcx: TyCtxt<'tcx, 'tcx>, log: &mut Option) -> ! { use cranelift_simplejit::{SimpleJITBackend, SimpleJITBuilder}; let mut jit_module: Module = Module::new(SimpleJITBuilder::new( @@ -96,7 +96,7 @@ fn run_jit<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>, log: &mut Option) -> } fn run_aot<'a, 'tcx: 'a>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, metadata: EncodedMetadata, need_metadata_module: bool, log: &mut Option, @@ -225,7 +225,7 @@ fn run_aot<'a, 'tcx: 'a>( } fn codegen_cgus<'a, 'tcx: 'a>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, module: &mut Module, debug: &mut Option>, log: &mut Option, @@ -243,7 +243,7 @@ fn codegen_cgus<'a, 'tcx: 'a>( } fn codegen_mono_items<'a, 'tcx: 'a>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, module: &mut Module, debug_context: Option<&mut DebugContext<'tcx>>, log: &mut Option, @@ -263,7 +263,7 @@ fn codegen_mono_items<'a, 'tcx: 'a>( } fn trans_mono_item<'a, 'clif, 'tcx: 'a, B: Backend + 'static>( - cx: &mut crate::CodegenCx<'a, 'clif, 'tcx, B>, + cx: &mut crate::CodegenCx<'clif, 'tcx, B>, mono_item: MonoItem<'tcx>, linkage: Linkage, ) { diff --git a/src/lib.rs b/src/lib.rs index be46d638b10..897e8a1e367 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -122,17 +122,17 @@ fn default() -> Self { } } -pub struct CodegenCx<'a, 'clif, 'tcx, B: Backend + 'static> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub struct CodegenCx<'clif, 'tcx, B: Backend + 'static> { + tcx: TyCtxt<'tcx, 'tcx>, module: &'clif mut Module, ccx: ConstantCx, caches: Caches<'tcx>, debug_context: Option<&'clif mut DebugContext<'tcx>>, } -impl<'a, 'clif, 'tcx, B: Backend + 'static> CodegenCx<'a, 'clif, 'tcx, B> { +impl<'clif, 'tcx, B: Backend + 'static> CodegenCx<'clif, 'tcx, B> { fn new( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, module: &'clif mut Module, debug_context: Option<&'clif mut DebugContext<'tcx>>, ) -> Self { @@ -195,7 +195,7 @@ fn provide_extern(&self, providers: &mut Providers) { fn codegen_crate<'a, 'tcx>( &self, - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, metadata: EncodedMetadata, need_metadata_module: bool, _rx: mpsc::Receiver>, diff --git a/src/main_shim.rs b/src/main_shim.rs index 20d79291296..6653951fd68 100644 --- a/src/main_shim.rs +++ b/src/main_shim.rs @@ -3,7 +3,7 @@ /// Create the `main` function which will initialize the rust runtime and call /// users main function. pub fn maybe_create_entry_wrapper<'a, 'tcx: 'a>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, module: &mut Module, ) { use rustc::middle::lang_items::StartFnLangItem; @@ -23,7 +23,7 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx: 'a>( create_entry_fn(tcx, module, main_def_id, use_start_lang_item);; fn create_entry_fn<'a, 'tcx: 'a>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, m: &mut Module, rust_main_def_id: DefId, use_start_lang_item: bool, diff --git a/src/metadata.rs b/src/metadata.rs index 56ce208a71a..9f6fccdc71e 100644 --- a/src/metadata.rs +++ b/src/metadata.rs @@ -49,7 +49,7 @@ fn get_dylib_metadata( // Adapted from https://github.com/rust-lang/rust/blob/da573206f87b5510de4b0ee1a9c044127e409bd3/src/librustc_codegen_llvm/base.rs#L47-L112 pub fn write_metadata<'a, 'gcx>( - tcx: TyCtxt<'a, 'gcx, 'gcx>, + tcx: TyCtxt<'gcx, 'gcx>, artifact: &mut faerie::Artifact ) -> EncodedMetadata { use std::io::Write; diff --git a/src/pretty_clif.rs b/src/pretty_clif.rs index 53cd4f33442..677cb4705bc 100644 --- a/src/pretty_clif.rs +++ b/src/pretty_clif.rs @@ -77,7 +77,7 @@ pub struct CommentWriter { } impl CommentWriter { - pub fn new<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: Instance<'tcx>) -> Self { + pub fn new<'a, 'tcx: 'a>(tcx: TyCtxt<'tcx, 'tcx>, instance: Instance<'tcx>) -> Self { CommentWriter { global_comments: vec![ format!("symbol {}", tcx.symbol_name(instance).as_str()), @@ -194,7 +194,7 @@ pub fn add_comment<'s, S: Into>>(&mut self, inst: Inst, comment: S) } pub fn write_clif_file<'a, 'tcx: 'a>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, postfix: &str, instance: Instance<'tcx>, func: &ir::Function,