@@ -179,20 +179,26 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
179
179
// match x { _ => () } // fake read of `x`
180
180
// };
181
181
// ```
182
- for ( thir_place, cause, hir_id) in fake_reads. into_iter ( ) {
183
- let place_builder = unpack ! ( block = this. as_place_builder( block, thir_place) ) ;
184
-
185
- if let Ok ( place_builder_resolved) =
186
- place_builder. try_upvars_resolved ( this. tcx , this. typeck_results )
187
- {
188
- let mir_place =
189
- place_builder_resolved. into_place ( this. tcx , this. typeck_results ) ;
190
- this. cfg . push_fake_read (
191
- block,
192
- this. source_info ( this. tcx . hir ( ) . span ( * hir_id) ) ,
193
- * cause,
194
- mir_place,
195
- ) ;
182
+ //
183
+ // FIXME(RFC2229, rust#85435): Remove feature gate once diagnostics are
184
+ // improved and unsafe checking works properly in closure bodies again.
185
+ if this. tcx . features ( ) . capture_disjoint_fields {
186
+ for ( thir_place, cause, hir_id) in fake_reads. into_iter ( ) {
187
+ let place_builder =
188
+ unpack ! ( block = this. as_place_builder( block, thir_place) ) ;
189
+
190
+ if let Ok ( place_builder_resolved) =
191
+ place_builder. try_upvars_resolved ( this. tcx , this. typeck_results )
192
+ {
193
+ let mir_place =
194
+ place_builder_resolved. into_place ( this. tcx , this. typeck_results ) ;
195
+ this. cfg . push_fake_read (
196
+ block,
197
+ this. source_info ( this. tcx . hir ( ) . span ( * hir_id) ) ,
198
+ * cause,
199
+ mir_place,
200
+ ) ;
201
+ }
196
202
}
197
203
}
198
204
0 commit comments