about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-03-24 14:45:16 +0000
committerbors <bors@rust-lang.org>2021-03-24 14:45:16 +0000
commitf5fe425c925ef36d5f4c18cfa44173fc42de31b8 (patch)
treefab6ad01e68791e75528eaa03b37070861a98034 /src/test
parent2e012ce681b4d116c2ce2d285d09e03a794482cb (diff)
parent74d7731c5b8f6557099b55378881699cd76175b3 (diff)
downloadrust-f5fe425c925ef36d5f4c18cfa44173fc42de31b8.tar.gz
rust-f5fe425c925ef36d5f4c18cfa44173fc42de31b8.zip
Auto merge of #83364 - sexxi-goose:fix-83176, r=nikomatsakis
2229 migration: Don't try resolve regions before writeback

In the analysis use `resolve_vars_if_possible` instead of `fully_resolve`,
because we might not have performed regionck yet.

Fixes: #83176

r? `@nikomatsakis`
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/closures/2229_closure_analysis/migrations/issue-78720.rs10
-rw-r--r--src/test/ui/closures/2229_closure_analysis/migrations/issue-78720.stderr15
2 files changed, 25 insertions, 0 deletions
diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/issue-78720.rs b/src/test/ui/closures/2229_closure_analysis/migrations/issue-78720.rs
new file mode 100644
index 00000000000..3a6af00254c
--- /dev/null
+++ b/src/test/ui/closures/2229_closure_analysis/migrations/issue-78720.rs
@@ -0,0 +1,10 @@
+// run-pass
+
+#![warn(disjoint_capture_drop_reorder)]
+
+fn main() {
+    if let a = "" {
+    //~^ WARNING: irrefutable `if let` pattern
+        drop(|_: ()| drop(a));
+    }
+}
diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/issue-78720.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/issue-78720.stderr
new file mode 100644
index 00000000000..7e5da949cb2
--- /dev/null
+++ b/src/test/ui/closures/2229_closure_analysis/migrations/issue-78720.stderr
@@ -0,0 +1,15 @@
+warning: irrefutable `if let` pattern
+  --> $DIR/issue-78720.rs:6:5
+   |
+LL | /     if let a = "" {
+LL | |
+LL | |         drop(|_: ()| drop(a));
+LL | |     }
+   | |_____^
+   |
+   = note: `#[warn(irrefutable_let_patterns)]` on by default
+   = note: this pattern will always match, so the `if let` is useless
+   = help: consider replacing the `if let` with a `let`
+
+warning: 1 warning emitted
+