@@ -4,12 +4,10 @@ use crate::infer::{
44} ;
55use crate :: traits:: { Obligation , PredicateObligations } ;
66
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 } ;
98use rustc_middle:: ty:: TyVar ;
109use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
1110use rustc_span:: Span ;
12- use std:: mem;
1311
1412/// Enforce that `a` is equal to or a subtype of `b`.
1513pub struct TypeRelating < ' combine , ' a , ' tcx > {
@@ -43,18 +41,6 @@ impl<'tcx> TypeRelation<'tcx> for TypeRelating<'_, '_, 'tcx> {
4341 self . a_is_expected
4442 }
4543
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-
5844 fn relate_with_variance < T : Relate < ' tcx > > (
5945 & mut self ,
6046 variance : ty:: Variance ,
@@ -84,12 +70,6 @@ impl<'tcx> TypeRelation<'tcx> for TypeRelating<'_, '_, 'tcx> {
8470
8571 match ( a. kind ( ) , b. kind ( ) ) {
8672 ( & 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-
9373 match self . ambient_variance {
9474 ty:: Covariant => {
9575 // can't make progress on `A <: B` if both A and B are
@@ -191,7 +171,7 @@ impl<'tcx> TypeRelation<'tcx> for TypeRelating<'_, '_, 'tcx> {
191171 a : ty:: Region < ' tcx > ,
192172 b : ty:: Region < ' tcx > ,
193173 ) -> RelateResult < ' tcx , ty:: Region < ' tcx > > {
194- debug ! ( "{}.regions({:?}, {:?}) self.cause={:?} " , self . tag( ) , a, b, self . fields . cause ) ;
174+ debug ! ( "{}.regions({:?}, {:?})" , self . tag( ) , a, b) ;
195175
196176 // FIXME -- we have more fine-grained information available
197177 // from the "cause" field, we could perhaps give more tailored
0 commit comments