summary refs log tree commit diff
path: root/tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-02-06 20:56:48 +0000
committerbors <bors@rust-lang.org>2025-02-06 20:56:48 +0000
commit38213856a8a3a6d49a234e0d95a722a4f28a2b18 (patch)
treeee486aab46d9b430698ffcc3d2e71fe1ce83bf5b /tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.rs
parent0277061b9a4096437b9b35f471c915e1cbe3128f (diff)
parentbf24cade3ef2aae66a5047f762d66b70d2b4b92f (diff)
downloadrust-38213856a8a3a6d49a234e0d95a722a4f28a2b18.tar.gz
rust-38213856a8a3a6d49a234e0d95a722a4f28a2b18.zip
Auto merge of #136650 - cuviper:beta-next, r=cuviper
[beta] backports

- Ensure that we don't try to access fields on a non-struct pattern type #135222
- Do not include GCC source code in source tarballs #135658
- Temporarily bring back `Rvalue::Len` #135709
- Add a couple of missing `ensure_sufficient_stacks` #136352
- Enable kernel sanitizers for aarch64-unknown-none-softfloat #135905

r? cuviper
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
+    }
 }