Skip to content

Commit

Permalink
Fix LLVM error with tuple struct match using (..)
Browse files Browse the repository at this point in the history
Consider PatEnums constructed with A(..) to be candidates for tuple
struct patterns, not just ones constructed with A(a,b,c). If these
patterns shouldn't be valid tuple struct patterns (as they're equivalent
to _), this needs to be caught before we get to trans.

Fixes #14308.
  • Loading branch information
lilyball committed May 21, 2014
1 parent d5b5aa4 commit 0718259
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/librustc/middle/trans/_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,7 @@ fn any_tuple_struct_pat(bcx: &Block, m: &[Match], col: uint) -> bool {
m.iter().any(|br| {
let pat = *br.pats.get(col);
match pat.node {
ast::PatEnum(_, Some(_)) => {
ast::PatEnum(_, _) => {
match bcx.tcx().def_map.borrow().find(&pat.id) {
Some(&ast::DefFn(..)) |
Some(&ast::DefStruct(..)) => true,
Expand Down

5 comments on commit 0718259

@bors
Copy link
Contributor

@bors bors commented on 0718259 May 23, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from cmr
at lilyball@0718259

@bors
Copy link
Contributor

@bors bors commented on 0718259 May 23, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging kballard/rust/tuple_dotdot_match_ice = 0718259 into auto

@bors
Copy link
Contributor

@bors bors commented on 0718259 May 23, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kballard/rust/tuple_dotdot_match_ice = 0718259 merged ok, testing candidate = c329a1f

@bors
Copy link
Contributor

@bors bors commented on 0718259 May 23, 2014

@bors
Copy link
Contributor

@bors bors commented on 0718259 May 23, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = c329a1f

Please sign in to comment.