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.
This commit is contained in:
parent
93c4ffe72f
commit
171c2aeb25
@ -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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user