@@ -3,6 +3,8 @@ use super::{FixupError, FixupResult, InferCtxt, Span};
33use rustc_middle:: ty:: fold:: { TypeFolder , TypeVisitor } ;
44use rustc_middle:: ty:: { self , Const , InferConst , Ty , TyCtxt , TypeFoldable } ;
55
6+ use std:: ops:: ControlFlow ;
7+
68///////////////////////////////////////////////////////////////////////////
79// OPPORTUNISTIC VAR RESOLVER
810
@@ -121,7 +123,7 @@ impl<'a, 'tcx> UnresolvedTypeFinder<'a, 'tcx> {
121123}
122124
123125impl < ' 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 < ( ) > {
125127 let t = self . infcx . shallow_resolve ( t) ;
126128 if t. has_infer_types ( ) {
127129 if let ty:: Infer ( infer_ty) = * t. kind ( ) {
@@ -143,15 +145,15 @@ impl<'a, 'tcx> TypeVisitor<'tcx> for UnresolvedTypeFinder<'a, 'tcx> {
143145 None
144146 } ;
145147 self . first_unresolved = Some ( ( t, ty_var_span) ) ;
146- true // Halt visiting.
148+ ControlFlow :: BREAK
147149 } else {
148150 // Otherwise, visit its contents.
149151 t. super_visit_with ( self )
150152 }
151153 } else {
152154 // All type variables in inference types must already be resolved,
153155 // - no need to visit the contents, continue visiting.
154- false
156+ ControlFlow :: CONTINUE
155157 }
156158 }
157159}
0 commit comments