Skip to content

Commit a931e04

Browse files
committed
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.
2 parents 7a1b61d + 0fadfc5 commit a931e04

File tree

6 files changed

+158
-65
lines changed

6 files changed

+158
-65
lines changed

src/librustc/driver/driver.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,8 @@ pub fn optgroups() -> ~[getopts::groups::OptGroup] {
821821
optmulti("", "cfg", "Configure the compilation
822822
environment", "SPEC"),
823823
optflag("", "emit-llvm",
824-
"Produce an LLVM bitcode file"),
824+
"Produce an LLVM assembly file if used with -S option;
825+
produce an LLVM bitcode file otherwise"),
825826
optflag("h", "help","Display this message"),
826827
optmulti("L", "", "Add a directory to the library search path",
827828
"PATH"),

0 commit comments

Comments
 (0)