@@ -89,19 +89,31 @@ impl<'a, 'tcx> InteriorVisitor<'a, 'tcx> {
8989 if let Some ( ( unresolved_type, unresolved_type_span) ) =
9090 self . fcx . unresolved_type_vars ( & ty)
9191 {
92- let note = format ! (
93- "the type is part of the {} because of this {}" ,
94- self . kind, yield_data. source
95- ) ;
96-
9792 // If unresolved type isn't a ty_var then unresolved_type_span is None
9893 let span = self
9994 . prev_unresolved_span
10095 . unwrap_or_else ( || unresolved_type_span. unwrap_or ( source_span) ) ;
101- self . fcx
102- . need_type_info_err_in_generator ( self . kind , span, unresolved_type)
103- . span_note ( yield_data. span , & * note)
104- . emit ( ) ;
96+
97+ // If we encounter an int/float variable, then inference fallback didn't
98+ // finish due to some other error. Don't emit spurious additional errors.
99+ if let ty:: Infer ( ty:: InferTy :: IntVar ( _) | ty:: InferTy :: FloatVar ( _) ) =
100+ unresolved_type. kind ( )
101+ {
102+ self . fcx
103+ . tcx
104+ . sess
105+ . delay_span_bug ( span, & format ! ( "Encountered var {:?}" , unresolved_type) ) ;
106+ } else {
107+ let note = format ! (
108+ "the type is part of the {} because of this {}" ,
109+ self . kind, yield_data. source
110+ ) ;
111+
112+ self . fcx
113+ . need_type_info_err_in_generator ( self . kind , span, unresolved_type)
114+ . span_note ( yield_data. span , & * note)
115+ . emit ( ) ;
116+ }
105117 } else {
106118 // Insert the type into the ordered set.
107119 let scope_span = scope. map ( |s| s. span ( self . fcx . tcx , self . region_scope_tree ) ) ;
0 commit comments