From: bors Date: Fri, 9 Aug 2013 04:41:05 +0000 (-0700) Subject: auto merge of #8350 : dim-an/rust/fix-struct-match, r=pcwalton X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=a931e04b757a795e3867ea98c81cee731bd54ac1;p=rust.git auto merge of #8350 : dim-an/rust/fix-struct-match, r=pcwalton Code that collects fields in struct-like patterns used to ignore wildcard patterns like `Foo{_}`. But `enter_defaults` considered struct-like patterns as default in order to overcome this (accoring to my understanding of situation). However such behaviour caused code like this: ``` enum E { Foo{f: int}, Bar } let e = Bar; match e { Foo{f: _f} => { /* do something (1) */ } _ => { /* do something (2) */ } } ``` consider pattern `Foo{f: _f}` as default. That caused inproper behaviour and even segfaults while trying to destruct `Bar` as `Foo{f: _f}`. Issues: #5625 , #5530. This patch fixes `collect_record_or_struct_fields` to split cases of single wildcard struct-like pattern and no struct-like pattern at all. Former case resolved with `enter_rec_or_struct` (and not with `enter_defaults`). Closes #5625. Closes #5530. --- a931e04b757a795e3867ea98c81cee731bd54ac1