Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Never expand specialized columns that only contain wild patterns in them
Doing so would incur deeply nested expansion of the tree with no useful side effects. This is problematic for "wide" data types such as structs with dozens of fields but where only a few are actually being matched or bound. Most notably, matching a fixed slice would use a number of stack frames that grows with the number of elements in the slice. Fixes #17877.
- Loading branch information
Jakub Wieczorek
committed
Oct 12, 2014
1 parent
86509d8
commit 0c48c57
Showing
4 changed files
with
107 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
fn main() { | ||
assert_eq!(match [0u8, ..1024] { | ||
_ => 42u, | ||
}, 42u); | ||
|
||
assert_eq!(match [0u8, ..1024] { | ||
[1, _..] => 0u, | ||
[0, _..] => 1u, | ||
_ => 2u | ||
}, 1u); | ||
} |
0c48c57
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from alexcrichton
at https://github.com/jakub-/rust/commit/0c48c5712dc52bb1f9e70181f1b68feff75269c2
0c48c57
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging jakub-/rust/issue-17877 = 0c48c57 into auto
0c48c57
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jakub-/rust/issue-17877 = 0c48c57 merged ok, testing candidate = ff0abf0
0c48c57
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all tests pass:
success: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/1761
success: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/1758
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-c/builds/1752
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/1758
success: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/1755
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-c/builds/1754
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/1754
success: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/1758
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-c/builds/1752
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/1751
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android-t/builds/1754
success: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/1410
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/1409
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/1411
success: http://buildbot.rust-lang.org/builders/auto-win-64-opt/builds/248
success: http://buildbot.rust-lang.org/builders/auto-win-64-nopt-t/builds/249
success: http://buildbot.rust-lang.org/builders/auto-win-64-nopt-c/builds/241
0c48c57
There was a problem hiding this comment.
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 = ff0abf0