diff options
| author | Aaron Keen <aaronkeen@gmail.com> | 2015-12-17 22:14:50 +0100 |
|---|---|---|
| committer | Aaron Keen <aaronkeen@gmail.com> | 2015-12-17 22:14:50 +0100 |
| commit | cedd794d72ee1a9dbf7e55cf66f4a52393066e85 (patch) | |
| tree | ad18e7168b47a4e4b3924442cd9065dc37ed113e /src | |
| parent | ae479725b7eef82c692e30ab2e30dd5cb6104ade (diff) | |
| download | rust-cedd794d72ee1a9dbf7e55cf66f4a52393066e85.tar.gz rust-cedd794d72ee1a9dbf7e55cf66f4a52393066e85.zip | |
Added a functioning version of the assoc-oddities-3 test case to
run-pass. Added run-pass/issue-28777 to demonstrate behavior of this parsing modification.
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/run-pass/assoc-oddities-3.rs | 21 | ||||
| -rw-r--r-- | src/test/run-pass/issue-28777.rs | 30 |
2 files changed, 51 insertions, 0 deletions
diff --git a/src/test/run-pass/assoc-oddities-3.rs b/src/test/run-pass/assoc-oddities-3.rs new file mode 100644 index 00000000000..4913816ffe6 --- /dev/null +++ b/src/test/run-pass/assoc-oddities-3.rs @@ -0,0 +1,21 @@ +// Copyright 2015 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 that_odd_parse(c: bool, n: usize) -> u32 { + let x = 2; + let a = [1, 2, 3, 4]; + let b = [5, 6, 7, 7]; + x + if c { a } else { b }[n] +} + +fn main() { + assert_eq!(4, that_odd_parse(true, 1)); + assert_eq!(8, that_odd_parse(false, 1)); +} diff --git a/src/test/run-pass/issue-28777.rs b/src/test/run-pass/issue-28777.rs new file mode 100644 index 00000000000..ea5d4e4f3c2 --- /dev/null +++ b/src/test/run-pass/issue-28777.rs @@ -0,0 +1,30 @@ +// Copyright 2015 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() { + let v1 = { 1 + {2} * {3} }; + let v2 = 1 + {2} * {3} ; + + assert_eq!(7, v1); + assert_eq!(7, v2); + + let v3; + v3 = { 1 + {2} * {3} }; + let v4; + v4 = 1 + {2} * {3}; + assert_eq!(7, v3); + assert_eq!(7, v4); + + let v5 = { 1 + {2} * 3 }; + assert_eq!(7, v5); + + let v9 = { 1 + if 1 > 2 {1} else {2} * {3} }; + assert_eq!(7, v9); +} |
