about summary refs log tree commit diff
path: root/src/tools
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2021-04-04 19:20:01 +0200
committerGitHub <noreply@github.com>2021-04-04 19:20:01 +0200
commita89eab9bca8b7efc37d386ff38d663035a5192de (patch)
treea213e9209a8268ba71722f3f1e70e4db468ea317 /src/tools
parent6c135561830a4126d1ce2c4767c8388b3c57bc86 (diff)
parentc29dc120e5e43a4757d8f7f20db35c61767fe987 (diff)
downloadrust-a89eab9bca8b7efc37d386ff38d663035a5192de.tar.gz
rust-a89eab9bca8b7efc37d386ff38d663035a5192de.zip
Rollup merge of #83521 - sexxi-goose:quick-diagnostic-fix, r=nikomatsakis
2229: Fix diagnostic issue when using FakeReads in closures

This PR fixes a diagnostic issue caused by https://github.com/rust-lang/rust/pull/82536. A temporary work around was used in this merged PR which involved feature gating the addition of FakeReads introduced as a result of pattern matching in closures.

The fix involves adding an optional closure DefId to ForLet and ForMatchedPlace FakeReadCauses. This DefId will only be added if a closure pattern matches a Place starting with an Upvar.

r? ```@nikomatsakis```
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs b/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs
index 1391f7505e2..dac4d93499d 100644
--- a/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs
+++ b/src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs
@@ -212,7 +212,7 @@ fn check_statement(tcx: TyCtxt<'tcx>, body: &Body<'tcx>, def_id: DefId, statemen
             check_rvalue(tcx, body, def_id, rval, span)
         }
 
-        StatementKind::FakeRead(_, place) |
+        StatementKind::FakeRead(box (_, place)) => check_place(tcx, *place, span, body),
         // just an assignment
         StatementKind::SetDiscriminant { place, .. } => check_place(tcx, **place, span, body),