Skip to content

incr.comp.: Make DepNode's std::fmt::Debug implementation useful again.#42625

Merged
bors merged 2 commits intorust-lang:masterfrom
michaelwoerister:dep-node-debug
Jun 15, 2017
Merged

incr.comp.: Make DepNode's std::fmt::Debug implementation useful again.#42625
bors merged 2 commits intorust-lang:masterfrom
michaelwoerister:dep-node-debug

Conversation

@michaelwoerister
Copy link
Copy Markdown
Member

With #42537 a regular DepNode only contains an opaque hash as its identifier. In most cases, this hash is actually a DefPathHash and we can reconstruct the DefId it came from via a table lookup --- and then use that to print something intelligible for debug outputs. For cases where we cannot reconstruct information from the DepNode's hash, this PR will cache a string representation of the DepNode in a side-table. This string is later used for debug outputs.

r? @nikomatsakis

@nikomatsakis
Copy link
Copy Markdown
Contributor

@bors r+

@bors
Copy link
Copy Markdown
Collaborator

bors commented Jun 13, 2017

📌 Commit 5b5499d has been approved by nikomatsakis

@nikomatsakis
Copy link
Copy Markdown
Contributor

@bors r-

let (def_id_0, def_id_1) = *self;

let def_path_hash_0 = tcx.def_path_hash(def_id_0);
let def_path_hash_1 = tcx.def_path_hash(def_id_1);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it'd be good to add a comment clarifying that this is a micro-opt, and the generic impl also suffices

@nikomatsakis
Copy link
Copy Markdown
Contributor

@bors r+

@bors
Copy link
Copy Markdown
Collaborator

bors commented Jun 13, 2017

📌 Commit e323652 has been approved by nikomatsakis

@arielb1 arielb1 added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jun 13, 2017
@bors
Copy link
Copy Markdown
Collaborator

bors commented Jun 14, 2017

⌛ Testing commit e323652 with merge 9430800...

@bors
Copy link
Copy Markdown
Collaborator

bors commented Jun 14, 2017

💔 Test failed - status-travis

@michaelwoerister
Copy link
Copy Markdown
Member Author

@bors retry

(looks like a time-out)

@bors
Copy link
Copy Markdown
Collaborator

bors commented Jun 14, 2017

⌛ Testing commit e323652 with merge aaf685b...

bors added a commit that referenced this pull request Jun 14, 2017
incr.comp.: Make DepNode's std::fmt::Debug implementation useful again.

With #42537 a regular `DepNode` only contains an opaque hash as its identifier. In most cases, this hash is actually a `DefPathHash` and we can reconstruct the `DefId` it came from via a table lookup --- and then use that to print something intelligible for debug outputs. For cases where we cannot reconstruct information from the DepNode's hash, this PR will cache a string representation of the `DepNode` in a side-table. This string is later used for debug outputs.

r? @nikomatsakis
@bors
Copy link
Copy Markdown
Collaborator

bors commented Jun 14, 2017

💔 Test failed - status-travis

@Mark-Simulacrum
Copy link
Copy Markdown
Member

@bors retry

  • timeout

@alexcrichton
Copy link
Copy Markdown
Member

Hm so the timed out build compared to the previous successful build shows that stage0-rustc jumped from 1000s to 2600s and stage1-rustc jumped from 1300s to 3500s.

This PR doesn't seem particularly at fault, I'm messaging Travis to hopefully clarify

@bors
Copy link
Copy Markdown
Collaborator

bors commented Jun 15, 2017

⌛ Testing commit e323652 with merge 119066f...

bors added a commit that referenced this pull request Jun 15, 2017
incr.comp.: Make DepNode's std::fmt::Debug implementation useful again.

With #42537 a regular `DepNode` only contains an opaque hash as its identifier. In most cases, this hash is actually a `DefPathHash` and we can reconstruct the `DefId` it came from via a table lookup --- and then use that to print something intelligible for debug outputs. For cases where we cannot reconstruct information from the DepNode's hash, this PR will cache a string representation of the `DepNode` in a side-table. This string is later used for debug outputs.

r? @nikomatsakis
@bors
Copy link
Copy Markdown
Collaborator

bors commented Jun 15, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing 119066f to master...

@bors bors merged commit e323652 into rust-lang:master Jun 15, 2017
nnethercote added a commit to nnethercote/rust that referenced this pull request Mar 29, 2026
This hashmap was added in rust-lang#42625 and is used for debug-only printing. If
a key isn't recoverable, `DepNode::construct` will create a string for
it (using `DepNodeKey::to_debug_str`) and insert the string in the
hashmap, but only if (a) it's a debug build, and (b)
`-Zincremental-info` or `-Zquery-dep-graph` is specified. ("Recoverable"
here means the fingerprint style is `KeyFingerPrintStyle::Opaque`.)

`DepNode::fmt` will then use this string to produce output showing the
key itself, and not just its fingerprint.

All this code is debug-only. Some of it is guarded with
`#[cfg(debug_assertions)]`, but some is not.

However, the `tcx.def_path_debug_str()` path in `DepNode::fmt` seems to
be unreachable. Because it's debug-only it can't be used by normal users
and so must only be there for rustc devs. But even in a debug build I
was unable to trigger that path. I tried changing it to a panic and ran
the full test suite without problem, and then I tried various flag
combinations and scenarios also without hitting it. The
`-Zincremental-info` condition doesn't make sense because that only
prints high-level info about queries, not individual keys. So the path
is either unreachable, or so hard to reach that it's not providing any
actual value.

This commit removes all this code.
Zalathar added a commit to Zalathar/rust that referenced this pull request Apr 5, 2026
…de_debug, r=cjgillot

Remove `DepGraphData::dep_node_debug`.

This hashmap was added in rust-lang#42625 and is used for debug-only printing. If a key isn't recoverable, `DepNode::construct` will create a string for it (using `DepNodeKey::to_debug_str`) and insert the string in the hashmap, but only if (a) it's a debug build, and (b) `-Zincremental-info` or `-Zquery-dep-graph` is specified. ("Recoverable" here means the fingerprint style is `KeyFingerPrintStyle::Opaque`.)

`DepNode::fmt` will then use this string to produce output showing the key itself, and not just its fingerprint.

All this code is debug-only. Some of it is guarded with `#[cfg(debug_assertions)]`, but some is not.

However, the `tcx.def_path_debug_str()` path in `DepNode::fmt` seems to be unreachable. Because it's debug-only it can't be used by normal users and so must only be there for rustc devs. But even in a debug build I was unable to trigger that path. I tried changing it to a panic and ran the full test suite without problem, and then I tried various flag combinations and scenarios also without hitting it. The `-Zincremental-info` condition doesn't make sense because that only prints high-level info about queries, not individual keys. So the path is either unreachable, or so hard to reach that it's not providing any actual value.

This commit removes all this code.

r? @cjgillot
rust-timer added a commit that referenced this pull request Apr 5, 2026
Rollup merge of #154565 - nnethercote:rm-DepGraphData-dep_node_debug, r=cjgillot

Remove `DepGraphData::dep_node_debug`.

This hashmap was added in #42625 and is used for debug-only printing. If a key isn't recoverable, `DepNode::construct` will create a string for it (using `DepNodeKey::to_debug_str`) and insert the string in the hashmap, but only if (a) it's a debug build, and (b) `-Zincremental-info` or `-Zquery-dep-graph` is specified. ("Recoverable" here means the fingerprint style is `KeyFingerPrintStyle::Opaque`.)

`DepNode::fmt` will then use this string to produce output showing the key itself, and not just its fingerprint.

All this code is debug-only. Some of it is guarded with `#[cfg(debug_assertions)]`, but some is not.

However, the `tcx.def_path_debug_str()` path in `DepNode::fmt` seems to be unreachable. Because it's debug-only it can't be used by normal users and so must only be there for rustc devs. But even in a debug build I was unable to trigger that path. I tried changing it to a panic and ran the full test suite without problem, and then I tried various flag combinations and scenarios also without hitting it. The `-Zincremental-info` condition doesn't make sense because that only prints high-level info about queries, not individual keys. So the path is either unreachable, or so hard to reach that it's not providing any actual value.

This commit removes all this code.

r? @cjgillot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants