Logo
Explore Help
Register Sign In
rust-lang/rust
1
0
Fork 0
You've already forked rust
Code Issues Pull Requests Actions 1 Packages Projects Releases Wiki Activity
Files
ecaf9e39c9435fa2de4fe393c4b263be36eb2d99
rust/src/test/compile-fail/issue-2848.rs

16 lines
239 B
Rust
Raw Normal View History

In resolve, check that an or-pattern has the same number of bindings in each disjunct resolve3 wasn't checking this. Added test cases. Also added a helpful informational message in the case where you have a variable binding that you probably think refers to a variant that you forgot to import. This is easier to do in resolve than in typeck because there's code in typeck that assumes that each of the patterns binds the same number of variables.
2012-07-10 18:24:41 -07:00
mod bar {
enum foo {
alpha,
beta,
charlie
}
}
fn main() {
import bar::{alpha, charlie};
Convert alt to match. Stop parsing alt
2012-08-06 12:34:08 -07:00
match alpha {
Switch alts to use arrows
2012-08-03 19:59:04 -07:00
alpha | beta => {} //~ ERROR: inconsistent number of bindings
charlie => {}
In resolve, check that an or-pattern has the same number of bindings in each disjunct resolve3 wasn't checking this. Added test cases. Also added a helpful informational message in the case where you have a variable binding that you probably think refers to a variant that you forgot to import. This is easier to do in resolve than in typeck because there's code in typeck that assumes that each of the patterns binds the same number of variables.
2012-07-10 18:24:41 -07:00
}
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 459ms Template: 4ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API