This repository has been archived by the owner on Mar 1, 2019. It is now read-only.
Don't take stale defs into account when checking for congruent ones #159
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We ignored the defs as congruent in cases where we lower the same crate - in the incremental case there's a very high chance our spans are the same as before - however we ignore them as congruent becase those existed previously, but since we did these will not exist now that we lower the data for a given crate.
The approach is to keep a 'queue' of ids we are yet to overwrite and when checking for congruent items don't take into account the defs that are still to be overwritten.
Small repro:
When (un)commenting
fn some() {}
repeatedly we can get stuck in the state where we ignore thefn other() {}
before it existed previously. With the invalidated crates queue approach, we first lower the root module andfn other() {}
but still ignore it when lowering the data from another crate target (e.g. fromtest
orbin
target) as designed previously.(The test is non-deterministic somehow and requires to coordinate multiple rustc runs, so I didn't add a regression test here - should I?)
Empirically, this seems to have brought back type definitions in goto and hover!
However, I get
def already exists at span
messages when lowering data from another crate target (in macro case where expansion differs (different gensyms) for both targets but still point to the same source location), but this doesn't seem to have a negative impact on the usability?