diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2017-11-24 13:44:36 +0100 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2017-12-13 00:15:17 -0600 |
| commit | 171c2aeb25539c5bb1a1a3b231c8a17c6e6b05cc (patch) | |
| tree | d088d73ba1e8b80ec57ee945af6618f14986ba39 | |
| parent | 93c4ffe72f8e406a166e258c80723606cd7d8304 (diff) | |
| download | rust-171c2aeb25539c5bb1a1a3b231c8a17c6e6b05cc.tar.gz rust-171c2aeb25539c5bb1a1a3b231c8a17c6e6b05cc.zip | |
Expanded HIR `--unpretty hir,identified` to include HIR local id.
Having the HIR local id is useful for cases like understanding the ReScope identifiers, which are now derived from the HIR local id, and thus one can map an ReScope back to the HIR node, once one knows what those local ids are.
| -rw-r--r-- | src/librustc_driver/pretty.rs | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index d930739c9f0..7fdcbfc4d29 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -423,7 +423,8 @@ impl<'hir> pprust_hir::PpAnn for IdentifiedAnnotation<'hir> { pprust_hir::NodeName(_) => Ok(()), pprust_hir::NodeItem(item) => { s.s.space()?; - s.synth_comment(item.id.to_string()) + s.synth_comment(format!("node_id: {} hir local_id: {}", + item.id, item.hir_id.local_id.0)) } pprust_hir::NodeSubItem(id) => { s.s.space()?; @@ -431,16 +432,19 @@ impl<'hir> pprust_hir::PpAnn for IdentifiedAnnotation<'hir> { } pprust_hir::NodeBlock(blk) => { s.s.space()?; - s.synth_comment(format!("block {}", blk.id)) + s.synth_comment(format!("block node_id: {} hir local_id: {}", + blk.id, blk.hir_id.local_id.0)) } pprust_hir::NodeExpr(expr) => { s.s.space()?; - s.synth_comment(expr.id.to_string())?; + s.synth_comment(format!("node_id: {} hir local_id: {}", + expr.id, expr.hir_id.local_id.0))?; s.pclose() } pprust_hir::NodePat(pat) => { s.s.space()?; - s.synth_comment(format!("pat {}", pat.id)) + s.synth_comment(format!("pat node_id: {} hir local_id: {}", + pat.id, pat.hir_id.local_id.0)) } } } |
