From de6afbc2613583d31797e8b33e85b09f6b6cda89 Mon Sep 17 00:00:00 2001 From: Phil Ellison Date: Wed, 7 Feb 2018 07:08:58 +0000 Subject: [PATCH] Explain how to dump HIR --- src/hir.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/hir.md b/src/hir.md index 52fda69a..12933687 100644 --- a/src/hir.md +++ b/src/hir.md @@ -10,6 +10,14 @@ been desugared away (as an example, `for` loops are converted into a This chapter covers the main concepts of the HIR. +You can view the HIR representation of your code by passing the +`-Zunpretty=hir-tree` flag to rustc, for example by setting the `RUSTFLAGS` +environment variable: + +``` +RUSTFLAGS=-Zunpretty=hir-tree cargo build +``` + ### Out-of-band storage and the `Crate` type The top-level data-structure in the HIR is the `Crate`, which stores