about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2021-05-21 14:55:09 -0400
committerFelix S. Klock II <pnkfelix@pnkfx.org>2021-05-21 14:55:09 -0400
commit1f130fbff8d32da093da8eca723323792a3a8554 (patch)
tree529e20a936fdf7958ff773508f43a4ef90e84fd1 /compiler
parentaf2ed1b51887ede4d766ee123d3fa216970d1fdd (diff)
downloadrust-1f130fbff8d32da093da8eca723323792a3a8554.tar.gz
rust-1f130fbff8d32da093da8eca723323792a3a8554.zip
Revert portion of PR #83521 that injected issue #85435 (and thus exposed underlying issue #85561).
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_mir_build/src/build/expr/as_rvalue.rs35
1 files changed, 20 insertions, 15 deletions
diff --git a/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs b/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs
index 92a2a7bc17a..1345531f3c6 100644
--- a/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs
+++ b/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs
@@ -185,21 +185,26 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
                 //     match x { _ => () } // fake read of `x`
                 // };
                 // ```
-                for (thir_place, cause, hir_id) in fake_reads.into_iter() {
-                    let place_builder =
-                        unpack!(block = this.as_place_builder(block, &this.thir[*thir_place]));
-
-                    if let Ok(place_builder_resolved) =
-                        place_builder.try_upvars_resolved(this.tcx, this.typeck_results)
-                    {
-                        let mir_place =
-                            place_builder_resolved.into_place(this.tcx, this.typeck_results);
-                        this.cfg.push_fake_read(
-                            block,
-                            this.source_info(this.tcx.hir().span(*hir_id)),
-                            *cause,
-                            mir_place,
-                        );
+                //
+                // FIXME(RFC2229, rust#85435): Remove feature gate once diagnostics are
+                // improved and unsafe checking works properly in closure bodies again.
+                if this.tcx.features().capture_disjoint_fields {
+                    for (thir_place, cause, hir_id) in fake_reads.into_iter() {
+                        let place_builder =
+                            unpack!(block = this.as_place_builder(block, &this.thir[*thir_place]));
+
+                        if let Ok(place_builder_resolved) =
+                            place_builder.try_upvars_resolved(this.tcx, this.typeck_results)
+                        {
+                            let mir_place =
+                                place_builder_resolved.into_place(this.tcx, this.typeck_results);
+                            this.cfg.push_fake_read(
+                                block,
+                                this.source_info(this.tcx.hir().span(*hir_id)),
+                                *cause,
+                                mir_place,
+                            );
+                        }
                     }
                 }