Skip to content

Commit 75dc963

Browse files
committed
Revert portion of PR #83521 that injected issue #85435 (and thus exposed underlying issue #85561).
1 parent 82b8621 commit 75dc963

File tree

1 file changed

+20
-14
lines changed

1 file changed

+20
-14
lines changed

compiler/rustc_mir_build/src/build/expr/as_rvalue.rs

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -179,20 +179,26 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
179179
// match x { _ => () } // fake read of `x`
180180
// };
181181
// ```
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+
}
196202
}
197203
}
198204

0 commit comments

Comments
 (0)