Skip to content

Commit 3da5daf

Browse files
committed
change various uses of item_variances to variances_of
1 parent 79de56a commit 3da5daf

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/librustc/ty/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ pub enum Variance {
313313
/// variance of every item in the local crate. You should not use it
314314
/// directly, because to do so will make your pass dependent on the
315315
/// HIR of every item in the local crate. Instead, use
316-
/// `tcx.item_variances()` to get the variance for a *particular*
316+
/// `tcx.variances_of()` to get the variance for a *particular*
317317
/// item.
318318
pub struct CrateVariancesMap {
319319
/// This relation tracks the dependencies between the variance of

src/librustc_metadata/encoder.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
240240
}
241241

242242
impl<'a, 'b: 'a, 'tcx: 'b> EntryBuilder<'a, 'b, 'tcx> {
243-
fn encode_item_variances(&mut self, def_id: DefId) -> LazySeq<ty::Variance> {
244-
debug!("EntryBuilder::encode_item_variances({:?})", def_id);
243+
fn encode_variances_of(&mut self, def_id: DefId) -> LazySeq<ty::Variance> {
244+
debug!("EntryBuilder::encode_variances_of({:?})", def_id);
245245
let tcx = self.tcx;
246246
self.lazy_seq_from_slice(&tcx.variances_of(def_id))
247247
}
@@ -824,7 +824,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> EntryBuilder<'a, 'b, 'tcx> {
824824
hir::ItemEnum(..) |
825825
hir::ItemStruct(..) |
826826
hir::ItemUnion(..) |
827-
hir::ItemTrait(..) => self.encode_item_variances(def_id),
827+
hir::ItemTrait(..) => self.encode_variances_of(def_id),
828828
_ => LazySeq::empty(),
829829
},
830830
generics: match item.node {

src/librustc_typeck/variance/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,15 +102,15 @@ can become quite muddled if we are not careful. To resolve this, we refactor
102102
into two queries:
103103

104104
- `crate_variances` computes the variance for all items in the current crate.
105-
- `item_variances` accesses the variance for an individual reading; it
105+
- `variances_of` accesses the variance for an individual reading; it
106106
works by requesting `crate_variances` and extracting the relevant data.
107107

108-
If you limit yourself to reading `item_variances`, your code will only
108+
If you limit yourself to reading `variances_of`, your code will only
109109
depend then on the inference inferred for that particular item.
110110

111111
Eventually, the goal is to rely on the red-green dependency management
112112
algorithm. At the moment, however, we rely instead on a hack, where
113-
`item_variances` ignores the dependencies of accessing
113+
`variances_of` ignores the dependencies of accessing
114114
`crate_variances` and instead computes the *correct* dependencies
115115
itself. To this end, when we build up the constraints in the system,
116116
we also built up a transitive `dependencies` relation as part of the

src/librustc_typeck/variance/test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for VarianceTest<'a, 'tcx> {
2727
// For unit testing: check for a special "rustc_variance"
2828
// attribute and report an error with various results if found.
2929
if self.tcx.has_attr(item_def_id, "rustc_variance") {
30-
let item_variances = self.tcx.variances_of(item_def_id);
30+
let variances_of = self.tcx.variances_of(item_def_id);
3131
span_err!(self.tcx.sess,
3232
item.span,
3333
E0208,
3434
"{:?}",
35-
item_variances);
35+
variances_of);
3636
}
3737
}
3838

0 commit comments

Comments
 (0)