diff options
| author | bors <bors@rust-lang.org> | 2013-05-03 14:27:36 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2013-05-03 14:27:36 -0700 |
| commit | 517bfc91d1481cb8b247c7a5f19528136987ee4e (patch) | |
| tree | 19eb2719c8df176fddaa046a6fca76bb79b80b0c /src/libsyntax | |
| parent | bfd3cd8171bee519093f570264e5a2b1dc17e9d8 (diff) | |
| parent | 32b3d3e9ebd8dbc1073445b3be9676da85b6410c (diff) | |
| download | rust-517bfc91d1481cb8b247c7a5f19528136987ee4e.tar.gz rust-517bfc91d1481cb8b247c7a5f19528136987ee4e.zip | |
auto merge of #6200 : catamorphism/rust/issue-5358, r=catamorphism
r? @nikomatsakis Previously, rustc would ICE if you matched on an enum-typed thing with a structure pattern. Error out correctly. This will close #5358
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast_util.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 47ef7227842..10350413f2d 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -41,12 +41,12 @@ pub fn stmt_id(s: &stmt) -> node_id { } } -pub fn variant_def_ids(d: def) -> (def_id, def_id) { +pub fn variant_def_ids(d: def) -> Option<(def_id, def_id)> { match d { def_variant(enum_id, var_id) => { - return (enum_id, var_id); + Some((enum_id, var_id)) } - _ => fail!(~"non-variant in variant_def_ids") + _ => None } } |
