diff --git a/src/libcore/flate.rs b/src/libcore/flate.rs index c830648e9df..d9dc89097d0 100644 --- a/src/libcore/flate.rs +++ b/src/libcore/flate.rs @@ -41,10 +41,10 @@ pub mod rustrt { } } -const lz_none : c_int = 0x0; // Huffman-coding only. -const lz_fast : c_int = 0x1; // LZ with only one probe -const lz_norm : c_int = 0x80; // LZ with 128 probes, "normal" -const lz_best : c_int = 0xfff; // LZ with 4095 probes, "best" +static lz_none : c_int = 0x0; // Huffman-coding only. +static lz_fast : c_int = 0x1; // LZ with only one probe +static lz_norm : c_int = 0x80; // LZ with 128 probes, "normal" +static lz_best : c_int = 0xfff; // LZ with 4095 probes, "best" pub fn deflate_bytes(bytes: &[const u8]) -> ~[u8] { do vec::as_const_buf(bytes) |b, len| { diff --git a/src/libcore/gc.rs b/src/libcore/gc.rs index 3449c5ff4ba..6b256114663 100644 --- a/src/libcore/gc.rs +++ b/src/libcore/gc.rs @@ -211,11 +211,11 @@ unsafe fn find_segment_for_frame(fp: *Word, segment: *StackSegment) type Memory = uint; -const task_local_heap: Memory = 1; -const exchange_heap: Memory = 2; -const stack: Memory = 4; +static task_local_heap: Memory = 1; +static exchange_heap: Memory = 2; +static stack: Memory = 4; -const need_cleanup: Memory = exchange_heap | stack; +static need_cleanup: Memory = exchange_heap | stack; // Walks stack, searching for roots of the requested type, and passes // each root to the visitor. diff --git a/src/libcore/hashmap.rs b/src/libcore/hashmap.rs index 64806cd21aa..f5a97bdaca3 100644 --- a/src/libcore/hashmap.rs +++ b/src/libcore/hashmap.rs @@ -25,7 +25,7 @@ pub mod linear { use uint; use vec; - const INITIAL_CAPACITY: uint = 32u; // 2^5 + static INITIAL_CAPACITY: uint = 32u; // 2^5 struct Bucket { hash: uint, diff --git a/src/libcore/libc.rs b/src/libcore/libc.rs index 2c624a963b1..47eece81ce1 100644 --- a/src/libcore/libc.rs +++ b/src/libcore/libc.rs @@ -732,52 +732,52 @@ pub mod consts { #[cfg(target_os = "win32")] pub mod os { pub mod c95 { - pub const EXIT_FAILURE : int = 1; - pub const EXIT_SUCCESS : int = 0; - pub const RAND_MAX : int = 32767; - pub const EOF : int = -1; - pub const SEEK_SET : int = 0; - pub const SEEK_CUR : int = 1; - pub const SEEK_END : int = 2; - pub const _IOFBF : int = 0; - pub const _IONBF : int = 4; - pub const _IOLBF : int = 64; - pub const BUFSIZ : uint = 512_u; - pub const FOPEN_MAX : uint = 20_u; - pub const FILENAME_MAX : uint = 260_u; - pub const L_tmpnam : uint = 16_u; - pub const TMP_MAX : uint = 32767_u; + pub static EXIT_FAILURE : int = 1; + pub static EXIT_SUCCESS : int = 0; + pub static RAND_MAX : int = 32767; + pub static EOF : int = -1; + pub static SEEK_SET : int = 0; + pub static SEEK_CUR : int = 1; + pub static SEEK_END : int = 2; + pub static _IOFBF : int = 0; + pub static _IONBF : int = 4; + pub static _IOLBF : int = 64; + pub static BUFSIZ : uint = 512_u; + pub static FOPEN_MAX : uint = 20_u; + pub static FILENAME_MAX : uint = 260_u; + pub static L_tmpnam : uint = 16_u; + pub static TMP_MAX : uint = 32767_u; } pub mod c99 { } pub mod posix88 { - pub const O_RDONLY : int = 0; - pub const O_WRONLY : int = 1; - pub const O_RDWR : int = 2; - pub const O_APPEND : int = 8; - pub const O_CREAT : int = 256; - pub const O_EXCL : int = 1024; - pub const O_TRUNC : int = 512; - pub const S_IFIFO : int = 4096; - pub const S_IFCHR : int = 8192; - pub const S_IFBLK : int = 12288; - pub const S_IFDIR : int = 16384; - pub const S_IFREG : int = 32768; - pub const S_IFMT : int = 61440; - pub const S_IEXEC : int = 64; - pub const S_IWRITE : int = 128; - pub const S_IREAD : int = 256; - pub const S_IRWXU : int = 448; - pub const S_IXUSR : int = 64; - pub const S_IWUSR : int = 128; - pub const S_IRUSR : int = 256; - pub const F_OK : int = 0; - pub const R_OK : int = 4; - pub const W_OK : int = 2; - pub const X_OK : int = 1; - pub const STDIN_FILENO : int = 0; - pub const STDOUT_FILENO : int = 1; - pub const STDERR_FILENO : int = 2; + pub static O_RDONLY : int = 0; + pub static O_WRONLY : int = 1; + pub static O_RDWR : int = 2; + pub static O_APPEND : int = 8; + pub static O_CREAT : int = 256; + pub static O_EXCL : int = 1024; + pub static O_TRUNC : int = 512; + pub static S_IFIFO : int = 4096; + pub static S_IFCHR : int = 8192; + pub static S_IFBLK : int = 12288; + pub static S_IFDIR : int = 16384; + pub static S_IFREG : int = 32768; + pub static S_IFMT : int = 61440; + pub static S_IEXEC : int = 64; + pub static S_IWRITE : int = 128; + pub static S_IREAD : int = 256; + pub static S_IRWXU : int = 448; + pub static S_IXUSR : int = 64; + pub static S_IWUSR : int = 128; + pub static S_IRUSR : int = 256; + pub static F_OK : int = 0; + pub static R_OK : int = 4; + pub static W_OK : int = 2; + pub static X_OK : int = 1; + pub static STDIN_FILENO : int = 0; + pub static STDOUT_FILENO : int = 1; + pub static STDERR_FILENO : int = 2; } pub mod posix01 { } @@ -786,13 +786,13 @@ pub mod consts { pub mod bsd44 { } pub mod extra { - pub const O_TEXT : int = 16384; - pub const O_BINARY : int = 32768; - pub const O_NOINHERIT: int = 128; + pub static O_TEXT : int = 16384; + pub static O_BINARY : int = 32768; + pub static O_NOINHERIT: int = 128; - pub const ERROR_SUCCESS : int = 0; - pub const ERROR_INSUFFICIENT_BUFFER : int = 122; - pub const INVALID_HANDLE_VALUE: int = -1; + pub static ERROR_SUCCESS : int = 0; + pub static ERROR_INSUFFICIENT_BUFFER : int = 122; + pub static INVALID_HANDLE_VALUE: int = -1; } } @@ -801,56 +801,56 @@ pub mod consts { #[cfg(target_os = "android")] pub mod os { pub mod c95 { - pub const EXIT_FAILURE : int = 1; - pub const EXIT_SUCCESS : int = 0; - pub const RAND_MAX : int = 2147483647; - pub const EOF : int = -1; - pub const SEEK_SET : int = 0; - pub const SEEK_CUR : int = 1; - pub const SEEK_END : int = 2; - pub const _IOFBF : int = 0; - pub const _IONBF : int = 2; - pub const _IOLBF : int = 1; - pub const BUFSIZ : uint = 8192_u; - pub const FOPEN_MAX : uint = 16_u; - pub const FILENAME_MAX : uint = 4096_u; - pub const L_tmpnam : uint = 20_u; - pub const TMP_MAX : uint = 238328_u; + pub static EXIT_FAILURE : int = 1; + pub static EXIT_SUCCESS : int = 0; + pub static RAND_MAX : int = 2147483647; + pub static EOF : int = -1; + pub static SEEK_SET : int = 0; + pub static SEEK_CUR : int = 1; + pub static SEEK_END : int = 2; + pub static _IOFBF : int = 0; + pub static _IONBF : int = 2; + pub static _IOLBF : int = 1; + pub static BUFSIZ : uint = 8192_u; + pub static FOPEN_MAX : uint = 16_u; + pub static FILENAME_MAX : uint = 4096_u; + pub static L_tmpnam : uint = 20_u; + pub static TMP_MAX : uint = 238328_u; } pub mod c99 { } pub mod posix88 { - pub const O_RDONLY : int = 0; - pub const O_WRONLY : int = 1; - pub const O_RDWR : int = 2; - pub const O_APPEND : int = 1024; - pub const O_CREAT : int = 64; - pub const O_EXCL : int = 128; - pub const O_TRUNC : int = 512; - pub const S_IFIFO : int = 4096; - pub const S_IFCHR : int = 8192; - pub const S_IFBLK : int = 24576; - pub const S_IFDIR : int = 16384; - pub const S_IFREG : int = 32768; - pub const S_IFMT : int = 61440; - pub const S_IEXEC : int = 64; - pub const S_IWRITE : int = 128; - pub const S_IREAD : int = 256; - pub const S_IRWXU : int = 448; - pub const S_IXUSR : int = 64; - pub const S_IWUSR : int = 128; - pub const S_IRUSR : int = 256; - pub const F_OK : int = 0; - pub const R_OK : int = 4; - pub const W_OK : int = 2; - pub const X_OK : int = 1; - pub const STDIN_FILENO : int = 0; - pub const STDOUT_FILENO : int = 1; - pub const STDERR_FILENO : int = 2; - pub const F_LOCK : int = 1; - pub const F_TEST : int = 3; - pub const F_TLOCK : int = 2; - pub const F_ULOCK : int = 0; + pub static O_RDONLY : int = 0; + pub static O_WRONLY : int = 1; + pub static O_RDWR : int = 2; + pub static O_APPEND : int = 1024; + pub static O_CREAT : int = 64; + pub static O_EXCL : int = 128; + pub static O_TRUNC : int = 512; + pub static S_IFIFO : int = 4096; + pub static S_IFCHR : int = 8192; + pub static S_IFBLK : int = 24576; + pub static S_IFDIR : int = 16384; + pub static S_IFREG : int = 32768; + pub static S_IFMT : int = 61440; + pub static S_IEXEC : int = 64; + pub static S_IWRITE : int = 128; + pub static S_IREAD : int = 256; + pub static S_IRWXU : int = 448; + pub static S_IXUSR : int = 64; + pub static S_IWUSR : int = 128; + pub static S_IRUSR : int = 256; + pub static F_OK : int = 0; + pub static R_OK : int = 4; + pub static W_OK : int = 2; + pub static X_OK : int = 1; + pub static STDIN_FILENO : int = 0; + pub static STDOUT_FILENO : int = 1; + pub static STDERR_FILENO : int = 2; + pub static F_LOCK : int = 1; + pub static F_TEST : int = 3; + pub static F_TLOCK : int = 2; + pub static F_ULOCK : int = 0; } pub mod posix01 { } @@ -859,65 +859,65 @@ pub mod consts { pub mod bsd44 { } pub mod extra { - pub const O_RSYNC : int = 1052672; - pub const O_DSYNC : int = 4096; - pub const O_SYNC : int = 1052672; + pub static O_RSYNC : int = 1052672; + pub static O_DSYNC : int = 4096; + pub static O_SYNC : int = 1052672; } } #[cfg(target_os = "freebsd")] pub mod os { pub mod c95 { - pub const EXIT_FAILURE : int = 1; - pub const EXIT_SUCCESS : int = 0; - pub const RAND_MAX : int = 2147483647; - pub const EOF : int = -1; - pub const SEEK_SET : int = 0; - pub const SEEK_CUR : int = 1; - pub const SEEK_END : int = 2; - pub const _IOFBF : int = 0; - pub const _IONBF : int = 2; - pub const _IOLBF : int = 1; - pub const BUFSIZ : uint = 1024_u; - pub const FOPEN_MAX : uint = 20_u; - pub const FILENAME_MAX : uint = 1024_u; - pub const L_tmpnam : uint = 1024_u; - pub const TMP_MAX : uint = 308915776_u; + pub static EXIT_FAILURE : int = 1; + pub static EXIT_SUCCESS : int = 0; + pub static RAND_MAX : int = 2147483647; + pub static EOF : int = -1; + pub static SEEK_SET : int = 0; + pub static SEEK_CUR : int = 1; + pub static SEEK_END : int = 2; + pub static _IOFBF : int = 0; + pub static _IONBF : int = 2; + pub static _IOLBF : int = 1; + pub static BUFSIZ : uint = 1024_u; + pub static FOPEN_MAX : uint = 20_u; + pub static FILENAME_MAX : uint = 1024_u; + pub static L_tmpnam : uint = 1024_u; + pub static TMP_MAX : uint = 308915776_u; } pub mod c99 { } pub mod posix88 { - pub const O_RDONLY : int = 0; - pub const O_WRONLY : int = 1; - pub const O_RDWR : int = 2; - pub const O_APPEND : int = 8; - pub const O_CREAT : int = 512; - pub const O_EXCL : int = 2048; - pub const O_TRUNC : int = 1024; - pub const S_IFIFO : int = 4096; - pub const S_IFCHR : int = 8192; - pub const S_IFBLK : int = 24576; - pub const S_IFDIR : int = 16384; - pub const S_IFREG : int = 32768; - pub const S_IFMT : int = 61440; - pub const S_IEXEC : int = 64; - pub const S_IWRITE : int = 128; - pub const S_IREAD : int = 256; - pub const S_IRWXU : int = 448; - pub const S_IXUSR : int = 64; - pub const S_IWUSR : int = 128; - pub const S_IRUSR : int = 256; - pub const F_OK : int = 0; - pub const R_OK : int = 4; - pub const W_OK : int = 2; - pub const X_OK : int = 1; - pub const STDIN_FILENO : int = 0; - pub const STDOUT_FILENO : int = 1; - pub const STDERR_FILENO : int = 2; - pub const F_LOCK : int = 1; - pub const F_TEST : int = 3; - pub const F_TLOCK : int = 2; - pub const F_ULOCK : int = 0; + pub static O_RDONLY : int = 0; + pub static O_WRONLY : int = 1; + pub static O_RDWR : int = 2; + pub static O_APPEND : int = 8; + pub static O_CREAT : int = 512; + pub static O_EXCL : int = 2048; + pub static O_TRUNC : int = 1024; + pub static S_IFIFO : int = 4096; + pub static S_IFCHR : int = 8192; + pub static S_IFBLK : int = 24576; + pub static S_IFDIR : int = 16384; + pub static S_IFREG : int = 32768; + pub static S_IFMT : int = 61440; + pub static S_IEXEC : int = 64; + pub static S_IWRITE : int = 128; + pub static S_IREAD : int = 256; + pub static S_IRWXU : int = 448; + pub static S_IXUSR : int = 64; + pub static S_IWUSR : int = 128; + pub static S_IRUSR : int = 256; + pub static F_OK : int = 0; + pub static R_OK : int = 4; + pub static W_OK : int = 2; + pub static X_OK : int = 1; + pub static STDIN_FILENO : int = 0; + pub static STDOUT_FILENO : int = 1; + pub static STDERR_FILENO : int = 2; + pub static F_LOCK : int = 1; + pub static F_TEST : int = 3; + pub static F_TLOCK : int = 2; + pub static F_ULOCK : int = 0; } pub mod posix01 { } @@ -926,66 +926,66 @@ pub mod consts { pub mod bsd44 { } pub mod extra { - pub const O_SYNC : int = 128; - pub const CTL_KERN: int = 1; - pub const KERN_PROC: int = 14; - pub const KERN_PROC_PATHNAME: int = 12; + pub static O_SYNC : int = 128; + pub static CTL_KERN: int = 1; + pub static KERN_PROC: int = 14; + pub static KERN_PROC_PATHNAME: int = 12; } } #[cfg(target_os = "macos")] pub mod os { pub mod c95 { - pub const EXIT_FAILURE : int = 1; - pub const EXIT_SUCCESS : int = 0; - pub const RAND_MAX : int = 2147483647; - pub const EOF : int = -1; - pub const SEEK_SET : int = 0; - pub const SEEK_CUR : int = 1; - pub const SEEK_END : int = 2; - pub const _IOFBF : int = 0; - pub const _IONBF : int = 2; - pub const _IOLBF : int = 1; - pub const BUFSIZ : uint = 1024_u; - pub const FOPEN_MAX : uint = 20_u; - pub const FILENAME_MAX : uint = 1024_u; - pub const L_tmpnam : uint = 1024_u; - pub const TMP_MAX : uint = 308915776_u; + pub static EXIT_FAILURE : int = 1; + pub static EXIT_SUCCESS : int = 0; + pub static RAND_MAX : int = 2147483647; + pub static EOF : int = -1; + pub static SEEK_SET : int = 0; + pub static SEEK_CUR : int = 1; + pub static SEEK_END : int = 2; + pub static _IOFBF : int = 0; + pub static _IONBF : int = 2; + pub static _IOLBF : int = 1; + pub static BUFSIZ : uint = 1024_u; + pub static FOPEN_MAX : uint = 20_u; + pub static FILENAME_MAX : uint = 1024_u; + pub static L_tmpnam : uint = 1024_u; + pub static TMP_MAX : uint = 308915776_u; } pub mod c99 { } pub mod posix88 { - pub const O_RDONLY : int = 0; - pub const O_WRONLY : int = 1; - pub const O_RDWR : int = 2; - pub const O_APPEND : int = 8; - pub const O_CREAT : int = 512; - pub const O_EXCL : int = 2048; - pub const O_TRUNC : int = 1024; - pub const S_IFIFO : int = 4096; - pub const S_IFCHR : int = 8192; - pub const S_IFBLK : int = 24576; - pub const S_IFDIR : int = 16384; - pub const S_IFREG : int = 32768; - pub const S_IFMT : int = 61440; - pub const S_IEXEC : int = 64; - pub const S_IWRITE : int = 128; - pub const S_IREAD : int = 256; - pub const S_IRWXU : int = 448; - pub const S_IXUSR : int = 64; - pub const S_IWUSR : int = 128; - pub const S_IRUSR : int = 256; - pub const F_OK : int = 0; - pub const R_OK : int = 4; - pub const W_OK : int = 2; - pub const X_OK : int = 1; - pub const STDIN_FILENO : int = 0; - pub const STDOUT_FILENO : int = 1; - pub const STDERR_FILENO : int = 2; - pub const F_LOCK : int = 1; - pub const F_TEST : int = 3; - pub const F_TLOCK : int = 2; - pub const F_ULOCK : int = 0; + pub static O_RDONLY : int = 0; + pub static O_WRONLY : int = 1; + pub static O_RDWR : int = 2; + pub static O_APPEND : int = 8; + pub static O_CREAT : int = 512; + pub static O_EXCL : int = 2048; + pub static O_TRUNC : int = 1024; + pub static S_IFIFO : int = 4096; + pub static S_IFCHR : int = 8192; + pub static S_IFBLK : int = 24576; + pub static S_IFDIR : int = 16384; + pub static S_IFREG : int = 32768; + pub static S_IFMT : int = 61440; + pub static S_IEXEC : int = 64; + pub static S_IWRITE : int = 128; + pub static S_IREAD : int = 256; + pub static S_IRWXU : int = 448; + pub static S_IXUSR : int = 64; + pub static S_IWUSR : int = 128; + pub static S_IRUSR : int = 256; + pub static F_OK : int = 0; + pub static R_OK : int = 4; + pub static W_OK : int = 2; + pub static X_OK : int = 1; + pub static STDIN_FILENO : int = 0; + pub static STDOUT_FILENO : int = 1; + pub static STDERR_FILENO : int = 2; + pub static F_LOCK : int = 1; + pub static F_TEST : int = 3; + pub static F_TLOCK : int = 2; + pub static F_ULOCK : int = 0; } pub mod posix01 { } @@ -994,9 +994,9 @@ pub mod consts { pub mod bsd44 { } pub mod extra { - pub const O_DSYNC : int = 4194304; - pub const O_SYNC : int = 128; - pub const F_FULLFSYNC : int = 51; + pub static O_DSYNC : int = 4194304; + pub static O_SYNC : int = 128; + pub static F_FULLFSYNC : int = 51; } } } diff --git a/src/libcore/managed.rs b/src/libcore/managed.rs index 30ebeda3f5c..4eda5e7b5e8 100644 --- a/src/libcore/managed.rs +++ b/src/libcore/managed.rs @@ -16,9 +16,9 @@ use ptr; pub mod raw { - pub const RC_EXCHANGE_UNIQUE : uint = (-1) as uint; - pub const RC_MANAGED_UNIQUE : uint = (-2) as uint; - pub const RC_IMMORTAL : uint = 0x77777777; + pub static RC_EXCHANGE_UNIQUE : uint = (-1) as uint; + pub static RC_MANAGED_UNIQUE : uint = (-2) as uint; + pub static RC_IMMORTAL : uint = 0x77777777; use intrinsic::TyDesc; diff --git a/src/libcore/num/cmath.rs b/src/libcore/num/cmath.rs index 2f9d4304cba..378ebfa53a0 100644 --- a/src/libcore/num/cmath.rs +++ b/src/libcore/num/cmath.rs @@ -174,33 +174,33 @@ pub mod c_float_utils { // FIXME obtain machine float/math constants automatically (Issue #1986) pub mod c_float_targ_consts { - pub const radix: uint = 2u; - pub const mantissa_digits: uint = 24u; - pub const digits: uint = 6u; - pub const min_exp: uint = -125u; - pub const max_exp: uint = 128u; - pub const min_10_exp: int = -37; - pub const max_10_exp: int = 38; - // FIXME (#1433): this is wrong, replace with hexadecimal (%a) constants + pub static radix: uint = 2u; + pub static mantissa_digits: uint = 24u; + pub static digits: uint = 6u; + pub static min_exp: uint = -125u; + pub static max_exp: uint = 128u; + pub static min_10_exp: int = -37; + pub static max_10_exp: int = 38; + // FIXME (#1433): this is wrong, replace with hexadecimal (%a) staticants // below. - pub const min_value: f32 = 1.175494e-38_f32; - pub const max_value: f32 = 3.402823e+38_f32; - pub const epsilon: f32 = 0.000000_f32; + pub static min_value: f32 = 1.175494e-38_f32; + pub static max_value: f32 = 3.402823e+38_f32; + pub static epsilon: f32 = 0.000000_f32; } pub mod c_double_targ_consts { - pub const radix: uint = 2u; - pub const mantissa_digits: uint = 53u; - pub const digits: uint = 15u; - pub const min_exp: uint = -1021u; - pub const max_exp: uint = 1024u; - pub const min_10_exp: int = -307; - pub const max_10_exp: int = 308; - // FIXME (#1433): this is wrong, replace with hexadecimal (%a) constants + pub static radix: uint = 2u; + pub static mantissa_digits: uint = 53u; + pub static digits: uint = 15u; + pub static min_exp: uint = -1021u; + pub static max_exp: uint = 1024u; + pub static min_10_exp: int = -307; + pub static max_10_exp: int = 308; + // FIXME (#1433): this is wrong, replace with hexadecimal (%a) staticants // below. - pub const min_value: f64 = 2.225074e-308_f64; - pub const max_value: f64 = 1.797693e+308_f64; - pub const epsilon: f64 = 2.220446e-16_f64; + pub static min_value: f64 = 2.225074e-308_f64; + pub static max_value: f64 = 1.797693e+308_f64; + pub static epsilon: f64 = 2.220446e-16_f64; } /* @@ -208,61 +208,61 @@ pub mod c_double_targ_consts { FIXME use these once they can be parsed (see Issue #1433) pub mod c_float_math_consts { - pub const pi: c_float = 0x1.921fb6p+1_f32; - pub const div_1_pi: c_float = 0x1.45f306p-2_f32; - pub const div_2_pi: c_float = 0x1.45f306p-1_f32; - pub const div_pi_2: c_float = 0x1.921fb6p+0_f32; - pub const div_pi_4: c_float = 0x1.921fb6p-1_f32; - pub const div_2_sqrtpi: c_float = 0x1.20dd76p+0_f32; - pub const e: c_float = 0x1.5bf0a8p+1_f32; - pub const log2_e: c_float = 0x1.715476p+0_f32; - pub const log10_e: c_float = 0x1.bcb7b2p-2_f32; - pub const ln_2: c_float = 0x1.62e43p-1_f32; - pub const ln_10: c_float = 0x1.26bb1cp+1_f32; - pub const sqrt2: c_float = 0x1.6a09e6p+0_f32; - pub const div_1_sqrt2: c_float = 0x1.6a09e6p-1_f32; + pub static pi: c_float = 0x1.921fb6p+1_f32; + pub static div_1_pi: c_float = 0x1.45f306p-2_f32; + pub static div_2_pi: c_float = 0x1.45f306p-1_f32; + pub static div_pi_2: c_float = 0x1.921fb6p+0_f32; + pub static div_pi_4: c_float = 0x1.921fb6p-1_f32; + pub static div_2_sqrtpi: c_float = 0x1.20dd76p+0_f32; + pub static e: c_float = 0x1.5bf0a8p+1_f32; + pub static log2_e: c_float = 0x1.715476p+0_f32; + pub static log10_e: c_float = 0x1.bcb7b2p-2_f32; + pub static ln_2: c_float = 0x1.62e43p-1_f32; + pub static ln_10: c_float = 0x1.26bb1cp+1_f32; + pub static sqrt2: c_float = 0x1.6a09e6p+0_f32; + pub static div_1_sqrt2: c_float = 0x1.6a09e6p-1_f32; } pub mod c_double_math_consts { - pub const pi: c_double = 0x1.921fb54442d18p+1_f64; - pub const div_1_pi: c_double = 0x1.45f306dc9c883p-2_f64; - pub const div_2_pi: c_double = 0x1.45f306dc9c883p-1_f64; - pub const div_pi_2: c_double = 0x1.921fb54442d18p+0_f64; - pub const div_pi_4: c_double = 0x1.921fb54442d18p-1_f64; - pub const div_2_sqrtpi: c_double = 0x1.20dd750429b6dp+0_f64; - pub const e: c_double = 0x1.5bf0a8b145769p+1_f64; - pub const log2_e: c_double = 0x1.71547652b82fep+0_f64; - pub const log10_e: c_double = 0x1.bcb7b1526e50ep-2_f64; - pub const ln_2: c_double = 0x1.62e42fefa39efp-1_f64; - pub const ln_10: c_double = 0x1.26bb1bbb55516p+1_f64; - pub const sqrt2: c_double = 0x1.6a09e667f3bcdp+0_f64; - pub const div_1_sqrt2: c_double = 0x1.6a09e667f3bcdp-1_f64; + pub static pi: c_double = 0x1.921fb54442d18p+1_f64; + pub static div_1_pi: c_double = 0x1.45f306dc9c883p-2_f64; + pub static div_2_pi: c_double = 0x1.45f306dc9c883p-1_f64; + pub static div_pi_2: c_double = 0x1.921fb54442d18p+0_f64; + pub static div_pi_4: c_double = 0x1.921fb54442d18p-1_f64; + pub static div_2_sqrtpi: c_double = 0x1.20dd750429b6dp+0_f64; + pub static e: c_double = 0x1.5bf0a8b145769p+1_f64; + pub static log2_e: c_double = 0x1.71547652b82fep+0_f64; + pub static log10_e: c_double = 0x1.bcb7b1526e50ep-2_f64; + pub static ln_2: c_double = 0x1.62e42fefa39efp-1_f64; + pub static ln_10: c_double = 0x1.26bb1bbb55516p+1_f64; + pub static sqrt2: c_double = 0x1.6a09e667f3bcdp+0_f64; + pub static div_1_sqrt2: c_double = 0x1.6a09e667f3bcdp-1_f64; } pub mod c_float_targ_consts { - pub const radix: uint = 2u; - pub const mantissa_digits: uint = 24u; - pub const digits: uint = 6u; - pub const min_exp: int = -125; - pub const max_exp: int = 128; - pub const min_10_exp: int = -37; - pub const max_10_exp: int = 38; - pub const min_value: c_float = 0x1p-126_f32; - pub const max_value: c_float = 0x1.fffffep+127_f32; - pub const epsilon: c_float = 0x1p-23_f32; + pub static radix: uint = 2u; + pub static mantissa_digits: uint = 24u; + pub static digits: uint = 6u; + pub static min_exp: int = -125; + pub static max_exp: int = 128; + pub static min_10_exp: int = -37; + pub static max_10_exp: int = 38; + pub static min_value: c_float = 0x1p-126_f32; + pub static max_value: c_float = 0x1.fffffep+127_f32; + pub static epsilon: c_float = 0x1p-23_f32; } pub mod c_double_targ_consts { - pub const radix: uint = 2u; - pub const mantissa_digits: uint = 53u; - pub const digits: uint = 15u; - pub const min_exp: int = -1021; - pub const max_exp: int = 1024; - pub const min_10_exp: int = -307; - pub const max_10_exp: int = 308; - pub const min_value: c_double = 0x1p-1022_f64; - pub const max_value: c_double = 0x1.fffffffffffffp+1023_f64; - pub const epsilon: c_double = 0x1p-52_f64; + pub static radix: uint = 2u; + pub static mantissa_digits: uint = 53u; + pub static digits: uint = 15u; + pub static min_exp: int = -1021; + pub static max_exp: int = 1024; + pub static min_10_exp: int = -307; + pub static max_10_exp: int = 308; + pub static min_value: c_double = 0x1p-1022_f64; + pub static max_value: c_double = 0x1.fffffffffffffp+1023_f64; + pub static epsilon: c_double = 0x1p-52_f64; } */ diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs index 719e5620d02..4a8649fb66e 100644 --- a/src/libcore/num/f32.rs +++ b/src/libcore/num/f32.rs @@ -102,11 +102,11 @@ delegate!(fn trunc(n: c_float) -> c_float = cmath::c_float_utils::trunc) // These are not defined inside consts:: for consistency with // the integer types -pub const NaN: f32 = 0.0_f32/0.0_f32; +pub static NaN: f32 = 0.0_f32/0.0_f32; -pub const infinity: f32 = 1.0_f32/0.0_f32; +pub static infinity: f32 = 1.0_f32/0.0_f32; -pub const neg_infinity: f32 = -1.0_f32/0.0_f32; +pub static neg_infinity: f32 = -1.0_f32/0.0_f32; #[inline(always)] pub fn is_NaN(f: f32) -> bool { f != f } @@ -206,45 +206,45 @@ pub fn is_finite(x: f32) -> bool { /* Module: consts */ pub mod consts { // FIXME (requires Issue #1433 to fix): replace with mathematical - // constants from cmath. - /// Archimedes' constant - pub const pi: f32 = 3.14159265358979323846264338327950288_f32; + // staticants from cmath. + /// Archimedes' staticant + pub static pi: f32 = 3.14159265358979323846264338327950288_f32; /// pi/2.0 - pub const frac_pi_2: f32 = 1.57079632679489661923132169163975144_f32; + pub static frac_pi_2: f32 = 1.57079632679489661923132169163975144_f32; /// pi/4.0 - pub const frac_pi_4: f32 = 0.785398163397448309615660845819875721_f32; + pub static frac_pi_4: f32 = 0.785398163397448309615660845819875721_f32; /// 1.0/pi - pub const frac_1_pi: f32 = 0.318309886183790671537767526745028724_f32; + pub static frac_1_pi: f32 = 0.318309886183790671537767526745028724_f32; /// 2.0/pi - pub const frac_2_pi: f32 = 0.636619772367581343075535053490057448_f32; + pub static frac_2_pi: f32 = 0.636619772367581343075535053490057448_f32; /// 2.0/sqrt(pi) - pub const frac_2_sqrtpi: f32 = 1.12837916709551257389615890312154517_f32; + pub static frac_2_sqrtpi: f32 = 1.12837916709551257389615890312154517_f32; /// sqrt(2.0) - pub const sqrt2: f32 = 1.41421356237309504880168872420969808_f32; + pub static sqrt2: f32 = 1.41421356237309504880168872420969808_f32; /// 1.0/sqrt(2.0) - pub const frac_1_sqrt2: f32 = 0.707106781186547524400844362104849039_f32; + pub static frac_1_sqrt2: f32 = 0.707106781186547524400844362104849039_f32; /// Euler's number - pub const e: f32 = 2.71828182845904523536028747135266250_f32; + pub static e: f32 = 2.71828182845904523536028747135266250_f32; /// log2(e) - pub const log2_e: f32 = 1.44269504088896340735992468100189214_f32; + pub static log2_e: f32 = 1.44269504088896340735992468100189214_f32; /// log10(e) - pub const log10_e: f32 = 0.434294481903251827651128918916605082_f32; + pub static log10_e: f32 = 0.434294481903251827651128918916605082_f32; /// ln(2.0) - pub const ln_2: f32 = 0.693147180559945309417232121458176568_f32; + pub static ln_2: f32 = 0.693147180559945309417232121458176568_f32; /// ln(10.0) - pub const ln_10: f32 = 2.30258509299404568401799145468436421_f32; + pub static ln_10: f32 = 2.30258509299404568401799145468436421_f32; } #[inline(always)] diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs index 6a581ddfa94..8107110e977 100644 --- a/src/libcore/num/f64.rs +++ b/src/libcore/num/f64.rs @@ -113,27 +113,27 @@ delegate!(fn yn(i: c_int, n: c_double) -> c_double = // These are not defined inside consts:: for consistency with // the integer types -pub const radix: uint = 2u; +pub static radix: uint = 2u; -pub const mantissa_digits: uint = 53u; -pub const digits: uint = 15u; +pub static mantissa_digits: uint = 53u; +pub static digits: uint = 15u; -pub const epsilon: f64 = 2.2204460492503131e-16_f64; +pub static epsilon: f64 = 2.2204460492503131e-16_f64; -pub const min_value: f64 = 2.2250738585072014e-308_f64; -pub const max_value: f64 = 1.7976931348623157e+308_f64; +pub static min_value: f64 = 2.2250738585072014e-308_f64; +pub static max_value: f64 = 1.7976931348623157e+308_f64; -pub const min_exp: int = -1021; -pub const max_exp: int = 1024; +pub static min_exp: int = -1021; +pub static max_exp: int = 1024; -pub const min_10_exp: int = -307; -pub const max_10_exp: int = 308; +pub static min_10_exp: int = -307; +pub static max_10_exp: int = 308; -pub const NaN: f64 = 0.0_f64/0.0_f64; +pub static NaN: f64 = 0.0_f64/0.0_f64; -pub const infinity: f64 = 1.0_f64/0.0_f64; +pub static infinity: f64 = 1.0_f64/0.0_f64; -pub const neg_infinity: f64 = -1.0_f64/0.0_f64; +pub static neg_infinity: f64 = -1.0_f64/0.0_f64; #[inline(always)] pub fn is_NaN(f: f64) -> bool { f != f } @@ -230,43 +230,43 @@ pub mod consts { // FIXME (requires Issue #1433 to fix): replace with mathematical // constants from cmath. /// Archimedes' constant - pub const pi: f64 = 3.14159265358979323846264338327950288_f64; + pub static pi: f64 = 3.14159265358979323846264338327950288_f64; /// pi/2.0 - pub const frac_pi_2: f64 = 1.57079632679489661923132169163975144_f64; + pub static frac_pi_2: f64 = 1.57079632679489661923132169163975144_f64; /// pi/4.0 - pub const frac_pi_4: f64 = 0.785398163397448309615660845819875721_f64; + pub static frac_pi_4: f64 = 0.785398163397448309615660845819875721_f64; /// 1.0/pi - pub const frac_1_pi: f64 = 0.318309886183790671537767526745028724_f64; + pub static frac_1_pi: f64 = 0.318309886183790671537767526745028724_f64; /// 2.0/pi - pub const frac_2_pi: f64 = 0.636619772367581343075535053490057448_f64; + pub static frac_2_pi: f64 = 0.636619772367581343075535053490057448_f64; /// 2.0/sqrt(pi) - pub const frac_2_sqrtpi: f64 = 1.12837916709551257389615890312154517_f64; + pub static frac_2_sqrtpi: f64 = 1.12837916709551257389615890312154517_f64; /// sqrt(2.0) - pub const sqrt2: f64 = 1.41421356237309504880168872420969808_f64; + pub static sqrt2: f64 = 1.41421356237309504880168872420969808_f64; /// 1.0/sqrt(2.0) - pub const frac_1_sqrt2: f64 = 0.707106781186547524400844362104849039_f64; + pub static frac_1_sqrt2: f64 = 0.707106781186547524400844362104849039_f64; /// Euler's number - pub const e: f64 = 2.71828182845904523536028747135266250_f64; + pub static e: f64 = 2.71828182845904523536028747135266250_f64; /// log2(e) - pub const log2_e: f64 = 1.44269504088896340735992468100189214_f64; + pub static log2_e: f64 = 1.44269504088896340735992468100189214_f64; /// log10(e) - pub const log10_e: f64 = 0.434294481903251827651128918916605082_f64; + pub static log10_e: f64 = 0.434294481903251827651128918916605082_f64; /// ln(2.0) - pub const ln_2: f64 = 0.693147180559945309417232121458176568_f64; + pub static ln_2: f64 = 0.693147180559945309417232121458176568_f64; /// ln(10.0) - pub const ln_10: f64 = 2.30258509299404568401799145468436421_f64; + pub static ln_10: f64 = 2.30258509299404568401799145468436421_f64; } #[inline(always)] diff --git a/src/libcore/num/float.rs b/src/libcore/num/float.rs index 4e9a1b62b6e..65a846c6db1 100644 --- a/src/libcore/num/float.rs +++ b/src/libcore/num/float.rs @@ -41,54 +41,54 @@ pub use f64::{modf, pow, round, sinh, tanh, tgamma, trunc}; pub use f64::signbit; pub use f64::{j0, j1, jn, y0, y1, yn}; -pub const NaN: float = 0.0/0.0; +pub static NaN: float = 0.0/0.0; -pub const infinity: float = 1.0/0.0; +pub static infinity: float = 1.0/0.0; -pub const neg_infinity: float = -1.0/0.0; +pub static neg_infinity: float = -1.0/0.0; /* Module: consts */ pub mod consts { // FIXME (requires Issue #1433 to fix): replace with mathematical - // constants from cmath. - /// Archimedes' constant - pub const pi: float = 3.14159265358979323846264338327950288; + // staticants from cmath. + /// Archimedes' staticant + pub static pi: float = 3.14159265358979323846264338327950288; /// pi/2.0 - pub const frac_pi_2: float = 1.57079632679489661923132169163975144; + pub static frac_pi_2: float = 1.57079632679489661923132169163975144; /// pi/4.0 - pub const frac_pi_4: float = 0.785398163397448309615660845819875721; + pub static frac_pi_4: float = 0.785398163397448309615660845819875721; /// 1.0/pi - pub const frac_1_pi: float = 0.318309886183790671537767526745028724; + pub static frac_1_pi: float = 0.318309886183790671537767526745028724; /// 2.0/pi - pub const frac_2_pi: float = 0.636619772367581343075535053490057448; + pub static frac_2_pi: float = 0.636619772367581343075535053490057448; /// 2.0/sqrt(pi) - pub const frac_2_sqrtpi: float = 1.12837916709551257389615890312154517; + pub static frac_2_sqrtpi: float = 1.12837916709551257389615890312154517; /// sqrt(2.0) - pub const sqrt2: float = 1.41421356237309504880168872420969808; + pub static sqrt2: float = 1.41421356237309504880168872420969808; /// 1.0/sqrt(2.0) - pub const frac_1_sqrt2: float = 0.707106781186547524400844362104849039; + pub static frac_1_sqrt2: float = 0.707106781186547524400844362104849039; /// Euler's number - pub const e: float = 2.71828182845904523536028747135266250; + pub static e: float = 2.71828182845904523536028747135266250; /// log2(e) - pub const log2_e: float = 1.44269504088896340735992468100189214; + pub static log2_e: float = 1.44269504088896340735992468100189214; /// log10(e) - pub const log10_e: float = 0.434294481903251827651128918916605082; + pub static log10_e: float = 0.434294481903251827651128918916605082; /// ln(2.0) - pub const ln_2: float = 0.693147180559945309417232121458176568; + pub static ln_2: float = 0.693147180559945309417232121458176568; /// ln(10.0) - pub const ln_10: float = 2.30258509299404568401799145468436421; + pub static ln_10: float = 2.30258509299404568401799145468436421; } /* diff --git a/src/libcore/num/int-template.rs b/src/libcore/num/int-template.rs index 4d5ac92311e..af56d3e6305 100644 --- a/src/libcore/num/int-template.rs +++ b/src/libcore/num/int-template.rs @@ -21,11 +21,11 @@ use prelude::*; pub use cmp::{min, max}; -pub const bits : uint = inst::bits; -pub const bytes : uint = (inst::bits / 8); +pub static bits : uint = inst::bits; +pub static bytes : uint = (inst::bits / 8); -pub const min_value: T = (-1 as T) << (bits - 1); -pub const max_value: T = min_value - 1 as T; +pub static min_value: T = (-1 as T) << (bits - 1); +pub static max_value: T = min_value - 1 as T; #[inline(always)] pub fn add(x: T, y: T) -> T { x + y } diff --git a/src/libcore/num/int-template/i16.rs b/src/libcore/num/int-template/i16.rs index 9914807c98f..965b6f86a53 100644 --- a/src/libcore/num/int-template/i16.rs +++ b/src/libcore/num/int-template/i16.rs @@ -14,7 +14,7 @@ use num::NumCast; mod inst { pub type T = i16; - pub const bits: uint = ::u16::bits; + pub static bits: uint = ::u16::bits; } impl NumCast for i16 { diff --git a/src/libcore/num/int-template/i32.rs b/src/libcore/num/int-template/i32.rs index c02facd47db..030bc9c3fde 100644 --- a/src/libcore/num/int-template/i32.rs +++ b/src/libcore/num/int-template/i32.rs @@ -14,7 +14,7 @@ use num::NumCast; mod inst { pub type T = i32; - pub const bits: uint = ::u32::bits; + pub static bits: uint = ::u32::bits; } impl NumCast for i32 { diff --git a/src/libcore/num/int-template/i64.rs b/src/libcore/num/int-template/i64.rs index c285ba23c27..283de94e9d8 100644 --- a/src/libcore/num/int-template/i64.rs +++ b/src/libcore/num/int-template/i64.rs @@ -14,7 +14,7 @@ use num::NumCast; mod inst { pub type T = i64; - pub const bits: uint = ::u64::bits; + pub static bits: uint = ::u64::bits; } impl NumCast for i64 { diff --git a/src/libcore/num/int-template/i8.rs b/src/libcore/num/int-template/i8.rs index 2733a064563..2f2de358337 100644 --- a/src/libcore/num/int-template/i8.rs +++ b/src/libcore/num/int-template/i8.rs @@ -14,7 +14,7 @@ use num::NumCast; mod inst { pub type T = i8; - pub const bits: uint = ::u8::bits; + pub static bits: uint = ::u8::bits; } impl NumCast for i8 { diff --git a/src/libcore/num/int-template/int.rs b/src/libcore/num/int-template/int.rs index 29e1e52348e..3c89492c7e4 100644 --- a/src/libcore/num/int-template/int.rs +++ b/src/libcore/num/int-template/int.rs @@ -16,7 +16,7 @@ pub use self::inst::pow; mod inst { pub type T = int; - pub const bits: uint = ::uint::bits; + pub static bits: uint = ::uint::bits; /// Returns `base` raised to the power of `exponent` pub fn pow(base: int, exponent: uint) -> int { diff --git a/src/libcore/num/strconv.rs b/src/libcore/num/strconv.rs index e39d52d86f2..26f0582bfb2 100644 --- a/src/libcore/num/strconv.rs +++ b/src/libcore/num/strconv.rs @@ -394,9 +394,9 @@ pub fn to_str_common T { x + y } diff --git a/src/libcore/num/uint-template/u16.rs b/src/libcore/num/uint-template/u16.rs index bdd95120136..c73313ac0f3 100644 --- a/src/libcore/num/uint-template/u16.rs +++ b/src/libcore/num/uint-template/u16.rs @@ -16,7 +16,7 @@ mod inst { pub type T = u16; #[allow(non_camel_case_types)] pub type T_SIGNED = i16; - pub const bits: uint = 16; + pub static bits: uint = 16; } impl NumCast for u16 { diff --git a/src/libcore/num/uint-template/u32.rs b/src/libcore/num/uint-template/u32.rs index 7bef51489f2..eb63f1a370a 100644 --- a/src/libcore/num/uint-template/u32.rs +++ b/src/libcore/num/uint-template/u32.rs @@ -16,7 +16,7 @@ mod inst { pub type T = u32; #[allow(non_camel_case_types)] pub type T_SIGNED = i32; - pub const bits: uint = 32; + pub static bits: uint = 32; } impl NumCast for u32 { diff --git a/src/libcore/num/uint-template/u64.rs b/src/libcore/num/uint-template/u64.rs index fecafe37f3d..799421dc976 100644 --- a/src/libcore/num/uint-template/u64.rs +++ b/src/libcore/num/uint-template/u64.rs @@ -16,7 +16,7 @@ mod inst { pub type T = u64; #[allow(non_camel_case_types)] pub type T_SIGNED = i64; - pub const bits: uint = 64; + pub static bits: uint = 64; } impl NumCast for u64 { diff --git a/src/libcore/num/uint-template/u8.rs b/src/libcore/num/uint-template/u8.rs index 0d48de67334..b173d29510c 100644 --- a/src/libcore/num/uint-template/u8.rs +++ b/src/libcore/num/uint-template/u8.rs @@ -18,7 +18,7 @@ mod inst { pub type T = u8; #[allow(non_camel_case_types)] pub type T_SIGNED = i8; - pub const bits: uint = 8; + pub static bits: uint = 8; // Type-specific functions here. These must be reexported by the // parent module so that they appear in core::u8 and not core::u8::u8; diff --git a/src/libcore/num/uint-template/uint.rs b/src/libcore/num/uint-template/uint.rs index f3f27a4e48a..741e0f36a33 100644 --- a/src/libcore/num/uint-template/uint.rs +++ b/src/libcore/num/uint-template/uint.rs @@ -28,10 +28,10 @@ pub mod inst { #[cfg(target_arch = "x86")] #[cfg(target_arch = "arm")] #[cfg(target_arch = "mips")] - pub const bits: uint = 32; + pub static bits: uint = 32; #[cfg(target_arch = "x86_64")] - pub const bits: uint = 64; + pub static bits: uint = 64; /** * Divide two numbers, return the result, rounded up. diff --git a/src/libcore/os.rs b/src/libcore/os.rs index 17ec9df9d56..3c2dbf7ea15 100644 --- a/src/libcore/os.rs +++ b/src/libcore/os.rs @@ -65,8 +65,8 @@ pub mod rustrt { } } -pub const TMPBUF_SZ : uint = 1000u; -const BUF_BYTES : uint = 2048u; +pub static TMPBUF_SZ : uint = 1000u; +static BUF_BYTES : uint = 2048u; pub fn getcwd() -> Path { let buf = [0 as libc::c_char, ..BUF_BYTES]; @@ -1013,8 +1013,8 @@ pub fn last_os_error() -> ~str { args: *c_void) -> DWORD; } - const FORMAT_MESSAGE_FROM_SYSTEM: DWORD = 0x00001000; - const FORMAT_MESSAGE_IGNORE_INSERTS: DWORD = 0x00000200; + static FORMAT_MESSAGE_FROM_SYSTEM: DWORD = 0x00001000; + static FORMAT_MESSAGE_IGNORE_INSERTS: DWORD = 0x00000200; let mut buf = [0 as c_char, ..TMPBUF_SZ]; @@ -1170,11 +1170,11 @@ pub mod consts { pub use os::consts::windows::*; pub mod unix { - pub const FAMILY: &'static str = "unix"; + pub static FAMILY: &'static str = "unix"; } pub mod windows { - pub const FAMILY: &'static str = "windows"; + pub static FAMILY: &'static str = "windows"; } #[cfg(target_os = "macos")] @@ -1193,38 +1193,38 @@ pub mod consts { pub use os::consts::win32::*; pub mod macos { - pub const SYSNAME: &'static str = "macos"; - pub const DLL_PREFIX: &'static str = "lib"; - pub const DLL_SUFFIX: &'static str = ".dylib"; - pub const EXE_SUFFIX: &'static str = ""; + pub static SYSNAME: &'static str = "macos"; + pub static DLL_PREFIX: &'static str = "lib"; + pub static DLL_SUFFIX: &'static str = ".dylib"; + pub static EXE_SUFFIX: &'static str = ""; } pub mod freebsd { - pub const SYSNAME: &'static str = "freebsd"; - pub const DLL_PREFIX: &'static str = "lib"; - pub const DLL_SUFFIX: &'static str = ".so"; - pub const EXE_SUFFIX: &'static str = ""; + pub static SYSNAME: &'static str = "freebsd"; + pub static DLL_PREFIX: &'static str = "lib"; + pub static DLL_SUFFIX: &'static str = ".so"; + pub static EXE_SUFFIX: &'static str = ""; } pub mod linux { - pub const SYSNAME: &'static str = "linux"; - pub const DLL_PREFIX: &'static str = "lib"; - pub const DLL_SUFFIX: &'static str = ".so"; - pub const EXE_SUFFIX: &'static str = ""; + pub static SYSNAME: &'static str = "linux"; + pub static DLL_PREFIX: &'static str = "lib"; + pub static DLL_SUFFIX: &'static str = ".so"; + pub static EXE_SUFFIX: &'static str = ""; } pub mod android { - pub const SYSNAME: &'static str = "android"; - pub const DLL_PREFIX: &'static str = "lib"; - pub const DLL_SUFFIX: &'static str = ".so"; - pub const EXE_SUFFIX: &'static str = ""; + pub static SYSNAME: &'static str = "android"; + pub static DLL_PREFIX: &'static str = "lib"; + pub static DLL_SUFFIX: &'static str = ".so"; + pub static EXE_SUFFIX: &'static str = ""; } pub mod win32 { - pub const SYSNAME: &'static str = "win32"; - pub const DLL_PREFIX: &'static str = ""; - pub const DLL_SUFFIX: &'static str = ".dll"; - pub const EXE_SUFFIX: &'static str = ".exe"; + pub static SYSNAME: &'static str = "win32"; + pub static DLL_PREFIX: &'static str = ""; + pub static DLL_SUFFIX: &'static str = ".dll"; + pub static EXE_SUFFIX: &'static str = ".exe"; } @@ -1241,16 +1241,16 @@ pub mod consts { use os::consts::mips::*; pub mod x86 { - pub const ARCH: &'static str = "x86"; + pub static ARCH: &'static str = "x86"; } pub mod x86_64 { - pub const ARCH: &'static str = "x86_64"; + pub static ARCH: &'static str = "x86_64"; } pub mod arm { - pub const ARCH: &'static str = "arm"; + pub static ARCH: &'static str = "arm"; } pub mod mips { - pub const ARCH: &'static str = "mips"; + pub static ARCH: &'static str = "mips"; } } diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs index 710f2c51ee8..9cf3e4d6114 100644 --- a/src/libcore/pipes.rs +++ b/src/libcore/pipes.rs @@ -96,7 +96,7 @@ use task; use vec; #[doc(hidden)] -const SPIN_COUNT: uint = 0; +static SPIN_COUNT: uint = 0; macro_rules! move_it ( { $x:expr } => ( unsafe { let y = *ptr::addr_of(&($x)); y } ) diff --git a/src/libcore/rand.rs b/src/libcore/rand.rs index fbdda02dcdc..3085269f692 100644 --- a/src/libcore/rand.rs +++ b/src/libcore/rand.rs @@ -313,7 +313,7 @@ impl RngUtil for @Rng { let u1 = self.next() as f64; let u2 = self.next() as f64; let u3 = self.next() as f64; - const scale : f64 = (u32::max_value as f64) + 1.0f64; + static scale : f64 = (u32::max_value as f64) + 1.0f64; return ((u1 / scale + u2) / scale + u3) / scale; } diff --git a/src/libcore/rt/context.rs b/src/libcore/rt/context.rs index 4150366dacf..4798399d5e9 100644 --- a/src/libcore/rt/context.rs +++ b/src/libcore/rt/context.rs @@ -112,10 +112,10 @@ fn initialize_call_frame(regs: &mut Registers, fptr: *c_void, arg: *c_void, sp: *mut uint) { // Redefinitions from regs.h - const RUSTRT_ARG0: uint = 3; - const RUSTRT_RSP: uint = 1; - const RUSTRT_IP: uint = 8; - const RUSTRT_RBP: uint = 2; + static RUSTRT_ARG0: uint = 3; + static RUSTRT_RSP: uint = 1; + static RUSTRT_IP: uint = 8; + static RUSTRT_RBP: uint = 2; let sp = align_down(sp); let sp = mut_offset(sp, -1); diff --git a/src/libcore/rt/sched.rs b/src/libcore/rt/sched.rs index c2c4bedee81..0beadb30d42 100644 --- a/src/libcore/rt/sched.rs +++ b/src/libcore/rt/sched.rs @@ -282,7 +282,7 @@ pub impl Scheduler { } } -const TASK_MIN_STACK_SIZE: uint = 10000000; // XXX: Too much stack +static TASK_MIN_STACK_SIZE: uint = 10000000; // XXX: Too much stack pub struct Task { /// The task entry point, saved here for later destruction @@ -481,7 +481,7 @@ fn test_swap_tasks() { #[bench] #[test] #[ignore(reason = "long test")] fn test_run_a_lot_of_tasks_queued() { do run_in_bare_thread { - const MAX: int = 1000000; + static MAX: int = 1000000; let mut count = 0; let count_ptr: *mut int = &mut count; @@ -514,7 +514,7 @@ fn test_run_a_lot_of_tasks_queued() { #[bench] #[test] #[ignore(reason = "too much stack allocation")] fn test_run_a_lot_of_tasks_direct() { do run_in_bare_thread { - const MAX: int = 100000; + static MAX: int = 100000; let mut count = 0; let count_ptr: *mut int = &mut count; diff --git a/src/libcore/rt/thread_local_storage.rs b/src/libcore/rt/thread_local_storage.rs index e10551b6b89..5af8c79fd63 100644 --- a/src/libcore/rt/thread_local_storage.rs +++ b/src/libcore/rt/thread_local_storage.rs @@ -56,7 +56,7 @@ pub type Key = DWORD; #[cfg(windows)] pub unsafe fn create(key: &mut Key) { - const TLS_OUT_OF_INDEXES: DWORD = 0xFFFFFFFF; + static TLS_OUT_OF_INDEXES: DWORD = 0xFFFFFFFF; *key = unsafe { TlsAlloc() }; fail_unless!(*key != TLS_OUT_OF_INDEXES); } diff --git a/src/libcore/rt/uv.rs b/src/libcore/rt/uv.rs index 4d87bdb02e8..19ce04bd66b 100644 --- a/src/libcore/rt/uv.rs +++ b/src/libcore/rt/uv.rs @@ -396,7 +396,7 @@ pub impl TcpWatcher { data.connect_cb = Some(cb); unsafe { - const BACKLOG: c_int = 128; // XXX should be configurable + static BACKLOG: c_int = 128; // XXX should be configurable // XXX: This can probably fail fail_unless!(0 == uvll::listen(self.native_handle(), BACKLOG, connection_cb)); @@ -848,7 +848,7 @@ fn connect_read() { #[ignore(reason = "ffi struct issues")] fn listen() { do run_in_bare_thread() { - const MAX: int = 10; + static MAX: int = 10; let mut loop_ = Loop::new(); let mut server_tcp_watcher = { TcpWatcher::new(&mut loop_) }; let addr = Ipv4(127, 0, 0, 1, 2925); diff --git a/src/libcore/str.rs b/src/libcore/str.rs index fc4d1e387dd..f26d9ee3492 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -1907,26 +1907,26 @@ pub fn any_between(s: &str, start: uint, end: uint, } // UTF-8 tags and ranges -const tag_cont_u8: u8 = 128u8; -const tag_cont: uint = 128u; -const max_one_b: uint = 128u; -const tag_two_b: uint = 192u; -const max_two_b: uint = 2048u; -const tag_three_b: uint = 224u; -const max_three_b: uint = 65536u; -const tag_four_b: uint = 240u; -const max_four_b: uint = 2097152u; -const tag_five_b: uint = 248u; -const max_five_b: uint = 67108864u; -const tag_six_b: uint = 252u; +static tag_cont_u8: u8 = 128u8; +static tag_cont: uint = 128u; +static max_one_b: uint = 128u; +static tag_two_b: uint = 192u; +static max_two_b: uint = 2048u; +static tag_three_b: uint = 224u; +static max_three_b: uint = 65536u; +static tag_four_b: uint = 240u; +static max_four_b: uint = 2097152u; +static tag_five_b: uint = 248u; +static max_five_b: uint = 67108864u; +static tag_six_b: uint = 252u; // Constants used for converting strs to floats -pub const inf_buf: [u8*3] = ['i' as u8, 'n' as u8, 'f' as u8]; -pub const positive_inf_buf: [u8*4] = ['+' as u8, 'i' as u8, - 'n' as u8, 'f' as u8]; -pub const negative_inf_buf: [u8*4] = ['-' as u8, 'i' as u8, - 'n' as u8, 'f' as u8]; -pub const nan_buf: [u8*3] = ['N' as u8, 'a' as u8, 'N' as u8]; +pub static inf_buf: [u8*3] = ['i' as u8, 'n' as u8, 'f' as u8]; +pub static positive_inf_buf: [u8*4] = ['+' as u8, 'i' as u8, + 'n' as u8, 'f' as u8]; +pub static negative_inf_buf: [u8*4] = ['-' as u8, 'i' as u8, + 'n' as u8, 'f' as u8]; +pub static nan_buf: [u8*3] = ['N' as u8, 'a' as u8, 'N' as u8]; /** * Work with the byte buffer of a string. diff --git a/src/libcore/task/mod.rs b/src/libcore/task/mod.rs index a38b44afb51..a6646605b75 100644 --- a/src/libcore/task/mod.rs +++ b/src/libcore/task/mod.rs @@ -1160,7 +1160,7 @@ fn test_child_doesnt_ref_parent() { // climbing the task tree to dereference each ancestor. (See #1789) // (well, it would if the constant were 8000+ - I lowered it to be more // valgrind-friendly. try this at home, instead..!) - const generations: uint = 16; + static generations: uint = 16; fn child_no(x: uint) -> ~fn() { return || { if x < generations { diff --git a/src/libcore/trie.rs b/src/libcore/trie.rs index 653e29b62a5..40ef5fee47a 100644 --- a/src/libcore/trie.rs +++ b/src/libcore/trie.rs @@ -13,9 +13,9 @@ use prelude::*; // FIXME: #5244: need to manually update the TrieNode constructor -const SHIFT: uint = 4; -const SIZE: uint = 1 << SHIFT; -const MASK: uint = SIZE - 1; +static SHIFT: uint = 4; +static SIZE: uint = 1 << SHIFT; +static MASK: uint = SIZE - 1; enum Child { Internal(~TrieNode), diff --git a/src/libcore/unstable/extfmt.rs b/src/libcore/unstable/extfmt.rs index 2571dca1c96..029205f6bfa 100644 --- a/src/libcore/unstable/extfmt.rs +++ b/src/libcore/unstable/extfmt.rs @@ -687,12 +687,12 @@ pub mod rt { use uint; use vec; - pub const flag_none : u32 = 0u32; - pub const flag_left_justify : u32 = 0b00000000000001u32; - pub const flag_left_zero_pad : u32 = 0b00000000000010u32; - pub const flag_space_for_sign : u32 = 0b00000000000100u32; - pub const flag_sign_always : u32 = 0b00000000001000u32; - pub const flag_alternate : u32 = 0b00000000010000u32; + pub static flag_none : u32 = 0u32; + pub static flag_left_justify : u32 = 0b00000000000001u32; + pub static flag_left_zero_pad : u32 = 0b00000000000010u32; + pub static flag_space_for_sign : u32 = 0b00000000000100u32; + pub static flag_sign_always : u32 = 0b00000000001000u32; + pub static flag_alternate : u32 = 0b00000000010000u32; pub enum Count { CountIs(uint), CountImplied, } diff --git a/src/libcore/unstable/global.rs b/src/libcore/unstable/global.rs index 66033605559..32e1b35d7db 100644 --- a/src/libcore/unstable/global.rs +++ b/src/libcore/unstable/global.rs @@ -159,7 +159,7 @@ impl Drop for GlobalState { fn get_global_state() -> Exclusive { - const POISON: int = -1; + static POISON: int = -1; // FIXME #4728: Doing atomic_cxchg to initialize the global state // lazily, which wouldn't be necessary with a runtime written diff --git a/src/libcore/unstable/lang.rs b/src/libcore/unstable/lang.rs index db0b1cc33cd..ea5dfa0a530 100644 --- a/src/libcore/unstable/lang.rs +++ b/src/libcore/unstable/lang.rs @@ -22,9 +22,9 @@ use cast::transmute; pub type rust_task = c_void; #[cfg(target_word_size = "32")] -pub const FROZEN_BIT: uint = 0x80000000; +pub static FROZEN_BIT: uint = 0x80000000; #[cfg(target_word_size = "64")] -pub const FROZEN_BIT: uint = 0x8000000000000000; +pub static FROZEN_BIT: uint = 0x8000000000000000; pub mod rustrt { use libc::{c_char, uintptr_t}; diff --git a/src/libfuzzer/cycles.rs b/src/libfuzzer/cycles.rs index 7ea74b36940..dcf9a493c55 100644 --- a/src/libfuzzer/cycles.rs +++ b/src/libfuzzer/cycles.rs @@ -26,8 +26,8 @@ fn choice(r : rand::rng, v : ~[const T]) -> T { fn likelihood(r : rand::rng, k : uint, n : uint) -> bool { under(r, n) < k } -const iters : uint = 1000u; -const vlen : uint = 100u; +static iters : uint = 1000u; +static vlen : uint = 100u; enum maybe_pointy { none, diff --git a/src/librust/rust.rc b/src/librust/rust.rc index 3ca4ef5efbd..2ebc162eb6a 100644 --- a/src/librust/rust.rc +++ b/src/librust/rust.rc @@ -54,7 +54,7 @@ struct Command { usage_full: UsageSource/&self } -const commands: &'static [Command/&static] = &[ +static commands: &'static [Command/&static] = &[ Command{ cmd: "build", action: Exec("rustc"), @@ -199,7 +199,7 @@ fn do_command(command: &Command, args: &[~str]) -> ValidUsage { } fn usage() { - const indent: uint = 8; + static indent: uint = 8; io::print( "The rust tool is a convenience for managing rust source code.\n\ diff --git a/src/librustc/back/abi.rs b/src/librustc/back/abi.rs index 06625c1ddd9..70a029ede6f 100644 --- a/src/librustc/back/abi.rs +++ b/src/librustc/back/abi.rs @@ -11,64 +11,64 @@ -pub const rc_base_field_refcnt: uint = 0u; +pub static rc_base_field_refcnt: uint = 0u; -pub const task_field_refcnt: uint = 0u; +pub static task_field_refcnt: uint = 0u; -pub const task_field_stk: uint = 2u; +pub static task_field_stk: uint = 2u; -pub const task_field_runtime_sp: uint = 3u; +pub static task_field_runtime_sp: uint = 3u; -pub const task_field_rust_sp: uint = 4u; +pub static task_field_rust_sp: uint = 4u; -pub const task_field_gc_alloc_chain: uint = 5u; +pub static task_field_gc_alloc_chain: uint = 5u; -pub const task_field_dom: uint = 6u; +pub static task_field_dom: uint = 6u; -pub const n_visible_task_fields: uint = 7u; +pub static n_visible_task_fields: uint = 7u; -pub const dom_field_interrupt_flag: uint = 1u; +pub static dom_field_interrupt_flag: uint = 1u; -pub const frame_glue_fns_field_mark: uint = 0u; +pub static frame_glue_fns_field_mark: uint = 0u; -pub const frame_glue_fns_field_drop: uint = 1u; +pub static frame_glue_fns_field_drop: uint = 1u; -pub const frame_glue_fns_field_reloc: uint = 2u; +pub static frame_glue_fns_field_reloc: uint = 2u; -pub const box_field_refcnt: uint = 0u; -pub const box_field_tydesc: uint = 1u; -pub const box_field_prev: uint = 2u; -pub const box_field_next: uint = 3u; -pub const box_field_body: uint = 4u; +pub static box_field_refcnt: uint = 0u; +pub static box_field_tydesc: uint = 1u; +pub static box_field_prev: uint = 2u; +pub static box_field_next: uint = 3u; +pub static box_field_body: uint = 4u; -pub const general_code_alignment: uint = 16u; +pub static general_code_alignment: uint = 16u; -pub const tydesc_field_size: uint = 0u; -pub const tydesc_field_align: uint = 1u; -pub const tydesc_field_take_glue: uint = 2u; -pub const tydesc_field_drop_glue: uint = 3u; -pub const tydesc_field_free_glue: uint = 4u; -pub const tydesc_field_visit_glue: uint = 5u; -pub const tydesc_field_shape: uint = 6u; -pub const tydesc_field_shape_tables: uint = 7u; -pub const n_tydesc_fields: uint = 8u; +pub static tydesc_field_size: uint = 0u; +pub static tydesc_field_align: uint = 1u; +pub static tydesc_field_take_glue: uint = 2u; +pub static tydesc_field_drop_glue: uint = 3u; +pub static tydesc_field_free_glue: uint = 4u; +pub static tydesc_field_visit_glue: uint = 5u; +pub static tydesc_field_shape: uint = 6u; +pub static tydesc_field_shape_tables: uint = 7u; +pub static n_tydesc_fields: uint = 8u; // The two halves of a closure: code and environment. -pub const fn_field_code: uint = 0u; -pub const fn_field_box: uint = 1u; +pub static fn_field_code: uint = 0u; +pub static fn_field_box: uint = 1u; -pub const vec_elt_fill: uint = 0u; +pub static vec_elt_fill: uint = 0u; -pub const vec_elt_alloc: uint = 1u; +pub static vec_elt_alloc: uint = 1u; -pub const vec_elt_elems: uint = 2u; +pub static vec_elt_elems: uint = 2u; -pub const slice_elt_base: uint = 0u; -pub const slice_elt_len: uint = 1u; +pub static slice_elt_base: uint = 0u; +pub static slice_elt_len: uint = 1u; -pub const worst_case_glue_call_args: uint = 7u; +pub static worst_case_glue_call_args: uint = 7u; -pub const abi_version: uint = 1u; +pub static abi_version: uint = 1u; pub fn memcpy_glue_name() -> ~str { return ~"rust_memcpy_glue"; } diff --git a/src/librustc/driver/session.rs b/src/librustc/driver/session.rs index caf4689688b..28ebc3f424e 100644 --- a/src/librustc/driver/session.rs +++ b/src/librustc/driver/session.rs @@ -44,29 +44,29 @@ pub struct config { float_type: float_ty } -pub const verbose: uint = 1 << 0; -pub const time_passes: uint = 1 << 1; -pub const count_llvm_insns: uint = 1 << 2; -pub const time_llvm_passes: uint = 1 << 3; -pub const trans_stats: uint = 1 << 4; -pub const no_asm_comments: uint = 1 << 5; -pub const no_verify: uint = 1 << 6; -pub const trace: uint = 1 << 7; -pub const coherence: uint = 1 << 8; -pub const borrowck_stats: uint = 1 << 9; -pub const borrowck_note_pure: uint = 1 << 10; -pub const borrowck_note_loan: uint = 1 << 11; -pub const no_landing_pads: uint = 1 << 12; -pub const debug_llvm: uint = 1 << 13; -pub const count_type_sizes: uint = 1 << 14; -pub const meta_stats: uint = 1 << 15; -pub const no_opt: uint = 1 << 16; -pub const no_monomorphic_collapse: uint = 1 << 17; -pub const gc: uint = 1 << 18; -pub const jit: uint = 1 << 19; -pub const debug_info: uint = 1 << 20; -pub const extra_debug_info: uint = 1 << 21; -pub const static: uint = 1 << 22; +pub static verbose: uint = 1 << 0; +pub static time_passes: uint = 1 << 1; +pub static count_llvm_insns: uint = 1 << 2; +pub static time_llvm_passes: uint = 1 << 3; +pub static trans_stats: uint = 1 << 4; +pub static no_asm_comments: uint = 1 << 5; +pub static no_verify: uint = 1 << 6; +pub static trace: uint = 1 << 7; +pub static coherence: uint = 1 << 8; +pub static borrowck_stats: uint = 1 << 9; +pub static borrowck_note_pure: uint = 1 << 10; +pub static borrowck_note_loan: uint = 1 << 11; +pub static no_landing_pads: uint = 1 << 12; +pub static debug_llvm: uint = 1 << 13; +pub static count_type_sizes: uint = 1 << 14; +pub static meta_stats: uint = 1 << 15; +pub static no_opt: uint = 1 << 16; +pub static no_monomorphic_collapse: uint = 1 << 17; +pub static gc: uint = 1 << 18; +pub static jit: uint = 1 << 19; +pub static debug_info: uint = 1 << 20; +pub static extra_debug_info: uint = 1 << 21; +pub static static: uint = 1 << 22; pub fn debugging_opts_map() -> ~[(~str, ~str, uint)] { ~[(~"verbose", ~"in general, enable more debug printouts", verbose), diff --git a/src/librustc/front/core_inject.rs b/src/librustc/front/core_inject.rs index 0766dcd2450..6e134d25ff2 100644 --- a/src/librustc/front/core_inject.rs +++ b/src/librustc/front/core_inject.rs @@ -19,7 +19,7 @@ use syntax::codemap; use syntax::codemap::dummy_sp; use syntax::fold; -const CORE_VERSION: &'static str = "0.6"; +static CORE_VERSION: &'static str = "0.6"; pub fn maybe_inject_libcore_ref(sess: Session, crate: @ast::crate) -> @ast::crate { diff --git a/src/librustc/front/test.rs b/src/librustc/front/test.rs index d7c1bc9b2d3..40100531010 100644 --- a/src/librustc/front/test.rs +++ b/src/librustc/front/test.rs @@ -257,7 +257,7 @@ mod __test { std::test::test_main_static(::os::args(), tests) } - const tests : &'static [std::test::TestDescAndFn] = &[ + static tests : &'static [std::test::TestDescAndFn] = &[ ... the list of tests in the crate ... ]; } @@ -360,7 +360,7 @@ fn mk_tests(cx: &TestCtxt) -> @ast::item { let test_descs = mk_test_descs(cx); (quote_item!( - pub const tests : &'static [self::std::test::TestDescAndFn] = + pub static tests : &'static [self::std::test::TestDescAndFn] = $test_descs ; )).get() diff --git a/src/librustc/lib/llvm.rs b/src/librustc/lib/llvm.rs index 5cdfe6a49f7..e01c4ae7d72 100644 --- a/src/librustc/lib/llvm.rs +++ b/src/librustc/lib/llvm.rs @@ -20,8 +20,8 @@ use std::oldmap::HashMap; pub type Opcode = u32; pub type Bool = c_uint; -pub const True: Bool = 1 as Bool; -pub const False: Bool = 0 as Bool; +pub static True: Bool = 1 as Bool; +pub static False: Bool = 0 as Bool; // Consts for the LLVM CallConv type, pre-cast to uint. diff --git a/src/librustc/metadata/common.rs b/src/librustc/metadata/common.rs index 38b76c4ace2..920631a55b4 100644 --- a/src/librustc/metadata/common.rs +++ b/src/librustc/metadata/common.rs @@ -11,84 +11,84 @@ // EBML enum definitions and utils shared by the encoder and decoder -pub const tag_items: uint = 0x02u; +pub static tag_items: uint = 0x02u; -pub const tag_paths_data_name: uint = 0x04u; +pub static tag_paths_data_name: uint = 0x04u; -pub const tag_def_id: uint = 0x07u; +pub static tag_def_id: uint = 0x07u; -pub const tag_items_data: uint = 0x08u; +pub static tag_items_data: uint = 0x08u; -pub const tag_items_data_item: uint = 0x09u; +pub static tag_items_data_item: uint = 0x09u; -pub const tag_items_data_item_family: uint = 0x0au; +pub static tag_items_data_item_family: uint = 0x0au; -pub const tag_items_data_item_ty_param_bounds: uint = 0x0bu; +pub static tag_items_data_item_ty_param_bounds: uint = 0x0bu; -pub const tag_items_data_item_type: uint = 0x0cu; +pub static tag_items_data_item_type: uint = 0x0cu; -pub const tag_items_data_item_symbol: uint = 0x0du; +pub static tag_items_data_item_symbol: uint = 0x0du; -pub const tag_items_data_item_variant: uint = 0x0eu; +pub static tag_items_data_item_variant: uint = 0x0eu; -pub const tag_items_data_parent_item: uint = 0x0fu; +pub static tag_items_data_parent_item: uint = 0x0fu; -pub const tag_index: uint = 0x11u; +pub static tag_index: uint = 0x11u; -pub const tag_index_buckets: uint = 0x12u; +pub static tag_index_buckets: uint = 0x12u; -pub const tag_index_buckets_bucket: uint = 0x13u; +pub static tag_index_buckets_bucket: uint = 0x13u; -pub const tag_index_buckets_bucket_elt: uint = 0x14u; +pub static tag_index_buckets_bucket_elt: uint = 0x14u; -pub const tag_index_table: uint = 0x15u; +pub static tag_index_table: uint = 0x15u; -pub const tag_meta_item_name_value: uint = 0x18u; +pub static tag_meta_item_name_value: uint = 0x18u; -pub const tag_meta_item_name: uint = 0x19u; +pub static tag_meta_item_name: uint = 0x19u; -pub const tag_meta_item_value: uint = 0x20u; +pub static tag_meta_item_value: uint = 0x20u; -pub const tag_attributes: uint = 0x21u; +pub static tag_attributes: uint = 0x21u; -pub const tag_attribute: uint = 0x22u; +pub static tag_attribute: uint = 0x22u; -pub const tag_meta_item_word: uint = 0x23u; +pub static tag_meta_item_word: uint = 0x23u; -pub const tag_meta_item_list: uint = 0x24u; +pub static tag_meta_item_list: uint = 0x24u; // The list of crates that this crate depends on -pub const tag_crate_deps: uint = 0x25u; +pub static tag_crate_deps: uint = 0x25u; // A single crate dependency -pub const tag_crate_dep: uint = 0x26u; +pub static tag_crate_dep: uint = 0x26u; -pub const tag_crate_hash: uint = 0x28u; +pub static tag_crate_hash: uint = 0x28u; -pub const tag_parent_item: uint = 0x29u; +pub static tag_parent_item: uint = 0x29u; -pub const tag_crate_dep_name: uint = 0x2au; -pub const tag_crate_dep_hash: uint = 0x2bu; -pub const tag_crate_dep_vers: uint = 0x2cu; +pub static tag_crate_dep_name: uint = 0x2au; +pub static tag_crate_dep_hash: uint = 0x2bu; +pub static tag_crate_dep_vers: uint = 0x2cu; -pub const tag_mod_impl: uint = 0x30u; +pub static tag_mod_impl: uint = 0x30u; -pub const tag_item_trait_method: uint = 0x31u; -pub const tag_impl_trait: uint = 0x32u; +pub static tag_item_trait_method: uint = 0x31u; +pub static tag_impl_trait: uint = 0x32u; // discriminator value for variants -pub const tag_disr_val: uint = 0x34u; +pub static tag_disr_val: uint = 0x34u; // used to encode ast_map::path and ast_map::path_elt -pub const tag_path: uint = 0x40u; -pub const tag_path_len: uint = 0x41u; -pub const tag_path_elt_mod: uint = 0x42u; -pub const tag_path_elt_name: uint = 0x43u; -pub const tag_item_field: uint = 0x44u; -pub const tag_struct_mut: uint = 0x45u; +pub static tag_path: uint = 0x40u; +pub static tag_path_len: uint = 0x41u; +pub static tag_path_elt_mod: uint = 0x42u; +pub static tag_path_elt_name: uint = 0x43u; +pub static tag_item_field: uint = 0x44u; +pub static tag_struct_mut: uint = 0x45u; -pub const tag_region_param: uint = 0x46u; -pub const tag_mod_impl_trait: uint = 0x47u; +pub static tag_region_param: uint = 0x46u; +pub static tag_mod_impl_trait: uint = 0x47u; /* trait items contain tag_item_trait_method elements, impl items contain tag_item_impl_method elements, and classes @@ -97,16 +97,16 @@ pub const tag_mod_impl_trait: uint = 0x47u; both, tag_item_trait_method and tag_item_impl_method have to be two different tags. */ -pub const tag_item_impl_method: uint = 0x48u; -pub const tag_item_dtor: uint = 0x49u; -pub const tag_item_trait_method_self_ty: uint = 0x4b; -pub const tag_item_trait_method_self_ty_region: uint = 0x4c; +pub static tag_item_impl_method: uint = 0x48u; +pub static tag_item_dtor: uint = 0x49u; +pub static tag_item_trait_method_self_ty: uint = 0x4b; +pub static tag_item_trait_method_self_ty_region: uint = 0x4c; // Reexports are found within module tags. Each reexport contains def_ids // and names. -pub const tag_items_data_item_reexport: uint = 0x4d; -pub const tag_items_data_item_reexport_def_id: uint = 0x4e; -pub const tag_items_data_item_reexport_name: uint = 0x4f; +pub static tag_items_data_item_reexport: uint = 0x4d; +pub static tag_items_data_item_reexport_def_id: uint = 0x4e; +pub static tag_items_data_item_reexport_name: uint = 0x4f; // used to encode crate_ctxt side tables pub enum astencode_tag { // Reserves 0x50 -- 0x6f @@ -136,9 +136,9 @@ pub enum astencode_tag { // Reserves 0x50 -- 0x6f tag_table_capture_map = 0x64 } -pub const tag_item_trait_method_sort: uint = 0x70; +pub static tag_item_trait_method_sort: uint = 0x70; -pub const tag_item_impl_type_basename: uint = 0x71; +pub static tag_item_impl_type_basename: uint = 0x71; // Language items are a top-level directory (for speed). Hierarchy: // @@ -147,17 +147,17 @@ pub const tag_item_impl_type_basename: uint = 0x71; // - tag_lang_items_item_id: u32 // - tag_lang_items_item_node_id: u32 -pub const tag_lang_items: uint = 0x72; -pub const tag_lang_items_item: uint = 0x73; -pub const tag_lang_items_item_id: uint = 0x74; -pub const tag_lang_items_item_node_id: uint = 0x75; +pub static tag_lang_items: uint = 0x72; +pub static tag_lang_items_item: uint = 0x73; +pub static tag_lang_items_item_id: uint = 0x74; +pub static tag_lang_items_item_node_id: uint = 0x75; -pub const tag_item_unnamed_field: uint = 0x76; -pub const tag_items_data_item_struct_ctor: uint = 0x77; -pub const tag_items_data_item_visibility: uint = 0x78; +pub static tag_item_unnamed_field: uint = 0x76; +pub static tag_items_data_item_struct_ctor: uint = 0x77; +pub static tag_items_data_item_visibility: uint = 0x78; -pub const tag_link_args: uint = 0x79; -pub const tag_link_args_arg: uint = 0x7a; +pub static tag_link_args: uint = 0x79; +pub static tag_link_args_arg: uint = 0x7a; pub struct LinkMeta { name: @str, diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index 6bb10a42f3e..ccc29fbbccb 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -1313,7 +1313,7 @@ fn encode_hash(ebml_w: writer::Encoder, hash: &str) { } // NB: Increment this as you change the metadata encoding version. -pub const metadata_encoding_version : &'static [u8] = +pub static metadata_encoding_version : &'static [u8] = &[0x72, //'r' as u8, 0x75, //'u' as u8, 0x73, //'s' as u8, diff --git a/src/librustc/middle/kind.rs b/src/librustc/middle/kind.rs index ef8857d444a..75247e78aca 100644 --- a/src/librustc/middle/kind.rs +++ b/src/librustc/middle/kind.rs @@ -58,7 +58,7 @@ use syntax::{visit, ast_util}; use core::hashmap::linear::LinearSet; -pub const try_adding: &'static str = "Try adding a move"; +pub static try_adding: &'static str = "Try adding a move"; pub type rval_map = HashMap; diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index 0959e2eb093..e3a595a8552 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -653,9 +653,9 @@ struct Specials { no_ret_var: Variable } -const ACC_READ: uint = 1u; -const ACC_WRITE: uint = 2u; -const ACC_USE: uint = 4u; +static ACC_READ: uint = 1u; +static ACC_WRITE: uint = 2u; +static ACC_USE: uint = 4u; type LiveNodeMap = HashMap; diff --git a/src/librustc/middle/trans/build.rs b/src/librustc/middle/trans/build.rs index 0933cf6c8e5..5e5cbc9f971 100644 --- a/src/librustc/middle/trans/build.rs +++ b/src/librustc/middle/trans/build.rs @@ -178,7 +178,7 @@ pub fn IndirectBr(cx: block, Addr: ValueRef, NumDests: uint) { // lot more efficient) than doing str::as_c_str("", ...) every time. pub fn noname() -> *libc::c_char { unsafe { - const cnull: uint = 0u; + static cnull: uint = 0u; return cast::reinterpret_cast(&ptr::addr_of(&cnull)); } } diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs index c220bd23e20..0b7d6f5c39b 100644 --- a/src/librustc/middle/trans/common.rs +++ b/src/librustc/middle/trans/common.rs @@ -76,8 +76,8 @@ pub type addrspace = c_uint; // 0 is ignored by the GC, and is used for all non-GC'd pointers. // 1 is for opaque GC'd boxes. // >= 2 are for specific types (e.g. resources). -pub const default_addrspace: addrspace = 0; -pub const gc_box_addrspace: addrspace = 1; +pub static default_addrspace: addrspace = 0; +pub static gc_box_addrspace: addrspace = 1; pub type addrspace_gen = @fn() -> addrspace; pub fn new_addrspace_gen() -> addrspace_gen { @@ -615,7 +615,7 @@ pub fn mk_block(llbb: BasicBlockRef, parent: Option, +kind: block_kind, } // First two args are retptr, env -pub const first_real_arg: uint = 2u; +pub static first_real_arg: uint = 2u; pub struct Result { bcx: block, diff --git a/src/librustc/middle/trans/consts.rs b/src/librustc/middle/trans/consts.rs index 884bfd219ab..ea34df54462 100644 --- a/src/librustc/middle/trans/consts.rs +++ b/src/librustc/middle/trans/consts.rs @@ -179,7 +179,7 @@ pub fn const_expr(cx: @CrateContext, e: @ast::expr) -> ValueRef { llconst = C_struct(~[llconst, C_null(T_opaque_box_ptr(cx))]) } Some(@ty::AutoAddEnv(ref r, ref s)) => { - cx.sess.span_bug(e.span, fmt!("unexpected const function: \ + cx.sess.span_bug(e.span, fmt!("unexpected static function: \ region %? sigil %?", *r, *s)) } Some(@ty::AutoDerefRef(ref adj)) => { diff --git a/src/librustc/middle/trans/debuginfo.rs b/src/librustc/middle/trans/debuginfo.rs index c575465ddf7..505c08fc8b8 100644 --- a/src/librustc/middle/trans/debuginfo.rs +++ b/src/librustc/middle/trans/debuginfo.rs @@ -29,32 +29,32 @@ use syntax::codemap::{span, CharPos}; use syntax::parse::token::ident_interner; use syntax::{ast, codemap, ast_util, ast_map}; -const LLVMDebugVersion: int = (9 << 16); +static LLVMDebugVersion: int = (9 << 16); -const DW_LANG_RUST: int = 0x9000; -const DW_VIRTUALITY_none: int = 0; +static DW_LANG_RUST: int = 0x9000; +static DW_VIRTUALITY_none: int = 0; -const CompileUnitTag: int = 17; -const FileDescriptorTag: int = 41; -const SubprogramTag: int = 46; -const SubroutineTag: int = 21; -const BasicTypeDescriptorTag: int = 36; -const AutoVariableTag: int = 256; -const ArgVariableTag: int = 257; -const ReturnVariableTag: int = 258; -const LexicalBlockTag: int = 11; -const PointerTypeTag: int = 15; -const StructureTypeTag: int = 19; -const MemberTag: int = 13; -const ArrayTypeTag: int = 1; -const SubrangeTag: int = 33; +static CompileUnitTag: int = 17; +static FileDescriptorTag: int = 41; +static SubprogramTag: int = 46; +static SubroutineTag: int = 21; +static BasicTypeDescriptorTag: int = 36; +static AutoVariableTag: int = 256; +static ArgVariableTag: int = 257; +static ReturnVariableTag: int = 258; +static LexicalBlockTag: int = 11; +static PointerTypeTag: int = 15; +static StructureTypeTag: int = 19; +static MemberTag: int = 13; +static ArrayTypeTag: int = 1; +static SubrangeTag: int = 33; -const DW_ATE_boolean: int = 0x02; -const DW_ATE_float: int = 0x04; -const DW_ATE_signed: int = 0x05; -const DW_ATE_signed_char: int = 0x06; -const DW_ATE_unsigned: int = 0x07; -const DW_ATE_unsigned_char: int = 0x08; +static DW_ATE_boolean: int = 0x02; +static DW_ATE_float: int = 0x04; +static DW_ATE_signed: int = 0x05; +static DW_ATE_signed_char: int = 0x06; +static DW_ATE_unsigned: int = 0x07; +static DW_ATE_unsigned_char: int = 0x08; fn llstr(s: &str) -> ValueRef { do str::as_c_str(s) |sbuf| { diff --git a/src/librustc/middle/trans/type_use.rs b/src/librustc/middle/trans/type_use.rs index 77e10b2fbda..45cf790ccee 100644 --- a/src/librustc/middle/trans/type_use.rs +++ b/src/librustc/middle/trans/type_use.rs @@ -47,9 +47,9 @@ use syntax::ast_util; use syntax::visit; pub type type_uses = uint; // Bitmask -pub const use_repr: uint = 1u; /* Dependency on size/alignment/mode and - take/drop glue */ -pub const use_tydesc: uint = 2u; /* Takes the tydesc, or compares */ +pub static use_repr: uint = 1u; /* Dependency on size/alignment/mode and + take/drop glue */ +pub static use_tydesc: uint = 2u; /* Takes the tydesc, or compares */ pub struct Context { ccx: @CrateContext, diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index cbd2ad86b75..de626675fa3 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -1801,43 +1801,43 @@ impl ToStr for TypeContents { } /// Constant for a type containing nothing of interest. -const TC_NONE: TypeContents = TypeContents{bits:0b0000_00000000}; +static TC_NONE: TypeContents = TypeContents{bits:0b0000_00000000}; /// Contains a borrowed value with a lifetime other than static -const TC_BORROWED_POINTER: TypeContents = TypeContents{bits:0b0000_00000001}; +static TC_BORROWED_POINTER: TypeContents = TypeContents{bits:0b0000_00000001}; /// Contains an owned pointer (~T) but not slice of some kind -const TC_OWNED_POINTER: TypeContents = TypeContents{bits:0b000000000010}; +static TC_OWNED_POINTER: TypeContents = TypeContents{bits:0b000000000010}; /// Contains an owned vector ~[] or owned string ~str -const TC_OWNED_VEC: TypeContents = TypeContents{bits:0b000000000100}; +static TC_OWNED_VEC: TypeContents = TypeContents{bits:0b000000000100}; /// Contains a ~fn() or a ~Trait, which is non-copyable. -const TC_OWNED_CLOSURE: TypeContents = TypeContents{bits:0b000000001000}; +static TC_OWNED_CLOSURE: TypeContents = TypeContents{bits:0b000000001000}; /// Type with a destructor -const TC_DTOR: TypeContents = TypeContents{bits:0b000000010000}; +static TC_DTOR: TypeContents = TypeContents{bits:0b000000010000}; /// Contains a managed value -const TC_MANAGED: TypeContents = TypeContents{bits:0b000000100000}; +static TC_MANAGED: TypeContents = TypeContents{bits:0b000000100000}; /// &mut with any region -const TC_BORROWED_MUT: TypeContents = TypeContents{bits:0b000001000000}; +static TC_BORROWED_MUT: TypeContents = TypeContents{bits:0b000001000000}; /// Mutable content, whether owned or by ref -const TC_MUTABLE: TypeContents = TypeContents{bits:0b000010000000}; +static TC_MUTABLE: TypeContents = TypeContents{bits:0b000010000000}; /// Mutable content, whether owned or by ref -const TC_ONCE_CLOSURE: TypeContents = TypeContents{bits:0b000100000000}; +static TC_ONCE_CLOSURE: TypeContents = TypeContents{bits:0b000100000000}; /// Something we estimate to be "big" -const TC_BIG: TypeContents = TypeContents{bits:0b001000000000}; +static TC_BIG: TypeContents = TypeContents{bits:0b001000000000}; /// An enum with no variants. -const TC_EMPTY_ENUM: TypeContents = TypeContents{bits:0b010000000000}; +static TC_EMPTY_ENUM: TypeContents = TypeContents{bits:0b010000000000}; /// All possible contents. -const TC_ALL: TypeContents = TypeContents{bits:0b011111111111}; +static TC_ALL: TypeContents = TypeContents{bits:0b011111111111}; pub fn type_is_copyable(cx: ctxt, t: ty::t) -> bool { type_contents(cx, t).is_copy(cx) @@ -4076,21 +4076,21 @@ fn struct_item_fields(cx:ctxt, } pub fn is_binopable(_cx: ctxt, ty: t, op: ast::binop) -> bool { - const tycat_other: int = 0; - const tycat_bool: int = 1; - const tycat_int: int = 2; - const tycat_float: int = 3; - const tycat_struct: int = 4; - const tycat_bot: int = 5; + static tycat_other: int = 0; + static tycat_bool: int = 1; + static tycat_int: int = 2; + static tycat_float: int = 3; + static tycat_struct: int = 4; + static tycat_bot: int = 5; - const opcat_add: int = 0; - const opcat_sub: int = 1; - const opcat_mult: int = 2; - const opcat_shift: int = 3; - const opcat_rel: int = 4; - const opcat_eq: int = 5; - const opcat_bit: int = 6; - const opcat_logic: int = 7; + static opcat_add: int = 0; + static opcat_sub: int = 1; + static opcat_mult: int = 2; + static opcat_shift: int = 3; + static opcat_rel: int = 4; + static opcat_eq: int = 5; + static opcat_bit: int = 6; + static opcat_logic: int = 7; fn opcat(op: ast::binop) -> int { match op { @@ -4126,8 +4126,8 @@ pub fn is_binopable(_cx: ctxt, ty: t, op: ast::binop) -> bool { } } - const t: bool = true; - const f: bool = false; + static t: bool = true; + static f: bool = false; let tbl = ~[ /*. add, shift, bit diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs index e259fdaf400..c288151308f 100644 --- a/src/librustc/middle/typeck/astconv.rs +++ b/src/librustc/middle/typeck/astconv.rs @@ -202,8 +202,8 @@ pub fn ast_path_to_ty( ty_param_substs_and_ty { substs: substs, ty: ty } } -pub const NO_REGIONS: uint = 1; -pub const NO_TPS: uint = 2; +pub static NO_REGIONS: uint = 1; +pub static NO_TPS: uint = 2; // Parses the programmer's textual representation of a type into our // internal notion of a type. `getter` is a function that returns the type diff --git a/src/librustc/middle/typeck/infer/resolve.rs b/src/librustc/middle/typeck/infer/resolve.rs index 1d9594d930c..038dc524bec 100644 --- a/src/librustc/middle/typeck/infer/resolve.rs +++ b/src/librustc/middle/typeck/infer/resolve.rs @@ -62,23 +62,23 @@ use syntax::ast; use core::vec; -pub const resolve_nested_tvar: uint = 0b0000000001; -pub const resolve_rvar: uint = 0b0000000010; -pub const resolve_ivar: uint = 0b0000000100; -pub const resolve_fvar: uint = 0b0000001000; -pub const resolve_fnvar: uint = 0b0000010000; -pub const resolve_all: uint = 0b0000011111; -pub const force_tvar: uint = 0b0000100000; -pub const force_rvar: uint = 0b0001000000; -pub const force_ivar: uint = 0b0010000000; -pub const force_fvar: uint = 0b0100000000; -pub const force_fnvar: uint = 0b1000000000; -pub const force_all: uint = 0b1111100000; +pub static resolve_nested_tvar: uint = 0b0000000001; +pub static resolve_rvar: uint = 0b0000000010; +pub static resolve_ivar: uint = 0b0000000100; +pub static resolve_fvar: uint = 0b0000001000; +pub static resolve_fnvar: uint = 0b0000010000; +pub static resolve_all: uint = 0b0000011111; +pub static force_tvar: uint = 0b0000100000; +pub static force_rvar: uint = 0b0001000000; +pub static force_ivar: uint = 0b0010000000; +pub static force_fvar: uint = 0b0100000000; +pub static force_fnvar: uint = 0b1000000000; +pub static force_all: uint = 0b1111100000; -pub const not_regions: uint = !(force_rvar | resolve_rvar); +pub static not_regions: uint = !(force_rvar | resolve_rvar); -pub const try_resolve_tvar_shallow: uint = 0; -pub const resolve_and_force_all_but_regions: uint = +pub static try_resolve_tvar_shallow: uint = 0; +pub static resolve_and_force_all_but_regions: uint = (resolve_all | force_all) & not_regions; pub struct ResolveState { diff --git a/src/librustc/middle/typeck/infer/test.rs b/src/librustc/middle/typeck/infer/test.rs index 867bcc30fa4..6a4def65fe7 100644 --- a/src/librustc/middle/typeck/infer/test.rs +++ b/src/librustc/middle/typeck/infer/test.rs @@ -47,7 +47,7 @@ struct RH { sub: &[RH] } -const EMPTY_SOURCE_STR: &str = "/* Hello, world! */"; +static EMPTY_SOURCE_STR: &str = "/* Hello, world! */"; fn setup_env(test_name: &str, source_string: &str) -> Env { let messages = @DVec(); diff --git a/src/librustdoc/demo.rs b/src/librustdoc/demo.rs index ad57af8942d..c5fb8f289f6 100644 --- a/src/librustdoc/demo.rs +++ b/src/librustdoc/demo.rs @@ -24,7 +24,7 @@ use core::prelude::*; /// The base price of a muffin on a non-holiday -const price_of_a_muffin: float = 70f; +static price_of_a_muffin: float = 70f; struct WaitPerson { hair_color: ~str diff --git a/src/librustdoc/desc_to_brief_pass.rs b/src/librustdoc/desc_to_brief_pass.rs index 281c318eb15..957b94d18f5 100644 --- a/src/librustdoc/desc_to_brief_pass.rs +++ b/src/librustdoc/desc_to_brief_pass.rs @@ -127,8 +127,7 @@ fn extract(desc: Option<~str>) -> Option<~str> { } fn parse_desc(desc: ~str) -> Option<~str> { - - const max_brief_len: uint = 120u; + static max_brief_len: uint = 120u; match first_sentence(copy desc) { Some(first_sentence) => { diff --git a/src/librustdoc/extract.rs b/src/librustdoc/extract.rs index 5e5c843da26..942dd3e01cb 100644 --- a/src/librustdoc/extract.rs +++ b/src/librustdoc/extract.rs @@ -184,7 +184,7 @@ fn constdoc_from_const(itemdoc: doc::ItemDoc) -> doc::ConstDoc { #[test] fn should_extract_const_name_and_id() { - let doc = test::mk_doc(~"const a: int = 0;"); + let doc = test::mk_doc(~"static a: int = 0;"); fail_unless!(doc.cratemod().consts()[0].id() != 0); fail_unless!(doc.cratemod().consts()[0].name() == ~"a"); } diff --git a/src/librustdoc/fold.rs b/src/librustdoc/fold.rs index e9d9732d51f..2cd9ef3671d 100644 --- a/src/librustdoc/fold.rs +++ b/src/librustdoc/fold.rs @@ -378,7 +378,7 @@ fn default_fold_should_produce_same_doc() { #[test] fn default_fold_should_produce_same_consts() { - let source = ~"const a: int = 0;"; + let source = ~"static a: int = 0;"; let ast = parse::from_str(source); let doc = extract::extract(ast, ~""); let fld = default_seq_fold(()); diff --git a/src/librustdoc/markdown_pass.rs b/src/librustdoc/markdown_pass.rs index 227eb25aa81..73f3aa53c25 100644 --- a/src/librustdoc/markdown_pass.rs +++ b/src/librustdoc/markdown_pass.rs @@ -594,7 +594,7 @@ fn write_const( #[test] fn should_write_const_header() { - let markdown = test::render(~"const a: bool = true;"); + let markdown = test::render(~"static a: bool = true;"); fail_unless!(str::contains(markdown, ~"## Const `a`\n\n")); } @@ -602,7 +602,7 @@ fn should_write_const_header() { fn should_write_const_description() { let markdown = test::render( ~"#[doc = \"b\"]\ - const a: bool = true;"); + static a: bool = true;"); fail_unless!(str::contains(markdown, ~"\n\nb\n\n")); } diff --git a/src/librustdoc/sort_item_type_pass.rs b/src/librustdoc/sort_item_type_pass.rs index 96727f6386d..5919f1b0c2f 100644 --- a/src/librustdoc/sort_item_type_pass.rs +++ b/src/librustdoc/sort_item_type_pass.rs @@ -45,7 +45,7 @@ fn test() { ~"mod imod { } \ extern mod inmod { } \ - const iconst: int = 0; \ + static iconst: int = 0; \ fn ifn() { } \ enum ienum { ivar } \ trait itrait { fn a(); } \ diff --git a/src/librustdoc/tystr_pass.rs b/src/librustdoc/tystr_pass.rs index 638274d0bb8..1472f6777b4 100644 --- a/src/librustdoc/tystr_pass.rs +++ b/src/librustdoc/tystr_pass.rs @@ -121,7 +121,7 @@ fn fold_const( #[test] fn should_add_const_types() { - let doc = test::mk_doc(~"const a: bool = true;"); + let doc = test::mk_doc(~"static a: bool = true;"); fail_unless!(doc.cratemod().consts()[0].sig == Some(~"bool")); } diff --git a/src/librustpkg/util.rs b/src/librustpkg/util.rs index 0572cf771db..8e5d7e95ae1 100644 --- a/src/librustpkg/util.rs +++ b/src/librustpkg/util.rs @@ -139,7 +139,7 @@ fn add_pkg_module(ctx: @mut ReadyCtx, m: ast::_mod) -> ast::_mod { let item = quote_item! ( mod __pkg { extern mod rustpkg (vers="0.6"); - const listeners : &[rustpkg::Listener] = $listeners; + static listeners : &[rustpkg::Listener] = $listeners; #[main] fn main() { rustpkg::run(listeners); diff --git a/src/libstd/arena.rs b/src/libstd/arena.rs index d76438dd89b..a26132d92ca 100644 --- a/src/libstd/arena.rs +++ b/src/libstd/arena.rs @@ -68,7 +68,7 @@ pub mod rustrt { // This probably belongs somewhere else. Needs to be kept in sync with // changes to glue... -const tydesc_drop_glue_index: size_t = 3 as size_t; +static tydesc_drop_glue_index: size_t = 3 as size_t; // The way arena uses arrays is really deeply awful. The arrays are // allocated, and have capacities reserved, but the fill for the array diff --git a/src/libstd/bigint.rs b/src/libstd/bigint.rs index 309925e7cf9..564afea9f08 100644 --- a/src/libstd/bigint.rs +++ b/src/libstd/bigint.rs @@ -44,14 +44,14 @@ pub mod BigDigit { #[cfg(target_arch = "x86")] #[cfg(target_arch = "arm")] #[cfg(target_arch = "mips")] - pub const bits: uint = 16; + pub static bits: uint = 16; #[cfg(target_arch = "x86_64")] - pub const bits: uint = 32; + pub static bits: uint = 32; - pub const base: uint = 1 << bits; - priv const hi_mask: uint = (-1 as uint) << bits; - priv const lo_mask: uint = (-1 as uint) >> bits; + pub static base: uint = 1 << bits; + priv static hi_mask: uint = (-1 as uint) << bits; + priv static lo_mask: uint = (-1 as uint) >> bits; priv fn get_hi(n: uint) -> BigDigit { (n >> bits) as BigDigit } priv fn get_lo(n: uint) -> BigDigit { (n & lo_mask) as BigDigit } @@ -1046,9 +1046,9 @@ mod biguint_tests { fail_unless!(BigUint::new(~[0, 0, -1]).to_uint() == uint::max_value); } - const sum_triples: &'static [(&'static [BigDigit], - &'static [BigDigit], - &'static [BigDigit])] = &[ + static sum_triples: &'static [(&'static [BigDigit], + &'static [BigDigit], + &'static [BigDigit])] = &[ (&[], &[], &[]), (&[], &[ 1], &[ 1]), (&[ 1], &[ 1], &[ 2]), @@ -1086,9 +1086,9 @@ mod biguint_tests { } } - const mul_triples: &'static [(&'static [BigDigit], - &'static [BigDigit], - &'static [BigDigit])] = &[ + static mul_triples: &'static [(&'static [BigDigit], + &'static [BigDigit], + &'static [BigDigit])] = &[ (&[], &[], &[]), (&[], &[ 1], &[]), (&[ 2], &[], &[]), @@ -1112,10 +1112,10 @@ mod biguint_tests { (&[ 0, 0, 1], &[ 0, 0, 0, 1], &[0, 0, 0, 0, 0, 1]) ]; - const divmod_quadruples: &'static [(&'static [BigDigit], - &'static [BigDigit], - &'static [BigDigit], - &'static [BigDigit])] + static divmod_quadruples: &'static [(&'static [BigDigit], + &'static [BigDigit], + &'static [BigDigit], + &'static [BigDigit])] = &[ (&[ 1], &[ 2], &[], &[1]), (&[ 1, 1], &[ 2], &[-1/2+1], &[1]), @@ -1400,9 +1400,9 @@ mod bigint_tests { ).to_uint() == 0); } - const sum_triples: &'static [(&'static [BigDigit], - &'static [BigDigit], - &'static [BigDigit])] = &[ + static sum_triples: &'static [(&'static [BigDigit], + &'static [BigDigit], + &'static [BigDigit])] = &[ (&[], &[], &[]), (&[], &[ 1], &[ 1]), (&[ 1], &[ 1], &[ 2]), @@ -1452,9 +1452,9 @@ mod bigint_tests { } } - const mul_triples: &'static [(&'static [BigDigit], - &'static [BigDigit], - &'static [BigDigit])] = &[ + static mul_triples: &'static [(&'static [BigDigit], + &'static [BigDigit], + &'static [BigDigit])] = &[ (&[], &[], &[]), (&[], &[ 1], &[]), (&[ 2], &[], &[]), @@ -1478,10 +1478,10 @@ mod bigint_tests { (&[ 0, 0, 1], &[ 0, 0, 0, 1], &[0, 0, 0, 0, 0, 1]) ]; - const divmod_quadruples: &'static [(&'static [BigDigit], - &'static [BigDigit], - &'static [BigDigit], - &'static [BigDigit])] + static divmod_quadruples: &'static [(&'static [BigDigit], + &'static [BigDigit], + &'static [BigDigit], + &'static [BigDigit])] = &[ (&[ 1], &[ 2], &[], &[1]), (&[ 1, 1], &[ 2], &[-1/2+1], &[1]), diff --git a/src/libstd/bitv.rs b/src/libstd/bitv.rs index 270a2c1fc1b..3acc95a3aad 100644 --- a/src/libstd/bitv.rs +++ b/src/libstd/bitv.rs @@ -877,7 +877,7 @@ mod tests { use core::vec; use core::rand; - const bench_bits : uint = 1 << 14; + static bench_bits : uint = 1 << 14; #[test] pub fn test_to_str() { diff --git a/src/libstd/cmp.rs b/src/libstd/cmp.rs index 6fd77de0342..93a2f4e2acc 100644 --- a/src/libstd/cmp.rs +++ b/src/libstd/cmp.rs @@ -14,7 +14,7 @@ use core::f32; use core::f64; use core::float; -pub const FUZZY_EPSILON: float = 1.0e-6; +pub static FUZZY_EPSILON: float = 1.0e-6; pub trait FuzzyEq { fn fuzzy_eq(&self, other: &Self) -> bool; diff --git a/src/libstd/deque.rs b/src/libstd/deque.rs index 4f61321b4e7..e6fcbdc84c8 100644 --- a/src/libstd/deque.rs +++ b/src/libstd/deque.rs @@ -14,7 +14,7 @@ use core::container::{Container, Mutable}; use core::prelude::*; use core::vec; -const initial_capacity: uint = 32u; // 2^5 +static initial_capacity: uint = 32u; // 2^5 pub struct Deque { priv nelts: uint, diff --git a/src/libstd/ebml.rs b/src/libstd/ebml.rs index 437ab561f95..92898af2993 100644 --- a/src/libstd/ebml.rs +++ b/src/libstd/ebml.rs @@ -545,7 +545,7 @@ pub mod writer { // Set to true to generate more debugging in EBML code. // Totally lame approach. - const debug: bool = false; + static debug: bool = false; priv impl Encoder { // used internally to emit things like the vector length and so on diff --git a/src/libstd/flatpipes.rs b/src/libstd/flatpipes.rs index 9855e803ccb..01d672c9b26 100644 --- a/src/libstd/flatpipes.rs +++ b/src/libstd/flatpipes.rs @@ -254,7 +254,7 @@ pub trait ByteChan { fn send(&self, val: ~[u8]); } -const CONTINUE: [u8 * 4] = [0xAA, 0xBB, 0xCC, 0xDD]; +static CONTINUE: [u8 * 4] = [0xAA, 0xBB, 0xCC, 0xDD]; impl,P:BytePort> GenericPort for FlatPort { fn recv(&self) -> T { @@ -921,7 +921,7 @@ mod test { } fn test_try_recv_none3(loader: PortLoader

) { - const 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 @@ mod test { fn test_try_recv_none4(+loader: PortLoader

) { fail_unless!(do task::try || { - const 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( diff --git a/src/libstd/oldmap.rs b/src/libstd/oldmap.rs index 0b688f0c678..02c610e4854 100644 --- a/src/libstd/oldmap.rs +++ b/src/libstd/oldmap.rs @@ -51,7 +51,7 @@ pub mod chained { use core::uint; use core::vec; - const initial_capacity: uint = 32u; // 2^5 + static initial_capacity: uint = 32u; // 2^5 struct Entry { hash: uint, diff --git a/src/libstd/par.rs b/src/libstd/par.rs index 17ae48e03b9..6f69ac4e1bd 100644 --- a/src/libstd/par.rs +++ b/src/libstd/par.rs @@ -22,10 +22,10 @@ use future_spawn = future::spawn; * The maximum number of tasks this module will spawn for a single * operation. */ -const max_tasks : uint = 32u; +static max_tasks : uint = 32u; /// The minimum number of elements each task will process. -const min_granularity : uint = 1024u; +static min_granularity : uint = 1024u; /** * An internal helper to map a function over a large vector and diff --git a/src/libstd/rope.rs b/src/libstd/rope.rs index c9ad762880c..51cf08c8ca1 100644 --- a/src/libstd/rope.rs +++ b/src/libstd/rope.rs @@ -636,14 +636,14 @@ pub mod node { * * This is not a strict value */ - pub const hint_max_leaf_char_len: uint = 256u; + pub static hint_max_leaf_char_len: uint = 256u; /** * The maximal height that _should_ be permitted in a tree. * * This is not a strict value */ - pub const hint_max_node_height: uint = 16u; + pub static hint_max_node_height: uint = 16u; /** * Adopt a string as a node. diff --git a/src/libstd/sha1.rs b/src/libstd/sha1.rs index 077ab191e69..64399defd54 100644 --- a/src/libstd/sha1.rs +++ b/src/libstd/sha1.rs @@ -53,13 +53,13 @@ trait Sha1 { } // Some unexported constants -const digest_buf_len: uint = 5u; -const msg_block_len: uint = 64u; -const work_buf_len: uint = 80u; -const k0: u32 = 0x5A827999u32; -const k1: u32 = 0x6ED9EBA1u32; -const k2: u32 = 0x8F1BBCDCu32; -const k3: u32 = 0xCA62C1D6u32; +static digest_buf_len: uint = 5u; +static msg_block_len: uint = 64u; +static work_buf_len: uint = 80u; +static k0: u32 = 0x5A827999u32; +static k1: u32 = 0x6ED9EBA1u32; +static k2: u32 = 0x8F1BBCDCu32; +static k3: u32 = 0xCA62C1D6u32; /// Construct a `sha` object diff --git a/src/libstd/sort.rs b/src/libstd/sort.rs index 8ab2c40116a..33f585d32fc 100644 --- a/src/libstd/sort.rs +++ b/src/libstd/sort.rs @@ -177,9 +177,9 @@ impl Sort for &'self mut [T] { fn qsort(self) { quick_sort3(self); } } -const MIN_MERGE: uint = 64; -const MIN_GALLOP: uint = 7; -const INITIAL_TMP_STORAGE: uint = 128; +static MIN_MERGE: uint = 64; +static MIN_GALLOP: uint = 7; +static INITIAL_TMP_STORAGE: uint = 128; pub fn tim_sort(array: &mut [T]) { let size = array.len(); diff --git a/src/libstd/term.rs b/src/libstd/term.rs index 2a8c8b3b06b..a6c8884e05d 100644 --- a/src/libstd/term.rs +++ b/src/libstd/term.rs @@ -17,24 +17,24 @@ use core::vec; // FIXME (#2807): Windows support. -pub const color_black: u8 = 0u8; -pub const color_red: u8 = 1u8; -pub const color_green: u8 = 2u8; -pub const color_yellow: u8 = 3u8; -pub const color_blue: u8 = 4u8; -pub const color_magenta: u8 = 5u8; -pub const color_cyan: u8 = 6u8; -pub const color_light_gray: u8 = 7u8; -pub const color_light_grey: u8 = 7u8; -pub const color_dark_gray: u8 = 8u8; -pub const color_dark_grey: u8 = 8u8; -pub const color_bright_red: u8 = 9u8; -pub const color_bright_green: u8 = 10u8; -pub const color_bright_yellow: u8 = 11u8; -pub const color_bright_blue: u8 = 12u8; -pub const color_bright_magenta: u8 = 13u8; -pub const color_bright_cyan: u8 = 14u8; -pub const color_bright_white: u8 = 15u8; +pub static color_black: u8 = 0u8; +pub static color_red: u8 = 1u8; +pub static color_green: u8 = 2u8; +pub static color_yellow: u8 = 3u8; +pub static color_blue: u8 = 4u8; +pub static color_magenta: u8 = 5u8; +pub static color_cyan: u8 = 6u8; +pub static color_light_gray: u8 = 7u8; +pub static color_light_grey: u8 = 7u8; +pub static color_dark_gray: u8 = 8u8; +pub static color_dark_grey: u8 = 8u8; +pub static color_bright_red: u8 = 9u8; +pub static color_bright_green: u8 = 10u8; +pub static color_bright_yellow: u8 = 11u8; +pub static color_bright_blue: u8 = 12u8; +pub static color_bright_magenta: u8 = 13u8; +pub static color_bright_cyan: u8 = 14u8; +pub static color_bright_white: u8 = 15u8; pub fn esc(writer: @io::Writer) { writer.write(~[0x1bu8, '[' as u8]); } diff --git a/src/libstd/test.rs b/src/libstd/test.rs index 7531992ae84..d039e8eef5a 100644 --- a/src/libstd/test.rs +++ b/src/libstd/test.rs @@ -477,10 +477,10 @@ fn run_tests(opts: &TestOpts, // Windows tends to dislike being overloaded with threads. #[cfg(windows)] -const sched_overcommit : uint = 1; +static sched_overcommit : uint = 1; #[cfg(unix)] -const sched_overcommit : uint = 4u; +static sched_overcommit : uint = 4u; fn get_concurrency() -> uint { unsafe { diff --git a/src/libstd/time.rs b/src/libstd/time.rs index b46d58f891b..ce153c1ac24 100644 --- a/src/libstd/time.rs +++ b/src/libstd/time.rs @@ -17,7 +17,7 @@ use core::prelude::*; use core::result::{Result, Ok, Err}; use core::str; -const NSEC_PER_SEC: i32 = 1_000_000_000_i32; +static NSEC_PER_SEC: i32 = 1_000_000_000_i32; pub mod rustrt { use super::Tm; @@ -900,8 +900,8 @@ mod tests { use core::vec; pub fn test_get_time() { - const some_recent_date: i64 = 1325376000i64; // 2012-01-01T00:00:00Z - const some_future_date: i64 = 1577836800i64; // 2020-01-01T00:00:00Z + static some_recent_date: i64 = 1325376000i64; // 2012-01-01T00:00:00Z + static some_future_date: i64 = 1577836800i64; // 2020-01-01T00:00:00Z let tv1 = get_time(); debug!("tv1=%? sec + %? nsec", tv1.sec as uint, tv1.nsec as uint); diff --git a/src/libstd/unicode.rs b/src/libstd/unicode.rs index f22bdaff3a0..4fdd4e286da 100644 --- a/src/libstd/unicode.rs +++ b/src/libstd/unicode.rs @@ -15,147 +15,147 @@ pub mod icu { pub type UProperty = int; pub type UChar32 = char; - pub const TRUE : u8 = 1u8; - pub const FALSE : u8 = 1u8; + pub static TRUE : u8 = 1u8; + pub static FALSE : u8 = 1u8; - pub const UCHAR_ALPHABETIC : UProperty = 0; - pub const UCHAR_BINARY_START : UProperty = 0; // = UCHAR_ALPHABETIC - pub const UCHAR_ASCII_HEX_DIGIT : UProperty = 1; - pub const UCHAR_BIDI_CONTROL : UProperty = 2; + pub static UCHAR_ALPHABETIC : UProperty = 0; + pub static UCHAR_BINARY_START : UProperty = 0; // = UCHAR_ALPHABETIC + pub static UCHAR_ASCII_HEX_DIGIT : UProperty = 1; + pub static UCHAR_BIDI_CONTROL : UProperty = 2; - pub const UCHAR_BIDI_MIRRORED : UProperty = 3; - pub const UCHAR_DASH : UProperty = 4; - pub const UCHAR_DEFAULT_IGNORABLE_CODE_POINT : UProperty = 5; - pub const UCHAR_DEPRECATED : UProperty = 6; + pub static UCHAR_BIDI_MIRRORED : UProperty = 3; + pub static UCHAR_DASH : UProperty = 4; + pub static UCHAR_DEFAULT_IGNORABLE_CODE_POINT : UProperty = 5; + pub static UCHAR_DEPRECATED : UProperty = 6; - pub const UCHAR_DIACRITIC : UProperty = 7; - pub const UCHAR_EXTENDER : UProperty = 8; - pub const UCHAR_FULL_COMPOSITION_EXCLUSION : UProperty = 9; - pub const UCHAR_GRAPHEME_BASE : UProperty = 10; + pub static UCHAR_DIACRITIC : UProperty = 7; + pub static UCHAR_EXTENDER : UProperty = 8; + pub static UCHAR_FULL_COMPOSITION_EXCLUSION : UProperty = 9; + pub static UCHAR_GRAPHEME_BASE : UProperty = 10; - pub const UCHAR_GRAPHEME_EXTEND : UProperty = 11; - pub const UCHAR_GRAPHEME_LINK : UProperty = 12; - pub const UCHAR_HEX_DIGIT : UProperty = 13; - pub const UCHAR_HYPHEN : UProperty = 14; + pub static UCHAR_GRAPHEME_EXTEND : UProperty = 11; + pub static UCHAR_GRAPHEME_LINK : UProperty = 12; + pub static UCHAR_HEX_DIGIT : UProperty = 13; + pub static UCHAR_HYPHEN : UProperty = 14; - pub const UCHAR_ID_CONTINUE : UProperty = 15; - pub const UCHAR_ID_START : UProperty = 16; - pub const UCHAR_IDEOGRAPHIC : UProperty = 17; - pub const UCHAR_IDS_BINARY_OPERATOR : UProperty = 18; + pub static UCHAR_ID_CONTINUE : UProperty = 15; + pub static UCHAR_ID_START : UProperty = 16; + pub static UCHAR_IDEOGRAPHIC : UProperty = 17; + pub static UCHAR_IDS_BINARY_OPERATOR : UProperty = 18; - pub const UCHAR_IDS_TRINARY_OPERATOR : UProperty = 19; - pub const UCHAR_JOIN_CONTROL : UProperty = 20; - pub const UCHAR_LOGICAL_ORDER_EXCEPTION : UProperty = 21; - pub const UCHAR_LOWERCASE : UProperty = 22; + pub static UCHAR_IDS_TRINARY_OPERATOR : UProperty = 19; + pub static UCHAR_JOIN_CONTROL : UProperty = 20; + pub static UCHAR_LOGICAL_ORDER_EXCEPTION : UProperty = 21; + pub static UCHAR_LOWERCASE : UProperty = 22; - pub const UCHAR_MATH : UProperty = 23; - pub const UCHAR_NONCHARACTER_CODE_POINT : UProperty = 24; - pub const UCHAR_QUOTATION_MARK : UProperty = 25; - pub const UCHAR_RADICAL : UProperty = 26; + pub static UCHAR_MATH : UProperty = 23; + pub static UCHAR_NONCHARACTER_CODE_POINT : UProperty = 24; + pub static UCHAR_QUOTATION_MARK : UProperty = 25; + pub static UCHAR_RADICAL : UProperty = 26; - pub const UCHAR_SOFT_DOTTED : UProperty = 27; - pub const UCHAR_TERMINAL_PUNCTUATION : UProperty = 28; - pub const UCHAR_UNIFIED_IDEOGRAPH : UProperty = 29; - pub const UCHAR_UPPERCASE : UProperty = 30; + pub static UCHAR_SOFT_DOTTED : UProperty = 27; + pub static UCHAR_TERMINAL_PUNCTUATION : UProperty = 28; + pub static UCHAR_UNIFIED_IDEOGRAPH : UProperty = 29; + pub static UCHAR_UPPERCASE : UProperty = 30; - pub const UCHAR_WHITE_SPACE : UProperty = 31; - pub const UCHAR_XID_CONTINUE : UProperty = 32; - pub const UCHAR_XID_START : UProperty = 33; - pub const UCHAR_CASE_SENSITIVE : UProperty = 34; + pub static UCHAR_WHITE_SPACE : UProperty = 31; + pub static UCHAR_XID_CONTINUE : UProperty = 32; + pub static UCHAR_XID_START : UProperty = 33; + pub static UCHAR_CASE_SENSITIVE : UProperty = 34; - pub const UCHAR_S_TERM : UProperty = 35; - pub const UCHAR_VARIATION_SELECTOR : UProperty = 36; - pub const UCHAR_NFD_INERT : UProperty = 37; - pub const UCHAR_NFKD_INERT : UProperty = 38; + pub static UCHAR_S_TERM : UProperty = 35; + pub static UCHAR_VARIATION_SELECTOR : UProperty = 36; + pub static UCHAR_NFD_INERT : UProperty = 37; + pub static UCHAR_NFKD_INERT : UProperty = 38; - pub const UCHAR_NFC_INERT : UProperty = 39; - pub const UCHAR_NFKC_INERT : UProperty = 40; - pub const UCHAR_SEGMENT_STARTER : UProperty = 41; - pub const UCHAR_PATTERN_SYNTAX : UProperty = 42; + pub static UCHAR_NFC_INERT : UProperty = 39; + pub static UCHAR_NFKC_INERT : UProperty = 40; + pub static UCHAR_SEGMENT_STARTER : UProperty = 41; + pub static UCHAR_PATTERN_SYNTAX : UProperty = 42; - pub const UCHAR_PATTERN_WHITE_SPACE : UProperty = 43; - pub const UCHAR_POSIX_ALNUM : UProperty = 44; - pub const UCHAR_POSIX_BLANK : UProperty = 45; - pub const UCHAR_POSIX_GRAPH : UProperty = 46; + pub static UCHAR_PATTERN_WHITE_SPACE : UProperty = 43; + pub static UCHAR_POSIX_ALNUM : UProperty = 44; + pub static UCHAR_POSIX_BLANK : UProperty = 45; + pub static UCHAR_POSIX_GRAPH : UProperty = 46; - pub const UCHAR_POSIX_PRINT : UProperty = 47; - pub const UCHAR_POSIX_XDIGIT : UProperty = 48; - pub const UCHAR_CASED : UProperty = 49; - pub const UCHAR_CASE_IGNORABLE : UProperty = 50; + pub static UCHAR_POSIX_PRINT : UProperty = 47; + pub static UCHAR_POSIX_XDIGIT : UProperty = 48; + pub static UCHAR_CASED : UProperty = 49; + pub static UCHAR_CASE_IGNORABLE : UProperty = 50; - pub const UCHAR_CHANGES_WHEN_LOWERCASED : UProperty = 51; - pub const UCHAR_CHANGES_WHEN_UPPERCASED : UProperty = 52; - pub const UCHAR_CHANGES_WHEN_TITLECASED : UProperty = 53; - pub const UCHAR_CHANGES_WHEN_CASEFOLDED : UProperty = 54; + pub static UCHAR_CHANGES_WHEN_LOWERCASED : UProperty = 51; + pub static UCHAR_CHANGES_WHEN_UPPERCASED : UProperty = 52; + pub static UCHAR_CHANGES_WHEN_TITLECASED : UProperty = 53; + pub static UCHAR_CHANGES_WHEN_CASEFOLDED : UProperty = 54; - pub const UCHAR_CHANGES_WHEN_CASEMAPPED : UProperty = 55; - pub const UCHAR_CHANGES_WHEN_NFKC_CASEFOLDED : UProperty = 56; - pub const UCHAR_BINARY_LIMIT : UProperty = 57; - pub const UCHAR_BIDI_CLASS : UProperty = 0x1000; + pub static UCHAR_CHANGES_WHEN_CASEMAPPED : UProperty = 55; + pub static UCHAR_CHANGES_WHEN_NFKC_CASEFOLDED : UProperty = 56; + pub static UCHAR_BINARY_LIMIT : UProperty = 57; + pub static UCHAR_BIDI_CLASS : UProperty = 0x1000; - pub const UCHAR_INT_START : UProperty = 0x1000; // UCHAR_BIDI_CLASS - pub const UCHAR_BLOCK : UProperty = 0x1001; - pub const UCHAR_CANONICAL_COMBINING_CLASS : UProperty = 0x1002; - pub const UCHAR_DECOMPOSITION_TYPE : UProperty = 0x1003; + pub static UCHAR_INT_START : UProperty = 0x1000; // UCHAR_BIDI_CLASS + pub static UCHAR_BLOCK : UProperty = 0x1001; + pub static UCHAR_CANONICAL_COMBINING_CLASS : UProperty = 0x1002; + pub static UCHAR_DECOMPOSITION_TYPE : UProperty = 0x1003; - pub const UCHAR_EAST_ASIAN_WIDTH : UProperty = 0x1004; - pub const UCHAR_GENERAL_CATEGORY : UProperty = 0x1005; - pub const UCHAR_JOINING_GROUP : UProperty = 0x1006; - pub const UCHAR_JOINING_TYPE : UProperty = 0x1007; + pub static UCHAR_EAST_ASIAN_WIDTH : UProperty = 0x1004; + pub static UCHAR_GENERAL_CATEGORY : UProperty = 0x1005; + pub static UCHAR_JOINING_GROUP : UProperty = 0x1006; + pub static UCHAR_JOINING_TYPE : UProperty = 0x1007; - pub const UCHAR_LINE_BREAK : UProperty = 0x1008; - pub const UCHAR_NUMERIC_TYPE : UProperty = 0x1009; - pub const UCHAR_SCRIPT : UProperty = 0x100A; - pub const UCHAR_HANGUL_SYLLABLE_TYPE : UProperty = 0x100B; + pub static UCHAR_LINE_BREAK : UProperty = 0x1008; + pub static UCHAR_NUMERIC_TYPE : UProperty = 0x1009; + pub static UCHAR_SCRIPT : UProperty = 0x100A; + pub static UCHAR_HANGUL_SYLLABLE_TYPE : UProperty = 0x100B; - pub const UCHAR_NFD_QUICK_CHECK : UProperty = 0x100C; - pub const UCHAR_NFKD_QUICK_CHECK : UProperty = 0x100D; - pub const UCHAR_NFC_QUICK_CHECK : UProperty = 0x100E; - pub const UCHAR_NFKC_QUICK_CHECK : UProperty = 0x100F; + pub static UCHAR_NFD_QUICK_CHECK : UProperty = 0x100C; + pub static UCHAR_NFKD_QUICK_CHECK : UProperty = 0x100D; + pub static UCHAR_NFC_QUICK_CHECK : UProperty = 0x100E; + pub static UCHAR_NFKC_QUICK_CHECK : UProperty = 0x100F; - pub const UCHAR_LEAD_CANONICAL_COMBINING_CLASS : UProperty = 0x1010; - pub const UCHAR_TRAIL_CANONICAL_COMBINING_CLASS : UProperty = 0x1011; - pub const UCHAR_GRAPHEME_CLUSTER_BREAK : UProperty = 0x1012; - pub const UCHAR_SENTENCE_BREAK : UProperty = 0x1013; + pub static UCHAR_LEAD_CANONICAL_COMBINING_CLASS : UProperty = 0x1010; + pub static UCHAR_TRAIL_CANONICAL_COMBINING_CLASS : UProperty = 0x1011; + pub static UCHAR_GRAPHEME_CLUSTER_BREAK : UProperty = 0x1012; + pub static UCHAR_SENTENCE_BREAK : UProperty = 0x1013; - pub const UCHAR_WORD_BREAK : UProperty = 0x1014; - pub const UCHAR_INT_LIMIT : UProperty = 0x1015; + pub static UCHAR_WORD_BREAK : UProperty = 0x1014; + pub static UCHAR_INT_LIMIT : UProperty = 0x1015; - pub const UCHAR_GENERAL_CATEGORY_MASK : UProperty = 0x2000; - pub const UCHAR_MASK_START : UProperty = 0x2000; + pub static UCHAR_GENERAL_CATEGORY_MASK : UProperty = 0x2000; + pub static UCHAR_MASK_START : UProperty = 0x2000; // = UCHAR_GENERAL_CATEGORY_MASK - pub const UCHAR_MASK_LIMIT : UProperty = 0x2001; + pub static UCHAR_MASK_LIMIT : UProperty = 0x2001; - pub const UCHAR_NUMERIC_VALUE : UProperty = 0x3000; - pub const UCHAR_DOUBLE_START : UProperty = 0x3000; + pub static UCHAR_NUMERIC_VALUE : UProperty = 0x3000; + pub static UCHAR_DOUBLE_START : UProperty = 0x3000; // = UCHAR_NUMERIC_VALUE - pub const UCHAR_DOUBLE_LIMIT : UProperty = 0x3001; + pub static UCHAR_DOUBLE_LIMIT : UProperty = 0x3001; - pub const UCHAR_AGE : UProperty = 0x4000; - pub const UCHAR_STRING_START : UProperty = 0x4000; // = UCHAR_AGE - pub const UCHAR_BIDI_MIRRORING_GLYPH : UProperty = 0x4001; - pub const UCHAR_CASE_FOLDING : UProperty = 0x4002; + pub static UCHAR_AGE : UProperty = 0x4000; + pub static UCHAR_STRING_START : UProperty = 0x4000; // = UCHAR_AGE + pub static UCHAR_BIDI_MIRRORING_GLYPH : UProperty = 0x4001; + pub static UCHAR_CASE_FOLDING : UProperty = 0x4002; - pub const UCHAR_ISO_COMMENT : UProperty = 0x4003; - pub const UCHAR_LOWERCASE_MAPPING : UProperty = 0x4004; - pub const UCHAR_NAME : UProperty = 0x4005; - pub const UCHAR_SIMPLE_CASE_FOLDING : UProperty = 0x4006; + pub static UCHAR_ISO_COMMENT : UProperty = 0x4003; + pub static UCHAR_LOWERCASE_MAPPING : UProperty = 0x4004; + pub static UCHAR_NAME : UProperty = 0x4005; + pub static UCHAR_SIMPLE_CASE_FOLDING : UProperty = 0x4006; - pub const UCHAR_SIMPLE_LOWERCASE_MAPPING : UProperty = 0x4007; - pub const UCHAR_SIMPLE_TITLECASE_MAPPING : UProperty = 0x4008; - pub const UCHAR_SIMPLE_UPPERCASE_MAPPING : UProperty = 0x4009; - pub const UCHAR_TITLECASE_MAPPING : UProperty = 0x400A; + pub static UCHAR_SIMPLE_LOWERCASE_MAPPING : UProperty = 0x4007; + pub static UCHAR_SIMPLE_TITLECASE_MAPPING : UProperty = 0x4008; + pub static UCHAR_SIMPLE_UPPERCASE_MAPPING : UProperty = 0x4009; + pub static UCHAR_TITLECASE_MAPPING : UProperty = 0x400A; - pub const UCHAR_UNICODE_1_NAME : UProperty = 0x400B; - pub const UCHAR_UPPERCASE_MAPPING : UProperty = 0x400C; - pub const UCHAR_STRING_LIMIT : UProperty = 0x400D; + pub static UCHAR_UNICODE_1_NAME : UProperty = 0x400B; + pub static UCHAR_UPPERCASE_MAPPING : UProperty = 0x400C; + pub static UCHAR_STRING_LIMIT : UProperty = 0x400D; - pub const UCHAR_SCRIPT_EXTENSIONS : UProperty = 0x7000; - pub const UCHAR_OTHER_PROPERTY_START : UProperty = 0x7000; + pub static UCHAR_SCRIPT_EXTENSIONS : UProperty = 0x7000; + pub static UCHAR_OTHER_PROPERTY_START : UProperty = 0x7000; // = UCHAR_SCRIPT_EXTENSIONS; - pub const UCHAR_OTHER_PROPERTY_LIMIT : UProperty = 0x7001; + pub static UCHAR_OTHER_PROPERTY_LIMIT : UProperty = 0x7001; - pub const UCHAR_INVALID_CODE : UProperty = -1; + pub static UCHAR_INVALID_CODE : UProperty = -1; pub mod libicu { #[link_name = "icuuc"] diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index c37d9d1c1c4..bef88e58a17 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -132,8 +132,8 @@ pub struct def_id { node: node_id, } -pub const local_crate: crate_num = 0; -pub const crate_node_id: node_id = 0; +pub static local_crate: crate_num = 0; +pub static crate_node_id: node_id = 0; #[auto_encode] #[auto_decode] diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 46ded7ecf3d..a69b3e20eb1 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -493,7 +493,7 @@ pub fn core_macros() -> ~str { mod $c { fn key(_x: @::core::condition::Handler<$in,$out>) { } - pub const cond : + pub static cond : ::core::condition::Condition/&static<$in,$out> = ::core::condition::Condition { name: stringify!($c), diff --git a/src/libsyntax/parse/prec.rs b/src/libsyntax/parse/prec.rs index e2a89d2a28c..79adabec9b7 100644 --- a/src/libsyntax/parse/prec.rs +++ b/src/libsyntax/parse/prec.rs @@ -16,13 +16,13 @@ use parse::token::Token; use core::prelude::*; /// Unary operators have higher precedence than binary -pub const unop_prec: uint = 100u; +pub static unop_prec: uint = 100u; /** * Precedence of the `as` operator, which is a binary operator * but is not represented in the precedence table. */ -pub const as_prec: uint = 11u; +pub static as_prec: uint = 11u; /** * Maps a token to a record specifying the corresponding binary diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 8b78087e16f..074bb13e199 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -309,50 +309,50 @@ pub fn is_bar(t: &Token) -> bool { pub mod special_idents { use ast::ident; - pub const underscore : ident = ident { repr: 0u }; - pub const anon : ident = ident { repr: 1u }; - pub const dtor : ident = ident { repr: 2u }; // 'drop', but that's + pub static underscore : ident = ident { repr: 0u }; + pub static anon : ident = ident { repr: 1u }; + pub static dtor : ident = ident { repr: 2u }; // 'drop', but that's // reserved - pub const invalid : ident = ident { repr: 3u }; // '' - pub const unary : ident = ident { repr: 4u }; - pub const not_fn : ident = ident { repr: 5u }; - pub const idx_fn : ident = ident { repr: 6u }; - pub const unary_minus_fn : ident = ident { repr: 7u }; - pub const clownshoes_extensions : ident = ident { repr: 8u }; + pub static invalid : ident = ident { repr: 3u }; // '' + pub static unary : ident = ident { repr: 4u }; + pub static not_fn : ident = ident { repr: 5u }; + pub static idx_fn : ident = ident { repr: 6u }; + pub static unary_minus_fn : ident = ident { repr: 7u }; + pub static clownshoes_extensions : ident = ident { repr: 8u }; - pub const self_ : ident = ident { repr: 9u }; // 'self' + pub static self_ : ident = ident { repr: 9u }; // 'self' /* for matcher NTs */ - pub const item : ident = ident { repr: 10u }; - pub const block : ident = ident { repr: 11u }; - pub const stmt : ident = ident { repr: 12u }; - pub const pat : ident = ident { repr: 13u }; - pub const expr : ident = ident { repr: 14u }; - pub const ty : ident = ident { repr: 15u }; - pub const ident : ident = ident { repr: 16u }; - pub const path : ident = ident { repr: 17u }; - pub const tt : ident = ident { repr: 18u }; - pub const matchers : ident = ident { repr: 19u }; + pub static item : ident = ident { repr: 10u }; + pub static block : ident = ident { repr: 11u }; + pub static stmt : ident = ident { repr: 12u }; + pub static pat : ident = ident { repr: 13u }; + pub static expr : ident = ident { repr: 14u }; + pub static ty : ident = ident { repr: 15u }; + pub static ident : ident = ident { repr: 16u }; + pub static path : ident = ident { repr: 17u }; + pub static tt : ident = ident { repr: 18u }; + pub static matchers : ident = ident { repr: 19u }; - pub const str : ident = ident { repr: 20u }; // for the type + pub static str : ident = ident { repr: 20u }; // for the type /* outside of libsyntax */ - pub const ty_visitor : ident = ident { repr: 21u }; - pub const arg : ident = ident { repr: 22u }; - pub const descrim : ident = ident { repr: 23u }; - pub const clownshoe_abi : ident = ident { repr: 24u }; - pub const clownshoe_stack_shim : ident = ident { repr: 25u }; - pub const tydesc : ident = ident { repr: 26u }; - pub const literally_dtor : ident = ident { repr: 27u }; - pub const main : ident = ident { repr: 28u }; - pub const opaque : ident = ident { repr: 29u }; - pub const blk : ident = ident { repr: 30u }; - pub const static : ident = ident { repr: 31u }; - pub const intrinsic : ident = ident { repr: 32u }; - pub const clownshoes_foreign_mod: ident = ident { repr: 33 }; - pub const unnamed_field: ident = ident { repr: 34 }; - pub const c_abi: ident = ident { repr: 35 }; - pub const type_self: ident = ident { repr: 36 }; // `Self` + pub static ty_visitor : ident = ident { repr: 21u }; + pub static arg : ident = ident { repr: 22u }; + pub static descrim : ident = ident { repr: 23u }; + pub static clownshoe_abi : ident = ident { repr: 24u }; + pub static clownshoe_stack_shim : ident = ident { repr: 25u }; + pub static tydesc : ident = ident { repr: 26u }; + pub static literally_dtor : ident = ident { repr: 27u }; + pub static main : ident = ident { repr: 28u }; + pub static opaque : ident = ident { repr: 29u }; + pub static blk : ident = ident { repr: 30u }; + pub static static : ident = ident { repr: 31u }; + pub static intrinsic : ident = ident { repr: 32u }; + pub static clownshoes_foreign_mod: ident = ident { repr: 33 }; + pub static unnamed_field: ident = ident { repr: 34 }; + pub static c_abi: ident = ident { repr: 35 }; + pub static type_self: ident = ident { repr: 36 }; // `Self` } pub struct ident_interner { diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index d0022675473..af9cb7b841e 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -139,7 +139,7 @@ pub struct print_stack_elt { pbreak: print_stack_break } -pub const size_infinity: int = 0xffff; +pub static size_infinity: int = 0xffff; pub fn mk_printer(out: @io::Writer, linewidth: uint) -> @mut Printer { // Yes 3, it makes the ring buffers big enough to never diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index ce12e0a7b87..9b061faa2ab 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -92,10 +92,10 @@ pub fn rust_printer(writer: @io::Writer, intr: @ident_interner) -> @ps { }; } -pub const indent_unit: uint = 4u; -pub const match_indent_unit: uint = 2u; +pub static indent_unit: uint = 4u; +pub static match_indent_unit: uint = 2u; -pub const default_columns: uint = 78u; +pub static default_columns: uint = 78u; // Requires you to pass an input filename and reader so that // it can scan the input text for comments and literals to diff --git a/src/test/auxiliary/cci_const.rs b/src/test/auxiliary/cci_const.rs index 945004ede6d..17029b9d377 100644 --- a/src/test/auxiliary/cci_const.rs +++ b/src/test/auxiliary/cci_const.rs @@ -11,6 +11,6 @@ pub extern fn bar() { } -pub const foopy: &'static str = "hi there"; -pub const uint_val: uint = 12; -pub const uint_expr: uint = (1 << uint_val) - 1; +pub static foopy: &'static str = "hi there"; +pub static uint_val: uint = 12; +pub static uint_expr: uint = (1 << uint_val) - 1; diff --git a/src/test/bench/shootout-nbody.rs b/src/test/bench/shootout-nbody.rs index 6ce9fce881a..97907025bd1 100644 --- a/src/test/bench/shootout-nbody.rs +++ b/src/test/bench/shootout-nbody.rs @@ -167,10 +167,10 @@ pub mod NBodySystem { pub mod Body { use Body; - pub const PI: float = 3.141592653589793; - pub const SOLAR_MASS: float = 39.478417604357432; + pub static PI: float = 3.141592653589793; + pub static SOLAR_MASS: float = 39.478417604357432; // was 4 * PI * PI originally - pub const DAYS_PER_YEAR: float = 365.24; + pub static DAYS_PER_YEAR: float = 365.24; pub struct Props { x: float, diff --git a/src/test/bench/sudoku.rs b/src/test/bench/sudoku.rs index 1e32697eb10..4964cea28ad 100644 --- a/src/test/bench/sudoku.rs +++ b/src/test/bench/sudoku.rs @@ -153,7 +153,7 @@ pub impl Sudoku { // Stores available colors as simple bitfield, bit 0 is always unset struct Colors(u16); -const heads: u16 = (1u16 << 10) - 1; /* bits 9..0 */ +static heads: u16 = (1u16 << 10) - 1; /* bits 9..0 */ impl Colors { fn new(start_color: u8) -> Colors { @@ -182,7 +182,7 @@ impl Colors { } } -const 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], @@ -196,7 +196,7 @@ const default_sudoku: [[u8 * 9] * 9] = [ ]; #[cfg(test)] -const 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], diff --git a/src/test/compile-fail/bad-const-type.rs b/src/test/compile-fail/bad-const-type.rs index e35d5e79bde..a66c00d5411 100644 --- a/src/test/compile-fail/bad-const-type.rs +++ b/src/test/compile-fail/bad-const-type.rs @@ -10,5 +10,5 @@ // error-pattern:expected `~str` but found `int` -const i: str = 10i; +static i: ~str = 10i; fn main() { debug!(i); } diff --git a/src/test/compile-fail/borrowck-assign-to-constants.rs b/src/test/compile-fail/borrowck-assign-to-constants.rs index 78a95cb33c0..0d65aacb65b 100644 --- a/src/test/compile-fail/borrowck-assign-to-constants.rs +++ b/src/test/compile-fail/borrowck-assign-to-constants.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -const foo: int = 5; +static foo: int = 5; fn main() { // assigning to various global constants diff --git a/src/test/compile-fail/const-cast-different-types.rs b/src/test/compile-fail/const-cast-different-types.rs index 45e39b47d23..56ec0bb9296 100644 --- a/src/test/compile-fail/const-cast-different-types.rs +++ b/src/test/compile-fail/const-cast-different-types.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -const a: &'static str = &"foo"; -const b: *u8 = a as *u8; //~ ERROR non-scalar cast -const c: *u8 = &a as *u8; //~ ERROR mismatched types +static a: &'static str = &"foo"; +static b: *u8 = a as *u8; //~ ERROR non-scalar cast +static c: *u8 = &a as *u8; //~ ERROR mismatched types fn main() { -} \ No newline at end of file +} diff --git a/src/test/compile-fail/const-cast-wrong-type.rs b/src/test/compile-fail/const-cast-wrong-type.rs index fe91056d47b..677f4318db7 100644 --- a/src/test/compile-fail/const-cast-wrong-type.rs +++ b/src/test/compile-fail/const-cast-wrong-type.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -const a: [u8 * 3] = ['h' as u8, 'i' as u8, 0 as u8]; -const b: *i8 = &a as *i8; //~ ERROR mismatched types +static a: [u8 * 3] = ['h' as u8, 'i' as u8, 0 as u8]; +static b: *i8 = &a as *i8; //~ ERROR mismatched types fn main() { -} \ No newline at end of file +} diff --git a/src/test/compile-fail/const-recursive.rs b/src/test/compile-fail/const-recursive.rs index f565a44c97f..9c633e082b1 100644 --- a/src/test/compile-fail/const-recursive.rs +++ b/src/test/compile-fail/const-recursive.rs @@ -9,8 +9,8 @@ // except according to those terms. // error-pattern: recursive constant -const a: int = b; -const b: int = a; +static a: int = b; +static b: int = a; fn main() { } diff --git a/src/test/compile-fail/issue-2478.rs b/src/test/compile-fail/issue-2478.rs index 2b52cab7fe7..d5663e57f4b 100644 --- a/src/test/compile-fail/issue-2478.rs +++ b/src/test/compile-fail/issue-2478.rs @@ -12,5 +12,5 @@ fn foo() -> &'a int { return &x; } -const x: int = 5; +static x: int = 5; fn main() {} diff --git a/src/test/compile-fail/issue-3521-2.rs b/src/test/compile-fail/issue-3521-2.rs index 39c14b4d316..431f98d8181 100644 --- a/src/test/compile-fail/issue-3521-2.rs +++ b/src/test/compile-fail/issue-3521-2.rs @@ -11,7 +11,7 @@ fn main() { let foo = 100; - const y: int = foo + 1; //~ ERROR: attempt to use a non-constant value in a constant + static y: int = foo + 1; //~ ERROR: attempt to use a non-constant value in a constant error!(y); } diff --git a/src/test/compile-fail/issue-3668-2.rs b/src/test/compile-fail/issue-3668-2.rs index be96918b250..f7637f684be 100644 --- a/src/test/compile-fail/issue-3668-2.rs +++ b/src/test/compile-fail/issue-3668-2.rs @@ -9,7 +9,7 @@ // except according to those terms. fn f(x:int) { - const child: int = x + 1; //~ ERROR attempt to use a non-constant value in a constant + static child: int = x + 1; //~ ERROR attempt to use a non-constant value in a constant } fn main() {} diff --git a/src/test/compile-fail/issue-3668.rs b/src/test/compile-fail/issue-3668.rs index 1b121878697..77e2e4f21e8 100644 --- a/src/test/compile-fail/issue-3668.rs +++ b/src/test/compile-fail/issue-3668.rs @@ -15,7 +15,7 @@ trait PTrait { impl PTrait for P { fn getChildOption(&self) -> Option<@P> { - const childVal: @P = self.child.get(); //~ ERROR attempt to use a non-constant value in a constant + static childVal: @P = self.child.get(); //~ ERROR attempt to use a non-constant value in a constant fail!(); } } diff --git a/src/test/compile-fail/issue-4523.rs b/src/test/compile-fail/issue-4523.rs index e8e27029371..6d072ce210e 100644 --- a/src/test/compile-fail/issue-4523.rs +++ b/src/test/compile-fail/issue-4523.rs @@ -10,7 +10,7 @@ fn foopy() {} -const f: &'static fn() = foopy; //~ ERROR mismatched types: expected `&'static fn()` +static f: &'static fn() = foopy; //~ ERROR mismatched types: expected `&'static fn()` fn main () { f(); diff --git a/src/test/compile-fail/issue-4968.rs b/src/test/compile-fail/issue-4968.rs index 315c2affe34..fc0c29e9a79 100644 --- a/src/test/compile-fail/issue-4968.rs +++ b/src/test/compile-fail/issue-4968.rs @@ -10,7 +10,7 @@ // Regression test for issue #4968 -const A: (int,int) = (4,2); +static A: (int,int) = (4,2); fn main() { match 42 { A => () } //~ ERROR mismatched types: expected `` but found `(int,int)` (expected integral variable but found tuple) } diff --git a/src/test/compile-fail/regions-in-consts.rs b/src/test/compile-fail/regions-in-consts.rs index 2ba27e888cb..c34e5fb29de 100644 --- a/src/test/compile-fail/regions-in-consts.rs +++ b/src/test/compile-fail/regions-in-consts.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -const c_x: &'blk int = &22; //~ ERROR Illegal lifetime 'blk: only 'static is allowed here -const c_y: &int = &22; //~ ERROR Illegal anonymous lifetime: only 'static is allowed here -const c_z: &'static int = &22; +static c_x: &'blk int = &22; //~ ERROR Illegal lifetime 'blk: only 'static is allowed here +static c_y: &int = &22; //~ ERROR Illegal anonymous lifetime: only 'static is allowed here +static c_z: &'static int = &22; fn main() { } diff --git a/src/test/run-pass-fulldeps/qquote.rs b/src/test/run-pass-fulldeps/qquote.rs index 613480e3a63..779fd3e4904 100644 --- a/src/test/run-pass-fulldeps/qquote.rs +++ b/src/test/run-pass-fulldeps/qquote.rs @@ -63,8 +63,8 @@ fn main() { let ty = quote_ty!(int); check_pp(ext_cx, ty, pprust::print_type, ~"int"); - let item = quote_item!(const x : int = 10;).get(); - check_pp(ext_cx, item, pprust::print_item, ~"const x: int = 10;"); + let item = quote_item!(static x : int = 10;).get(); + check_pp(ext_cx, item, pprust::print_item, ~"static x: int = 10;"); let stmt = quote_stmt!(let x = 20;); check_pp(ext_cx, *stmt, pprust::print_stmt, ~"let x = 20;"); diff --git a/src/test/run-pass-fulldeps/quote-tokens.rs b/src/test/run-pass-fulldeps/quote-tokens.rs index f324f2d198b..ccee163eafe 100644 --- a/src/test/run-pass-fulldeps/quote-tokens.rs +++ b/src/test/run-pass-fulldeps/quote-tokens.rs @@ -19,7 +19,7 @@ fn syntax_extension(ext_cx: @ext_ctxt) { let p_toks : ~[syntax::ast::token_tree] = quote_tokens!((x, 1 .. 4, *)); let a: @syntax::ast::expr = quote_expr!(1 + 2); - let _b: Option<@syntax::ast::item> = quote_item!( const foo : int = $e_toks; ); + let _b: Option<@syntax::ast::item> = quote_item!( static foo : int = $e_toks; ); let _c: @syntax::ast::pat = quote_pat!( (x, 1 .. 4, *) ); let _d: @syntax::ast::stmt = quote_stmt!( let x = $a; ); let _e: @syntax::ast::expr = quote_expr!( match foo { $p_toks => 10 } ); diff --git a/src/test/run-pass/conditional-compile.rs b/src/test/run-pass/conditional-compile.rs index 38854abff47..194f0e71b17 100644 --- a/src/test/run-pass/conditional-compile.rs +++ b/src/test/run-pass/conditional-compile.rs @@ -15,9 +15,9 @@ use flippity; #[cfg(bogus)] -const b: bool = false; +static b: bool = false; -const b: bool = true; +static b: bool = true; mod rustrt { #[cfg(bogus)] @@ -102,8 +102,8 @@ fn test_in_fn_ctxt() { f(); #[cfg(bogus)] - const i: int = 0; - const i: int = 1; + static i: int = 0; + static i: int = 1; fail_unless!((i == 1)); } diff --git a/src/test/run-pass/const-autoderef-newtype.rs b/src/test/run-pass/const-autoderef-newtype.rs index cb56ab36335..a157c46403b 100644 --- a/src/test/run-pass/const-autoderef-newtype.rs +++ b/src/test/run-pass/const-autoderef-newtype.rs @@ -9,8 +9,8 @@ // except according to those terms. struct S(&'static [int]); -const C0: S = S([3]); -const C1: int = C0[0]; +static C0: S = S([3]); +static C1: int = C0[0]; pub fn main() { fail_unless!(C1 == 3); diff --git a/src/test/run-pass/const-autoderef.rs b/src/test/run-pass/const-autoderef.rs index 9fb6c4aa0db..fa482c38d14 100644 --- a/src/test/run-pass/const-autoderef.rs +++ b/src/test/run-pass/const-autoderef.rs @@ -8,10 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -const A: [u8 * 1] = ['h' as u8]; -const B: u8 = (&A)[0]; -const C: &'static &'static &'static &'static [u8 * 1] = & & & &A; -const D: u8 = (&C)[0]; +static A: [u8 * 1] = ['h' as u8]; +static B: u8 = (&A)[0]; +static C: &'static &'static &'static &'static [u8 * 1] = & & & &A; +static D: u8 = (&C)[0]; pub fn main() { fail_unless!(B == A[0]); diff --git a/src/test/run-pass/const-big-enum.rs b/src/test/run-pass/const-big-enum.rs index a7d1739a56b..97544da41c0 100644 --- a/src/test/run-pass/const-big-enum.rs +++ b/src/test/run-pass/const-big-enum.rs @@ -14,7 +14,7 @@ enum Foo { Quux(u64, u16) } -const X: Foo = Baz; +static X: Foo = Baz; pub fn main() { match X { @@ -34,5 +34,5 @@ pub fn main() { } } -const Y: Foo = Bar(2654435769); -const Z: Foo = Quux(0x123456789abcdef0, 0x1234); +static Y: Foo = Bar(2654435769); +static Z: Foo = Quux(0x123456789abcdef0, 0x1234); diff --git a/src/test/run-pass/const-cast-ptr-int.rs b/src/test/run-pass/const-cast-ptr-int.rs index 2d7dc349c00..eefd1aa642e 100644 --- a/src/test/run-pass/const-cast-ptr-int.rs +++ b/src/test/run-pass/const-cast-ptr-int.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -const a: *u8 = 0 as *u8; +static a: *u8 = 0 as *u8; fn main() { fail_unless!(a == ptr::null()); diff --git a/src/test/run-pass/const-cast.rs b/src/test/run-pass/const-cast.rs index 64c6f368f2b..83f365a6320 100644 --- a/src/test/run-pass/const-cast.rs +++ b/src/test/run-pass/const-cast.rs @@ -10,10 +10,10 @@ extern fn foo() {} -const x: *u8 = foo; -const y: *libc::c_void = x as *libc::c_void; -const a: &'static int = &10; -const b: *int = a as *int; +static x: *u8 = foo; +static y: *libc::c_void = x as *libc::c_void; +static a: &'static int = &10; +static b: *int = a as *int; fn main() { fail_unless!(x as *libc::c_void == y); diff --git a/src/test/run-pass/const-const.rs b/src/test/run-pass/const-const.rs index 142bcb7f9a8..3f8a7da4c14 100644 --- a/src/test/run-pass/const-const.rs +++ b/src/test/run-pass/const-const.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -const a: int = 1; -const b: int = a + 2; +static a: int = 1; +static b: int = a + 2; pub fn main() { fail_unless!(b == 3); diff --git a/src/test/run-pass/const-contents.rs b/src/test/run-pass/const-contents.rs index 72db11c64e8..379089cc2a2 100644 --- a/src/test/run-pass/const-contents.rs +++ b/src/test/run-pass/const-contents.rs @@ -10,12 +10,12 @@ // Issue #570 -const lsl : int = 1 << 2; -const add : int = 1 + 2; -const addf : float = 1.0f + 2.0f; -const not : int = !0; -const notb : bool = !true; -const neg : int = -(1); +static lsl : int = 1 << 2; +static add : int = 1 + 2; +static addf : float = 1.0f + 2.0f; +static not : int = !0; +static notb : bool = !true; +static neg : int = -(1); pub fn main() { fail_unless!((lsl == 4)); diff --git a/src/test/run-pass/const-cross-crate-const.rs b/src/test/run-pass/const-cross-crate-const.rs index e01519ae8a5..130f43cfddd 100644 --- a/src/test/run-pass/const-cross-crate-const.rs +++ b/src/test/run-pass/const-cross-crate-const.rs @@ -12,9 +12,9 @@ // aux-build:cci_const.rs extern mod cci_const; -const foo: &'static str = cci_const::foopy; -const a: uint = cci_const::uint_val; -const b: uint = cci_const::uint_expr + 5; +static foo: &'static str = cci_const::foopy; +static a: uint = cci_const::uint_val; +static b: uint = cci_const::uint_expr + 5; fn main() { fail_unless!(a == 12); diff --git a/src/test/run-pass/const-cross-crate-extern.rs b/src/test/run-pass/const-cross-crate-extern.rs index e1a4fc634ba..723835a46d8 100644 --- a/src/test/run-pass/const-cross-crate-extern.rs +++ b/src/test/run-pass/const-cross-crate-extern.rs @@ -13,7 +13,7 @@ extern mod cci_const; use cci_const::bar; -const foo: *u8 = bar; +static foo: *u8 = bar; fn main() { fail_unless!(foo == cci_const::bar); diff --git a/src/test/run-pass/const-deref.rs b/src/test/run-pass/const-deref.rs index 71ae273aaa3..a69ca9cb939 100644 --- a/src/test/run-pass/const-deref.rs +++ b/src/test/run-pass/const-deref.rs @@ -8,11 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -const C: &'static int = &1000; -const D: int = *C; +static C: &'static int = &1000; +static D: int = *C; struct S(&'static int); -const E: &'static S = &S(C); -const F: int = ***E; +static E: &'static S = &S(C); +static F: int = ***E; pub fn main() { fail_unless!(D == 1000); diff --git a/src/test/run-pass/const-enum-byref-self.rs b/src/test/run-pass/const-enum-byref-self.rs index 57cfdd2f9d4..c4e1ea727e4 100644 --- a/src/test/run-pass/const-enum-byref-self.rs +++ b/src/test/run-pass/const-enum-byref-self.rs @@ -9,7 +9,7 @@ // except according to those terms. enum E { V, VV(int) } -const C: E = V; +static C: E = V; pub impl E { fn method(&self) { diff --git a/src/test/run-pass/const-enum-byref.rs b/src/test/run-pass/const-enum-byref.rs index a8d24dc300a..83fafad4f99 100644 --- a/src/test/run-pass/const-enum-byref.rs +++ b/src/test/run-pass/const-enum-byref.rs @@ -9,7 +9,7 @@ // except according to those terms. enum E { V, VV(int) } -const C: E = V; +static C: E = V; fn f(a: &E) { match *a { diff --git a/src/test/run-pass/const-enum-cast.rs b/src/test/run-pass/const-enum-cast.rs index ac0bbfda20d..20d7a94ccac 100644 --- a/src/test/run-pass/const-enum-cast.rs +++ b/src/test/run-pass/const-enum-cast.rs @@ -12,10 +12,10 @@ enum A { A1, A2 } enum B { B1=0, B2=2 } fn main () { - const c1: int = A2 as int; - const c2: int = B2 as int; - const c3: float = A2 as float; - const c4: float = B2 as float; + static c1: int = A2 as int; + static c2: int = B2 as int; + static c3: float = A2 as float; + static c4: float = B2 as float; let a1 = A2 as int; let a2 = B2 as int; let a3 = A2 as float; diff --git a/src/test/run-pass/const-enum-ptr.rs b/src/test/run-pass/const-enum-ptr.rs index 594350d2988..c1e3889d613 100644 --- a/src/test/run-pass/const-enum-ptr.rs +++ b/src/test/run-pass/const-enum-ptr.rs @@ -9,7 +9,7 @@ // except according to those terms. enum E { V0, V1(int) } -const C: &'static E = &V0; +static C: &'static E = &V0; pub fn main() { match *C { diff --git a/src/test/run-pass/const-enum-struct.rs b/src/test/run-pass/const-enum-struct.rs index 8ab470461eb..7da171cc006 100644 --- a/src/test/run-pass/const-enum-struct.rs +++ b/src/test/run-pass/const-enum-struct.rs @@ -10,7 +10,7 @@ enum E { V16(u16), V32(u32) } struct S { a: E, b: u16, c: u16 } -const C: S = S { a: V16(0xDEAD), b: 0x600D, c: 0xBAD }; +static C: S = S { a: V16(0xDEAD), b: 0x600D, c: 0xBAD }; pub fn main() { let n = C.b; diff --git a/src/test/run-pass/const-enum-struct2.rs b/src/test/run-pass/const-enum-struct2.rs index 49078b8efe2..c24db8414c4 100644 --- a/src/test/run-pass/const-enum-struct2.rs +++ b/src/test/run-pass/const-enum-struct2.rs @@ -10,7 +10,7 @@ enum E { V0, V16(u16) } struct S { a: E, b: u16, c: u16 } -const C: S = S { a: V0, b: 0x600D, c: 0xBAD }; +static C: S = S { a: V0, b: 0x600D, c: 0xBAD }; pub fn main() { let n = C.b; diff --git a/src/test/run-pass/const-enum-structlike.rs b/src/test/run-pass/const-enum-structlike.rs index 3faad1fee7e..86640bcc408 100644 --- a/src/test/run-pass/const-enum-structlike.rs +++ b/src/test/run-pass/const-enum-structlike.rs @@ -13,7 +13,7 @@ enum E { S1 { u: uint } } -const C: E = S1 { u: 23 }; +static C: E = S1 { u: 23 }; fn main() { match C { diff --git a/src/test/run-pass/const-enum-tuple.rs b/src/test/run-pass/const-enum-tuple.rs index d46207ea812..acefd4ff878 100644 --- a/src/test/run-pass/const-enum-tuple.rs +++ b/src/test/run-pass/const-enum-tuple.rs @@ -9,7 +9,7 @@ // except according to those terms. enum E { V16(u16), V32(u32) } -const C: (E, u16, u16) = (V16(0xDEAD), 0x600D, 0xBAD); +static C: (E, u16, u16) = (V16(0xDEAD), 0x600D, 0xBAD); pub fn main() { let (_, n, _) = C; diff --git a/src/test/run-pass/const-enum-tuple2.rs b/src/test/run-pass/const-enum-tuple2.rs index 08007b5b67d..63f1f41d9ab 100644 --- a/src/test/run-pass/const-enum-tuple2.rs +++ b/src/test/run-pass/const-enum-tuple2.rs @@ -9,7 +9,7 @@ // except according to those terms. enum E { V0, V16(u16) } -const C: (E, u16, u16) = (V0, 0x600D, 0xBAD); +static C: (E, u16, u16) = (V0, 0x600D, 0xBAD); pub fn main() { let (_, n, _) = C; diff --git a/src/test/run-pass/const-enum-tuplestruct.rs b/src/test/run-pass/const-enum-tuplestruct.rs index a88bbca7919..b0d321abb09 100644 --- a/src/test/run-pass/const-enum-tuplestruct.rs +++ b/src/test/run-pass/const-enum-tuplestruct.rs @@ -10,7 +10,7 @@ enum E { V16(u16), V32(u32) } struct S(E, u16, u16); -const C: S = S(V16(0xDEAD), 0x600D, 0xBAD); +static C: S = S(V16(0xDEAD), 0x600D, 0xBAD); pub fn main() { let S(_, n, _) = C; diff --git a/src/test/run-pass/const-enum-tuplestruct2.rs b/src/test/run-pass/const-enum-tuplestruct2.rs index 4bbadd40574..7fa04af3f9a 100644 --- a/src/test/run-pass/const-enum-tuplestruct2.rs +++ b/src/test/run-pass/const-enum-tuplestruct2.rs @@ -10,7 +10,7 @@ enum E { V0, V16(u16) } struct S(E, u16, u16); -const C: S = S(V0, 0x600D, 0xBAD); +static C: S = S(V0, 0x600D, 0xBAD); pub fn main() { let S(_, n, _) = C; diff --git a/src/test/run-pass/const-enum-vec-index.rs b/src/test/run-pass/const-enum-vec-index.rs index 6dde7cc41ec..fd11fc42272 100644 --- a/src/test/run-pass/const-enum-vec-index.rs +++ b/src/test/run-pass/const-enum-vec-index.rs @@ -9,9 +9,9 @@ // except according to those terms. enum E { V1(int), V0 } -const C: &'static [E] = &[V0, V1(0xDEADBEE)]; -const C0: E = C[0]; -const C1: E = C[1]; +static C: &'static [E] = &[V0, V1(0xDEADBEE)]; +static C0: E = C[0]; +static C1: E = C[1]; pub fn main() { match C0 { diff --git a/src/test/run-pass/const-enum-vec-ptr.rs b/src/test/run-pass/const-enum-vec-ptr.rs index b398bfbf0d5..8d152dca54c 100644 --- a/src/test/run-pass/const-enum-vec-ptr.rs +++ b/src/test/run-pass/const-enum-vec-ptr.rs @@ -9,7 +9,7 @@ // except according to those terms. enum E { V1(int), V0 } -const C: &'static [E] = &[V0, V1(0xDEADBEE), V0]; +static C: &'static [E] = &[V0, V1(0xDEADBEE), V0]; pub fn main() { match C[1] { diff --git a/src/test/run-pass/const-enum-vector.rs b/src/test/run-pass/const-enum-vector.rs index 48b3c774e39..db7982c451f 100644 --- a/src/test/run-pass/const-enum-vector.rs +++ b/src/test/run-pass/const-enum-vector.rs @@ -9,7 +9,7 @@ // except according to those terms. enum E { V1(int), V0 } -const C: [E * 3] = [V0, V1(0xDEADBEE), V0]; +static C: [E * 3] = [V0, V1(0xDEADBEE), V0]; pub fn main() { match C[1] { diff --git a/src/test/run-pass/const-expr-in-fixed-length-vec.rs b/src/test/run-pass/const-expr-in-fixed-length-vec.rs index aa5c4cbbc1d..69585c9d31c 100644 --- a/src/test/run-pass/const-expr-in-fixed-length-vec.rs +++ b/src/test/run-pass/const-expr-in-fixed-length-vec.rs @@ -13,7 +13,7 @@ fn main() { - const FOO: int = 2; + static FOO: int = 2; let _v: [int * FOO*3]; } diff --git a/src/test/run-pass/const-expr-in-vec-repeat.rs b/src/test/run-pass/const-expr-in-vec-repeat.rs index 76952ef730f..a04c588c07b 100644 --- a/src/test/run-pass/const-expr-in-vec-repeat.rs +++ b/src/test/run-pass/const-expr-in-vec-repeat.rs @@ -12,7 +12,7 @@ fn main() { - const FOO: int = 2; + static FOO: int = 2; let _v = [0, ..FOO*3*2/2]; } diff --git a/src/test/run-pass/const-extern-function.rs b/src/test/run-pass/const-extern-function.rs index 6b6a3e4d0a4..5e7ac4e4518 100644 --- a/src/test/run-pass/const-extern-function.rs +++ b/src/test/run-pass/const-extern-function.rs @@ -10,8 +10,8 @@ extern fn foopy() {} -const f: *u8 = foopy; -const s: S = S { f: foopy }; +static f: *u8 = foopy; +static s: S = S { f: foopy }; struct S { f: *u8 diff --git a/src/test/run-pass/const-fields-and-indexing.rs b/src/test/run-pass/const-fields-and-indexing.rs index c13215bb236..a3611c5eb26 100644 --- a/src/test/run-pass/const-fields-and-indexing.rs +++ b/src/test/run-pass/const-fields-and-indexing.rs @@ -8,22 +8,21 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -const x : [int * 4] = [1,2,3,4]; -const p : int = x[2]; -const y : &'static [int] = &[1,2,3,4]; -const q : int = y[2]; +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]; struct S {a: int, b: int} -const s : S = S {a: 10, b: 20}; -const t : int = s.b; +static s : S = S {a: 10, b: 20}; +static t : int = s.b; struct K {a: int, b: int, c: D} struct D { d: int, e: int } -const k : K = K {a: 10, b: 20, c: D {d: 30, - e: 40}}; -const m : int = k.c.e; +static k : K = K {a: 10, b: 20, c: D {d: 30, e: 40}}; +static m : int = k.c.e; pub fn main() { io::println(fmt!("%?", p)); diff --git a/src/test/run-pass/const-fn-val.rs b/src/test/run-pass/const-fn-val.rs index c3d09a58b5b..1c0cfa64d88 100644 --- a/src/test/run-pass/const-fn-val.rs +++ b/src/test/run-pass/const-fn-val.rs @@ -14,7 +14,7 @@ fn foo() -> int { struct Bar { f: &'self fn() -> int } -const b : Bar/&static = Bar { f: foo }; +static b : Bar/&static = Bar { f: foo }; pub fn main() { fail_unless!((b.f)() == 0xca7f000d); diff --git a/src/test/run-pass/const-negative.rs b/src/test/run-pass/const-negative.rs index a2550829331..e2add6409f7 100644 --- a/src/test/run-pass/const-negative.rs +++ b/src/test/run-pass/const-negative.rs @@ -10,7 +10,7 @@ // Issue #358 -const toplevel_mod: int = -1; +static toplevel_mod: int = -1; pub fn main() { fail_unless!(toplevel_mod == -1); diff --git a/src/test/run-pass/const-nullary-enum.rs b/src/test/run-pass/const-nullary-enum.rs index cbc862185a8..bc61c8e9aec 100644 --- a/src/test/run-pass/const-nullary-enum.rs +++ b/src/test/run-pass/const-nullary-enum.rs @@ -14,7 +14,7 @@ enum Foo { Boo, } -const X: Foo = Bar; +static X: Foo = Bar; pub fn main() { match X { @@ -27,4 +27,4 @@ pub fn main() { } } -const Y: Foo = Baz; +static Y: Foo = Baz; diff --git a/src/test/run-pass/const-nullary-univariant-enum.rs b/src/test/run-pass/const-nullary-univariant-enum.rs index 184a9da6fb7..75fd2774095 100644 --- a/src/test/run-pass/const-nullary-univariant-enum.rs +++ b/src/test/run-pass/const-nullary-univariant-enum.rs @@ -12,11 +12,11 @@ enum Foo { Bar = 0xDEADBEE } -const X: Foo = Bar; +static X: Foo = Bar; pub fn main() { fail_unless!(((X as uint) == 0xDEADBEE)); fail_unless!(((Y as uint) == 0xDEADBEE)); } -const Y: Foo = Bar; +static Y: Foo = Bar; diff --git a/src/test/run-pass/const-rec-and-tup.rs b/src/test/run-pass/const-rec-and-tup.rs index ff1f3338e44..77d4521e709 100644 --- a/src/test/run-pass/const-rec-and-tup.rs +++ b/src/test/run-pass/const-rec-and-tup.rs @@ -12,11 +12,11 @@ struct Pair { a: float, b: float } struct AnotherPair { x: (i64, i64), y: Pair } -const x : (i32,i32) = (0xfeedf00dd,0xca11ab1e); -const y : AnotherPair = AnotherPair{ x: (0xf0f0f0f0_f0f0f0f0, - 0xabababab_abababab), - y: Pair { a: 3.14159265358979323846, - b: 2.7182818284590452354 }}; +static x : (i32,i32) = (0xfeedf00dd,0xca11ab1e); +static y : AnotherPair = AnotherPair{ x: (0xf0f0f0f0_f0f0f0f0, + 0xabababab_abababab), + y: Pair { a: 3.14159265358979323846, + b: 2.7182818284590452354 }}; pub fn main() { let (p, _) = y.x; diff --git a/src/test/run-pass/const-region-ptrs-noncopy.rs b/src/test/run-pass/const-region-ptrs-noncopy.rs index 078ae7661cf..23d1d63f189 100644 --- a/src/test/run-pass/const-region-ptrs-noncopy.rs +++ b/src/test/run-pass/const-region-ptrs-noncopy.rs @@ -10,8 +10,8 @@ type Big = [u64 * 8]; struct Pair { a: int, b: &'self Big } -const x: &'static Big = &([13, 14, 10, 13, 11, 14, 14, 15]); -const y: &'static Pair<'static> = &Pair {a: 15, b: x}; +static x: &'static Big = &([13, 14, 10, 13, 11, 14, 14, 15]); +static y: &'static Pair<'static> = &Pair {a: 15, b: x}; pub fn main() { fail_unless!(ptr::addr_of(x) == ptr::addr_of(y.b)); diff --git a/src/test/run-pass/const-region-ptrs.rs b/src/test/run-pass/const-region-ptrs.rs index dbb3abe7daf..32c5f65bf3a 100644 --- a/src/test/run-pass/const-region-ptrs.rs +++ b/src/test/run-pass/const-region-ptrs.rs @@ -11,9 +11,9 @@ struct Pair { a: int, b: &'self int } -const x: &'static int = &10; +static x: &'static int = &10; -const y: &'static Pair<'static> = &Pair {a: 15, b: x}; +static y: &'static Pair<'static> = &Pair {a: 15, b: x}; pub fn main() { io::println(fmt!("x = %?", *x)); diff --git a/src/test/run-pass/const-str-ptr.rs b/src/test/run-pass/const-str-ptr.rs index a1637f6ebb8..2560431b532 100644 --- a/src/test/run-pass/const-str-ptr.rs +++ b/src/test/run-pass/const-str-ptr.rs @@ -8,9 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -const a: [u8 * 3] = ['h' as u8, 'i' as u8, 0 as u8]; -const c: &'static [u8 * 3] = &a; -const b: *u8 = c as *u8; +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() { let foo = &a as *u8; diff --git a/src/test/run-pass/const-struct.rs b/src/test/run-pass/const-struct.rs index f2b5be4e36f..a826f7bf564 100644 --- a/src/test/run-pass/const-struct.rs +++ b/src/test/run-pass/const-struct.rs @@ -20,9 +20,9 @@ impl cmp::Eq for foo { fn ne(&self, other: &foo) -> bool { !(*self).eq(other) } } -const x : foo = foo { a:1, b:2, c: 3 }; -const y : foo = foo { b:2, c:3, a: 1 }; -const z : &'static foo = &foo { a: 10, b: 22, c: 12 }; +static x : foo = foo { a:1, b:2, c: 3 }; +static y : foo = foo { b:2, c:3, a: 1 }; +static z : &'static foo = &foo { a: 10, b: 22, c: 12 }; pub fn main() { fail_unless!(x.b == 2); diff --git a/src/test/run-pass/const-tuple-struct.rs b/src/test/run-pass/const-tuple-struct.rs index 9a25a2eb1aa..857997b29d2 100644 --- a/src/test/run-pass/const-tuple-struct.rs +++ b/src/test/run-pass/const-tuple-struct.rs @@ -10,7 +10,7 @@ struct Bar(int, int); -const X: Bar = Bar(1, 2); +static X: Bar = Bar(1, 2); pub fn main() { match X { diff --git a/src/test/run-pass/const-unit-struct.rs b/src/test/run-pass/const-unit-struct.rs index bc996314e03..b4acde098ba 100644 --- a/src/test/run-pass/const-unit-struct.rs +++ b/src/test/run-pass/const-unit-struct.rs @@ -10,7 +10,7 @@ struct Foo; -const X: Foo = Foo; +static X: Foo = Foo; pub fn main() { match X { diff --git a/src/test/run-pass/const-vec-of-fns.rs b/src/test/run-pass/const-vec-of-fns.rs index 5598756ac75..deb1a0769f7 100644 --- a/src/test/run-pass/const-vec-of-fns.rs +++ b/src/test/run-pass/const-vec-of-fns.rs @@ -9,16 +9,16 @@ // except according to those terms. /*! - * Try to double-check that const fns have the right size (with or + * Try to double-check that static fns have the right size (with or * without dummy env ptr, as appropriate) by iterating a size-2 array. - * If the const size differs from the runtime size, the second element + * If the static size differs from the runtime size, the second element * should be read as a null or otherwise wrong pointer and crash. */ fn f() { } -const bare_fns: &'static [extern fn()] = &[f, f]; +static bare_fns: &'static [extern fn()] = &[f, f]; struct S<'self>(&'self fn()); -const closures: &'static [S<'static>] = &[S(f), S(f)]; +static closures: &'static [S<'static>] = &[S(f), S(f)]; pub fn main() { for bare_fns.each |&bare_fn| { bare_fn() } diff --git a/src/test/run-pass/const-vecs-and-slices.rs b/src/test/run-pass/const-vecs-and-slices.rs index 1e86ff3515b..736335464b2 100644 --- a/src/test/run-pass/const-vecs-and-slices.rs +++ b/src/test/run-pass/const-vecs-and-slices.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -const x : [int * 4] = [1,2,3,4]; -const y : &'static [int] = &[1,2,3,4]; +static x : [int * 4] = [1,2,3,4]; +static y : &'static [int] = &[1,2,3,4]; pub fn main() { io::println(fmt!("%?", x[1])); diff --git a/src/test/run-pass/const.rs b/src/test/run-pass/const.rs index e935a2cd434..d9d84c3fd50 100644 --- a/src/test/run-pass/const.rs +++ b/src/test/run-pass/const.rs @@ -10,6 +10,6 @@ -const i: int = 10; +static i: int = 10; pub fn main() { debug!("%i", i); } diff --git a/src/test/run-pass/consts-in-patterns.rs b/src/test/run-pass/consts-in-patterns.rs index e6841495880..5e79838c4b7 100644 --- a/src/test/run-pass/consts-in-patterns.rs +++ b/src/test/run-pass/consts-in-patterns.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -const FOO: int = 10; -const BAR: int = 3; +static FOO: int = 10; +static BAR: int = 3; pub fn main() { let x: int = 3; diff --git a/src/test/run-pass/explicit-self.rs b/src/test/run-pass/explicit-self.rs index 1a21fa0a5d7..3e48b8f05ba 100644 --- a/src/test/run-pass/explicit-self.rs +++ b/src/test/run-pass/explicit-self.rs @@ -9,7 +9,7 @@ // except according to those terms. -const tau: float = 2.0*3.14159265358979323; +static tau: float = 2.0*3.14159265358979323; struct Point {x: float, y: float} struct Size {w: float, h: float} diff --git a/src/test/run-pass/export-glob-imports-target.rs b/src/test/run-pass/export-glob-imports-target.rs index ae17d6ca8b3..6b97c9031f0 100644 --- a/src/test/run-pass/export-glob-imports-target.rs +++ b/src/test/run-pass/export-glob-imports-target.rs @@ -18,7 +18,7 @@ mod foo { use foo::bar::*; pub mod bar { - pub const a : int = 10; + pub static a : int = 10; } pub fn zum() { let b = a; diff --git a/src/test/run-pass/foreign-mod-unused-const.rs b/src/test/run-pass/foreign-mod-unused-const.rs index f66ffbd0e0e..430da7a3f60 100644 --- a/src/test/run-pass/foreign-mod-unused-const.rs +++ b/src/test/run-pass/foreign-mod-unused-const.rs @@ -11,7 +11,7 @@ mod foo { #[nolink] pub extern { - pub const errno: int; + pub static errno: int; } } diff --git a/src/test/run-pass/issue-1660.rs b/src/test/run-pass/issue-1660.rs index da8dfbf6792..5c8b4be0cee 100644 --- a/src/test/run-pass/issue-1660.rs +++ b/src/test/run-pass/issue-1660.rs @@ -9,5 +9,5 @@ // except according to those terms. pub fn main() { - const _x: int = 1<<2; + static _x: int = 1<<2; } diff --git a/src/test/run-pass/issue-2190-1.rs b/src/test/run-pass/issue-2190-1.rs index c769c33390f..f3a81771c21 100644 --- a/src/test/run-pass/issue-2190-1.rs +++ b/src/test/run-pass/issue-2190-1.rs @@ -9,7 +9,7 @@ // except according to those terms. // xfail-test -const generations: uint = 1024+256+128+49; +static generations: uint = 1024+256+128+49; fn child_no(x: uint) -> ~fn() { || { diff --git a/src/test/run-pass/issue-2428.rs b/src/test/run-pass/issue-2428.rs index 766bc23173c..a571c49c438 100644 --- a/src/test/run-pass/issue-2428.rs +++ b/src/test/run-pass/issue-2428.rs @@ -10,7 +10,7 @@ pub fn main() { let foo = 100; - const quux: int = 5; + static quux: int = 5; enum Stuff { Bar = quux diff --git a/src/test/run-pass/item-attributes.rs b/src/test/run-pass/item-attributes.rs index 5de3e88acc0..24fe6713372 100644 --- a/src/test/run-pass/item-attributes.rs +++ b/src/test/run-pass/item-attributes.rs @@ -29,7 +29,7 @@ mod test_first_item_in_file_mod {} mod test_single_attr_outer { #[attr = "val"] - pub const x: int = 10; + pub static x: int = 10; #[attr = "val"] pub fn f() { } @@ -47,7 +47,7 @@ mod test_single_attr_outer { mod test_multi_attr_outer { #[attr1 = "val"] #[attr2 = "val"] - pub const x: int = 10; + pub static x: int = 10; #[attr1 = "val"] #[attr2 = "val"] @@ -72,7 +72,7 @@ mod test_multi_attr_outer { mod test_stmt_single_attr_outer { pub fn f() { #[attr = "val"] - const x: int = 10; + static x: int = 10; #[attr = "val"] fn f() { } @@ -95,7 +95,7 @@ mod test_stmt_multi_attr_outer { #[attr1 = "val"] #[attr2 = "val"] - const x: int = 10; + static x: int = 10; #[attr1 = "val"] #[attr2 = "val"] diff --git a/src/test/run-pass/mod-merge-hack-inst.rs b/src/test/run-pass/mod-merge-hack-inst.rs index e8cf244c6b1..999c6ac2a71 100644 --- a/src/test/run-pass/mod-merge-hack-inst.rs +++ b/src/test/run-pass/mod-merge-hack-inst.rs @@ -12,5 +12,5 @@ mod inst { pub type T = i32; - pub const bits: uint = 32; + pub static bits: uint = 32; } diff --git a/src/test/run-pass/mod-merge-hack-template.rs b/src/test/run-pass/mod-merge-hack-template.rs index 8628d84d4e7..7f7dd33dc09 100644 --- a/src/test/run-pass/mod-merge-hack-template.rs +++ b/src/test/run-pass/mod-merge-hack-template.rs @@ -12,5 +12,5 @@ use T = self::inst::T; -pub const bits: uint = inst::bits; +pub static bits: uint = inst::bits; pub fn min(x: T, y: T) -> T { if x < y { x } else { y } } diff --git a/src/test/run-pass/resolve-issue-2428.rs b/src/test/run-pass/resolve-issue-2428.rs index 20cda911cdd..799db4ed212 100644 --- a/src/test/run-pass/resolve-issue-2428.rs +++ b/src/test/run-pass/resolve-issue-2428.rs @@ -10,6 +10,6 @@ // xfail-test -const foo: int = 4 >> 1; +static foo: int = 4 >> 1; enum bs { thing = foo } pub fn main() { fail_unless!((thing as int == foo)); } diff --git a/src/test/run-pass/shift.rs b/src/test/run-pass/shift.rs index c6165c1530a..cea32fc745e 100644 --- a/src/test/run-pass/shift.rs +++ b/src/test/run-pass/shift.rs @@ -54,28 +54,28 @@ fn test_expr() { } fn test_const() { - const r1_1: uint = 10u >> 2u8; - const r2_1: uint = 10u << 4u8; + static r1_1: uint = 10u >> 2u8; + static r2_1: uint = 10u << 4u8; fail_unless!(r1_1 == 2 as uint); fail_unless!(r2_1 == 160 as uint); - const r1_2: u8 = 10u8 >> 2u; - const r2_2: u8 = 10u8 << 4u; + static r1_2: u8 = 10u8 >> 2u; + static r2_2: u8 = 10u8 << 4u; fail_unless!(r1_2 == 2 as u8); fail_unless!(r2_2 == 160 as u8); - const r1_3: int = 10 >> 2i8; - const r2_3: int = 10 << 4i8; + static r1_3: int = 10 >> 2i8; + static r2_3: int = 10 << 4i8; fail_unless!(r1_3 == 2 as int); fail_unless!(r2_3 == 160 as int); - const r1_4: i8 = 10i8 >> 2; - const r2_4: i8 = 10i8 << 4; + static r1_4: i8 = 10i8 >> 2; + static r2_4: i8 = 10i8 << 4; fail_unless!(r1_4 == 2 as i8); fail_unless!(r2_4 == 160 as i8); - const r1_5: uint = 10u >> 2i8; - const r2_5: uint = 10u << 4i8; + static r1_5: uint = 10u >> 2i8; + static r2_5: uint = 10u << 4i8; fail_unless!(r1_5 == 2 as uint); fail_unless!(r2_5 == 160 as uint); }