Skip to content

Commit 1f130fb

Browse files
committed
Revert portion of PR rust-lang#83521 that injected issue rust-lang#85435 (and thus exposed underlying issue rust-lang#85561).
1 parent af2ed1b commit 1f130fb

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

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

+20-15
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)