@@ -125,11 +125,8 @@ pub enum TypeOrigin {
125
125
// FIXME(eddyb) #11161 is the original Expr required?
126
126
ExprAssignable ( Span ) ,
127
127
128
- // Relating trait refs when resolving vtables
129
- RelateTraitRefs ( Span ) ,
130
-
131
- // Relating self types when resolving vtables
132
- RelateSelfType ( Span ) ,
128
+ // Relating types in an impl
129
+ TraitMatchTypes ( Span ) ,
133
130
134
131
// Relating trait type parameters to those found in impl etc
135
132
RelateOutputImplTypes ( Span ) ,
@@ -154,10 +151,9 @@ impl TypeOrigin {
154
151
fn as_str ( & self ) -> & ' static str {
155
152
match self {
156
153
& TypeOrigin :: Misc ( _) |
157
- & TypeOrigin :: RelateSelfType ( _) |
154
+ & TypeOrigin :: TraitMatchTypes ( _) |
158
155
& TypeOrigin :: RelateOutputImplTypes ( _) |
159
156
& TypeOrigin :: ExprAssignable ( _) => "mismatched types" ,
160
- & TypeOrigin :: RelateTraitRefs ( _) => "mismatched traits" ,
161
157
& TypeOrigin :: MethodCompatCheck ( _) => "method not compatible with trait" ,
162
158
& TypeOrigin :: MatchExpressionArm ( _, _, source) => match source {
163
159
hir:: MatchSource :: IfLetDesugar { ..} => "`if let` arms have incompatible types" ,
@@ -205,6 +201,9 @@ pub enum SubregionOrigin<'tcx> {
205
201
// error.
206
202
RFC1214Subregion ( Rc < SubregionOrigin < ' tcx > > ) ,
207
203
204
+ // Arose as part of trait matching
205
+ TraitMatch ( Span ) ,
206
+
208
207
// Arose from a subtyping relation
209
208
Subtype ( TypeTrace < ' tcx > ) ,
210
209
@@ -842,6 +841,14 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
842
841
self . region_vars . add_given ( sub, sup) ;
843
842
}
844
843
844
+ pub fn equate_regions ( & self ,
845
+ origin : SubregionOrigin < ' tcx > ,
846
+ a : ty:: Region ,
847
+ b : ty:: Region )
848
+ {
849
+ self . region_vars . make_eqregion ( origin, a, b)
850
+ }
851
+
845
852
pub fn sub_types ( & self ,
846
853
a_is_expected : bool ,
847
854
origin : TypeOrigin ,
@@ -1546,8 +1553,7 @@ impl TypeOrigin {
1546
1553
MethodCompatCheck ( span) => span,
1547
1554
ExprAssignable ( span) => span,
1548
1555
Misc ( span) => span,
1549
- RelateTraitRefs ( span) => span,
1550
- RelateSelfType ( span) => span,
1556
+ TraitMatchTypes ( span) => span,
1551
1557
RelateOutputImplTypes ( span) => span,
1552
1558
MatchExpressionArm ( match_span, _, _) => match_span,
1553
1559
IfExpression ( span) => span,
@@ -1563,6 +1569,7 @@ impl<'tcx> SubregionOrigin<'tcx> {
1563
1569
match * self {
1564
1570
RFC1214Subregion ( ref a) => a. span ( ) ,
1565
1571
Subtype ( ref a) => a. span ( ) ,
1572
+ TraitMatch ( a) => a,
1566
1573
InfStackClosure ( a) => a,
1567
1574
InvokeClosure ( a) => a,
1568
1575
DerefPointer ( a) => a,
0 commit comments