@@ -4,12 +4,10 @@ use crate::infer::{
4
4
} ;
5
5
use crate :: traits:: { Obligation , PredicateObligations } ;
6
6
7
- use rustc_middle:: ty:: relate:: { Cause , Relate , RelateResult , TypeRelation } ;
8
- use rustc_middle:: ty:: visit:: TypeVisitableExt ;
7
+ use rustc_middle:: ty:: relate:: { Relate , RelateResult , TypeRelation } ;
9
8
use rustc_middle:: ty:: TyVar ;
10
9
use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
11
10
use rustc_span:: Span ;
12
- use std:: mem;
13
11
14
12
/// Enforce that `a` is equal to or a subtype of `b`.
15
13
pub struct TypeRelating < ' combine , ' a , ' tcx > {
@@ -43,18 +41,6 @@ impl<'tcx> TypeRelation<'tcx> for TypeRelating<'_, '_, 'tcx> {
43
41
self . a_is_expected
44
42
}
45
43
46
- fn with_cause < F , R > ( & mut self , cause : Cause , f : F ) -> R
47
- where
48
- F : FnOnce ( & mut Self ) -> R ,
49
- {
50
- debug ! ( "sub with_cause={:?}" , cause) ;
51
- let old_cause = mem:: replace ( & mut self . fields . cause , Some ( cause) ) ;
52
- let r = f ( self ) ;
53
- debug ! ( "sub old_cause={:?}" , old_cause) ;
54
- self . fields . cause = old_cause;
55
- r
56
- }
57
-
58
44
fn relate_with_variance < T : Relate < ' tcx > > (
59
45
& mut self ,
60
46
variance : ty:: Variance ,
@@ -84,12 +70,6 @@ impl<'tcx> TypeRelation<'tcx> for TypeRelating<'_, '_, 'tcx> {
84
70
85
71
match ( a. kind ( ) , b. kind ( ) ) {
86
72
( & ty:: Infer ( TyVar ( a_id) ) , & ty:: Infer ( TyVar ( b_id) ) ) => {
87
- // Shouldn't have any LBR here, so we can safely put
88
- // this under a binder below without fear of accidental
89
- // capture.
90
- assert ! ( !a. has_escaping_bound_vars( ) ) ;
91
- assert ! ( !b. has_escaping_bound_vars( ) ) ;
92
-
93
73
match self . ambient_variance {
94
74
ty:: Covariant => {
95
75
// can't make progress on `A <: B` if both A and B are
@@ -191,7 +171,7 @@ impl<'tcx> TypeRelation<'tcx> for TypeRelating<'_, '_, 'tcx> {
191
171
a : ty:: Region < ' tcx > ,
192
172
b : ty:: Region < ' tcx > ,
193
173
) -> RelateResult < ' tcx , ty:: Region < ' tcx > > {
194
- debug ! ( "{}.regions({:?}, {:?}) self.cause={:?} " , self . tag( ) , a, b, self . fields . cause ) ;
174
+ debug ! ( "{}.regions({:?}, {:?})" , self . tag( ) , a, b) ;
195
175
196
176
// FIXME -- we have more fine-grained information available
197
177
// from the "cause" field, we could perhaps give more tailored
0 commit comments