-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ICE on stable (1.57) in inremental compilation in hir_module_items
. Likely related to issue #84970
#92218
Comments
hir_module_items
. Likely related to https://github.com/rust-lang/rust/issues/84970hir_module_items
. Likely related to #84970
hir_module_items
. Likely related to #84970hir_module_items
. Likely related to [#84970](https://github.com/rust-lang/rust/issues/84970)
hir_module_items
. Likely related to [#84970](https://github.com/rust-lang/rust/issues/84970)hir_module_items
. Likely related to issue #84970
@alfriadox Do you know what changes you were making before this ICE occured? |
@Aaron1011 I was adding code to an entirely separate module in a different folder. Only other thing that changed was that I updated crate version in cargo and added a dependency. |
It it helps, a large amount of the module errorring is generated by a proc macro from the |
I've managed to reproduce a similar crash in the incremental compilation system, which I think has the same root cause as your issue. I'll be opening a pull request later today. |
Oh that's great! Please tag me or reference this issue so that I can stay up to date if this gets fixed :) |
All other 'containers' (e.g. `impl` blocks) hashed their contents in the normal, order-dependent way. However, `Mod` was hashing its contents in a (sort-of) order-independent way. However, the exact order is exposed to consumers through `Mod.item_ids`, and through query results like `hir_module_items`. Therefore, stable hashing needs to take the order of items into account, to avoid fingerprint ICEs. Unforuntately, I was unable to directly build a reproducer for the ICE, due to the behavior of `Fingerprint::combine_commutative`. This operation swaps the upper and lower `u64` when constructing the result, which makes the function non-associative. Since we start the hashing of module items by combining `Fingerprint::ZERO` with the first item, it's difficult to actually build an example where changing the order of module items leaves the final hash unchanged. However, this appears to have been hit in practice in rust-lang#92218 While we're not able to reproduce it, the fact that proc-macros are involved (which can give an entire module the same span, preventing any span-related invalidations) makes me confident that the root cause of that issue is our method of hashing module items. This PR removes all of the special handling for `Mod`, instead deriving a `HashStable` implementation. This makes `Mod` consistent with other 'contains' like `Impl`, which hash their contents through the typical derive of `HashStable`.
I've opened #92259 which should fix this issue. |
Awesome! Looking forward to it's merge |
…elwoerister Remove special-cased stable hashing for HIR module All other 'containers' (e.g. `impl` blocks) hashed their contents in the normal, order-dependent way. However, `Mod` was hashing its contents in a (sort-of) order-independent way. However, the exact order is exposed to consumers through `Mod.item_ids`, and through query results like `hir_module_items`. Therefore, stable hashing needs to take the order of items into account, to avoid fingerprint ICEs. Unforuntately, I was unable to directly build a reproducer for the ICE, due to the behavior of `Fingerprint::combine_commutative`. This operation swaps the upper and lower `u64` when constructing the result, which makes the function non-associative. Since we start the hashing of module items by combining `Fingerprint::ZERO` with the first item, it's difficult to actually build an example where changing the order of module items leaves the final hash unchanged. However, this appears to have been hit in practice in rust-lang#92218 While we're not able to reproduce it, the fact that proc-macros are involved (which can give an entire module the same span, preventing any span-related invalidations) makes me confident that the root cause of that issue is our method of hashing module items. This PR removes all of the special handling for `Mod`, instead deriving a `HashStable` implementation. This makes `Mod` consistent with other 'contains' like `Impl`, which hash their contents through the typical derive of `HashStable`.
@rustbot label +A-incr-comp |
Triage: Since the fix was not reported to not work, let's assume it worked. Feel free to reopen if that is wrong. Closing. |
Code
See rcos/Telescope@5b86ad5. This is hard to minimize because it is unclear to me what is causing this bug.
Meta
rustc --version --verbose
:Error output
Backtrace
This issue is likely related to #84970
The text was updated successfully, but these errors were encountered: