diff options
| author | Dmitry Ermolov <epdmitry@yandex.ru> | 2013-08-06 22:43:57 +0400 |
|---|---|---|
| committer | Dmitry Ermolov <epdmitry@yandex.ru> | 2013-08-07 00:04:28 +0400 |
| commit | 0fadfc5fb7de47f0ffcb55a8bbfe0a75c2a4dbee (patch) | |
| tree | e1f486734fd0c05d86a85a8f9b2dfbc13807e0d6 /src/rustllvm/RustWrapper.cpp | |
| parent | 1710125f673fe8ca2f1ab76074ca26d6f6acd720 (diff) | |
| download | rust-0fadfc5fb7de47f0ffcb55a8bbfe0a75c2a4dbee.tar.gz rust-0fadfc5fb7de47f0ffcb55a8bbfe0a75c2a4dbee.zip | |
Fix bug in `match`ing struct patterns
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.
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
