diff options
| author | Corey Farwell <coreyf@rwell.org> | 2017-05-05 17:35:29 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-05-05 17:35:29 -0400 |
| commit | 26e067b058102e3dcfef461a3f45f403fd456bb8 (patch) | |
| tree | c9201a1edd4d92eb6fd8b0ca98b8bb0bf8dba03c /src/librustc_metadata/encoder.rs | |
| parent | 9b2aacfdbe9569666d2d723bcde78ba3deef41a0 (diff) | |
| parent | 3da5daf42587c9cece98a7b0985215cc40c31d58 (diff) | |
Rollup merge of #41734 - nikomatsakis:incr-comp-refactor-variance, r=pnkfelix
Refactor variance and remove last `[pub]` map
This PR refactors variance to work in a more red-green friendly way. Because red-green doesn't exist yet, it has to be a bit hacky. The basic idea is this:
- We compute a big map with the variance for all items in the crate; when you request variances for a particular item, we read it from the crate
- We now hard-code that traits are invariant (which they are, for deep reasons, not gonna' change)
- When building constraints, we compute the transitive closure of all things within the crate that depend on what using `TransitiveRelation`
- this lets us gin up the correct dependencies when requesting variance of a single item
Ah damn, just remembered, one TODO:
- [x] Update the variance README -- ah, I guess the README updates I did are sufficient
r? @michaelwoerister
Diffstat (limited to 'src/librustc_metadata/encoder.rs')
| -rw-r--r-- | src/librustc_metadata/encoder.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index 125026b799c..796cb8c4d65 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -240,8 +240,8 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { } impl<'a, 'b: 'a, 'tcx: 'b> EntryBuilder<'a, 'b, 'tcx> { - fn encode_item_variances(&mut self, def_id: DefId) -> LazySeq<ty::Variance> { - debug!("EntryBuilder::encode_item_variances({:?})", def_id); + fn encode_variances_of(&mut self, def_id: DefId) -> LazySeq<ty::Variance> { + debug!("EntryBuilder::encode_variances_of({:?})", def_id); let tcx = self.tcx; self.lazy_seq_from_slice(&tcx.variances_of(def_id)) } @@ -824,7 +824,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> EntryBuilder<'a, 'b, 'tcx> { hir::ItemEnum(..) | hir::ItemStruct(..) | hir::ItemUnion(..) | - hir::ItemTrait(..) => self.encode_item_variances(def_id), + hir::ItemTrait(..) => self.encode_variances_of(def_id), _ => LazySeq::empty(), }, generics: match item.node { |
