-
Couldn't load subscription status.
- Fork 13.9k
Description
The plan changed to removing the loop detector.
Original issue
The code at https://github.com/rust-lang/rust/blob/master/src/librustc_mir/interpret/snapshot.rs leaves me puzzled and confused after wasting about two hours on it. Open questions are:
- Why is
AllocIdSnapshotanOption? What does it mean when there is aNonethere and when does that happen? - Why does
EvalSnapshot::newmake a deep copy, and then it has a methodEvalSnapshot::snapshotthat does a snapshot (of theEvalSnapshot, confusing naming)? That method is called inPartialEq::eq, doesn't that mean we do tons of allocations and copies every time we compare? - Where and how does it avoid snapshotting the same allocation twice in one snapshot?
I tried fixing the second point (making a snapshot when EvalSnapshot is created, not when it is compared), but failed to do so as the thing produced by the Snapshot trait isn't actually a snapshot (which I would expect to be a deep, independent copy), but something full of references to somewhere (couldn't figure out where though, just saw the lifetime).
Documentation (inline in the code) should be improved to answer these questions, and if the part about allocating during comparison is correct, that should be fixed.