X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustc_passes%2Fliveness.rs;h=7718139f6e9246af2b0eb2ef03781ee4c3de31e6;hb=bfac73c0a6786644d0a58a12347839d442be26ac;hp=3ae5e4f72b7444ec45200563b8fa708616238ae7;hpb=1c9b8036bf25b68af7751a1db4a07f98808c0ee7;p=rust.git diff --git a/src/librustc_passes/liveness.rs b/src/librustc_passes/liveness.rs index 3ae5e4f72b7..7718139f6e9 100644 --- a/src/librustc_passes/liveness.rs +++ b/src/librustc_passes/liveness.rs @@ -96,15 +96,16 @@ use self::LiveNodeKind::*; use self::VarKind::*; -use errors::Applicability; -use rustc::hir::intravisit::{self, FnKind, NestedVisitorMap, Visitor}; +use rustc::hir::map::Map; use rustc::lint; use rustc::ty::query::Providers; use rustc::ty::{self, TyCtxt}; use rustc_data_structures::fx::FxIndexMap; +use rustc_errors::Applicability; use rustc_hir as hir; use rustc_hir::def::*; use rustc_hir::def_id::DefId; +use rustc_hir::intravisit::{self, FnKind, NestedVisitorMap, Visitor}; use rustc_hir::{Expr, HirId, HirIdMap, HirIdSet, Node}; use rustc_span::symbol::sym; use rustc_span::Span; @@ -153,7 +154,9 @@ fn live_node_kind_to_string(lnk: LiveNodeKind, tcx: TyCtxt<'_>) -> String { } impl<'tcx> Visitor<'tcx> for IrMaps<'tcx> { - fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { + type Map = Map<'tcx>; + + fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> { NestedVisitorMap::OnlyBodies(&self.tcx.hir()) } @@ -1061,7 +1064,7 @@ fn propagate_through_expr(&mut self, expr: &Expr<'_>, succ: LiveNode) -> LiveNod .sess .struct_span_err(expr.span, "`break` to unknown label") .emit(); - errors::FatalError.raise() + rustc_errors::FatalError.raise() } } } @@ -1348,7 +1351,9 @@ fn propagate_through_loop( // Checking for error conditions impl<'a, 'tcx> Visitor<'tcx> for Liveness<'a, 'tcx> { - fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> { + type Map = Map<'tcx>; + + fn nested_visit_map(&mut self) -> NestedVisitorMap<'_, Self::Map> { NestedVisitorMap::None } @@ -1508,13 +1513,16 @@ fn report_unused(&self, spans: Vec, hir_id: HirId, ln: LiveNode, var: Vari if ln == self.s.exit_ln { false } else { self.assigned_on_exit(ln, var).is_some() }; if is_assigned { - self.ir.tcx.lint_hir_note( - lint::builtin::UNUSED_VARIABLES, - hir_id, - spans, - &format!("variable `{}` is assigned to, but never used", name), - &format!("consider using `_{}` instead", name), - ); + self.ir + .tcx + .struct_span_lint_hir( + lint::builtin::UNUSED_VARIABLES, + hir_id, + spans, + &format!("variable `{}` is assigned to, but never used", name), + ) + .note(&format!("consider using `_{}` instead", name)) + .emit(); } else { let mut err = self.ir.tcx.struct_span_lint_hir( lint::builtin::UNUSED_VARIABLES,