More fallout

This commit is contained in:
Nick Cameron 2015-01-01 17:40:24 +13:00
parent 13392d19ca
commit 2c92ddeda7
47 changed files with 149 additions and 149 deletions

View File

@ -1617,7 +1617,7 @@ value. In this example, each element of `a` will be initialized to `0i`:
let a = [0i; 20]; // a: [int; 20]
```
Arrays have type `[T,..N]`. We'll talk about this `T` notation later, when we
Arrays have type `[T; N]`. We'll talk about this `T` notation later, when we
cover generics.
You can get the number of elements in an array `a` with `a.len()`, and use

View File

@ -382,7 +382,7 @@ pub trait SliceExt<T> for Sized? {
fn get_mut(&mut self, index: uint) -> Option<&mut T>;
/// Work with `self` as a mut slice.
/// Primarily intended for getting a &mut [T] from a [T, ..N].
/// Primarily intended for getting a &mut [T] from a [T; N].
#[stable]
fn as_mut_slice(&mut self) -> &mut [T];
@ -2060,7 +2060,7 @@ mod tests {
}
// shouldn't panic
let mut v: [uint, .. 0] = [];
let mut v: [uint; 0] = [];
v.sort();
let mut v = [0xDEADBEEFu];
@ -2072,7 +2072,7 @@ mod tests {
fn test_sort_stability() {
for len in range(4i, 25) {
for _ in range(0u, 10) {
let mut counts = [0i, .. 10];
let mut counts = [0i; 10];
// create a vector like [(6, 1), (5, 1), (6, 2), ...],
// where the first item of each tuple is random, but

View File

@ -2743,7 +2743,7 @@ mod tests {
use core::iter::order;
// official Unicode test data
// from http://www.unicode.org/Public/UCD/latest/ucd/auxiliary/GraphemeBreakTest.txt
let test_same: [(_, &[_]), .. 325] = [
let test_same: [(_, &[_]); 325] = [
("\u{20}\u{20}", &["\u{20}", "\u{20}"]),
("\u{20}\u{308}\u{20}", &["\u{20}\u{308}", "\u{20}"]),
("\u{20}\u{D}", &["\u{20}", "\u{D}"]),
@ -3075,7 +3075,7 @@ mod tests {
("\u{646}\u{200D}\u{20}", &["\u{646}\u{200D}", "\u{20}"]),
];
let test_diff: [(_, &[_], &[_]), .. 23] = [
let test_diff: [(_, &[_], &[_]); 23] = [
("\u{20}\u{903}", &["\u{20}\u{903}"], &["\u{20}", "\u{903}"]), ("\u{20}\u{308}\u{903}",
&["\u{20}\u{308}\u{903}"], &["\u{20}\u{308}", "\u{903}"]), ("\u{D}\u{308}\u{903}",
&["\u{D}", "\u{308}\u{903}"], &["\u{D}", "\u{308}", "\u{903}"]), ("\u{A}\u{308}\u{903}",

View File

@ -26,33 +26,33 @@ macro_rules! array_impls {
($($N:expr)+) => {
$(
#[stable]
impl<T:Copy> Clone for [T, ..$N] {
fn clone(&self) -> [T, ..$N] {
impl<T:Copy> Clone for [T; $N] {
fn clone(&self) -> [T; $N] {
*self
}
}
#[unstable = "waiting for Show to stabilize"]
impl<T:fmt::Show> fmt::Show for [T, ..$N] {
impl<T:fmt::Show> fmt::Show for [T; $N] {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::Show::fmt(&self[], f)
}
}
#[stable]
impl<A, B> PartialEq<[B, ..$N]> for [A, ..$N] where A: PartialEq<B> {
impl<A, B> PartialEq<[B; $N]> for [A; $N] where A: PartialEq<B> {
#[inline]
fn eq(&self, other: &[B, ..$N]) -> bool {
fn eq(&self, other: &[B; $N]) -> bool {
self[] == other[]
}
#[inline]
fn ne(&self, other: &[B, ..$N]) -> bool {
fn ne(&self, other: &[B; $N]) -> bool {
self[] != other[]
}
}
#[stable]
impl<'a, A, B, Rhs> PartialEq<Rhs> for [A, ..$N] where
impl<'a, A, B, Rhs> PartialEq<Rhs> for [A; $N] where
A: PartialEq<B>,
Rhs: Deref<[B]>,
{
@ -63,47 +63,47 @@ macro_rules! array_impls {
}
#[stable]
impl<'a, A, B, Lhs> PartialEq<[B, ..$N]> for Lhs where
impl<'a, A, B, Lhs> PartialEq<[B; $N]> for Lhs where
A: PartialEq<B>,
Lhs: Deref<[A]>
{
#[inline(always)]
fn eq(&self, other: &[B, ..$N]) -> bool { PartialEq::eq(&**self, other[]) }
fn eq(&self, other: &[B; $N]) -> bool { PartialEq::eq(&**self, other[]) }
#[inline(always)]
fn ne(&self, other: &[B, ..$N]) -> bool { PartialEq::ne(&**self, other[]) }
fn ne(&self, other: &[B; $N]) -> bool { PartialEq::ne(&**self, other[]) }
}
#[stable]
impl<T:Eq> Eq for [T, ..$N] { }
impl<T:Eq> Eq for [T; $N] { }
#[stable]
impl<T:PartialOrd> PartialOrd for [T, ..$N] {
impl<T:PartialOrd> PartialOrd for [T; $N] {
#[inline]
fn partial_cmp(&self, other: &[T, ..$N]) -> Option<Ordering> {
fn partial_cmp(&self, other: &[T; $N]) -> Option<Ordering> {
PartialOrd::partial_cmp(&self[], &other[])
}
#[inline]
fn lt(&self, other: &[T, ..$N]) -> bool {
fn lt(&self, other: &[T; $N]) -> bool {
PartialOrd::lt(&self[], &other[])
}
#[inline]
fn le(&self, other: &[T, ..$N]) -> bool {
fn le(&self, other: &[T; $N]) -> bool {
PartialOrd::le(&self[], &other[])
}
#[inline]
fn ge(&self, other: &[T, ..$N]) -> bool {
fn ge(&self, other: &[T; $N]) -> bool {
PartialOrd::ge(&self[], &other[])
}
#[inline]
fn gt(&self, other: &[T, ..$N]) -> bool {
fn gt(&self, other: &[T; $N]) -> bool {
PartialOrd::gt(&self[], &other[])
}
}
#[stable]
impl<T:Ord> Ord for [T, ..$N] {
impl<T:Ord> Ord for [T; $N] {
#[inline]
fn cmp(&self, other: &[T, ..$N]) -> Ordering {
fn cmp(&self, other: &[T; $N]) -> Ordering {
Ord::cmp(&self[], &other[])
}
}

View File

@ -100,7 +100,7 @@ macro_rules! impl_hash {
impl<S: Writer> Hash<S> for $ty {
#[inline]
fn hash(&self, state: &mut S) {
let a: [u8, ..::$ty::BYTES] = unsafe {
let a: [u8; ::$ty::BYTES] = unsafe {
mem::transmute((*self as $uty).to_le() as $ty)
};
state.write(a.as_slice())

View File

@ -1632,7 +1632,7 @@ pub mod types {
#[repr(C)]
#[deriving(Copy)] pub struct WSAPROTOCOLCHAIN {
pub ChainLen: c_int,
pub ChainEntries: [DWORD, ..MAX_PROTOCOL_CHAIN as uint],
pub ChainEntries: [DWORD; MAX_PROTOCOL_CHAIN as uint],
}
pub type LPWSAPROTOCOLCHAIN = *mut WSAPROTOCOLCHAIN;
@ -1658,7 +1658,7 @@ pub mod types {
pub iSecurityScheme: c_int,
pub dwMessageSize: DWORD,
pub dwProviderReserved: DWORD,
pub szProtocol: [u8, ..(WSAPROTOCOL_LEN as uint) + 1u],
pub szProtocol: [u8; (WSAPROTOCOL_LEN as uint) + 1u],
}
pub type LPWSAPROTOCOL_INFO = *mut WSAPROTOCOL_INFO;

View File

@ -31,14 +31,14 @@ const CHACHA_ROUNDS: uint = 20; // Cryptographically secure from 8 upwards as of
#[deriving(Copy)]
pub struct ChaChaRng {
buffer: [u32, ..STATE_WORDS], // Internal buffer of output
state: [u32, ..STATE_WORDS], // Initial state
buffer: [u32; STATE_WORDS], // Internal buffer of output
state: [u32; STATE_WORDS], // Initial state
index: uint, // Index into state
}
static EMPTY: ChaChaRng = ChaChaRng {
buffer: [0, ..STATE_WORDS],
state: [0, ..STATE_WORDS],
buffer: [0; STATE_WORDS],
state: [0; STATE_WORDS],
index: STATE_WORDS
};
@ -68,7 +68,7 @@ macro_rules! double_round{
}
#[inline]
fn core(output: &mut [u32, ..STATE_WORDS], input: &[u32, ..STATE_WORDS]) {
fn core(output: &mut [u32; STATE_WORDS], input: &[u32; STATE_WORDS]) {
*output = *input;
for _ in range(0, CHACHA_ROUNDS / 2) {
@ -86,7 +86,7 @@ impl ChaChaRng {
/// fixed key of 8 zero words.
pub fn new_unseeded() -> ChaChaRng {
let mut rng = EMPTY;
rng.init(&[0, ..KEY_WORDS]);
rng.init(&[0; KEY_WORDS]);
rng
}
@ -124,7 +124,7 @@ impl ChaChaRng {
/// ```
/// [1]: Daniel J. Bernstein. [*Extending the Salsa20
/// nonce.*](http://cr.yp.to/papers.html#xsalsa)
fn init(&mut self, key: &[u32, ..KEY_WORDS]) {
fn init(&mut self, key: &[u32; KEY_WORDS]) {
self.state[0] = 0x61707865;
self.state[1] = 0x3320646E;
self.state[2] = 0x79622D32;
@ -174,7 +174,7 @@ impl<'a> SeedableRng<&'a [u32]> for ChaChaRng {
fn reseed(&mut self, seed: &'a [u32]) {
// reset state
self.init(&[0u32, ..KEY_WORDS]);
self.init(&[0u32; KEY_WORDS]);
// set key in place
let key = self.state.slice_mut(4, 4+KEY_WORDS);
for (k, s) in key.iter_mut().zip(seed.iter()) {
@ -195,7 +195,7 @@ impl<'a> SeedableRng<&'a [u32]> for ChaChaRng {
impl Rand for ChaChaRng {
fn rand<R: Rng>(other: &mut R) -> ChaChaRng {
let mut key : [u32, ..KEY_WORDS] = [0, ..KEY_WORDS];
let mut key : [u32; KEY_WORDS] = [0; KEY_WORDS];
for word in key.iter_mut() {
*word = other.gen();
}

View File

@ -11,9 +11,9 @@
// Tables for distributions which are sampled using the ziggurat
// algorithm. Autogenerated by `ziggurat_tables.py`.
pub type ZigTable = &'static [f64, .. 257];
pub type ZigTable = &'static [f64; 257];
pub static ZIG_NORM_R: f64 = 3.654152885361008796;
pub static ZIG_NORM_X: [f64, .. 257] =
pub static ZIG_NORM_X: [f64; 257] =
[3.910757959537090045, 3.654152885361008796, 3.449278298560964462, 3.320244733839166074,
3.224575052047029100, 3.147889289517149969, 3.083526132001233044, 3.027837791768635434,
2.978603279880844834, 2.934366867207854224, 2.894121053612348060, 2.857138730872132548,
@ -79,7 +79,7 @@ pub static ZIG_NORM_X: [f64, .. 257] =
0.487443966121754335, 0.463634336771763245, 0.437518402186662658, 0.408389134588000746,
0.375121332850465727, 0.335737519180459465, 0.286174591747260509, 0.215241895913273806,
0.000000000000000000];
pub static ZIG_NORM_F: [f64, .. 257] =
pub static ZIG_NORM_F: [f64; 257] =
[0.000477467764586655, 0.001260285930498598, 0.002609072746106363, 0.004037972593371872,
0.005522403299264754, 0.007050875471392110, 0.008616582769422917, 0.010214971439731100,
0.011842757857943104, 0.013497450601780807, 0.015177088307982072, 0.016880083152595839,
@ -146,7 +146,7 @@ pub static ZIG_NORM_F: [f64, .. 257] =
0.932060075968990209, 0.945198953453078028, 0.959879091812415930, 0.977101701282731328,
1.000000000000000000];
pub static ZIG_EXP_R: f64 = 7.697117470131050077;
pub static ZIG_EXP_X: [f64, .. 257] =
pub static ZIG_EXP_X: [f64; 257] =
[8.697117470131052741, 7.697117470131050077, 6.941033629377212577, 6.478378493832569696,
6.144164665772472667, 5.882144315795399869, 5.666410167454033697, 5.482890627526062488,
5.323090505754398016, 5.181487281301500047, 5.054288489981304089, 4.938777085901250530,
@ -212,7 +212,7 @@ pub static ZIG_EXP_X: [f64, .. 257] =
0.253658363385912022, 0.233790483059674731, 0.212671510630966620, 0.189958689622431842,
0.165127622564187282, 0.137304980940012589, 0.104838507565818778, 0.063852163815001570,
0.000000000000000000];
pub static ZIG_EXP_F: [f64, .. 257] =
pub static ZIG_EXP_F: [f64; 257] =
[0.000167066692307963, 0.000454134353841497, 0.000967269282327174, 0.001536299780301573,
0.002145967743718907, 0.002788798793574076, 0.003460264777836904, 0.004157295120833797,
0.004877655983542396, 0.005619642207205489, 0.006381905937319183, 0.007163353183634991,

View File

@ -32,8 +32,8 @@ const RAND_SIZE_UINT: uint = 1 << (RAND_SIZE_LEN as uint);
#[deriving(Copy)]
pub struct IsaacRng {
cnt: u32,
rsl: [u32, ..RAND_SIZE_UINT],
mem: [u32, ..RAND_SIZE_UINT],
rsl: [u32; RAND_SIZE_UINT],
mem: [u32; RAND_SIZE_UINT],
a: u32,
b: u32,
c: u32
@ -41,8 +41,8 @@ pub struct IsaacRng {
static EMPTY: IsaacRng = IsaacRng {
cnt: 0,
rsl: [0, ..RAND_SIZE_UINT],
mem: [0, ..RAND_SIZE_UINT],
rsl: [0; RAND_SIZE_UINT],
mem: [0; RAND_SIZE_UINT],
a: 0, b: 0, c: 0
};
@ -267,8 +267,8 @@ const RAND_SIZE_64: uint = 1 << RAND_SIZE_64_LEN;
#[deriving(Copy)]
pub struct Isaac64Rng {
cnt: uint,
rsl: [u64, .. RAND_SIZE_64],
mem: [u64, .. RAND_SIZE_64],
rsl: [u64; RAND_SIZE_64],
mem: [u64; RAND_SIZE_64],
a: u64,
b: u64,
c: u64,
@ -276,8 +276,8 @@ pub struct Isaac64Rng {
static EMPTY_64: Isaac64Rng = Isaac64Rng {
cnt: 0,
rsl: [0, .. RAND_SIZE_64],
mem: [0, .. RAND_SIZE_64],
rsl: [0; RAND_SIZE_64],
mem: [0; RAND_SIZE_64],
a: 0, b: 0, c: 0,
};
@ -358,7 +358,7 @@ impl Isaac64Rng {
let mut a = self.a;
let mut b = self.b + self.c;
const MIDPOINT: uint = RAND_SIZE_64 / 2;
const MP_VEC: [(uint, uint), .. 2] = [(0,MIDPOINT), (MIDPOINT, 0)];
const MP_VEC: [(uint, uint); 2] = [(0,MIDPOINT), (MIDPOINT, 0)];
macro_rules! ind (
($x:expr) => {
*self.mem.get_unchecked(($x as uint >> 3) & (RAND_SIZE_64 - 1))

View File

@ -140,7 +140,7 @@ pub trait Rng {
/// ```rust
/// use std::rand::{thread_rng, Rng};
///
/// let mut v = [0u8, .. 13579];
/// let mut v = [0u8; 13579];
/// thread_rng().fill_bytes(&mut v);
/// println!("{}", v.as_slice());
/// ```
@ -429,9 +429,9 @@ impl Rng for XorShiftRng {
}
}
impl SeedableRng<[u32, .. 4]> for XorShiftRng {
impl SeedableRng<[u32; 4]> for XorShiftRng {
/// Reseed an XorShiftRng. This will panic if `seed` is entirely 0.
fn reseed(&mut self, seed: [u32, .. 4]) {
fn reseed(&mut self, seed: [u32; 4]) {
assert!(!seed.iter().all(|&x| x == 0),
"XorShiftRng.reseed called with an all zero seed.");
@ -442,7 +442,7 @@ impl SeedableRng<[u32, .. 4]> for XorShiftRng {
}
/// Create a new XorShiftRng. This will panic if `seed` is entirely 0.
fn from_seed(seed: [u32, .. 4]) -> XorShiftRng {
fn from_seed(seed: [u32; 4]) -> XorShiftRng {
assert!(!seed.iter().all(|&x| x == 0),
"XorShiftRng::from_seed called with an all zero seed.");

View File

@ -169,7 +169,7 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str,
chars: CharReader::new(input),
}.run(start, end);
type Captures = [Option<uint>, ..$num_cap_locs];
type Captures = [Option<uint>; $num_cap_locs];
struct Nfa<'t> {
which: MatchKind,
@ -250,8 +250,8 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str,
struct Threads {
which: MatchKind,
queue: [Thread, ..$num_insts],
sparse: [uint, ..$num_insts],
queue: [Thread; $num_insts],
sparse: [uint; $num_insts],
size: uint,
}

View File

@ -547,7 +547,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
// Small vector optimization. This should catch 100% of the cases that
// we care about.
if ixs.len() < 16 {
let mut small_vec = [ C_i32(self.ccx, 0), ..16 ];
let mut small_vec = [ C_i32(self.ccx, 0); 16 ];
for (small_vec_e, &ix) in small_vec.iter_mut().zip(ixs.iter()) {
*small_vec_e = C_i32(self.ccx, ix as i32);
}

View File

@ -63,7 +63,7 @@ pub const EXIT_MAX: uint = 2;
pub enum CleanupScopeKind<'blk, 'tcx: 'blk> {
CustomScopeKind,
AstScopeKind(ast::NodeId),
LoopScopeKind(ast::NodeId, [Block<'blk, 'tcx>, ..EXIT_MAX])
LoopScopeKind(ast::NodeId, [Block<'blk, 'tcx>; EXIT_MAX])
}
impl<'blk, 'tcx: 'blk> fmt::Show for CleanupScopeKind<'blk, 'tcx> {
@ -146,7 +146,7 @@ impl<'blk, 'tcx> CleanupMethods<'blk, 'tcx> for FunctionContext<'blk, 'tcx> {
fn push_loop_cleanup_scope(&self,
id: ast::NodeId,
exits: [Block<'blk, 'tcx>, ..EXIT_MAX]) {
exits: [Block<'blk, 'tcx>; EXIT_MAX]) {
debug!("push_loop_cleanup_scope({})",
self.ccx.tcx().map.node_to_string(id));
assert_eq!(Some(id), self.top_ast_scope());
@ -1058,7 +1058,7 @@ pub trait CleanupMethods<'blk, 'tcx> {
fn push_ast_cleanup_scope(&self, id: NodeInfo);
fn push_loop_cleanup_scope(&self,
id: ast::NodeId,
exits: [Block<'blk, 'tcx>, ..EXIT_MAX]);
exits: [Block<'blk, 'tcx>; EXIT_MAX]);
fn push_custom_cleanup_scope(&self) -> CustomScopeIndex;
fn push_custom_cleanup_scope_with_debug_loc(&self,
debug_loc: NodeInfo)

View File

@ -392,7 +392,7 @@ fn escape_str(writer: &mut io::Writer, v: &str) -> Result<(), io::IoError> {
}
fn escape_char(writer: &mut io::Writer, v: char) -> Result<(), io::IoError> {
let mut buf = [0, .. 4];
let mut buf = [0; 4];
let len = v.encode_utf8(&mut buf).unwrap();
escape_bytes(writer, buf[mut ..len])
}

View File

@ -454,7 +454,7 @@ unsafe fn with_c_str<T, F>(v: &[u8], checked: bool, f: F) -> T where
F: FnOnce(*const libc::c_char) -> T,
{
let c_str = if v.len() < BUF_LEN {
let mut buf: [u8, .. BUF_LEN] = mem::uninitialized();
let mut buf: [u8; BUF_LEN] = mem::uninitialized();
slice::bytes::copy_memory(&mut buf, v);
buf[v.len()] = 0;

View File

@ -882,7 +882,7 @@ mod test {
}
{
let mut read_stream = File::open_mode(filename, Open, Read);
let mut read_buf = [0, .. 1028];
let mut read_buf = [0; 1028];
let read_str = match check!(read_stream.read(&mut read_buf)) {
-1|0 => panic!("shouldn't happen"),
n => str::from_utf8(read_buf[..n]).unwrap().to_string()
@ -922,7 +922,7 @@ mod test {
#[test]
fn file_test_io_non_positional_read() {
let message: &str = "ten-four";
let mut read_mem = [0, .. 8];
let mut read_mem = [0; 8];
let tmpdir = tmpdir();
let filename = &tmpdir.join("file_rt_io_file_test_positional.txt");
{
@ -948,7 +948,7 @@ mod test {
#[test]
fn file_test_io_seek_and_tell_smoke_test() {
let message = "ten-four";
let mut read_mem = [0, .. 4];
let mut read_mem = [0; 4];
let set_cursor = 4 as u64;
let mut tell_pos_pre_read;
let mut tell_pos_post_read;
@ -978,7 +978,7 @@ mod test {
let overwrite_msg = "-the-bar!!";
let final_msg = "foo-the-bar!!";
let seek_idx = 3i;
let mut read_mem = [0, .. 13];
let mut read_mem = [0; 13];
let tmpdir = tmpdir();
let filename = &tmpdir.join("file_rt_io_file_test_seek_and_write.txt");
{
@ -1003,7 +1003,7 @@ mod test {
let chunk_one: &str = "qwer";
let chunk_two: &str = "asdf";
let chunk_three: &str = "zxcv";
let mut read_mem = [0, .. 4];
let mut read_mem = [0; 4];
let tmpdir = tmpdir();
let filename = &tmpdir.join("file_rt_io_file_test_seek_shakedown.txt");
{
@ -1105,7 +1105,7 @@ mod test {
check!(w.write(msg));
}
let files = check!(readdir(dir));
let mut mem = [0u8, .. 4];
let mut mem = [0u8; 4];
for f in files.iter() {
{
let n = f.filestem_str();
@ -1137,7 +1137,7 @@ mod test {
check!(File::create(&dir2.join("14")));
let mut files = check!(walk_dir(dir));
let mut cur = [0u8, .. 2];
let mut cur = [0u8; 2];
for f in files {
let stem = f.filestem_str().unwrap();
let root = stem.as_bytes()[0] - b'0';

View File

@ -725,9 +725,9 @@ mod test {
{
let mut rdr = MemReader::new(buf);
for _i in range(0u, 10) {
let mut buf = [0 as u8, .. 10];
let mut buf = [0 as u8; 10];
rdr.read(&mut buf).unwrap();
assert_eq!(buf.as_slice(), [5, .. 10].as_slice());
assert_eq!(buf.as_slice(), [5; 10].as_slice());
}
}
});
@ -740,10 +740,10 @@ mod test {
{
let mut wr = BufWriter::new(&mut buf);
for _i in range(0u, 10) {
wr.write(&[5, .. 10]).unwrap();
wr.write(&[5; 10]).unwrap();
}
}
assert_eq!(buf.as_slice(), [5, .. 100].as_slice());
assert_eq!(buf.as_slice(), [5; 100].as_slice());
});
}
@ -754,9 +754,9 @@ mod test {
{
let mut rdr = BufReader::new(&buf);
for _i in range(0u, 10) {
let mut buf = [0 as u8, .. 10];
let mut buf = [0 as u8; 10];
rdr.read(&mut buf).unwrap();
assert_eq!(buf, [5, .. 10]);
assert_eq!(buf, [5; 10]);
}
}
});

View File

@ -672,7 +672,7 @@ mod tests {
s.set_timeout(Some(20));
for i in range(0u, 1001) {
match s.write(&[0, .. 128 * 1024]) {
match s.write(&[0; 128 * 1024]) {
Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {},
Err(IoError { kind: TimedOut, .. }) => break,
Err(e) => panic!("{}", e),
@ -701,7 +701,7 @@ mod tests {
rx.recv();
let mut amt = 0;
while amt < 100 * 128 * 1024 {
match s.read(&mut [0, ..128 * 1024]) {
match s.read(&mut [0;128 * 1024]) {
Ok(n) => { amt += n; }
Err(e) => panic!("{}", e),
}
@ -716,7 +716,7 @@ mod tests {
tx.send(());
for _ in range(0u, 100) {
assert!(s.write(&[0, ..128 * 1024]).is_ok());
assert!(s.write(&[0;128 * 1024]).is_ok());
}
}
@ -735,7 +735,7 @@ mod tests {
let mut s = a.accept().unwrap();
s.set_write_timeout(Some(20));
for i in range(0u, 1001) {
match s.write(&[0, .. 128 * 1024]) {
match s.write(&[0; 128 * 1024]) {
Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {},
Err(IoError { kind: TimedOut, .. }) => break,
Err(e) => panic!("{}", e),

View File

@ -1256,7 +1256,7 @@ mod test {
s.set_timeout(Some(20));
for i in range(0i, 1001) {
match s.write(&[0, .. 128 * 1024]) {
match s.write(&[0; 128 * 1024]) {
Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {},
Err(IoError { kind: TimedOut, .. }) => break,
Err(e) => panic!("{}", e),
@ -1280,7 +1280,7 @@ mod test {
rx.recv();
let mut amt = 0;
while amt < 100 * 128 * 1024 {
match s.read(&mut [0, ..128 * 1024]) {
match s.read(&mut [0;128 * 1024]) {
Ok(n) => { amt += n; }
Err(e) => panic!("{}", e),
}
@ -1295,7 +1295,7 @@ mod test {
tx.send(());
for _ in range(0i, 100) {
assert!(s.write(&[0, ..128 * 1024]).is_ok());
assert!(s.write(&[0;128 * 1024]).is_ok());
}
}
@ -1314,7 +1314,7 @@ mod test {
let mut s = a.accept().unwrap();
s.set_write_timeout(Some(20));
for i in range(0i, 1001) {
match s.write(&[0, .. 128 * 1024]) {
match s.write(&[0; 128 * 1024]) {
Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {},
Err(IoError { kind: TimedOut, .. }) => break,
Err(e) => panic!("{}", e),

View File

@ -599,7 +599,7 @@ mod test {
a.set_write_timeout(Some(1000));
for _ in range(0u, 100) {
match a.send_to(&[0, ..4*1024], addr2) {
match a.send_to(&[0;4*1024], addr2) {
Ok(()) | Err(IoError { kind: ShortWrite(..), .. }) => {},
Err(IoError { kind: TimedOut, .. }) => break,
Err(e) => panic!("other error: {}", e),

View File

@ -235,7 +235,7 @@ impl<R: Reader, W: Writer> Reader for TeeReader<R, W> {
/// Copies all data from a `Reader` to a `Writer`.
pub fn copy<R: Reader, W: Writer>(r: &mut R, w: &mut W) -> io::IoResult<()> {
let mut buf = [0, ..super::DEFAULT_BUF_SIZE];
let mut buf = [0; super::DEFAULT_BUF_SIZE];
loop {
let len = match r.read(&mut buf) {
Ok(len) => len,

View File

@ -669,7 +669,7 @@ mod bench {
#[bench]
fn rand_shuffle_100(b: &mut Bencher) {
let mut rng = weak_rng();
let x : &mut[uint] = &mut [1,..100];
let x : &mut[uint] = &mut [1; 100];
b.iter(|| {
rng.shuffle(x);
})

View File

@ -217,12 +217,12 @@ mod imp {
impl Rng for OsRng {
fn next_u32(&mut self) -> u32 {
let mut v = [0u8, .. 4];
let mut v = [0u8; 4];
self.fill_bytes(&mut v);
unsafe { mem::transmute(v) }
}
fn next_u64(&mut self) -> u64 {
let mut v = [0u8, .. 8];
let mut v = [0u8; 8];
self.fill_bytes(&mut v);
unsafe { mem::transmute(v) }
}
@ -304,12 +304,12 @@ mod imp {
impl Rng for OsRng {
fn next_u32(&mut self) -> u32 {
let mut v = [0u8, .. 4];
let mut v = [0u8; 4];
self.fill_bytes(&mut v);
unsafe { mem::transmute(v) }
}
fn next_u64(&mut self) -> u64 {
let mut v = [0u8, .. 8];
let mut v = [0u8; 8];
self.fill_bytes(&mut v);
unsafe { mem::transmute(v) }
}
@ -351,7 +351,7 @@ mod test {
r.next_u32();
r.next_u64();
let mut v = [0u8, .. 1000];
let mut v = [0u8; 1000];
r.fill_bytes(&mut v);
}
@ -371,7 +371,7 @@ mod test {
// as possible (XXX: is this a good test?)
let mut r = OsRng::new().unwrap();
Thread::yield_now();
let mut v = [0u8, .. 1000];
let mut v = [0u8; 1000];
for _ in range(0u, 100) {
r.next_u32();

View File

@ -105,7 +105,7 @@ mod test {
#[test]
fn test_reader_rng_fill_bytes() {
let v = [1u8, 2, 3, 4, 5, 6, 7, 8];
let mut w = [0u8, .. 8];
let mut w = [0u8; 8];
let mut rng = ReaderRng::new(MemReader::new(v.as_slice().to_vec()));
rng.fill_bytes(&mut w);
@ -117,7 +117,7 @@ mod test {
#[should_fail]
fn test_reader_rng_insufficient_bytes() {
let mut rng = ReaderRng::new(MemReader::new(vec!()));
let mut v = [0u8, .. 3];
let mut v = [0u8; 3];
rng.fill_bytes(&mut v);
}
}

View File

@ -82,7 +82,7 @@ pub const unwinder_private_data_size: uint = 2;
pub struct _Unwind_Exception {
pub exception_class: _Unwind_Exception_Class,
pub exception_cleanup: _Unwind_Exception_Cleanup_Fn,
pub private: [_Unwind_Word, ..unwinder_private_data_size],
pub private: [_Unwind_Word; unwinder_private_data_size],
}
pub enum _Unwind_Context {}

View File

@ -83,7 +83,7 @@ pub type Callback = fn(msg: &(Any + Send), file: &'static str, line: uint);
//
// For more information, see below.
const MAX_CALLBACKS: uint = 16;
static CALLBACKS: [atomic::AtomicUint, ..MAX_CALLBACKS] =
static CALLBACKS: [atomic::AtomicUint; MAX_CALLBACKS] =
[atomic::INIT_ATOMIC_UINT, atomic::INIT_ATOMIC_UINT,
atomic::INIT_ATOMIC_UINT, atomic::INIT_ATOMIC_UINT,
atomic::INIT_ATOMIC_UINT, atomic::INIT_ATOMIC_UINT,
@ -168,7 +168,7 @@ fn rust_panic(cause: Box<Any + Send>) -> ! {
uwe: uw::_Unwind_Exception {
exception_class: rust_exception_class(),
exception_cleanup: exception_cleanup,
private: [0, ..uw::unwinder_private_data_size],
private: [0; uw::unwinder_private_data_size],
},
cause: Some(cause),
};

View File

@ -310,7 +310,7 @@ pub fn get_address_name(addr: IpAddr) -> Result<String, IoError> {
let mut storage: libc::sockaddr_storage = unsafe { mem::zeroed() };
let len = addr_to_sockaddr(addr, &mut storage);
let mut hostbuf = [0 as c_char, ..NI_MAXHOST];
let mut hostbuf = [0 as c_char; NI_MAXHOST];
let res = unsafe {
getnameinfo(&storage as *const _ as *const libc::sockaddr, len,

View File

@ -94,7 +94,7 @@ mod select {
#[repr(C)]
pub struct fd_set {
fds_bits: [i32, ..(FD_SETSIZE / 32)]
fds_bits: [i32; (FD_SETSIZE / 32)]
}
pub fn fd_set(set: &mut fd_set, fd: i32) {
@ -115,7 +115,7 @@ mod select {
#[repr(C)]
pub struct fd_set {
// FIXME: shouldn't this be a c_ulong?
fds_bits: [libc::uintptr_t, ..(FD_SETSIZE / uint::BITS)]
fds_bits: [libc::uintptr_t; (FD_SETSIZE / uint::BITS)]
}
pub fn fd_set(set: &mut fd_set, fd: i32) {

View File

@ -100,7 +100,7 @@ pub fn error_string(errno: i32) -> String {
}
}
let mut buf = [0 as c_char, ..TMPBUF_SZ];
let mut buf = [0 as c_char; TMPBUF_SZ];
let p = buf.as_mut_ptr();
unsafe {
@ -124,7 +124,7 @@ pub unsafe fn pipe() -> IoResult<(FileDesc, FileDesc)> {
pub fn getcwd() -> IoResult<Path> {
use c_str::CString;
let mut buf = [0 as c_char, ..BUF_BYTES];
let mut buf = [0 as c_char; BUF_BYTES];
unsafe {
if libc::getcwd(buf.as_mut_ptr(), buf.len() as libc::size_t).is_null() {
Err(IoError::last_error())

View File

@ -86,30 +86,30 @@ mod os {
#[repr(C)]
pub struct pthread_mutex_t {
__sig: libc::c_long,
__opaque: [u8, ..__PTHREAD_MUTEX_SIZE__],
__opaque: [u8; __PTHREAD_MUTEX_SIZE__],
}
#[repr(C)]
pub struct pthread_cond_t {
__sig: libc::c_long,
__opaque: [u8, ..__PTHREAD_COND_SIZE__],
__opaque: [u8; __PTHREAD_COND_SIZE__],
}
#[repr(C)]
pub struct pthread_rwlock_t {
__sig: libc::c_long,
__opaque: [u8, ..__PTHREAD_RWLOCK_SIZE__],
__opaque: [u8; __PTHREAD_RWLOCK_SIZE__],
}
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
__sig: _PTHREAD_MUTEX_SIG_INIT,
__opaque: [0, ..__PTHREAD_MUTEX_SIZE__],
__opaque: [0; __PTHREAD_MUTEX_SIZE__],
};
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
__sig: _PTHREAD_COND_SIG_INIT,
__opaque: [0, ..__PTHREAD_COND_SIZE__],
__opaque: [0; __PTHREAD_COND_SIZE__],
};
pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
__sig: _PTHREAD_RWLOCK_SIG_INIT,
__opaque: [0, ..__PTHREAD_RWLOCK_SIZE__],
__opaque: [0; __PTHREAD_RWLOCK_SIZE__],
};
}
@ -145,30 +145,30 @@ mod os {
#[repr(C)]
pub struct pthread_mutex_t {
__align: libc::c_longlong,
size: [u8, ..__SIZEOF_PTHREAD_MUTEX_T],
size: [u8; __SIZEOF_PTHREAD_MUTEX_T],
}
#[repr(C)]
pub struct pthread_cond_t {
__align: libc::c_longlong,
size: [u8, ..__SIZEOF_PTHREAD_COND_T],
size: [u8; __SIZEOF_PTHREAD_COND_T],
}
#[repr(C)]
pub struct pthread_rwlock_t {
__align: libc::c_longlong,
size: [u8, ..__SIZEOF_PTHREAD_RWLOCK_T],
size: [u8; __SIZEOF_PTHREAD_RWLOCK_T],
}
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
__align: 0,
size: [0, ..__SIZEOF_PTHREAD_MUTEX_T],
size: [0; __SIZEOF_PTHREAD_MUTEX_T],
};
pub const PTHREAD_COND_INITIALIZER: pthread_cond_t = pthread_cond_t {
__align: 0,
size: [0, ..__SIZEOF_PTHREAD_COND_T],
size: [0; __SIZEOF_PTHREAD_COND_T],
};
pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
__align: 0,
size: [0, ..__SIZEOF_PTHREAD_RWLOCK_T],
size: [0; __SIZEOF_PTHREAD_RWLOCK_T],
};
}
#[cfg(target_os = "android")]

View File

@ -83,7 +83,7 @@ struct SYMBOL_INFO {
// note that windows has this as 1, but it basically just means that
// the name is inline at the end of the struct. For us, we just bump
// the struct size up to MAX_SYM_NAME.
Name: [libc::c_char, ..MAX_SYM_NAME],
Name: [libc::c_char; MAX_SYM_NAME],
}
@ -162,7 +162,7 @@ mod arch {
EFlags: libc::DWORD,
Esp: libc::DWORD,
SegSs: libc::DWORD,
ExtendedRegisters: [u8, ..MAXIMUM_SUPPORTED_EXTENSION],
ExtendedRegisters: [u8; MAXIMUM_SUPPORTED_EXTENSION],
}
#[repr(C)]
@ -245,7 +245,7 @@ mod arch {
FltSave: FLOATING_SAVE_AREA,
VectorRegister: [M128A, .. 26],
VectorRegister: [M128A; 26],
VectorControl: DWORDLONG,
DebugControl: DWORDLONG,

View File

@ -43,8 +43,8 @@ pub const WSA_WAIT_FAILED: libc::DWORD = libc::consts::os::extra::WAIT_FAILED;
pub struct WSADATA {
pub wVersion: libc::WORD,
pub wHighVersion: libc::WORD,
pub szDescription: [u8, ..WSADESCRIPTION_LEN + 1],
pub szSystemStatus: [u8, ..WSASYS_STATUS_LEN + 1],
pub szDescription: [u8; WSADESCRIPTION_LEN + 1],
pub szSystemStatus: [u8; WSASYS_STATUS_LEN + 1],
pub iMaxSockets: u16,
pub iMaxUdpDg: u16,
pub lpVendorInfo: *mut u8,
@ -57,8 +57,8 @@ pub struct WSADATA {
pub iMaxSockets: u16,
pub iMaxUdpDg: u16,
pub lpVendorInfo: *mut u8,
pub szDescription: [u8, ..WSADESCRIPTION_LEN + 1],
pub szSystemStatus: [u8, ..WSASYS_STATUS_LEN + 1],
pub szDescription: [u8; WSADESCRIPTION_LEN + 1],
pub szSystemStatus: [u8; WSASYS_STATUS_LEN + 1],
}
pub type LPWSADATA = *mut WSADATA;
@ -66,7 +66,7 @@ pub type LPWSADATA = *mut WSADATA;
#[repr(C)]
pub struct WSANETWORKEVENTS {
pub lNetworkEvents: libc::c_long,
pub iErrorCode: [libc::c_int, ..FD_MAX_EVENTS],
pub iErrorCode: [libc::c_int; FD_MAX_EVENTS],
}
pub type LPWSANETWORKEVENTS = *mut WSANETWORKEVENTS;
@ -76,7 +76,7 @@ pub type WSAEVENT = libc::HANDLE;
#[repr(C)]
pub struct fd_set {
fd_count: libc::c_uint,
fd_array: [libc::SOCKET, ..FD_SETSIZE],
fd_array: [libc::SOCKET; FD_SETSIZE],
}
pub fn fd_set(set: &mut fd_set, s: libc::SOCKET) {

View File

@ -80,7 +80,7 @@ pub fn error_string(errnum: i32) -> String {
// MAKELANGID(LANG_SYSTEM_DEFAULT, SUBLANG_SYS_DEFAULT)
let langId = 0x0800 as DWORD;
let mut buf = [0 as WCHAR, ..TMPBUF_SZ];
let mut buf = [0 as WCHAR; TMPBUF_SZ];
unsafe {
let res = FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM |
@ -164,7 +164,7 @@ pub fn getcwd() -> IoResult<Path> {
use libc::GetCurrentDirectoryW;
use io::OtherIoError;
let mut buf = [0 as u16, ..BUF_BYTES];
let mut buf = [0 as u16; BUF_BYTES];
unsafe {
if libc::GetCurrentDirectoryW(buf.len() as DWORD, buf.as_mut_ptr()) == 0 as DWORD {
return Err(IoError::last_error());

View File

@ -90,7 +90,7 @@ pub struct EXCEPTION_RECORD {
pub ExceptionRecord: *mut EXCEPTION_RECORD,
pub ExceptionAddress: LPVOID,
pub NumberParameters: DWORD,
pub ExceptionInformation: [LPVOID, ..EXCEPTION_MAXIMUM_PARAMETERS]
pub ExceptionInformation: [LPVOID; EXCEPTION_MAXIMUM_PARAMETERS]
}
pub struct EXCEPTION_POINTERS {

View File

@ -119,6 +119,6 @@ pub fn expand_build_diagnostic_array<'cx>(ecx: &'cx mut ExtCtxt,
});
MacItems::new(vec![quote_item!(ecx,
pub static $name: [(&'static str, &'static str), ..$count] = $expr;
pub static $name: [(&'static str, &'static str); $count] = $expr;
).unwrap()].into_iter())
}

View File

@ -11,5 +11,5 @@
// Test that the old fixed length array syntax is a parsing error.
fn main() {
let _x: [int, ..3] = [0i, 1, 2]; //~ ERROR
let _x: [int, ..3] = [0i, 1, 2]; //~ ERROR
}

View File

@ -9,5 +9,5 @@
// except according to those terms.
fn main() {
let x: [int 3]; //~ ERROR expected one of `(`, `+`, `,`, `::`, `;`, or `]`, found `3`
let x: [int 3]; //~ ERROR expected one of `(`, `+`, `::`, `;`, or `]`, found `3`
}

View File

@ -13,13 +13,13 @@
#[cfg(target_word_size = "64")]
fn main() {
let n = 0u;
let a = box [&n,..0xF000000000000000u];
let a = box [&n; 0xF000000000000000u];
println!("{}", a[0xFFFFFFu]);
}
#[cfg(target_word_size = "32")]
fn main() {
let n = 0u;
let a = box [&n,..0xFFFFFFFFu];
let a = box [&n; 0xFFFFFFFFu];
println!("{}", a[0xFFFFFFu]);
}

View File

@ -11,5 +11,5 @@
// Trying to create a fixed-length vector with a negative size
fn main() {
let _x = [0,..-1]; //~ ERROR found negative integer
let _x = [0; -1]; //~ ERROR found negative integer
}

View File

@ -8,4 +8,4 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
type v = [int * 3]; //~ ERROR expected one of `(`, `+`, `,`, `::`, `;`, or `]`, found `*`
type v = [int * 3]; //~ ERROR expected one of `(`, `+`, `::`, `;`, or `]`, found `*`

View File

@ -10,4 +10,4 @@
type v = [mut int];
//~^ ERROR expected identifier, found keyword `mut`
//~^^ ERROR expected one of `(`, `+`, `,`, `::`, `;`, or `]`, found `int`
//~^^ ERROR expected one of `(`, `+`, `::`, `;`, or `]`, found `int`

View File

@ -20,29 +20,29 @@ pub fn bar() {
const FOO: uint = 5u - 4u;
let _: [(); FOO] = [()];
let _ : [(), ..1u] = [()];
let _ : [(); 1u] = [()];
let _ = &([1i,2,3]) as *const _ as *const [int, ..3u];
let _ = &([1i,2,3]) as *const _ as *const [int; 3u];
format!("test");
}
pub type Foo = [int, ..3u];
pub type Foo = [int; 3u];
pub struct Bar {
pub x: [int, ..3u]
pub x: [int; 3u]
}
pub struct TupleBar([int, ..4u]);
pub struct TupleBar([int; 4u]);
pub enum Baz {
BazVariant([int, ..5u])
BazVariant([int; 5u])
}
pub fn id<T>(x: T) -> T { x }
pub fn use_id() {
let _ = id::<[int, ..3u]>([1,2,3]);
let _ = id::<[int; 3u]>([1,2,3]);
}

View File

@ -9,7 +9,7 @@
// except according to those terms.
pub fn main() {
let x = [1i,..100];
let x = [1i; 100];
let mut y = 0i;
for i in x.iter() {
if y > 10 {

View File

@ -9,7 +9,7 @@
// except according to those terms.
pub fn main() {
let x = [1i,..100];
let x = [1i; 100];
let mut y = 0i;
for (n,i) in x.iter().enumerate() {
if n < 10 {

View File

@ -9,8 +9,8 @@
// except according to those terms.
pub fn main() {
let x = [1i,..100];
let y = [2i,..100];
let x = [1i; 100];
let y = [2i; 100];
let mut p = 0i;
let mut q = 0i;
for i in x.iter() {

View File

@ -9,7 +9,7 @@
// except according to those terms.
pub fn main() {
let x = [1i,..100];
let x = [1i; 100];
let mut y = 0i;
for i in x.iter() {
y += *i

View File

@ -13,6 +13,6 @@
pub fn main() {
unsafe {
::std::mem::transmute::<[int,..1],int>([1])
::std::mem::transmute::<[int; 1],int>([1])
};
}