summaryrefslogtreecommitdiffstats
path: root/tests/ui/closures/2229_closure_analysis/run_pass/destructure-pattern-closure-within-closure.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/closures/2229_closure_analysis/run_pass/destructure-pattern-closure-within-closure.rs')
-rw-r--r--tests/ui/closures/2229_closure_analysis/run_pass/destructure-pattern-closure-within-closure.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/ui/closures/2229_closure_analysis/run_pass/destructure-pattern-closure-within-closure.rs b/tests/ui/closures/2229_closure_analysis/run_pass/destructure-pattern-closure-within-closure.rs
new file mode 100644
index 000000000..5c278bff9
--- /dev/null
+++ b/tests/ui/closures/2229_closure_analysis/run_pass/destructure-pattern-closure-within-closure.rs
@@ -0,0 +1,21 @@
+// edition:2021
+// check-pass
+#![warn(unused)]
+
+fn main() {
+ let t = (String::from("Hello"), String::from("World"));
+ let g = (String::from("Mr"), String::from("Goose"));
+
+ let a = || {
+ let (_, g2) = g;
+ //~^ WARN unused variable: `g2`
+ let c = || {
+ let (_, t2) = t;
+ //~^ WARN unused variable: `t2`
+ };
+
+ c();
+ };
+
+ a();
+}