incr.comp.: Make DepNode's std::fmt::Debug implementation useful again.#42625
incr.comp.: Make DepNode's std::fmt::Debug implementation useful again.#42625bors merged 2 commits intorust-lang:masterfrom
Conversation
|
@bors r+ |
|
📌 Commit 5b5499d has been approved by |
|
@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); |
There was a problem hiding this comment.
it'd be good to add a comment clarifying that this is a micro-opt, and the generic impl also suffices
…mance optimization
|
@bors r+ |
|
📌 Commit e323652 has been approved by |
|
⌛ Testing commit e323652 with merge 9430800... |
|
💔 Test failed - status-travis |
|
@bors retry (looks like a time-out) |
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
|
💔 Test failed - status-travis |
|
@bors retry
|
|
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 |
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
|
☀️ Test successful - status-appveyor, status-travis |
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.
…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
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
With #42537 a regular
DepNodeonly contains an opaque hash as its identifier. In most cases, this hash is actually aDefPathHashand we can reconstruct theDefIdit 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 theDepNodein a side-table. This string is later used for debug outputs.r? @nikomatsakis