Skip to content

Commit

Permalink
Rollup merge of #97223 - cjgillot:linear-hir-tree, r=jackh726
Browse files Browse the repository at this point in the history
Remove quadratic behaviour from -Zunpretty=hir-tree.

Closes #97115
  • Loading branch information
GuillaumeGomez authored May 21, 2022
2 parents 6fef5f1 + cd90406 commit 54e36ef
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion compiler/rustc_hir/src/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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> {
Expand Down

0 comments on commit 54e36ef

Please sign in to comment.