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

Projects
None yet
5 participants
@SimonSapin
Copy link
Contributor

SimonSapin commented Oct 23, 2017

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

Fix #45471

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Oct 23, 2017

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

This comment has been minimized.

Copy link
Contributor Author

SimonSapin commented Oct 23, 2017

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

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Oct 23, 2017

@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.

Remove dependency tracking for variance computation
This custom tracking is now replaced by the red/green algorithm.

Fix #45471
@SimonSapin

This comment has been minimized.

Copy link
Contributor Author

SimonSapin commented Oct 23, 2017

Done.

@SimonSapin SimonSapin force-pushed the SimonSapin:variance-red-green branch from b2ade98 to 94edd8f Oct 23, 2017

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Oct 23, 2017

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Oct 23, 2017

📌 Commit 94edd8f has been approved by nikomatsakis

@bors

This comment has been minimized.

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

Auto merge of #45473 - SimonSapin:variance-red-green, r=nikomatsakis
Remove dependency tracking for variance computation

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

Fix #45471
@bors

This comment has been minimized.

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

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details

@SimonSapin SimonSapin deleted the SimonSapin:variance-red-green branch Oct 25, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.