@@ -33,6 +33,7 @@ struct InteriorVisitor<'a, 'tcx> {
3333 /// that they may succeed the said yield point in the post-order.
3434 guard_bindings : SmallVec < [ SmallVec < [ HirId ; 4 ] > ; 1 ] > ,
3535 guard_bindings_set : HirIdSet ,
36+ linted_values : HirIdSet ,
3637}
3738
3839impl < ' a , ' tcx > InteriorVisitor < ' a , ' tcx > {
@@ -122,18 +123,21 @@ impl<'a, 'tcx> InteriorVisitor<'a, 'tcx> {
122123 // Insert the type into the ordered set.
123124 let scope_span = scope. map ( |s| s. span ( self . fcx . tcx , self . region_scope_tree ) ) ;
124125
125- check_must_not_suspend_ty (
126- self . fcx ,
127- ty,
128- hir_id,
129- SuspendCheckData {
130- expr,
131- source_span,
132- yield_span : yield_data. span ,
133- plural_len : 1 ,
134- ..Default :: default ( )
135- } ,
136- ) ;
126+ if !self . linted_values . contains ( & hir_id) {
127+ check_must_not_suspend_ty (
128+ self . fcx ,
129+ ty,
130+ hir_id,
131+ SuspendCheckData {
132+ expr,
133+ source_span,
134+ yield_span : yield_data. span ,
135+ plural_len : 1 ,
136+ ..Default :: default ( )
137+ } ,
138+ ) ;
139+ self . linted_values . insert ( hir_id) ;
140+ }
137141
138142 self . types . insert ( ty:: GeneratorInteriorTypeCause {
139143 span : source_span,
@@ -181,6 +185,7 @@ pub fn resolve_interior<'a, 'tcx>(
181185 prev_unresolved_span : None ,
182186 guard_bindings : <_ >:: default ( ) ,
183187 guard_bindings_set : <_ >:: default ( ) ,
188+ linted_values : <_ >:: default ( ) ,
184189 } ;
185190 intravisit:: walk_body ( & mut visitor, body) ;
186191
0 commit comments