diff options
| -rw-r--r-- | src/librustc/ty/mod.rs | 2 | ||||
| -rw-r--r-- | src/librustc_metadata/encoder.rs | 6 | ||||
| -rw-r--r-- | src/librustc_typeck/variance/README.md | 6 | ||||
| -rw-r--r-- | src/librustc_typeck/variance/test.rs | 4 |
4 files changed, 9 insertions, 9 deletions
diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 2355ed7e147..9ffab1acf3c 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -313,7 +313,7 @@ pub enum Variance { /// variance of every item in the local crate. You should not use it /// directly, because to do so will make your pass dependent on the /// HIR of every item in the local crate. Instead, use -/// `tcx.item_variances()` to get the variance for a *particular* +/// `tcx.variances_of()` to get the variance for a *particular* /// item. pub struct CrateVariancesMap { /// This relation tracks the dependencies between the variance of 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 { diff --git a/src/librustc_typeck/variance/README.md b/src/librustc_typeck/variance/README.md index 9ec20c1a45c..59291617889 100644 --- a/src/librustc_typeck/variance/README.md +++ b/src/librustc_typeck/variance/README.md @@ -102,15 +102,15 @@ can become quite muddled if we are not careful. To resolve this, we refactor into two queries: - `crate_variances` computes the variance for all items in the current crate. -- `item_variances` accesses the variance for an individual reading; it +- `variances_of` accesses the variance for an individual reading; it works by requesting `crate_variances` and extracting the relevant data. -If you limit yourself to reading `item_variances`, your code will only +If you limit yourself to reading `variances_of`, your code will only depend then on the inference inferred for that particular item. Eventually, the goal is to rely on the red-green dependency management algorithm. At the moment, however, we rely instead on a hack, where -`item_variances` ignores the dependencies of accessing +`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 diff --git a/src/librustc_typeck/variance/test.rs b/src/librustc_typeck/variance/test.rs index 53f2bd37fbc..1acadb7e772 100644 --- a/src/librustc_typeck/variance/test.rs +++ b/src/librustc_typeck/variance/test.rs @@ -27,12 +27,12 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for VarianceTest<'a, 'tcx> { // For unit testing: check for a special "rustc_variance" // attribute and report an error with various results if found. if self.tcx.has_attr(item_def_id, "rustc_variance") { - let item_variances = self.tcx.variances_of(item_def_id); + let variances_of = self.tcx.variances_of(item_def_id); span_err!(self.tcx.sess, item.span, E0208, "{:?}", - item_variances); + variances_of); } } |
