Skip to content

Commit 3b19262

Browse files
committed
---
yaml --- r: 184177 b: refs/heads/beta c: 74199c2 h: refs/heads/master i: 184175: fc0e7d7 v: v3
1 parent 419181c commit 3b19262

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ refs/heads/automation-fail: 1bf06495443584539b958873e04cc2f864ab10e4
3131
refs/heads/issue-18208-method-dispatch-3-quick-reject: 2009f85b9f99dedcec4404418eda9ddba90258a2
3232
refs/heads/batch: b7fd822592a4fb577552d93010c4a4e14f314346
3333
refs/heads/building: 126db549b038c84269a1e4fe46f051b2c15d6970
34-
refs/heads/beta: d622235b303409016d8b764b4ae7f2098223ce4d
34+
refs/heads/beta: 74199c24d0c09d5096eba1c1da7ce2d85a207d4b
3535
refs/heads/windistfix: 7608dbad651f02e837ed05eef3d74a6662a6e928
3636
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
3737
refs/heads/tmp: c65fb1a81e5dc58cf171cc47f65de9e6e2119247

branches/beta/src/librustc/middle/infer/bivariate.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,23 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
//! Applies the "bivariance relationship" to two types and/or regions.
12+
//! If (A,B) are bivariant then either A <: B or B <: A. It occurs
13+
//! when type/lifetime parameters are unconstrained. Usually this is
14+
//! an error, but we permit it in the specific case where a type
15+
//! parameter is constrained in a where-clause via an associated type.
16+
//!
17+
//! There are several ways one could implement bivariance. You could
18+
//! just do nothing at all, for example, or you could fully verify
19+
//! that one of the two subtyping relationships hold. We choose to
20+
//! thread a middle line: we relate types up to regions, but ignore
21+
//! all region relationships.
22+
//!
23+
//! At one point, handling bivariance in this fashion was necessary
24+
//! for inference, but I'm actually not sure if that is true anymore.
25+
//! In particular, it might be enough to say (A,B) are bivariant for
26+
//! all (A,B).
27+
1128
use middle::ty::{BuiltinBounds};
1229
use middle::ty::{self, Ty};
1330
use middle::ty::TyVar;

branches/beta/src/librustc/middle/infer/sub.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ impl<'f, 'tcx> Combine<'tcx> for Sub<'f, 'tcx> {
3939
fn tys_with_variance(&self, v: ty::Variance, a: Ty<'tcx>, b: Ty<'tcx>)
4040
-> cres<'tcx, Ty<'tcx>>
4141
{
42-
// Once we're equating, it doesn't matter what the variance is.
4342
match v {
4443
ty::Invariant => self.equate().tys(a, b),
4544
ty::Covariant => self.tys(a, b),

branches/beta/src/librustc/middle/traits/select.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -803,8 +803,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
803803
ambiguous: false
804804
};
805805

806-
// Check for the `PhantomFn` trait. This is really just a special annotation that
807-
// *always* be considered to match, no matter what the type parameters etc.
806+
// Check for the `PhantomFn` trait. This is really just a
807+
// special annotation that is *always* considered to match, no
808+
// matter what the type parameters are etc.
808809
if self.tcx().lang_items.phantom_fn() == Some(obligation.predicate.def_id()) {
809810
candidates.vec.push(PhantomFnCandidate);
810811
return Ok(candidates);

0 commit comments

Comments
 (0)