Skip to content

Commit d82a12f

Browse files
committed
HirIdify driver::pretty::HirPrinterSupport::node_path
1 parent f05cbc9 commit d82a12f

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/librustc_driver/pretty.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,9 @@ trait HirPrinterSupport<'hir>: pprust_hir::PpAnn {
253253
fn pp_ann<'a>(&'a self) -> &'a dyn pprust_hir::PpAnn;
254254

255255
/// Computes an user-readable representation of a path, if possible.
256-
fn node_path(&self, id: ast::NodeId) -> Option<String> {
256+
fn node_path(&self, id: hir::HirId) -> Option<String> {
257257
self.hir_map().and_then(|map| {
258-
let hir_id = map.node_to_hir_id(id);
259-
map.def_path_from_hir_id(hir_id)
258+
map.def_path_from_hir_id(id)
260259
}).map(|path| {
261260
path.data
262261
.into_iter()
@@ -471,8 +470,8 @@ impl<'b, 'tcx> HirPrinterSupport<'tcx> for TypedAnnotation<'b, 'tcx> {
471470
self
472471
}
473472

474-
fn node_path(&self, id: ast::NodeId) -> Option<String> {
475-
Some(self.tcx.def_path_str(self.tcx.hir().local_def_id(id)))
473+
fn node_path(&self, id: hir::HirId) -> Option<String> {
474+
Some(self.tcx.def_path_str(self.tcx.hir().local_def_id_from_hir_id(id)))
476475
}
477476
}
478477

@@ -834,7 +833,7 @@ pub fn print_after_hir_lowering<'tcx>(
834833
let node = hir_map.get(hir_id);
835834
pp_state.print_node(node)?;
836835
pp_state.s.space()?;
837-
let path = annotation.node_path(node_id)
836+
let path = annotation.node_path(hir_id)
838837
.expect("-Z unpretty missing node paths");
839838
pp_state.synth_comment(path)?;
840839
pp_state.s.hardbreak()?;

0 commit comments

Comments
 (0)