about summary refs log tree commit diff
path: root/src/test/bench
diff options
context:
space:
mode:
authorNick Cameron <ncameron@mozilla.com>2014-12-20 15:20:51 +1300
committerNick Cameron <ncameron@mozilla.com>2014-12-20 15:23:29 +1300
commit2e86929a4a5a36f3993e577b4582ba70d84bbb40 (patch)
tree7b3e8049edae74dde7a870a7173afed6f9fc744e /src/test/bench
parentcbe9fb45bc705a89f23b434c686544d490923596 (diff)
downloadrust-2e86929a4a5a36f3993e577b4582ba70d84bbb40.tar.gz
rust-2e86929a4a5a36f3993e577b4582ba70d84bbb40.zip
Allow use of `[_ ; n]` syntax for fixed length and repeating arrays.
This does NOT break any existing programs because the `[_, ..n]` syntax is also supported.
Diffstat (limited to 'src/test/bench')
-rw-r--r--src/test/bench/noise.rs12
-rw-r--r--src/test/bench/shootout-fannkuch-redux.rs14
-rw-r--r--src/test/bench/shootout-fasta-redux.rs12
-rw-r--r--src/test/bench/shootout-fasta.rs2
-rw-r--r--src/test/bench/shootout-k-nucleotide.rs4
-rw-r--r--src/test/bench/shootout-nbody.rs8
-rw-r--r--src/test/bench/shootout-reverse-complement.rs8
-rw-r--r--src/test/bench/sudoku.rs6
8 files changed, 33 insertions, 33 deletions
diff --git a/src/test/bench/noise.rs b/src/test/bench/noise.rs
index 025f8467d20..75cf864ce49 100644
--- a/src/test/bench/noise.rs
+++ b/src/test/bench/noise.rs
@@ -37,20 +37,20 @@ fn gradient(orig: Vec2, grad: Vec2, p: Vec2) -> f32 {
 }
 
 struct Noise2DContext {
-    rgradients: [Vec2, ..256],
-    permutations: [i32, ..256],
+    rgradients: [Vec2; 256],
+    permutations: [i32; 256],
 }
 
 impl Noise2DContext {
     fn new() -> Noise2DContext {
         let mut rng = StdRng::new().unwrap();
 
-        let mut rgradients = [Vec2 { x: 0.0, y: 0.0 }, ..256];
+        let mut rgradients = [Vec2 { x: 0.0, y: 0.0 }; 256];
         for x in rgradients.iter_mut() {
             *x = random_gradient(&mut rng);
         }
 
-        let mut permutations = [0i32, ..256];
+        let mut permutations = [0i32; 256];
         for (i, x) in permutations.iter_mut().enumerate() {
             *x = i as i32;
         }
@@ -65,7 +65,7 @@ impl Noise2DContext {
         self.rgradients[(idx & 255) as uint]
     }
 
-    fn get_gradients(&self, x: f32, y: f32) -> ([Vec2, ..4], [Vec2, ..4]) {
+    fn get_gradients(&self, x: f32, y: f32) -> ([Vec2; 4], [Vec2; 4]) {
         let x0f = x.floor();
         let y0f = y.floor();
         let x1f = x0f + 1.0;
@@ -102,7 +102,7 @@ impl Noise2DContext {
 
 fn main() {
     let symbols = [' ', '░', '▒', '▓', '█', '█'];
-    let mut pixels = [0f32, ..256*256];
+    let mut pixels = [0f32; 256*256];
     let n2d = Noise2DContext::new();
 
     for _ in range(0u, 100) {
diff --git a/src/test/bench/shootout-fannkuch-redux.rs b/src/test/bench/shootout-fannkuch-redux.rs
index 4849421a3f0..723b2b722d7 100644
--- a/src/test/bench/shootout-fannkuch-redux.rs
+++ b/src/test/bench/shootout-fannkuch-redux.rs
@@ -64,14 +64,14 @@ fn next_permutation(perm: &mut [i32], count: &mut [i32]) {
 }
 
 struct P {
-    p: [i32, .. 16],
+    p: [i32; 16],
 }
 
 impl Copy for P {}
 
 struct Perm {
-    cnt: [i32, .. 16],
-    fact: [u32, .. 16],
+    cnt: [i32; 16],
+    fact: [u32; 16],
     n: u32,
     permcount: u32,
     perm: P,
@@ -81,21 +81,21 @@ impl Copy for Perm {}
 
 impl Perm {
     fn new(n: u32) -> Perm {
-        let mut fact = [1, .. 16];
+        let mut fact = [1; 16];
         for i in range(1, n as uint + 1) {
             fact[i] = fact[i - 1] * i as u32;
         }
         Perm {
-            cnt: [0, .. 16],
+            cnt: [0; 16],
             fact: fact,
             n: n,
             permcount: 0,
-            perm: P { p: [0, .. 16 ] }
+            perm: P { p: [0; 16 ] }
         }
     }
 
     fn get(&mut self, mut idx: i32) -> P {
-        let mut pp = [0u8, .. 16];
+        let mut pp = [0u8; 16];
         self.permcount = idx as u32;
         for (i, place) in self.perm.p.iter_mut().enumerate() {
             *place = i as i32 + 1;
diff --git a/src/test/bench/shootout-fasta-redux.rs b/src/test/bench/shootout-fasta-redux.rs
index afffbe5bed4..eb18cfdaed3 100644
--- a/src/test/bench/shootout-fasta-redux.rs
+++ b/src/test/bench/shootout-fasta-redux.rs
@@ -64,7 +64,7 @@ const ALU: &'static str = "GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTG\
 
 const NULL_AMINO_ACID: AminoAcid = AminoAcid { c: ' ' as u8, p: 0.0 };
 
-static IUB: [AminoAcid, ..15] = [
+static IUB: [AminoAcid;15] = [
     AminoAcid { c: 'a' as u8, p: 0.27 },
     AminoAcid { c: 'c' as u8, p: 0.12 },
     AminoAcid { c: 'g' as u8, p: 0.12 },
@@ -82,7 +82,7 @@ static IUB: [AminoAcid, ..15] = [
     AminoAcid { c: 'Y' as u8, p: 0.02 },
 ];
 
-static HOMO_SAPIENS: [AminoAcid, ..4] = [
+static HOMO_SAPIENS: [AminoAcid;4] = [
     AminoAcid { c: 'a' as u8, p: 0.3029549426680 },
     AminoAcid { c: 'c' as u8, p: 0.1979883004921 },
     AminoAcid { c: 'g' as u8, p: 0.1975473066391 },
@@ -148,8 +148,8 @@ impl<'a, W: Writer> RepeatFasta<'a, W> {
     }
 }
 
-fn make_lookup(a: &[AminoAcid]) -> [AminoAcid, ..LOOKUP_SIZE] {
-    let mut lookup = [ NULL_AMINO_ACID, ..LOOKUP_SIZE ];
+fn make_lookup(a: &[AminoAcid]) -> [AminoAcid;LOOKUP_SIZE] {
+    let mut lookup = [ NULL_AMINO_ACID;LOOKUP_SIZE ];
     let mut j = 0;
     for (i, slot) in lookup.iter_mut().enumerate() {
         while a[j].p < (i as f32) {
@@ -162,7 +162,7 @@ fn make_lookup(a: &[AminoAcid]) -> [AminoAcid, ..LOOKUP_SIZE] {
 
 struct RandomFasta<'a, W:'a> {
     seed: u32,
-    lookup: [AminoAcid, ..LOOKUP_SIZE],
+    lookup: [AminoAcid;LOOKUP_SIZE],
     out: &'a mut W,
 }
 
@@ -193,7 +193,7 @@ impl<'a, W: Writer> RandomFasta<'a, W> {
     fn make(&mut self, n: uint) -> IoResult<()> {
         let lines = n / LINE_LEN;
         let chars_left = n % LINE_LEN;
-        let mut buf = [0, ..LINE_LEN + 1];
+        let mut buf = [0;LINE_LEN + 1];
 
         for _ in range(0, lines) {
             for i in range(0u, LINE_LEN) {
diff --git a/src/test/bench/shootout-fasta.rs b/src/test/bench/shootout-fasta.rs
index 1f0bed05521..2de61cf3572 100644
--- a/src/test/bench/shootout-fasta.rs
+++ b/src/test/bench/shootout-fasta.rs
@@ -89,7 +89,7 @@ fn make_fasta<W: Writer, I: Iterator<u8>>(
     -> std::io::IoResult<()>
 {
     try!(wr.write(header.as_bytes()));
-    let mut line = [0u8, .. LINE_LENGTH + 1];
+    let mut line = [0u8; LINE_LENGTH + 1];
     while n > 0 {
         let nb = min(LINE_LENGTH, n);
         for i in range(0, nb) {
diff --git a/src/test/bench/shootout-k-nucleotide.rs b/src/test/bench/shootout-k-nucleotide.rs
index d112fe60674..8521e2216e9 100644
--- a/src/test/bench/shootout-k-nucleotide.rs
+++ b/src/test/bench/shootout-k-nucleotide.rs
@@ -46,10 +46,10 @@ use std::string::String;
 use std::slice;
 use std::sync::{Arc, Future};
 
-static TABLE: [u8, ..4] = [ 'A' as u8, 'C' as u8, 'G' as u8, 'T' as u8 ];
+static TABLE: [u8;4] = [ 'A' as u8, 'C' as u8, 'G' as u8, 'T' as u8 ];
 static TABLE_SIZE: uint = 2 << 16;
 
-static OCCURRENCES: [&'static str, ..5] = [
+static OCCURRENCES: [&'static str;5] = [
     "GGT",
     "GGTA",
     "GGTATT",
diff --git a/src/test/bench/shootout-nbody.rs b/src/test/bench/shootout-nbody.rs
index 3f36c16aff6..dab67331120 100644
--- a/src/test/bench/shootout-nbody.rs
+++ b/src/test/bench/shootout-nbody.rs
@@ -45,7 +45,7 @@ const SOLAR_MASS: f64 = 4.0 * PI * PI;
 const YEAR: f64 = 365.24;
 const N_BODIES: uint = 5;
 
-static BODIES: [Planet, ..N_BODIES] = [
+static BODIES: [Planet;N_BODIES] = [
     // Sun
     Planet {
         x: 0.0, y: 0.0, z: 0.0,
@@ -102,7 +102,7 @@ struct Planet {
 
 impl Copy for Planet {}
 
-fn advance(bodies: &mut [Planet, ..N_BODIES], dt: f64, steps: int) {
+fn advance(bodies: &mut [Planet;N_BODIES], dt: f64, steps: int) {
     for _ in range(0, steps) {
         let mut b_slice = bodies.as_mut_slice();
         loop {
@@ -135,7 +135,7 @@ fn advance(bodies: &mut [Planet, ..N_BODIES], dt: f64, steps: int) {
     }
 }
 
-fn energy(bodies: &[Planet, ..N_BODIES]) -> f64 {
+fn energy(bodies: &[Planet;N_BODIES]) -> f64 {
     let mut e = 0.0;
     let mut bodies = bodies.iter();
     loop {
@@ -155,7 +155,7 @@ fn energy(bodies: &[Planet, ..N_BODIES]) -> f64 {
     e
 }
 
-fn offset_momentum(bodies: &mut [Planet, ..N_BODIES]) {
+fn offset_momentum(bodies: &mut [Planet;N_BODIES]) {
     let mut px = 0.0;
     let mut py = 0.0;
     let mut pz = 0.0;
diff --git a/src/test/bench/shootout-reverse-complement.rs b/src/test/bench/shootout-reverse-complement.rs
index 312ee2dd27e..d746ec1dbab 100644
--- a/src/test/bench/shootout-reverse-complement.rs
+++ b/src/test/bench/shootout-reverse-complement.rs
@@ -50,17 +50,17 @@ use std::ptr::{copy_memory};
 use std::io::{IoResult, EndOfFile};
 
 struct Tables {
-    table8: [u8, ..1 << 8],
-    table16: [u16, ..1 << 16]
+    table8: [u8;1 << 8],
+    table16: [u16;1 << 16]
 }
 
 impl Tables {
     fn new() -> Tables {
-        let mut table8 = [0, ..1 << 8];
+        let mut table8 = [0;1 << 8];
         for (i, v) in table8.iter_mut().enumerate() {
             *v = Tables::computed_cpl8(i as u8);
         }
-        let mut table16 = [0, ..1 << 16];
+        let mut table16 = [0;1 << 16];
         for (i, v) in table16.iter_mut().enumerate() {
             *v = table8[i & 255] as u16 << 8 |
                  table8[i >> 8]  as u16;
diff --git a/src/test/bench/sudoku.rs b/src/test/bench/sudoku.rs
index c55f85f40e8..5fb7e2c3a84 100644
--- a/src/test/bench/sudoku.rs
+++ b/src/test/bench/sudoku.rs
@@ -46,7 +46,7 @@ impl Sudoku {
         return Sudoku { grid: g }
     }
 
-    pub fn from_vec(vec: &[[u8, ..9], ..9]) -> Sudoku {
+    pub fn from_vec(vec: &[[u8;9];9]) -> Sudoku {
         let g = Vec::from_fn(9u, |i| {
             Vec::from_fn(9u, |j| { vec[i][j] })
         });
@@ -198,7 +198,7 @@ impl Colors {
     }
 }
 
-static DEFAULT_SUDOKU: [[u8, ..9], ..9] = [
+static DEFAULT_SUDOKU: [[u8;9];9] = [
          /* 0    1    2    3    4    5    6    7    8    */
   /* 0 */  [0u8, 4u8, 0u8, 6u8, 0u8, 0u8, 0u8, 3u8, 2u8],
   /* 1 */  [0u8, 0u8, 8u8, 0u8, 2u8, 0u8, 0u8, 0u8, 0u8],
@@ -212,7 +212,7 @@ static DEFAULT_SUDOKU: [[u8, ..9], ..9] = [
 ];
 
 #[cfg(test)]
-static DEFAULT_SOLUTION: [[u8, ..9], ..9] = [
+static DEFAULT_SOLUTION: [[u8;9];9] = [
          /* 0    1    2    3    4    5    6    7    8    */
   /* 0 */  [1u8, 4u8, 9u8, 6u8, 7u8, 5u8, 8u8, 3u8, 2u8],
   /* 1 */  [5u8, 3u8, 8u8, 1u8, 2u8, 9u8, 7u8, 4u8, 6u8],