Skip to content

Commit 54e36ef

Browse files
Rollup merge of #97223 - cjgillot:linear-hir-tree, r=jackh726
Remove quadratic behaviour from -Zunpretty=hir-tree. Closes #97115
2 parents 6fef5f1 + cd90406 commit 54e36ef

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

compiler/rustc_hir/src/hir.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,6 @@ impl<'tcx> AttributeMap<'tcx> {
796796
/// Map of all HIR nodes inside the current owner.
797797
/// These nodes are mapped by `ItemLocalId` alongside the index of their parent node.
798798
/// The HIR tree, including bodies, is pre-hashed.
799-
#[derive(Debug)]
800799
pub struct OwnerNodes<'tcx> {
801800
/// Pre-computed hash of the full HIR.
802801
pub hash_including_bodies: Fingerprint,
@@ -822,6 +821,18 @@ impl<'tcx> OwnerNodes<'tcx> {
822821
}
823822
}
824823

824+
impl fmt::Debug for OwnerNodes<'_> {
825+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
826+
f.debug_struct("OwnerNodes")
827+
.field("node", &self.nodes[ItemLocalId::from_u32(0)])
828+
.field("bodies", &self.bodies)
829+
.field("local_id_to_def_id", &self.local_id_to_def_id)
830+
.field("hash_without_bodies", &self.hash_without_bodies)
831+
.field("hash_including_bodies", &self.hash_including_bodies)
832+
.finish()
833+
}
834+
}
835+
825836
/// Full information resulting from lowering an AST node.
826837
#[derive(Debug, HashStable_Generic)]
827838
pub struct OwnerInfo<'hir> {

0 commit comments

Comments
 (0)