Skip to content
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

Remove dependency tracking for variance computation #45473

Merged
merged 1 commit into from
Oct 25, 2017

Conversation

SimonSapin
Copy link
Contributor

This custom tracking is now replaced by the red/green algorithm.

Fix #45471

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@SimonSapin
Copy link
Contributor Author

r? @nikomatsakis

I made the changes described in #45471, then kept removing things until everything compiled.

Does src/librustc_typeck/variance/README.md also need changes?

@nikomatsakis
Copy link
Contributor

@SimonSapin Yeah. Let's replace this paragraph:

Eventually, the goal is to rely on the red-green dependency management algorithm. At the moment, however, we rely instead on a hack, where variances_of ignores the dependencies of accessing crate_variances and instead computes the correct dependencies itself. To this end, when we build up the constraints in the system, we also built up a transitive dependencies relation as part of the crate map. A (X, Y) pair is added to the map each time we have a constraint that the variance of some inferred for the item X depends on the variance of some element of Y. This is to some extent a mirroring of the inference graph in the dependency graph. This means we can just completely ignore the fixed-point iteration, since it is just shuffling values along this graph.

with

Ultimately, this setup relies on the red-green algorithm. In particular, every variance query ultimately depends on -- effectively -- all type definitions in the entire crate (through crate_variances), but since most changes will not result in a change to the actual results from variance inference, the variances_of query will wind up being considered green after it is re-evaluated.

This custom tracking is now replaced by the red/green algorithm.

Fix rust-lang#45471
@SimonSapin
Copy link
Contributor Author

Done.

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Oct 23, 2017

📌 Commit 94edd8f has been approved by nikomatsakis

@kennytm kennytm added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Oct 24, 2017
@SimonSapin SimonSapin mentioned this pull request Oct 24, 2017
@bors
Copy link
Contributor

bors commented Oct 25, 2017

⌛ Testing commit 94edd8f with merge b247805...

bors added a commit that referenced this pull request Oct 25, 2017
Remove dependency tracking for variance computation

This custom tracking is now replaced by the red/green algorithm.

Fix #45471
@bors
Copy link
Contributor

bors commented Oct 25, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing b247805 to master...

@bors bors merged commit 94edd8f into rust-lang:master Oct 25, 2017
@SimonSapin SimonSapin deleted the variance-red-green branch October 25, 2017 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants