From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- .../run_pass/capture_with_wildcard_match.rs | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/test/ui/closures/2229_closure_analysis/run_pass/capture_with_wildcard_match.rs (limited to 'src/test/ui/closures/2229_closure_analysis/run_pass/capture_with_wildcard_match.rs') diff --git a/src/test/ui/closures/2229_closure_analysis/run_pass/capture_with_wildcard_match.rs b/src/test/ui/closures/2229_closure_analysis/run_pass/capture_with_wildcard_match.rs new file mode 100644 index 000000000..cea02fbe1 --- /dev/null +++ b/src/test/ui/closures/2229_closure_analysis/run_pass/capture_with_wildcard_match.rs @@ -0,0 +1,27 @@ +// edition:2021 +//check-pass + +fn test1() { + let foo : [Vec; 3] = ["String".into(), "String".into(), "String".into()]; + let c = || { + match foo { _ => () }; + }; + drop(foo); + c(); +} + +fn test2() { + let foo : Option<[Vec; 3]> = Some(["String".into(), "String".into(), "String".into()]); + let c = || { + match foo { + Some(_) => 1, + _ => 2 + }; + }; + c(); +} + +fn main() { + test1(); + test2(); +} -- cgit v1.2.3