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