librustc: Remove all uses of the old [T * N]
fixed-length vector syntax
This commit is contained in:
parent
46d4cc12d1
commit
142dbd65da
@ -38,12 +38,12 @@ struct MemoryRegion { priv opaque: () }
|
||||
#[cfg(target_arch="x86")]
|
||||
#[cfg(target_arch="arm")]
|
||||
struct Registers {
|
||||
data: [u32 * 16]
|
||||
data: [u32, ..16]
|
||||
}
|
||||
|
||||
#[cfg(target_arch="mips")]
|
||||
struct Registers {
|
||||
data: [u32 * 32]
|
||||
data: [u32, ..32]
|
||||
}
|
||||
|
||||
#[cfg(target_arch="x86")]
|
||||
@ -52,12 +52,12 @@ struct Registers {
|
||||
struct Context {
|
||||
regs: Registers,
|
||||
next: *Context,
|
||||
pad: [u32 * 3]
|
||||
pad: [u32, ..3]
|
||||
}
|
||||
|
||||
#[cfg(target_arch="x86_64")]
|
||||
struct Registers {
|
||||
data: [u64 * 22]
|
||||
data: [u64, ..22]
|
||||
}
|
||||
|
||||
#[cfg(target_arch="x86_64")]
|
||||
@ -80,7 +80,7 @@ struct Task {
|
||||
// Public fields
|
||||
refcount: intptr_t, // 0
|
||||
id: TaskID, // 4
|
||||
pad: [u32 * 2], // 8
|
||||
pad: [u32, ..2], // 8
|
||||
ctx: Context, // 16
|
||||
stack_segment: *StackSegment, // 96
|
||||
runtime_sp: uintptr_t, // 100
|
||||
|
@ -162,7 +162,7 @@ struct SipState {
|
||||
mut v1: u64,
|
||||
mut v2: u64,
|
||||
mut v3: u64,
|
||||
mut tail: [u8 * 8], // unprocessed bytes
|
||||
mut tail: [u8, ..8], // unprocessed bytes
|
||||
mut ntail: uint, // how many bytes in tail are valid
|
||||
}
|
||||
|
||||
@ -369,7 +369,7 @@ fn reset(&self) {
|
||||
|
||||
#[test]
|
||||
pub fn test_siphash() {
|
||||
let vecs : [[u8 * 8] * 64] = [
|
||||
let vecs : [[u8, ..8], ..64] = [
|
||||
[ 0x31, 0x0e, 0x0e, 0xdd, 0x47, 0xdb, 0x6f, 0x72, ],
|
||||
[ 0xfd, 0x67, 0xdc, 0x93, 0xc5, 0x39, 0xf8, 0x74, ],
|
||||
[ 0x5a, 0x4f, 0xa9, 0xd9, 0x09, 0x80, 0x6c, 0x0d, ],
|
||||
@ -443,7 +443,7 @@ pub fn test_siphash() {
|
||||
let stream_inc = &State(k0,k1);
|
||||
let stream_full = &State(k0,k1);
|
||||
|
||||
fn to_hex_str(r: &[u8 * 8]) -> ~str {
|
||||
fn to_hex_str(r: &[u8, ..8]) -> ~str {
|
||||
let mut s = ~"";
|
||||
for vec::each(*r) |b| {
|
||||
s += uint::to_str_radix(*b as uint, 16u);
|
||||
|
@ -342,7 +342,7 @@ pub struct stat {
|
||||
st_mtime_nsec: c_long,
|
||||
st_ctime: time_t,
|
||||
st_ctime_nsec: c_long,
|
||||
__unused: [c_long * 3],
|
||||
__unused: [c_long, ..3],
|
||||
}
|
||||
}
|
||||
pub mod posix08 {
|
||||
@ -430,7 +430,7 @@ pub struct stat {
|
||||
st_lspare: int32_t,
|
||||
st_birthtime: time_t,
|
||||
st_birthtime_nsec: c_long,
|
||||
__unused: [uint8_t * 2],
|
||||
__unused: [uint8_t, ..2],
|
||||
}
|
||||
}
|
||||
pub mod posix08 {
|
||||
@ -631,7 +631,7 @@ pub struct stat {
|
||||
st_flags: uint32_t,
|
||||
st_gen: uint32_t,
|
||||
st_lspare: int32_t,
|
||||
st_qspare: [int64_t * 2],
|
||||
st_qspare: [int64_t, ..2],
|
||||
}
|
||||
}
|
||||
pub mod posix08 {
|
||||
@ -712,7 +712,7 @@ pub struct stat {
|
||||
st_flags: uint32_t,
|
||||
st_gen: uint32_t,
|
||||
st_lspare: int32_t,
|
||||
st_qspare: [int64_t * 2],
|
||||
st_qspare: [int64_t, ..2],
|
||||
}
|
||||
}
|
||||
pub mod posix08 {
|
||||
|
@ -132,10 +132,12 @@ impl NumStrConv for $t {
|
||||
|
||||
|
||||
// Special value strings as [u8] consts.
|
||||
static inf_buf: [u8*3] = ['i' as u8, 'n' as u8, 'f' as u8];
|
||||
static positive_inf_buf: [u8*4] = ['+' as u8, 'i' as u8, 'n' as u8, 'f' as u8];
|
||||
static negative_inf_buf: [u8*4] = ['-' as u8, 'i' as u8, 'n' as u8, 'f' as u8];
|
||||
static nan_buf: [u8*3] = ['N' as u8, 'a' as u8, 'N' as u8];
|
||||
static inf_buf: [u8, ..3] = ['i' as u8, 'n' as u8, 'f' as u8];
|
||||
static positive_inf_buf: [u8, ..4] = ['+' as u8, 'i' as u8, 'n' as u8,
|
||||
'f' as u8];
|
||||
static negative_inf_buf: [u8, ..4] = ['-' as u8, 'i' as u8, 'n' as u8,
|
||||
'f' as u8];
|
||||
static nan_buf: [u8, ..3] = ['N' as u8, 'a' as u8, 'N' as u8];
|
||||
|
||||
/**
|
||||
* Converts a number to its string representation as a byte vector.
|
||||
|
@ -123,7 +123,7 @@ fn initialize_call_frame(regs: &mut Registers, fptr: *c_void, arg: *c_void, sp:
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
type Registers = [uint * 22];
|
||||
type Registers = [uint, ..22];
|
||||
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
fn new_regs() -> ~Registers { ~[0, .. 22] }
|
||||
@ -157,7 +157,7 @@ fn initialize_call_frame(regs: &mut Registers, fptr: *c_void, arg: *c_void, sp:
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "arm")]
|
||||
type Registers = [uint * 32];
|
||||
type Registers = [uint, ..32];
|
||||
|
||||
#[cfg(target_arch = "arm")]
|
||||
fn new_regs() -> ~Registers { ~[0, .. 32] }
|
||||
@ -175,7 +175,7 @@ fn initialize_call_frame(regs: &mut Registers, fptr: *c_void, arg: *c_void, sp:
|
||||
}
|
||||
|
||||
#[cfg(target_arch = "mips")]
|
||||
type Registers = [uint * 32];
|
||||
type Registers = [uint, ..32];
|
||||
|
||||
#[cfg(target_arch = "mips")]
|
||||
fn new_regs() -> ~Registers { ~[0, .. 32] }
|
||||
|
@ -194,7 +194,7 @@ pub fn size_of_64() {
|
||||
|
||||
#[test]
|
||||
pub fn nonzero_size_of_basic() {
|
||||
type Z = [i8 * 0];
|
||||
type Z = [i8, ..0];
|
||||
fail_unless!(size_of::<Z>() == 0u);
|
||||
fail_unless!(nonzero_size_of::<Z>() == 1u);
|
||||
fail_unless!(nonzero_size_of::<uint>() == size_of::<uint>());
|
||||
|
@ -223,7 +223,7 @@ fn remove(&mut self, value: &uint) -> bool { self.map.remove(value) }
|
||||
|
||||
struct TrieNode<T> {
|
||||
count: uint,
|
||||
children: [Child<T> * SIZE]
|
||||
children: [Child<T>, ..SIZE]
|
||||
}
|
||||
|
||||
impl<T> TrieNode<T> {
|
||||
|
@ -2636,7 +2636,7 @@ fn test_is_empty() {
|
||||
|
||||
#[test]
|
||||
fn test_len_divzero() {
|
||||
type Z = [i8 * 0];
|
||||
type Z = [i8, ..0];
|
||||
let v0 : &[Z] = &[];
|
||||
let v1 : &[Z] = &[[]];
|
||||
let v2 : &[Z] = &[[], []];
|
||||
|
@ -1201,11 +1201,11 @@ struct GraphNode {
|
||||
span: span,
|
||||
classification: Classification,
|
||||
value: GraphNodeValue,
|
||||
head_edge: [uint * 2],
|
||||
head_edge: [uint, ..2],
|
||||
}
|
||||
|
||||
struct GraphEdge {
|
||||
next_edge: [uint * 2],
|
||||
next_edge: [uint, ..2],
|
||||
constraint: Constraint,
|
||||
span: span,
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ pub trait ByteChan {
|
||||
fn send(&self, val: ~[u8]);
|
||||
}
|
||||
|
||||
static CONTINUE: [u8 * 4] = [0xAA, 0xBB, 0xCC, 0xDD];
|
||||
static CONTINUE: [u8, ..4] = [0xAA, 0xBB, 0xCC, 0xDD];
|
||||
|
||||
impl<T,U:Unflattener<T>,P:BytePort> GenericPort<T> for FlatPort<T, U, P> {
|
||||
fn recv(&self) -> T {
|
||||
@ -921,7 +921,7 @@ fn test_try_recv_none2_pipe() {
|
||||
}
|
||||
|
||||
fn test_try_recv_none3<P:BytePort>(loader: PortLoader<P>) {
|
||||
static CONTINUE: [u8 * 4] = [0xAA, 0xBB, 0xCC, 0xDD];
|
||||
static CONTINUE: [u8, ..4] = [0xAA, 0xBB, 0xCC, 0xDD];
|
||||
// The control word is followed by garbage
|
||||
let bytes = CONTINUE.to_vec() + ~[0];
|
||||
let port = loader(bytes);
|
||||
@ -940,7 +940,7 @@ fn test_try_recv_none3_pipe() {
|
||||
|
||||
fn test_try_recv_none4<P:BytePort>(+loader: PortLoader<P>) {
|
||||
fail_unless!(do task::try || {
|
||||
static CONTINUE: [u8 * 4] = [0xAA, 0xBB, 0xCC, 0xDD];
|
||||
static CONTINUE: [u8, ..4] = [0xAA, 0xBB, 0xCC, 0xDD];
|
||||
// The control word is followed by a valid length,
|
||||
// then undeserializable garbage
|
||||
let len_bytes = do io::u64_to_be_bytes(
|
||||
|
@ -251,7 +251,7 @@ pub struct Parser {
|
||||
token: @mut token::Token,
|
||||
span: @mut span,
|
||||
last_span: @mut span,
|
||||
buffer: @mut [TokenAndSpan * 4],
|
||||
buffer: @mut [TokenAndSpan, ..4],
|
||||
buffer_start: @mut int,
|
||||
buffer_end: @mut int,
|
||||
tokens_consumed: @mut uint,
|
||||
|
@ -24,8 +24,8 @@ fn gradient(orig: Vec2, grad: Vec2, p: Vec2) -> f32 {
|
||||
}
|
||||
|
||||
struct Noise2DContext {
|
||||
rgradients: [Vec2 * 256],
|
||||
permutations: [int * 256],
|
||||
rgradients: [Vec2, ..256],
|
||||
permutations: [int, ..256],
|
||||
}
|
||||
|
||||
fn Noise2DContext() -> ~Noise2DContext {
|
||||
@ -50,7 +50,7 @@ fn get_gradient(&self, x: int, y: int) -> Vec2 {
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn get_gradients(&self, gradients: &mut [Vec2 * 4], origins: &mut [Vec2 * 4], x: f32, y: f32) {
|
||||
fn get_gradients(&self, gradients: &mut [Vec2, ..4], origins: &mut [Vec2, ..4], x: f32, y: f32) {
|
||||
let x0f = f32::floor(x);
|
||||
let y0f = f32::floor(y);
|
||||
let x0 = x0f as int;
|
||||
|
@ -44,7 +44,7 @@ pub fn new(g: grid) -> Sudoku {
|
||||
return Sudoku { grid: g }
|
||||
}
|
||||
|
||||
pub fn from_vec(vec: &[[u8 * 9] * 9]) -> Sudoku {
|
||||
pub fn from_vec(vec: &[[u8, ..9], ..9]) -> Sudoku {
|
||||
let mut g = do vec::from_fn(9u) |i| {
|
||||
do vec::from_fn(9u) |j| { vec[i][j] }
|
||||
};
|
||||
@ -183,7 +183,7 @@ fn remove(&mut self, color: u8) {
|
||||
}
|
||||
}
|
||||
|
||||
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],
|
||||
@ -197,7 +197,7 @@ fn remove(&mut self, color: u8) {
|
||||
];
|
||||
|
||||
#[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],
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
static a: [u8 * 3] = ['h' as u8, 'i' as u8, 0 as u8];
|
||||
static a: [u8, ..3] = ['h' as u8, 'i' as u8, 0 as u8];
|
||||
static b: *i8 = &a as *i8; //~ ERROR mismatched types
|
||||
|
||||
fn main() {
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
fn wants_box(x: @[uint]) { }
|
||||
fn wants_uniq(x: ~[uint]) { }
|
||||
fn wants_three(x: [uint * 3]) { }
|
||||
fn wants_three(x: [uint, ..3]) { }
|
||||
|
||||
fn has_box(x: @[uint]) {
|
||||
wants_box(x);
|
||||
@ -24,13 +24,13 @@ fn has_uniq(x: ~[uint]) {
|
||||
wants_three(x); //~ ERROR [] storage differs: expected 3 but found ~
|
||||
}
|
||||
|
||||
fn has_three(x: [uint * 3]) {
|
||||
fn has_three(x: [uint, ..3]) {
|
||||
wants_box(x); //~ ERROR [] storage differs: expected @ but found 3
|
||||
wants_uniq(x); //~ ERROR [] storage differs: expected ~ but found 3
|
||||
wants_three(x);
|
||||
}
|
||||
|
||||
fn has_four(x: [uint * 4]) {
|
||||
fn has_four(x: [uint, ..4]) {
|
||||
wants_box(x); //~ ERROR [] storage differs: expected @ but found 4
|
||||
wants_uniq(x); //~ ERROR [] storage differs: expected ~ but found 4
|
||||
wants_three(x); //~ ERROR [] storage differs: expected 3 but found 4
|
||||
|
@ -1,6 +1,6 @@
|
||||
fn bar(int_param: int) {}
|
||||
|
||||
fn main() {
|
||||
let foo: [u8 * 4] = [1u8, ..4u8];
|
||||
let foo: [u8, ..4] = [1u8, ..4u8];
|
||||
bar(foo); //~ ERROR mismatched types: expected `int` but found `[u8 * 4]` (expected int but found vector)
|
||||
}
|
||||
|
@ -8,9 +8,9 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
static A: [u8 * 1] = ['h' as u8];
|
||||
static A: [u8, ..1] = ['h' as u8];
|
||||
static B: u8 = (&A)[0];
|
||||
static C: &'static &'static &'static &'static [u8 * 1] = & & & &A;
|
||||
static C: &'static &'static &'static &'static [u8, ..1] = & & & &A;
|
||||
static D: u8 = (&C)[0];
|
||||
|
||||
pub fn main() {
|
||||
|
@ -9,7 +9,7 @@
|
||||
// except according to those terms.
|
||||
|
||||
enum E { V1(int), V0 }
|
||||
static C: [E * 3] = [V0, V1(0xDEADBEE), V0];
|
||||
static C: [E, ..3] = [V0, V1(0xDEADBEE), V0];
|
||||
|
||||
pub fn main() {
|
||||
match C[1] {
|
||||
|
@ -14,6 +14,6 @@
|
||||
fn main() {
|
||||
|
||||
static FOO: int = 2;
|
||||
let _v: [int * FOO*3];
|
||||
let _v: [int, ..FOO*3];
|
||||
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
static x : [int * 4] = [1,2,3,4];
|
||||
static x : [int, ..4] = [1,2,3,4];
|
||||
static p : int = x[2];
|
||||
static y : &'static [int] = &[1,2,3,4];
|
||||
static q : int = y[2];
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
type Big = [u64 * 8];
|
||||
type Big = [u64, ..8];
|
||||
struct Pair { a: int, b: &'self Big }
|
||||
static x: &'static Big = &([13, 14, 10, 13, 11, 14, 14, 15]);
|
||||
static y: &'static Pair<'static> = &Pair {a: 15, b: x};
|
||||
|
@ -8,8 +8,8 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
static a: [u8 * 3] = ['h' as u8, 'i' as u8, 0 as u8];
|
||||
static c: &'static [u8 * 3] = &a;
|
||||
static a: [u8, ..3] = ['h' as u8, 'i' as u8, 0 as u8];
|
||||
static c: &'static [u8, ..3] = &a;
|
||||
static b: *u8 = c as *u8;
|
||||
|
||||
fn main() {
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
static x : [int * 4] = [1,2,3,4];
|
||||
static x : [int, ..4] = [1,2,3,4];
|
||||
static y : &'static [int] = &[1,2,3,4];
|
||||
|
||||
pub fn main() {
|
||||
|
@ -9,8 +9,8 @@
|
||||
// except according to those terms.
|
||||
|
||||
pub fn main() {
|
||||
let x : [@int * 5] = [@1,@2,@3,@4,@5];
|
||||
let _y : [@int * 5] = [@1,@2,@3,@4,@5];
|
||||
let x : [@int, ..5] = [@1,@2,@3,@4,@5];
|
||||
let _y : [@int, ..5] = [@1,@2,@3,@4,@5];
|
||||
let mut z = [@1,@2,@3,@4,@5];
|
||||
z = x;
|
||||
fail_unless!(*z[0] == 1);
|
||||
|
@ -14,16 +14,16 @@
|
||||
// Doesn't work; needs a design decision.
|
||||
|
||||
pub fn main() {
|
||||
let x : [int * 5] = [1,2,3,4,5];
|
||||
let _y : [int * 5] = [1,2,3,4,5];
|
||||
let x : [int, ..5] = [1,2,3,4,5];
|
||||
let _y : [int, ..5] = [1,2,3,4,5];
|
||||
let mut z = [1,2,3,4,5];
|
||||
z = x;
|
||||
fail_unless!(z[0] == 1);
|
||||
fail_unless!(z[4] == 5);
|
||||
|
||||
let a : [int * 5] = [1,1,1,1,1];
|
||||
let b : [int * 5] = [2,2,2,2,2];
|
||||
let c : [int * 5] = [2,2,2,2,3];
|
||||
let a : [int, ..5] = [1,1,1,1,1];
|
||||
let b : [int, ..5] = [2,2,2,2,2];
|
||||
let c : [int, ..5] = [2,2,2,2,3];
|
||||
|
||||
log(debug, a);
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
struct Struc { a: u8, b: [int * 3], c: int }
|
||||
struct Struc { a: u8, b: [int, ..3], c: int }
|
||||
|
||||
pub fn main() {
|
||||
let arr = [1,2,3];
|
||||
|
@ -16,7 +16,7 @@
|
||||
use core::libc::*;
|
||||
|
||||
struct KEYGEN {
|
||||
hash_algorithm: [c_uint * 2],
|
||||
hash_algorithm: [c_uint, ..2],
|
||||
count: uint32_t,
|
||||
salt: *c_void,
|
||||
salt_size: uint32_t,
|
||||
|
@ -14,7 +14,7 @@ struct A {
|
||||
|
||||
struct B {
|
||||
v1: int,
|
||||
v2: [int * 3],
|
||||
v2: [int, ..3],
|
||||
v3: ~[int],
|
||||
v4: C,
|
||||
v5: ~C,
|
||||
|
@ -9,7 +9,7 @@
|
||||
// except according to those terms.
|
||||
|
||||
pub fn main() {
|
||||
let x: [int*4] = [1, 2, 3, 4];
|
||||
let x: [int, ..4] = [1, 2, 3, 4];
|
||||
io::println(fmt!("%d", x[0]));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user