@@ -33,6 +33,7 @@ struct InteriorVisitor<'a, 'tcx> {
33
33
/// that they may succeed the said yield point in the post-order.
34
34
guard_bindings : SmallVec < [ SmallVec < [ HirId ; 4 ] > ; 1 ] > ,
35
35
guard_bindings_set : HirIdSet ,
36
+ linted_values : HirIdSet ,
36
37
}
37
38
38
39
impl < ' a , ' tcx > InteriorVisitor < ' a , ' tcx > {
@@ -122,18 +123,21 @@ impl<'a, 'tcx> InteriorVisitor<'a, 'tcx> {
122
123
// Insert the type into the ordered set.
123
124
let scope_span = scope. map ( |s| s. span ( self . fcx . tcx , self . region_scope_tree ) ) ;
124
125
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
+ }
137
141
138
142
self . types . insert ( ty:: GeneratorInteriorTypeCause {
139
143
span : source_span,
@@ -181,6 +185,7 @@ pub fn resolve_interior<'a, 'tcx>(
181
185
prev_unresolved_span : None ,
182
186
guard_bindings : <_ >:: default ( ) ,
183
187
guard_bindings_set : <_ >:: default ( ) ,
188
+ linted_values : <_ >:: default ( ) ,
184
189
} ;
185
190
intravisit:: walk_body ( & mut visitor, body) ;
186
191
0 commit comments