about summary refs log tree commit diff
path: root/tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.rs
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2025-01-08 08:52:24 +0000
committerGitHub <noreply@github.com>2025-01-08 08:52:24 +0000
commit8edcd9374a26cffa9474ce92d79c64892caef146 (patch)
tree36b4829675d832d323283fc37457f6509f8a519c /tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.rs
parent16a26f9b4658c3481d231241a6c6130edc9a6de7 (diff)
parent2d180714e14b34e36bf883bdf706ebaf5fa96754 (diff)
downloadrust-8edcd9374a26cffa9474ce92d79c64892caef146.tar.gz
rust-8edcd9374a26cffa9474ce92d79c64892caef146.zip
Merge pull request #4127 from rust-lang/rustup-2025-01-08
Automatic Rustup
Diffstat (limited to 'tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.rs')
-rw-r--r--tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.rs b/tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.rs
index 225891e390f..39f9f5a2c02 100644
--- a/tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.rs
+++ b/tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.rs
@@ -3,6 +3,10 @@ struct Website {
     title: Option<String>,
 }
 
+enum Foo {
+    Bar { a: i32 },
+}
+
 fn main() {
     let website = Website {
         url: "http://www.example.com".into(),
@@ -18,4 +22,9 @@ fn main() {
         println!("[{}]({})", title, url); //~ ERROR cannot find value `title` in this scope
         //~^ NOTE not found in this scope
     }
+
+    let x = Foo::Bar { a: 1 };
+    if let Foo::Bar { .. } = x { //~ NOTE this pattern
+        println!("{a}"); //~ ERROR cannot find value `a` in this scope
+    }
 }