Skip to content

Commit 0d76fb0

Browse files
committed
librustc: Remove all uses of the old [T * N] fixed-length vector syntax
1 parent 0ffb6be commit 0d76fb0

29 files changed

+63
-61
lines changed

src/libcore/cleanup.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ struct MemoryRegion { priv opaque: () }
3838
#[cfg(target_arch="x86")]
3939
#[cfg(target_arch="arm")]
4040
struct Registers {
41-
data: [u32 * 16]
41+
data: [u32, ..16]
4242
}
4343

4444
#[cfg(target_arch="mips")]
4545
struct Registers {
46-
data: [u32 * 32]
46+
data: [u32, ..32]
4747
}
4848

4949
#[cfg(target_arch="x86")]
@@ -52,12 +52,12 @@ struct Registers {
5252
struct Context {
5353
regs: Registers,
5454
next: *Context,
55-
pad: [u32 * 3]
55+
pad: [u32, ..3]
5656
}
5757

5858
#[cfg(target_arch="x86_64")]
5959
struct Registers {
60-
data: [u64 * 22]
60+
data: [u64, ..22]
6161
}
6262

6363
#[cfg(target_arch="x86_64")]
@@ -80,7 +80,7 @@ struct Task {
8080
// Public fields
8181
refcount: intptr_t, // 0
8282
id: TaskID, // 4
83-
pad: [u32 * 2], // 8
83+
pad: [u32, ..2], // 8
8484
ctx: Context, // 16
8585
stack_segment: *StackSegment, // 96
8686
runtime_sp: uintptr_t, // 100

src/libcore/hash.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ struct SipState {
162162
mut v1: u64,
163163
mut v2: u64,
164164
mut v3: u64,
165-
mut tail: [u8 * 8], // unprocessed bytes
165+
mut tail: [u8, ..8], // unprocessed bytes
166166
mut ntail: uint, // how many bytes in tail are valid
167167
}
168168

@@ -369,7 +369,7 @@ impl Streaming for SipState {
369369

370370
#[test]
371371
pub fn test_siphash() {
372-
let vecs : [[u8 * 8] * 64] = [
372+
let vecs : [[u8, ..8], ..64] = [
373373
[ 0x31, 0x0e, 0x0e, 0xdd, 0x47, 0xdb, 0x6f, 0x72, ],
374374
[ 0xfd, 0x67, 0xdc, 0x93, 0xc5, 0x39, 0xf8, 0x74, ],
375375
[ 0x5a, 0x4f, 0xa9, 0xd9, 0x09, 0x80, 0x6c, 0x0d, ],
@@ -443,7 +443,7 @@ pub fn test_siphash() {
443443
let stream_inc = &State(k0,k1);
444444
let stream_full = &State(k0,k1);
445445

446-
fn to_hex_str(r: &[u8 * 8]) -> ~str {
446+
fn to_hex_str(r: &[u8, ..8]) -> ~str {
447447
let mut s = ~"";
448448
for vec::each(*r) |b| {
449449
s += uint::to_str_radix(*b as uint, 16u);

src/libcore/libc.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ pub mod types {
342342
st_mtime_nsec: c_long,
343343
st_ctime: time_t,
344344
st_ctime_nsec: c_long,
345-
__unused: [c_long * 3],
345+
__unused: [c_long, ..3],
346346
}
347347
}
348348
pub mod posix08 {
@@ -430,7 +430,7 @@ pub mod types {
430430
st_lspare: int32_t,
431431
st_birthtime: time_t,
432432
st_birthtime_nsec: c_long,
433-
__unused: [uint8_t * 2],
433+
__unused: [uint8_t, ..2],
434434
}
435435
}
436436
pub mod posix08 {
@@ -631,7 +631,7 @@ pub mod types {
631631
st_flags: uint32_t,
632632
st_gen: uint32_t,
633633
st_lspare: int32_t,
634-
st_qspare: [int64_t * 2],
634+
st_qspare: [int64_t, ..2],
635635
}
636636
}
637637
pub mod posix08 {
@@ -712,7 +712,7 @@ pub mod types {
712712
st_flags: uint32_t,
713713
st_gen: uint32_t,
714714
st_lspare: int32_t,
715-
st_qspare: [int64_t * 2],
715+
st_qspare: [int64_t, ..2],
716716
}
717717
}
718718
pub mod posix08 {

src/libcore/rt/context.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ fn initialize_call_frame(regs: &mut Registers,
102102
}
103103

104104
#[cfg(target_arch = "x86_64")]
105-
type Registers = [uint * 22];
105+
type Registers = [uint, ..22];
106106

107107
#[cfg(target_arch = "x86_64")]
108108
fn new_regs() -> ~Registers { ~[0, .. 22] }
@@ -137,7 +137,7 @@ fn initialize_call_frame(regs: &mut Registers,
137137
}
138138

139139
#[cfg(target_arch = "arm")]
140-
type Registers = [uint * 32];
140+
type Registers = [uint, ..32];
141141

142142
#[cfg(target_arch = "arm")]
143143
fn new_regs() -> ~Registers { ~[0, .. 32] }
@@ -156,7 +156,7 @@ fn initialize_call_frame(regs: &mut Registers,
156156
}
157157

158158
#[cfg(target_arch = "mips")]
159-
type Registers = [uint * 32];
159+
type Registers = [uint, ..32];
160160

161161
#[cfg(target_arch = "mips")]
162162
fn new_regs() -> ~Registers { ~[0, .. 32] }

src/libcore/str.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1921,12 +1921,12 @@ static max_five_b: uint = 67108864u;
19211921
static tag_six_b: uint = 252u;
19221922

19231923
// Constants used for converting strs to floats
1924-
pub static inf_buf: [u8*3] = ['i' as u8, 'n' as u8, 'f' as u8];
1925-
pub static positive_inf_buf: [u8*4] = ['+' as u8, 'i' as u8,
1926-
'n' as u8, 'f' as u8];
1927-
pub static negative_inf_buf: [u8*4] = ['-' as u8, 'i' as u8,
1928-
'n' as u8, 'f' as u8];
1929-
pub static nan_buf: [u8*3] = ['N' as u8, 'a' as u8, 'N' as u8];
1924+
pub static inf_buf: [u8, ..3] = ['i' as u8, 'n' as u8, 'f' as u8];
1925+
pub static positive_inf_buf: [u8, ..4] = ['+' as u8, 'i' as u8,
1926+
'n' as u8, 'f' as u8];
1927+
pub static negative_inf_buf: [u8, ..4] = ['-' as u8, 'i' as u8,
1928+
'n' as u8, 'f' as u8];
1929+
pub static nan_buf: [u8, ..3] = ['N' as u8, 'a' as u8, 'N' as u8];
19301930

19311931
/**
19321932
* Work with the byte buffer of a string.

src/libcore/sys.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ pub mod tests {
194194

195195
#[test]
196196
pub fn nonzero_size_of_basic() {
197-
type Z = [i8 * 0];
197+
type Z = [i8, ..0];
198198
fail_unless!(size_of::<Z>() == 0u);
199199
fail_unless!(nonzero_size_of::<Z>() == 1u);
200200
fail_unless!(nonzero_size_of::<uint>() == size_of::<uint>());

src/libcore/trie.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,9 @@ impl TrieSet {
215215

216216
struct TrieNode<T> {
217217
count: uint,
218-
children: [Child<T> * 16] // FIXME: #3469: can't use the SIZE constant yet
218+
219+
// FIXME: #3469: can't use the SIZE constant yet
220+
children: [Child<T>, ..16]
219221
}
220222

221223
impl<T> TrieNode<T> {

src/libcore/vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2642,7 +2642,7 @@ mod tests {
26422642

26432643
#[test]
26442644
fn test_len_divzero() {
2645-
type Z = [i8 * 0];
2645+
type Z = [i8, ..0];
26462646
let v0 : &[Z] = &[];
26472647
let v1 : &[Z] = &[[]];
26482648
let v2 : &[Z] = &[[], []];

src/librustc/middle/typeck/infer/region_inference.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,11 +1187,11 @@ struct GraphNode {
11871187
span: span,
11881188
classification: Classification,
11891189
value: GraphNodeValue,
1190-
head_edge: [uint * 2],
1190+
head_edge: [uint, ..2],
11911191
}
11921192

11931193
struct GraphEdge {
1194-
next_edge: [uint * 2],
1194+
next_edge: [uint, ..2],
11951195
constraint: Constraint,
11961196
span: span,
11971197
}

src/libstd/flatpipes.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ pub trait ByteChan {
254254
fn send(&self, val: ~[u8]);
255255
}
256256

257-
static CONTINUE: [u8 * 4] = [0xAA, 0xBB, 0xCC, 0xDD];
257+
static CONTINUE: [u8, ..4] = [0xAA, 0xBB, 0xCC, 0xDD];
258258

259259
impl<T,U:Unflattener<T>,P:BytePort> GenericPort<T> for FlatPort<T, U, P> {
260260
fn recv(&self) -> T {
@@ -921,7 +921,7 @@ mod test {
921921
}
922922

923923
fn test_try_recv_none3<P:BytePort>(loader: PortLoader<P>) {
924-
static CONTINUE: [u8 * 4] = [0xAA, 0xBB, 0xCC, 0xDD];
924+
static CONTINUE: [u8, ..4] = [0xAA, 0xBB, 0xCC, 0xDD];
925925
// The control word is followed by garbage
926926
let bytes = CONTINUE.to_vec() + ~[0];
927927
let port = loader(bytes);
@@ -940,7 +940,7 @@ mod test {
940940

941941
fn test_try_recv_none4<P:BytePort>(+loader: PortLoader<P>) {
942942
fail_unless!(do task::try || {
943-
static CONTINUE: [u8 * 4] = [0xAA, 0xBB, 0xCC, 0xDD];
943+
static CONTINUE: [u8, ..4] = [0xAA, 0xBB, 0xCC, 0xDD];
944944
// The control word is followed by a valid length,
945945
// then undeserializable garbage
946946
let len_bytes = do io::u64_to_be_bytes(

0 commit comments

Comments
 (0)