From d82a12f64f05d33f10f0e345e14175c4256703f8 Mon Sep 17 00:00:00 2001 From: ljedrz Date: Mon, 24 Jun 2019 10:03:37 +0200 Subject: [PATCH] HirIdify driver::pretty::HirPrinterSupport::node_path --- src/librustc_driver/pretty.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index 87f7f2fdb48b2..d92f3aafa1c7e 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -253,10 +253,9 @@ trait HirPrinterSupport<'hir>: pprust_hir::PpAnn { fn pp_ann<'a>(&'a self) -> &'a dyn pprust_hir::PpAnn; /// Computes an user-readable representation of a path, if possible. - fn node_path(&self, id: ast::NodeId) -> Option { + fn node_path(&self, id: hir::HirId) -> Option { self.hir_map().and_then(|map| { - let hir_id = map.node_to_hir_id(id); - map.def_path_from_hir_id(hir_id) + map.def_path_from_hir_id(id) }).map(|path| { path.data .into_iter() @@ -471,8 +470,8 @@ impl<'b, 'tcx> HirPrinterSupport<'tcx> for TypedAnnotation<'b, 'tcx> { self } - fn node_path(&self, id: ast::NodeId) -> Option { - Some(self.tcx.def_path_str(self.tcx.hir().local_def_id(id))) + fn node_path(&self, id: hir::HirId) -> Option { + Some(self.tcx.def_path_str(self.tcx.hir().local_def_id_from_hir_id(id))) } } @@ -834,7 +833,7 @@ pub fn print_after_hir_lowering<'tcx>( let node = hir_map.get(hir_id); pp_state.print_node(node)?; pp_state.s.space()?; - let path = annotation.node_path(node_id) + let path = annotation.node_path(hir_id) .expect("-Z unpretty missing node paths"); pp_state.synth_comment(path)?; pp_state.s.hardbreak()?;