incr. comp.: Take spans into account for ICH#36025
Conversation
|
(rust_highfive has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
TODO: Rename this to CachingCodemapView.
|
☔ The latest upstream changes (presumably #36030) made this pull request unmergeable. Please resolve the merge conflicts. |
4dcf193 to
e063f41
Compare
|
This is ready for review now. |
| // collect a deterministic hash of def-ids that we have seen | ||
| def_path_hashes: &'a mut DefPathHashes<'hash, 'tcx>, | ||
| hash_spans: bool, | ||
| codemap: CachedCodemapView<'tcx>, |
There was a problem hiding this comment.
Nit: I think it would be better if this lived one level up, next to the DefPathHashes, so that we can cache across items.
|
r=me modulo comments about span hashing |
|
@bors r=nikomatsakis |
|
📌 Commit 4549b6b has been approved by |
|
☔ The latest upstream changes (presumably #35718) made this pull request unmergeable. Please resolve the merge conflicts. |
4549b6b to
7310a8f
Compare
|
@bors r=nikomatsakis rebased. |
|
📌 Commit 7310a8f has been approved by |
|
⌛ Testing commit 7310a8f with merge 4c70c01... |
|
💔 Test failed - auto-win-gnu-32-opt-rustbuild |
|
@bors retry |
|
@bors r- Want to take a look at the failed test on travis first... |
|
@bors retry Couldn't reproduce the test failure. |
|
@bors r=nikomatsakis |
|
📌 Commit 7310a8f has been approved by |
|
⌛ Testing commit 7310a8f with merge 3af7da5... |
|
💔 Test failed - auto-win-msvc-64-cargotest |
|
Can reproduce, will investigate... |
|
r=me on the last commit |
|
@bors r=nikomatsakis |
|
📌 Commit 3057b7b has been approved by |
|
⌛ Testing commit 3057b7b with merge 923bac4... |
…atsakis incr. comp.: Take spans into account for ICH This PR makes the ICH (incr. comp. hash) take spans into account when debuginfo is enabled. A side-effect of this is that the SVH (which is based on the ICHs of all items in the crate) becomes sensitive to the tiniest change in a code base if debuginfo is enabled. Since we are not trying to model ABI compatibility via the SVH anymore (this is done via the crate disambiguator now), this should be not be a problem. Fixes #33888. Fixes #32753.
This impl skips over a handful of attributes as if they aren't there. This skipping originated all the way back in rust-lang#36025, and was extended a couple of times, e.g. in rust-lang#36370. Those PRs don't have any explanation of why the skipping exists. Removing the impl (and falling back to the default impl for `[T]`) doesn't seem to have any effects.
This impl skips: - All doc comments - A handful of other attributes, mostly `rustc_*` ones related to incremental compilation testing. This skipping originated in rust-lang#36025 and was extended a couple of times, e.g. in rust-lang#36370. Those PRs don't have any explanation of why the skipping exists. Perhaps the reasoning was that doc comments should only affect rustdoc and rustdoc doesn't use incremental compilation? But doc comments end up in metadata, and there is a query `attrs_for_def` that returns a `&'tcx [hir::Attribute]`. So skipping some attributes just seems plainly wrong. This commit removes the impl, which means `[hir::Attribute]` hashing falls back to the default impl for `[T]`. This has no noticeable effect on the test suite. It does slightly hurt performance, because of the doc comments. This perf regression seems worth it for the correcteness benefits.
This impl skips: - All doc comments - A handful of other attributes, mostly `rustc_*` ones related to incremental compilation testing. This skipping originated in rust-lang#36025 and was extended a couple of times, e.g. in rust-lang#36370. Those PRs don't have any explanation of why the skipping exists. Perhaps the reasoning was that doc comments should only affect rustdoc and rustdoc doesn't use incremental compilation? But doc comments end up in metadata, and there is a query `attrs_for_def` that returns a `&'tcx [hir::Attribute]`. So skipping some attributes just seems plainly wrong. This commit removes the impl, which means `[hir::Attribute]` hashing falls back to the default impl for `[T]`. This has no noticeable effect on the test suite. It does slightly hurt performance, because of the doc comments. This perf regression seems worth it for the correctness benefits.
This PR makes the ICH (incr. comp. hash) take spans into account when debuginfo is enabled.
A side-effect of this is that the SVH (which is based on the ICHs of all items in the crate) becomes sensitive to the tiniest change in a code base if debuginfo is enabled. Since we are not trying to model ABI compatibility via the SVH anymore (this is done via the crate disambiguator now), this should be not be a problem.
Fixes #33888.
Fixes #32753.