diff options
| author | Matthew Jasper <mjjasper1@gmail.com> | 2019-06-29 15:31:43 +0100 |
|---|---|---|
| committer | Matthew Jasper <mjjasper1@gmail.com> | 2019-07-06 21:56:03 +0100 |
| commit | db6f77f0d74934a95eb91d74bda19e5b0e8258e3 (patch) | |
| tree | 56ec65c1a901bc6a8074fafe634537c36eab493d | |
| parent | 254f2014954bd66da206232490824975c0c662f1 (diff) | |
| download | rust-db6f77f0d74934a95eb91d74bda19e5b0e8258e3.tar.gz rust-db6f77f0d74934a95eb91d74bda19e5b0e8258e3.zip | |
Add arm ids for -Zunpretty=hir,identified
| -rw-r--r-- | src/librustc/hir/print.rs | 3 | ||||
| -rw-r--r-- | src/librustc_borrowck/dataflow.rs | 3 | ||||
| -rw-r--r-- | src/librustc_driver/pretty.rs | 20 |
3 files changed, 15 insertions, 11 deletions
diff --git a/src/librustc/hir/print.rs b/src/librustc/hir/print.rs index 367e4dba042..6817107635a 100644 --- a/src/librustc/hir/print.rs +++ b/src/librustc/hir/print.rs @@ -27,6 +27,7 @@ pub enum AnnNode<'a> { SubItem(hir::HirId), Expr(&'a hir::Expr), Pat(&'a hir::Pat), + Arm(&'a hir::Arm), } pub enum Nested { @@ -1821,6 +1822,7 @@ impl<'a> State<'a> { self.s.space(); } self.cbox(indent_unit); + self.ann.pre(self, AnnNode::Arm(arm)); self.ibox(0); self.print_outer_attributes(&arm.attrs); let mut first = true; @@ -1865,6 +1867,7 @@ impl<'a> State<'a> { self.s.word(","); } } + self.ann.post(self, AnnNode::Arm(arm)); self.end() // close enclosing cbox } diff --git a/src/librustc_borrowck/dataflow.rs b/src/librustc_borrowck/dataflow.rs index 95580952ffb..f1f9f3f71e4 100644 --- a/src/librustc_borrowck/dataflow.rs +++ b/src/librustc_borrowck/dataflow.rs @@ -109,7 +109,8 @@ impl<'tcx, O: DataFlowOperator> pprust::PpAnn for DataFlowContext<'tcx, O> { pprust::AnnNode::Block(blk) => blk.hir_id.local_id, pprust::AnnNode::Item(_) | pprust::AnnNode::SubItem(_) => return, - pprust::AnnNode::Pat(pat) => pat.hir_id.local_id + pprust::AnnNode::Pat(pat) => pat.hir_id.local_id, + pprust::AnnNode::Arm(arm) => arm.hir_id.local_id, }; if !self.has_bitset_for_local_id(id) { diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index f314af43f99..fc55d5ac355 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -387,28 +387,28 @@ impl<'hir> pprust_hir::PpAnn for IdentifiedAnnotation<'hir> { pprust_hir::AnnNode::Name(_) => {}, pprust_hir::AnnNode::Item(item) => { s.s.space(); - s.synth_comment(format!("hir_id: {} hir local_id: {}", - item.hir_id, item.hir_id.local_id.as_u32())) + s.synth_comment(format!("hir_id: {}", item.hir_id)); } pprust_hir::AnnNode::SubItem(id) => { s.s.space(); - s.synth_comment(id.to_string()) + s.synth_comment(id.to_string()); } pprust_hir::AnnNode::Block(blk) => { s.s.space(); - s.synth_comment(format!("block hir_id: {} hir local_id: {}", - blk.hir_id, blk.hir_id.local_id.as_u32())) + s.synth_comment(format!("block hir_id: {}", blk.hir_id)); } pprust_hir::AnnNode::Expr(expr) => { s.s.space(); - s.synth_comment(format!("expr hir_id: {} hir local_id: {}", - expr.hir_id, expr.hir_id.local_id.as_u32())); - s.pclose() + s.synth_comment(format!("expr hir_id: {}", expr.hir_id)); + s.pclose(); } pprust_hir::AnnNode::Pat(pat) => { s.s.space(); - s.synth_comment(format!("pat hir_id: {} hir local_id: {}", - pat.hir_id, pat.hir_id.local_id.as_u32())) + s.synth_comment(format!("pat hir_id: {}", pat.hir_id)); + } + pprust_hir::AnnNode::Arm(arm) => { + s.s.space(); + s.synth_comment(format!("arm hir_id: {}", arm.hir_id)); } } } |
