@@ -111,19 +111,17 @@ impl<'a, 'tcx> TypeFolder<'tcx> for OpportunisticRegionResolver<'a, 'tcx> {
111111/// involve some hashing and so forth).
112112pub struct UnresolvedTypeFinder < ' a , ' tcx > {
113113 infcx : & ' a InferCtxt < ' a , ' tcx > ,
114-
115- /// Used to find the type parameter name and location for error reporting.
116- pub first_unresolved : Option < ( Ty < ' tcx > , Option < Span > ) > ,
117114}
118115
119116impl < ' a , ' tcx > UnresolvedTypeFinder < ' a , ' tcx > {
120117 pub fn new ( infcx : & ' a InferCtxt < ' a , ' tcx > ) -> Self {
121- UnresolvedTypeFinder { infcx, first_unresolved : None }
118+ UnresolvedTypeFinder { infcx }
122119 }
123120}
124121
125122impl < ' a , ' tcx > TypeVisitor < ' tcx > for UnresolvedTypeFinder < ' a , ' tcx > {
126- fn visit_ty ( & mut self , t : Ty < ' tcx > ) -> ControlFlow < ( ) > {
123+ type BreakTy = ( Ty < ' tcx > , Option < Span > ) ;
124+ fn visit_ty ( & mut self , t : Ty < ' tcx > ) -> ControlFlow < Self :: BreakTy > {
127125 let t = self . infcx . shallow_resolve ( t) ;
128126 if t. has_infer_types ( ) {
129127 if let ty:: Infer ( infer_ty) = * t. kind ( ) {
@@ -144,8 +142,7 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for UnresolvedTypeFinder<'a, 'tcx> {
144142 } else {
145143 None
146144 } ;
147- self . first_unresolved = Some ( ( t, ty_var_span) ) ;
148- ControlFlow :: BREAK
145+ ControlFlow :: Break ( ( t, ty_var_span) )
149146 } else {
150147 // Otherwise, visit its contents.
151148 t. super_visit_with ( self )
0 commit comments