From 6a75768b33b10fde649f0dcab6ff72a7dd62b561 Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Tue, 29 Oct 2019 18:11:11 +0200 Subject: [PATCH] rustc_codegen_ssa: clean up lifetimes on TerminatorCodegenHelper's methods. --- src/librustc_codegen_ssa/mir/block.rs | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/src/librustc_codegen_ssa/mir/block.rs b/src/librustc_codegen_ssa/mir/block.rs index c8881ca5f95..370c172f97f 100644 --- a/src/librustc_codegen_ssa/mir/block.rs +++ b/src/librustc_codegen_ssa/mir/block.rs @@ -30,23 +30,22 @@ struct TerminatorCodegenHelper<'tcx> { funclet_bb: Option, } -// FIXME(eddyb) clean up the lifetimes in this impl. -impl<'tcx> TerminatorCodegenHelper<'tcx> { +impl<'a, 'tcx> TerminatorCodegenHelper<'tcx> { /// Returns the associated funclet from `FunctionCx::funclets` for the /// `funclet_bb` member if it is not `None`. - fn funclet<'c, 'b, Bx: BuilderMethods<'b, 'tcx>>( + fn funclet<'b, Bx: BuilderMethods<'a, 'tcx>>( &self, - fx: &'c mut FunctionCx<'b, 'tcx, Bx>, - ) -> Option<&'c Bx::Funclet> { + fx: &'b mut FunctionCx<'a, 'tcx, Bx>, + ) -> Option<&'b Bx::Funclet> { match self.funclet_bb { Some(funcl) => fx.funclets[funcl].as_ref(), None => None, } } - fn lltarget<'b, 'c, Bx: BuilderMethods<'b, 'tcx>>( + fn lltarget>( &self, - fx: &'c mut FunctionCx<'b, 'tcx, Bx>, + fx: &mut FunctionCx<'a, 'tcx, Bx>, target: mir::BasicBlock, ) -> (Bx::BasicBlock, bool) { let span = self.terminator.source_info.span; @@ -64,9 +63,9 @@ impl<'tcx> TerminatorCodegenHelper<'tcx> { } /// Create a basic block. - fn llblock<'c, 'b, Bx: BuilderMethods<'b, 'tcx>>( + fn llblock>( &self, - fx: &'c mut FunctionCx<'b, 'tcx, Bx>, + fx: &mut FunctionCx<'a, 'tcx, Bx>, target: mir::BasicBlock, ) -> Bx::BasicBlock { let (lltarget, is_cleanupret) = self.lltarget(fx, target); @@ -84,9 +83,9 @@ impl<'tcx> TerminatorCodegenHelper<'tcx> { } } - fn funclet_br<'c, 'b, Bx: BuilderMethods<'b, 'tcx>>( + fn funclet_br>( &self, - fx: &'c mut FunctionCx<'b, 'tcx, Bx>, + fx: &mut FunctionCx<'a, 'tcx, Bx>, bx: &mut Bx, target: mir::BasicBlock, ) { @@ -102,9 +101,9 @@ impl<'tcx> TerminatorCodegenHelper<'tcx> { /// Call `fn_ptr` of `fn_abi` with the arguments `llargs`, the optional /// return destination `destination` and the cleanup function `cleanup`. - fn do_call<'c, 'b, Bx: BuilderMethods<'b, 'tcx>>( + fn do_call>( &self, - fx: &'c mut FunctionCx<'b, 'tcx, Bx>, + fx: &mut FunctionCx<'a, 'tcx, Bx>, bx: &mut Bx, fn_abi: FnAbi<'tcx, Ty<'tcx>>, fn_ptr: Bx::Value, @@ -152,7 +151,7 @@ impl<'tcx> TerminatorCodegenHelper<'tcx> { // Generate sideeffect intrinsic if jumping to any of the targets can form // a loop. - fn maybe_sideeffect<'b, Bx: BuilderMethods<'b, 'tcx>>( + fn maybe_sideeffect>( &self, mir: mir::ReadOnlyBodyCache<'tcx, 'tcx>, bx: &mut Bx,