Nit: improve Binders comment in `relate_tys`
This commit is contained in:
parent
d85a7da8fe
commit
3171cbe986
|
@ -410,11 +410,11 @@ impl<'cx, 'bccx, 'gcx, 'tcx> TypeRelation<'cx, 'gcx, 'tcx>
|
||||||
);
|
);
|
||||||
|
|
||||||
if self.ambient_covariance() {
|
if self.ambient_covariance() {
|
||||||
// Covariance, so we want `for<'a> A <: for<'b...> B` --
|
// Covariance, so we want `for<..> A <: for<..> B` --
|
||||||
// therefore we replace all of the `'b...` regions with
|
// therefore we compare any instantiation of A (i.e., A
|
||||||
// placeholders and then replace `'a...` with
|
// instantiated with existentials) against every
|
||||||
// existentials. We then check if any instantiation of A
|
// instantiation of B (i.e., B instantiated with
|
||||||
// can match against the placeholders in B.
|
// universals).
|
||||||
|
|
||||||
let b_scope = self.create_scope(b, UniversallyQuantified(true));
|
let b_scope = self.create_scope(b, UniversallyQuantified(true));
|
||||||
let a_scope = self.create_scope(a, UniversallyQuantified(false));
|
let a_scope = self.create_scope(a, UniversallyQuantified(false));
|
||||||
|
@ -443,9 +443,11 @@ impl<'cx, 'bccx, 'gcx, 'tcx> TypeRelation<'cx, 'gcx, 'tcx>
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.ambient_contravariance() {
|
if self.ambient_contravariance() {
|
||||||
// Contravariance, so we want `for<'a> A :> for<'b...> B`
|
// Contravariance, so we want `for<..> A :> for<..> B`
|
||||||
// -- do the opposite, therefore, of covariant. Replace
|
// -- therefore we compare every instantiation of A (i.e.,
|
||||||
// the `'a...` placeholders with `'b...` variables.
|
// A instantiated with universals) against any
|
||||||
|
// instantiation of B (i.e., B instantiated with
|
||||||
|
// existentials). Opposite of above.
|
||||||
|
|
||||||
let a_scope = self.create_scope(a, UniversallyQuantified(true));
|
let a_scope = self.create_scope(a, UniversallyQuantified(true));
|
||||||
let b_scope = self.create_scope(b, UniversallyQuantified(false));
|
let b_scope = self.create_scope(b, UniversallyQuantified(false));
|
||||||
|
|
Loading…
Reference in New Issue