@@ -111,18 +111,16 @@ impl<'a, 'tcx> TypeFolder<'tcx> for OpportunisticRegionResolver<'a, 'tcx> {
111
111
/// involve some hashing and so forth).
112
112
pub struct UnresolvedTypeFinder < ' a , ' tcx > {
113
113
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 > ) > ,
117
114
}
118
115
119
116
impl < ' a , ' tcx > UnresolvedTypeFinder < ' a , ' tcx > {
120
117
pub fn new ( infcx : & ' a InferCtxt < ' a , ' tcx > ) -> Self {
121
- UnresolvedTypeFinder { infcx, first_unresolved : None }
118
+ UnresolvedTypeFinder { infcx }
122
119
}
123
120
}
124
121
125
122
impl < ' a , ' tcx > TypeVisitor < ' tcx > for UnresolvedTypeFinder < ' a , ' tcx > {
123
+ type BreakTy = ( Ty < ' tcx > , Option < Span > ) ;
126
124
fn visit_ty ( & mut self , t : Ty < ' tcx > ) -> ControlFlow < Self :: BreakTy > {
127
125
let t = self . infcx . shallow_resolve ( t) ;
128
126
if t. has_infer_types ( ) {
@@ -144,8 +142,7 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for UnresolvedTypeFinder<'a, 'tcx> {
144
142
} else {
145
143
None
146
144
} ;
147
- self . first_unresolved = Some ( ( t, ty_var_span) ) ;
148
- ControlFlow :: BREAK
145
+ ControlFlow :: Break ( ( t, ty_var_span) )
149
146
} else {
150
147
// Otherwise, visit its contents.
151
148
t. super_visit_with ( self )
0 commit comments