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
c3ccaacc6c90fc678cbba9c3c0427f0a7dece75c
rust/src/test/compile-fail/match-struct.rs

11 lines
174 B
Rust
Raw Normal View History

Check type when struct is matched against enum-like pattern Previously check always succeeded because struct type was derived from the matched expression, not the matched pattern.
2013-02-20 01:43:15 +09:00
struct S { a: int }
enum E { C(int) }
fn main() {
match S { a: 1 } {
Fix reversed current/expected type Fix some reversed type of arm pattern and type of search pattern in error message.
2013-02-25 00:15:53 +09:00
C(_) => (), //~ ERROR mismatched types: expected `S` but found `E`
Check type when struct is matched against enum-like pattern Previously check always succeeded because struct type was derived from the matched expression, not the matched pattern.
2013-02-20 01:43:15 +09:00
_ => ()
}
}
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.6 Page: 280ms Template: 2ms
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