diff --git a/compiler/rustc_passes/src/loops.rs b/compiler/rustc_passes/src/loops.rs index c11562ae39e..9afd8ad47ad 100644 --- a/compiler/rustc_passes/src/loops.rs +++ b/compiler/rustc_passes/src/loops.rs @@ -64,8 +64,8 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { } #[derive(Clone)] -struct CheckLoopVisitor<'a, 'tcx> { - sess: &'a Session, +struct CheckLoopVisitor<'tcx> { + sess: &'tcx Session, tcx: TyCtxt<'tcx>, // Keep track of a stack of contexts, so that suggestions // are not made for contexts where it would be incorrect, @@ -90,7 +90,7 @@ pub(crate) fn provide(providers: &mut Providers) { *providers = Providers { check_mod_loops, ..*providers }; } -impl<'a, 'hir> Visitor<'hir> for CheckLoopVisitor<'a, 'hir> { +impl<'hir> Visitor<'hir> for CheckLoopVisitor<'hir> { type NestedFilter = nested_filter::OnlyBodies; fn nested_visit_map(&mut self) -> Self::Map { @@ -129,7 +129,7 @@ fn visit_expr(&mut self, e: &'hir hir::Expr<'hir>) { hir::ExprKind::If(cond, then, else_opt) => { self.visit_expr(cond); - let get_block = |ck_loop: &CheckLoopVisitor<'a, 'hir>, + let get_block = |ck_loop: &CheckLoopVisitor<'hir>, expr: &hir::Expr<'hir>| -> Option<&hir::Block<'hir>> { if let hir::ExprKind::Block(b, None) = expr.kind @@ -306,10 +306,10 @@ fn visit_expr(&mut self, e: &'hir hir::Expr<'hir>) { } } -impl<'a, 'hir> CheckLoopVisitor<'a, 'hir> { +impl<'hir> CheckLoopVisitor<'hir> { fn with_context(&mut self, cx: Context, f: F) where - F: FnOnce(&mut CheckLoopVisitor<'a, 'hir>), + F: FnOnce(&mut CheckLoopVisitor<'hir>), { self.cx_stack.push(cx); f(self);