diff options
| author | bors <bors@rust-lang.org> | 2025-01-08 21:31:51 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-01-08 21:31:51 +0000 |
| commit | e26ff2f9086fc449b963df578f8641c31846abe6 (patch) | |
| tree | 8b479896279a326978b89a0978ba6c10069663fd /tests/ui/pattern/struct-pattern-with-missing-fields-resolve-error.rs | |
| parent | a580b5c379b4fca50dfe5afc0fc0ce00921e4e00 (diff) | |
| parent | 6a093f771135f26ea7cdaa8557ebeeb9d8b7da04 (diff) | |
| download | rust-e26ff2f9086fc449b963df578f8641c31846abe6.tar.gz rust-e26ff2f9086fc449b963df578f8641c31846abe6.zip | |
Auto merge of #135260 - matthiaskrgr:rollup-8irqs72, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #134228 (Exhaustively handle expressions in patterns) - #135194 (triagebot: mark tidy changes with a more specific `A-tidy` label) - #135222 (Ensure that we don't try to access fields on a non-struct pattern type) - #135250 (A couple simple borrowck cleanups) - #135252 (Fix release notes link) - #135253 (Revert #131365) Failed merges: - #135195 (Make `lit_to_mir_constant` and `lit_to_const` infallible) r? `@ghost` `@rustbot` modify labels: rollup
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.rs | 9 |
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 + } } |
