@@ -3,6 +3,8 @@ use super::{FixupError, FixupResult, InferCtxt, Span};
3
3
use rustc_middle:: ty:: fold:: { TypeFolder , TypeVisitor } ;
4
4
use rustc_middle:: ty:: { self , Const , InferConst , Ty , TyCtxt , TypeFoldable } ;
5
5
6
+ use std:: ops:: ControlFlow ;
7
+
6
8
///////////////////////////////////////////////////////////////////////////
7
9
// OPPORTUNISTIC VAR RESOLVER
8
10
@@ -121,7 +123,7 @@ impl<'a, 'tcx> UnresolvedTypeFinder<'a, 'tcx> {
121
123
}
122
124
123
125
impl < ' a , ' tcx > TypeVisitor < ' tcx > for UnresolvedTypeFinder < ' a , ' tcx > {
124
- fn visit_ty ( & mut self , t : Ty < ' tcx > ) -> bool {
126
+ fn visit_ty ( & mut self , t : Ty < ' tcx > ) -> ControlFlow < ( ) > {
125
127
let t = self . infcx . shallow_resolve ( t) ;
126
128
if t. has_infer_types ( ) {
127
129
if let ty:: Infer ( infer_ty) = * t. kind ( ) {
@@ -143,15 +145,15 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for UnresolvedTypeFinder<'a, 'tcx> {
143
145
None
144
146
} ;
145
147
self . first_unresolved = Some ( ( t, ty_var_span) ) ;
146
- true // Halt visiting.
148
+ ControlFlow :: BREAK
147
149
} else {
148
150
// Otherwise, visit its contents.
149
151
t. super_visit_with ( self )
150
152
}
151
153
} else {
152
154
// All type variables in inference types must already be resolved,
153
155
// - no need to visit the contents, continue visiting.
154
- false
156
+ ControlFlow :: CONTINUE
155
157
}
156
158
}
157
159
}
0 commit comments