diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2022-05-21 11:39:51 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-21 11:39:51 +0200 |
| commit | 54e36ef1b38f7182fe361bb1083e940e9a575242 (patch) | |
| tree | 5f4979a08932585733d3a3757c453a108c4804ab | |
| parent | 6fef5f1e243c30deec7728616cdcf21c4547ab9e (diff) | |
| parent | cd90406090c5439d4d403981d9503b66bd7bea0d (diff) | |
| download | rust-54e36ef1b38f7182fe361bb1083e940e9a575242.tar.gz rust-54e36ef1b38f7182fe361bb1083e940e9a575242.zip | |
Rollup merge of #97223 - cjgillot:linear-hir-tree, r=jackh726
Remove quadratic behaviour from -Zunpretty=hir-tree. Closes https://github.com/rust-lang/rust/issues/97115
| -rw-r--r-- | compiler/rustc_hir/src/hir.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 2e077ae2440..1a0cac8fe79 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -796,7 +796,6 @@ impl<'tcx> AttributeMap<'tcx> { /// Map of all HIR nodes inside the current owner. /// These nodes are mapped by `ItemLocalId` alongside the index of their parent node. /// The HIR tree, including bodies, is pre-hashed. -#[derive(Debug)] pub struct OwnerNodes<'tcx> { /// Pre-computed hash of the full HIR. pub hash_including_bodies: Fingerprint, @@ -822,6 +821,18 @@ impl<'tcx> OwnerNodes<'tcx> { } } +impl fmt::Debug for OwnerNodes<'_> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_struct("OwnerNodes") + .field("node", &self.nodes[ItemLocalId::from_u32(0)]) + .field("bodies", &self.bodies) + .field("local_id_to_def_id", &self.local_id_to_def_id) + .field("hash_without_bodies", &self.hash_without_bodies) + .field("hash_including_bodies", &self.hash_including_bodies) + .finish() + } +} + /// Full information resulting from lowering an AST node. #[derive(Debug, HashStable_Generic)] pub struct OwnerInfo<'hir> { |
