Uh oh!
There was an error while loading. Please reload this page.
Make re-export collection deterministic - #65043
Conversation
rust-highfive
commented
Oct 3, 2019
(rust_highfive has picked a reviewer for you, use r? to override) |
Aaron1011
commented
Oct 3, 2019
r? @Centril |
Centril
commented
Oct 3, 2019
Looks good but r? @petrochenkov should really review this since resolve is their wheelhouse. :) |
Mark-Simulacrum
commented
Oct 3, 2019
I think we usually deal with this via collection into a Vec and sorting just before metadata serialization; that might be a better approach here? |
jonas-schievink
commented
Oct 3, 2019
Centril
commented
Oct 3, 2019
I personally feel that |
Aaron1011
commented
Oct 3, 2019
@jonas-schievink: Thanks, fixed |
Mark-Simulacrum
commented
Oct 3, 2019
We do have a StableMap in the data structures crate as of a recent PR, so maybe using that here would be better. It does not expose iteration order at all (lacking those methods entirely). But again, I'm fine landing this in the mean time. An indexmap seems like a reasonable answer too. |
matthewjasper
commented
Oct 3, 2019
Stable map looks unsuitable since |
petrochenkov
commented
Oct 3, 2019
That was my first reaction too. We actually have a method for visiting resolutions in a stable fashion ( |
@bors try @rust-timer queue |
bors
commented
Oct 3, 2019
⌛ Trying commit 2c9bf5f9320945e4fc29927e8de60dd2fad8172f with merge 9f13bf7d334cc30a5fbe83d0309ccf107c0d512e... |
This comment has been minimized.
This comment has been minimized.
rust-timer
commented
Oct 3, 2019
Awaiting bors try build completion |
bors
commented
Oct 3, 2019
⌛ Trying commit 2c9bf5f9320945e4fc29927e8de60dd2fad8172f with merge 0e298d5daf4f422edf242c37161329ee79515942... |
Actually, I'm not sure that the insertion order itself is stable for the resolutions, if it's not, then |
Centril
commented
Oct 3, 2019
Interesting. I'm pretty happy I reassigned this PR. :) |
bors
commented
Oct 3, 2019
☀️ Try build successful - checks-azure |
rust-timer
commented
Oct 3, 2019
Queued 0e298d5daf4f422edf242c37161329ee79515942 with parent 032a53a, future comparison URL. |
bjorn3
commented
Oct 4, 2019
We have |
Aaron1011
commented
Oct 4, 2019
@petrochenkov: This looks like a wash performance wise - a few minor speedups and a few minor slowdowns. I suspect that much of it is just noise. |
petrochenkov
commented
Oct 4, 2019
Yeah, I just wanted to check what performance impact |
@petrochenkov: All other things being equal, I think it's better to reduce the amount of non-determinism in the compiler. This issue was a pain to track down, and I'm worried that it might crop up again if we're relying on every caller using |
petrochenkov
commented
Oct 4, 2019
Let's check whether |
petrochenkov
commented
Oct 5, 2019
Looks like resolutions are added in stable order, so we can use an @Aaron1011 |
Previously, we were using an `FxHashMap` to collect module re-exports. However, re-exports end up getting serialized into crate metadata, which means that metadata generation was non-deterministic. This resulted in spurious error messages changes (e.g. PR rust-lang#64906) due to pretty-printing implicitly depending on the order of re-exports when computing the proper path to show to the user. See rust-lang#65042 for a long-term strategy to detect this kind of issue
2c9bf5f to
33178a9CompareAaron1011
commented
Oct 5, 2019
@petrochenkov Updated |
Now that `Resolutions` has a deterministic iteration order, it's no longer necessary to sort its entries before iterating over them
33178a9 to
add0a42Comparepetrochenkov
commented
Oct 5, 2019
Thanks! |
bors
commented
Oct 5, 2019
📌 Commit add0a42 has been approved by |
bors
commented
Oct 6, 2019
…nkov Make re-export collection deterministic Fixes#65036 Previously, we were using an `FxHashMap` to collect module re-exports. However, re-exports end up getting serialized into crate metadata, which means that metadata generation was non-deterministic. This resulted in spurious error messages changes (e.g. PR #64906) due to pretty-printing implicitly depending on the order of re-exports when computing the proper path to show to the user. See #65042 for a long-term strategy to detect this kind of issue
bors
commented
Oct 6, 2019
☀️ Test successful - checks-azure |
RalfJung
commented
Oct 9, 2019
Clarification to avoid spreading this myth further: |
Aaron1011
commented
Oct 9, 2019
@RalfJung: I meant 'non-deterministic with respect to platforms' - that is, the crate metadata order wouldn't look the same across different platforms. Sorry for the confusion. |
Fixes#65036
Previously, we were using an
FxHashMapto collect module re-exports.However, re-exports end up getting serialized into crate metadata, which
means that metadata generation was non-deterministic. This resulted in
spurious error messages changes (e.g. PR #64906) due to pretty-printing
implicitly depending on the order of re-exports when computing the
proper path to show to the user.
See #65042 for a long-term strategy to detect this kind of issue