]> git.lizzy.rs Git - rust.git/commitdiff
rustc: Convert statics to constants
authorAlex Crichton <alex@alexcrichton.com>
Tue, 7 Oct 2014 00:30:54 +0000 (17:30 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Thu, 9 Oct 2014 16:44:51 +0000 (09:44 -0700)
14 files changed:
src/librustc/back/link.rs
src/librustc/driver/config.rs
src/librustc/lint/context.rs
src/librustc/lint/mod.rs
src/librustc/metadata/common.rs
src/librustc/metadata/encoder.rs
src/librustc/metadata/loader.rs
src/librustc/middle/graph.rs
src/librustc/middle/trans/cleanup.rs
src/librustc/middle/ty.rs
src/librustc/middle/typeck/astconv.rs
src/librustc/middle/typeck/infer/resolve.rs
src/librustc_back/abi.rs
src/librustc_llvm/lib.rs

index 295768d468eac9385944e0a008f50c47b1d099e3..fc5d726bf67c24c351dc5c368e3586b9436d1c21 100644 (file)
 
 // This is the "magic number" expected at the beginning of a LLVM bytecode
 // object in an rlib.
-pub static RLIB_BYTECODE_OBJECT_MAGIC: &'static [u8] = b"RUST_OBJECT";
+pub const RLIB_BYTECODE_OBJECT_MAGIC: &'static [u8] = b"RUST_OBJECT";
 
 // The version number this compiler will write to bytecode objects in rlibs
-pub static RLIB_BYTECODE_OBJECT_VERSION: u32 = 1;
+pub const RLIB_BYTECODE_OBJECT_VERSION: u32 = 1;
 
 // The offset in bytes the bytecode object format version number can be found at
-pub static RLIB_BYTECODE_OBJECT_VERSION_OFFSET: uint = 11;
+pub const RLIB_BYTECODE_OBJECT_VERSION_OFFSET: uint = 11;
 
 // The offset in bytes the size of the compressed bytecode can be found at in
 // format version 1
-pub static RLIB_BYTECODE_OBJECT_V1_DATASIZE_OFFSET: uint =
+pub const RLIB_BYTECODE_OBJECT_V1_DATASIZE_OFFSET: uint =
     RLIB_BYTECODE_OBJECT_VERSION_OFFSET + 4;
 
 // The offset in bytes the compressed LLVM bytecode can be found at in format
 // version 1
-pub static RLIB_BYTECODE_OBJECT_V1_DATA_OFFSET: uint =
+pub const RLIB_BYTECODE_OBJECT_V1_DATA_OFFSET: uint =
     RLIB_BYTECODE_OBJECT_V1_DATASIZE_OFFSET + 8;
 
 
index 9ce012502446dca7f8d9fcfe3bd6efd4daf0e3e4..fdd3c5b5a2608b8782ccc57f71390171ca5b6540 100644 (file)
@@ -154,10 +154,10 @@ pub enum CrateType {
 
 macro_rules! debugging_opts(
     ([ $opt:ident ] $cnt:expr ) => (
-        pub static $opt: u64 = 1 << $cnt;
+        pub const $opt: u64 = 1 << $cnt;
     );
     ([ $opt:ident, $($rest:ident),* ] $cnt:expr ) => (
-        pub static $opt: u64 = 1 << $cnt;
+        pub const $opt: u64 = 1 << $cnt;
         debugging_opts!([ $($rest),* ] $cnt + 1)
     )
 )
@@ -268,7 +268,7 @@ pub fn basic_codegen_options() -> CodegenOptions {
     }
 
     pub type CodegenSetter = fn(&mut CodegenOptions, v: Option<&str>) -> bool;
-    pub static CG_OPTIONS: &'static [(&'static str, CodegenSetter,
+    pub const CG_OPTIONS: &'static [(&'static str, CodegenSetter,
                                       &'static str)] =
         &[ $( (stringify!($opt), cgsetters::$opt, $desc) ),* ];
 
index bb277511463b9f61c69e43cbe60a2853e8f8b444..6d00724fb41fc1be400908b1a596ea1ba6ad24ee 100644 (file)
@@ -112,9 +112,9 @@ pub fn get_lint_groups<'t>(&'t self) -> Vec<(&'static str, Vec<LintId>, bool)> {
     pub fn register_pass(&mut self, sess: Option<&Session>,
                          from_plugin: bool, pass: LintPassObject) {
         for &lint in pass.get_lints().iter() {
-            self.lints.push((lint, from_plugin));
+            self.lints.push((*lint, from_plugin));
 
-            let id = LintId::of(lint);
+            let id = LintId::of(*lint);
             if !self.by_name.insert(lint.name_lower(), id) {
                 let msg = format!("duplicate specification of lint {}", lint.name_lower());
                 match (sess, from_plugin) {
index 8047c12efc2917adc9b4549fb0f5a0dfcf7fafb4..5afe5326171d7851b0047c06c3407906daf8fd07 100644 (file)
@@ -99,12 +99,12 @@ macro_rules! declare_lint (
 macro_rules! lint_array ( ($( $lint:expr ),*) => (
     {
         #[allow(non_uppercase_statics)]
-        static array: LintArray = &[ $( $lint ),* ];
+        static array: LintArray = &[ $( &$lint ),* ];
         array
     }
 ))
 
-pub type LintArray = &'static [&'static Lint];
+pub type LintArray = &'static [&'static &'static Lint];
 
 /// Trait for types providing lint checks.
 ///
index ef88795762e43617966665217885920a7612caf9..492feee6f84b3033240d5e9dc586778eb252e33e 100644 (file)
 
 // EBML enum definitions and utils shared by the encoder and decoder
 
-pub static tag_items: uint = 0x00;
+pub const tag_items: uint = 0x00;
 
-pub static tag_paths_data_name: uint = 0x01;
+pub const tag_paths_data_name: uint = 0x01;
 
-pub static tag_def_id: uint = 0x02;
+pub const tag_def_id: uint = 0x02;
 
-pub static tag_items_data: uint = 0x03;
+pub const tag_items_data: uint = 0x03;
 
-pub static tag_items_data_item: uint = 0x04;
+pub const tag_items_data_item: uint = 0x04;
 
-pub static tag_items_data_item_family: uint = 0x05;
+pub const tag_items_data_item_family: uint = 0x05;
 
-pub static tag_items_data_item_type: uint = 0x07;
+pub const tag_items_data_item_type: uint = 0x07;
 
-pub static tag_items_data_item_symbol: uint = 0x08;
+pub const tag_items_data_item_symbol: uint = 0x08;
 
-pub static tag_items_data_item_variant: uint = 0x09;
+pub const tag_items_data_item_variant: uint = 0x09;
 
-pub static tag_items_data_parent_item: uint = 0x0a;
+pub const tag_items_data_parent_item: uint = 0x0a;
 
-pub static tag_items_data_item_is_tuple_struct_ctor: uint = 0x0b;
+pub const tag_items_data_item_is_tuple_struct_ctor: uint = 0x0b;
 
-pub static tag_index: uint = 0x0c;
+pub const tag_index: uint = 0x0c;
 
-pub static tag_index_buckets: uint = 0x0d;
+pub const tag_index_buckets: uint = 0x0d;
 
-pub static tag_index_buckets_bucket: uint = 0x0e;
+pub const tag_index_buckets_bucket: uint = 0x0e;
 
-pub static tag_index_buckets_bucket_elt: uint = 0x0f;
+pub const tag_index_buckets_bucket_elt: uint = 0x0f;
 
-pub static tag_index_table: uint = 0x10;
+pub const tag_index_table: uint = 0x10;
 
-pub static tag_meta_item_name_value: uint = 0x11;
+pub const tag_meta_item_name_value: uint = 0x11;
 
-pub static tag_meta_item_name: uint = 0x12;
+pub const tag_meta_item_name: uint = 0x12;
 
-pub static tag_meta_item_value: uint = 0x13;
+pub const tag_meta_item_value: uint = 0x13;
 
-pub static tag_attributes: uint = 0x14;
+pub const tag_attributes: uint = 0x14;
 
-pub static tag_attribute: uint = 0x15;
+pub const tag_attribute: uint = 0x15;
 
-pub static tag_meta_item_word: uint = 0x16;
+pub const tag_meta_item_word: uint = 0x16;
 
-pub static tag_meta_item_list: uint = 0x17;
+pub const tag_meta_item_list: uint = 0x17;
 
 // The list of crates that this crate depends on
-pub static tag_crate_deps: uint = 0x18;
+pub const tag_crate_deps: uint = 0x18;
 
 // A single crate dependency
-pub static tag_crate_dep: uint = 0x19;
+pub const tag_crate_dep: uint = 0x19;
 
-pub static tag_crate_hash: uint = 0x1a;
-pub static tag_crate_crate_name: uint = 0x1b;
+pub const tag_crate_hash: uint = 0x1a;
+pub const tag_crate_crate_name: uint = 0x1b;
 
-pub static tag_crate_dep_crate_name: uint = 0x1d;
-pub static tag_crate_dep_hash: uint = 0x1e;
+pub const tag_crate_dep_crate_name: uint = 0x1d;
+pub const tag_crate_dep_hash: uint = 0x1e;
 
-pub static tag_mod_impl: uint = 0x1f;
+pub const tag_mod_impl: uint = 0x1f;
 
-pub static tag_item_trait_item: uint = 0x20;
+pub const tag_item_trait_item: uint = 0x20;
 
-pub static tag_item_trait_ref: uint = 0x21;
-pub static tag_item_super_trait_ref: uint = 0x22;
+pub const tag_item_trait_ref: uint = 0x21;
+pub const tag_item_super_trait_ref: uint = 0x22;
 
 // discriminator value for variants
-pub static tag_disr_val: uint = 0x23;
+pub const tag_disr_val: uint = 0x23;
 
 // used to encode ast_map::PathElem
-pub static tag_path: uint = 0x24;
-pub static tag_path_len: uint = 0x25;
-pub static tag_path_elem_mod: uint = 0x26;
-pub static tag_path_elem_name: uint = 0x27;
-pub static tag_item_field: uint = 0x28;
-pub static tag_item_field_origin: uint = 0x29;
-
-pub static tag_item_variances: uint = 0x2a;
+pub const tag_path: uint = 0x24;
+pub const tag_path_len: uint = 0x25;
+pub const tag_path_elem_mod: uint = 0x26;
+pub const tag_path_elem_name: uint = 0x27;
+pub const tag_item_field: uint = 0x28;
+pub const tag_item_field_origin: uint = 0x29;
+
+pub const tag_item_variances: uint = 0x2a;
 /*
   trait items contain tag_item_trait_item elements,
   impl items contain tag_item_impl_item elements, and classes
@@ -100,15 +100,15 @@ impl items contain tag_item_impl_item elements, and classes
   both, tag_item_trait_item and tag_item_impl_item have to be two
   different tags.
  */
-pub static tag_item_impl_item: uint = 0x30;
-pub static tag_item_trait_method_explicit_self: uint = 0x31;
+pub const tag_item_impl_item: uint = 0x30;
+pub const tag_item_trait_method_explicit_self: uint = 0x31;
 
 
 // Reexports are found within module tags. Each reexport contains def_ids
 // and names.
-pub static tag_items_data_item_reexport: uint = 0x38;
-pub static tag_items_data_item_reexport_def_id: uint = 0x39;
-pub static tag_items_data_item_reexport_name: uint = 0x3a;
+pub const tag_items_data_item_reexport: uint = 0x38;
+pub const tag_items_data_item_reexport_def_id: uint = 0x39;
+pub const tag_items_data_item_reexport_name: uint = 0x3a;
 
 // used to encode crate_ctxt side tables
 #[deriving(PartialEq)]
@@ -153,15 +153,15 @@ pub fn from_uint(value : uint) -> Option<astencode_tag> {
     }
 }
 
-pub static tag_item_trait_item_sort: uint = 0x60;
+pub const tag_item_trait_item_sort: uint = 0x60;
 
-pub static tag_item_trait_parent_sort: uint = 0x61;
+pub const tag_item_trait_parent_sort: uint = 0x61;
 
-pub static tag_item_impl_type_basename: uint = 0x62;
+pub const tag_item_impl_type_basename: uint = 0x62;
 
-pub static tag_crate_triple: uint = 0x66;
+pub const tag_crate_triple: uint = 0x66;
 
-pub static tag_dylib_dependency_formats: uint = 0x67;
+pub const tag_dylib_dependency_formats: uint = 0x67;
 
 // Language items are a top-level directory (for speed). Hierarchy:
 //
@@ -170,51 +170,51 @@ pub fn from_uint(value : uint) -> Option<astencode_tag> {
 //   - tag_lang_items_item_id: u32
 //   - tag_lang_items_item_node_id: u32
 
-pub static tag_lang_items: uint = 0x70;
-pub static tag_lang_items_item: uint = 0x71;
-pub static tag_lang_items_item_id: uint = 0x72;
-pub static tag_lang_items_item_node_id: uint = 0x73;
-pub static tag_lang_items_missing: uint = 0x74;
+pub const tag_lang_items: uint = 0x70;
+pub const tag_lang_items_item: uint = 0x71;
+pub const tag_lang_items_item_id: uint = 0x72;
+pub const tag_lang_items_item_node_id: uint = 0x73;
+pub const tag_lang_items_missing: uint = 0x74;
 
-pub static tag_item_unnamed_field: uint = 0x75;
-pub static tag_items_data_item_visibility: uint = 0x76;
+pub const tag_item_unnamed_field: uint = 0x75;
+pub const tag_items_data_item_visibility: uint = 0x76;
 
-pub static tag_item_method_tps: uint = 0x79;
-pub static tag_item_method_fty: uint = 0x7a;
+pub const tag_item_method_tps: uint = 0x79;
+pub const tag_item_method_fty: uint = 0x7a;
 
-pub static tag_mod_child: uint = 0x7b;
-pub static tag_misc_info: uint = 0x7c;
-pub static tag_misc_info_crate_items: uint = 0x7d;
+pub const tag_mod_child: uint = 0x7b;
+pub const tag_misc_info: uint = 0x7c;
+pub const tag_misc_info_crate_items: uint = 0x7d;
 
-pub static tag_item_method_provided_source: uint = 0x7e;
-pub static tag_item_impl_vtables: uint = 0x7f;
+pub const tag_item_method_provided_source: uint = 0x7e;
+pub const tag_item_impl_vtables: uint = 0x7f;
 
-pub static tag_impls: uint = 0x80;
-pub static tag_impls_impl: uint = 0x81;
+pub const tag_impls: uint = 0x80;
+pub const tag_impls_impl: uint = 0x81;
 
-pub static tag_items_data_item_inherent_impl: uint = 0x82;
-pub static tag_items_data_item_extension_impl: uint = 0x83;
+pub const tag_items_data_item_inherent_impl: uint = 0x82;
+pub const tag_items_data_item_extension_impl: uint = 0x83;
 
 // GAP 0x84, 0x85, 0x86
 
-pub static tag_native_libraries: uint = 0x87;
-pub static tag_native_libraries_lib: uint = 0x88;
-pub static tag_native_libraries_name: uint = 0x89;
-pub static tag_native_libraries_kind: uint = 0x8a;
+pub const tag_native_libraries: uint = 0x87;
+pub const tag_native_libraries_lib: uint = 0x88;
+pub const tag_native_libraries_name: uint = 0x89;
+pub const tag_native_libraries_kind: uint = 0x8a;
 
-pub static tag_plugin_registrar_fn: uint = 0x8b;
-pub static tag_exported_macros: uint = 0x8c;
-pub static tag_macro_def: uint = 0x8d;
+pub const tag_plugin_registrar_fn: uint = 0x8b;
+pub const tag_exported_macros: uint = 0x8c;
+pub const tag_macro_def: uint = 0x8d;
 
-pub static tag_method_argument_names: uint = 0x8e;
-pub static tag_method_argument_name: uint = 0x8f;
+pub const tag_method_argument_names: uint = 0x8e;
+pub const tag_method_argument_name: uint = 0x8f;
 
-pub static tag_reachable_extern_fns: uint = 0x90;
-pub static tag_reachable_extern_fn_id: uint = 0x91;
+pub const tag_reachable_extern_fns: uint = 0x90;
+pub const tag_reachable_extern_fn_id: uint = 0x91;
 
-pub static tag_items_data_item_stability: uint = 0x92;
+pub const tag_items_data_item_stability: uint = 0x92;
 
-pub static tag_items_data_item_repr: uint = 0x93;
+pub const tag_items_data_item_repr: uint = 0x93;
 
 #[deriving(Clone, Show)]
 pub struct LinkMeta {
@@ -222,29 +222,29 @@ pub struct LinkMeta {
     pub crate_hash: Svh,
 }
 
-pub static tag_unboxed_closures: uint = 0x95;
-pub static tag_unboxed_closure: uint = 0x96;
-pub static tag_unboxed_closure_type: uint = 0x97;
-pub static tag_unboxed_closure_kind: uint = 0x98;
+pub const tag_unboxed_closures: uint = 0x95;
+pub const tag_unboxed_closure: uint = 0x96;
+pub const tag_unboxed_closure_type: uint = 0x97;
+pub const tag_unboxed_closure_kind: uint = 0x98;
 
-pub static tag_struct_fields: uint = 0x99;
-pub static tag_struct_field: uint = 0x9a;
-pub static tag_struct_field_id: uint = 0x9b;
+pub const tag_struct_fields: uint = 0x99;
+pub const tag_struct_field: uint = 0x9a;
+pub const tag_struct_field_id: uint = 0x9b;
 
-pub static tag_attribute_is_sugared_doc: uint = 0x9c;
+pub const tag_attribute_is_sugared_doc: uint = 0x9c;
 
-pub static tag_trait_def_bounds: uint = 0x9d;
+pub const tag_trait_def_bounds: uint = 0x9d;
 
-pub static tag_items_data_region: uint = 0x9e;
+pub const tag_items_data_region: uint = 0x9e;
 
-pub static tag_region_param_def: uint = 0xa0;
-pub static tag_region_param_def_ident: uint = 0xa1;
-pub static tag_region_param_def_def_id: uint = 0xa2;
-pub static tag_region_param_def_space: uint = 0xa3;
-pub static tag_region_param_def_index: uint = 0xa4;
+pub const tag_region_param_def: uint = 0xa0;
+pub const tag_region_param_def_ident: uint = 0xa1;
+pub const tag_region_param_def_def_id: uint = 0xa2;
+pub const tag_region_param_def_space: uint = 0xa3;
+pub const tag_region_param_def_index: uint = 0xa4;
 
-pub static tag_type_param_def: uint = 0xa5;
+pub const tag_type_param_def: uint = 0xa5;
 
-pub static tag_item_generics: uint = 0xa6;
-pub static tag_method_ty_generics: uint = 0xa7;
+pub const tag_item_generics: uint = 0xa6;
+pub const tag_method_ty_generics: uint = 0xa7;
 
index 94d86956f70058142542acb92012d90fe71aeaa8..02f6a4a78dbc819f26501c10f3abff01b80cb172 100644 (file)
@@ -2035,7 +2035,7 @@ fn encode_dylib_dependency_formats(rbml_w: &mut Encoder, ecx: &EncodeContext) {
 
 // NB: Increment this as you change the metadata encoding version.
 #[allow(non_uppercase_statics)]
-pub static metadata_encoding_version : &'static [u8] = &[b'r', b'u', b's', b't', 0, 0, 0, 1 ];
+pub const metadata_encoding_version : &'static [u8] = &[b'r', b'u', b's', b't', 0, 0, 0, 1 ];
 
 pub fn encode_metadata(parms: EncodeParams, krate: &Crate) -> Vec<u8> {
     let mut wr = SeekableMemWriter::new();
index dc97b6c0df8cce1f9220d0c92f412311ec953907..62c179f598c965c8396807986365105a829854f0 100644 (file)
 use flate;
 use time;
 
-pub static MACOS_DLL_PREFIX: &'static str = "lib";
-pub static MACOS_DLL_SUFFIX: &'static str = ".dylib";
+pub const MACOS_DLL_PREFIX: &'static str = "lib";
+pub const MACOS_DLL_SUFFIX: &'static str = ".dylib";
 
-pub static WIN32_DLL_PREFIX: &'static str = "";
-pub static WIN32_DLL_SUFFIX: &'static str = ".dll";
+pub const WIN32_DLL_PREFIX: &'static str = "";
+pub const WIN32_DLL_SUFFIX: &'static str = ".dll";
 
-pub static LINUX_DLL_PREFIX: &'static str = "lib";
-pub static LINUX_DLL_SUFFIX: &'static str = ".so";
+pub const LINUX_DLL_PREFIX: &'static str = "lib";
+pub const LINUX_DLL_SUFFIX: &'static str = ".so";
 
-pub static FREEBSD_DLL_PREFIX: &'static str = "lib";
-pub static FREEBSD_DLL_SUFFIX: &'static str = ".so";
+pub const FREEBSD_DLL_PREFIX: &'static str = "lib";
+pub const FREEBSD_DLL_SUFFIX: &'static str = ".so";
 
-pub static DRAGONFLY_DLL_PREFIX: &'static str = "lib";
-pub static DRAGONFLY_DLL_SUFFIX: &'static str = ".so";
+pub const DRAGONFLY_DLL_PREFIX: &'static str = "lib";
+pub const DRAGONFLY_DLL_SUFFIX: &'static str = ".so";
 
-pub static ANDROID_DLL_PREFIX: &'static str = "lib";
-pub static ANDROID_DLL_SUFFIX: &'static str = ".so";
+pub const ANDROID_DLL_PREFIX: &'static str = "lib";
+pub const ANDROID_DLL_SUFFIX: &'static str = ".so";
 
 pub struct CrateMismatch {
     path: Path,
index 9135ca07935a5d8903a79b160a9ae1223a216da8..8484ec9293496da690040f446eeb3310df75a027 100644 (file)
@@ -58,20 +58,20 @@ pub struct Edge<E> {
 #[deriving(Clone, PartialEq, Show)]
 pub struct NodeIndex(pub uint);
 #[allow(non_uppercase_statics)]
-pub static InvalidNodeIndex: NodeIndex = NodeIndex(uint::MAX);
+pub const InvalidNodeIndex: NodeIndex = NodeIndex(uint::MAX);
 
 #[deriving(PartialEq)]
 pub struct EdgeIndex(pub uint);
 #[allow(non_uppercase_statics)]
-pub static InvalidEdgeIndex: EdgeIndex = EdgeIndex(uint::MAX);
+pub const InvalidEdgeIndex: EdgeIndex = EdgeIndex(uint::MAX);
 
 // Use a private field here to guarantee no more instances are created:
 #[deriving(Show)]
 pub struct Direction { repr: uint }
 #[allow(non_uppercase_statics)]
-pub static Outgoing: Direction = Direction { repr: 0 };
+pub const Outgoing: Direction = Direction { repr: 0 };
 #[allow(non_uppercase_statics)]
-pub static Incoming: Direction = Direction { repr: 1 };
+pub const Incoming: Direction = Direction { repr: 1 };
 
 impl NodeIndex {
     fn get(&self) -> uint { let NodeIndex(v) = *self; v }
index 20fd0b0eb3d8f66728528969806f107bb1fc0e50..392436d3a806994a5c08c1672ba07f9492e0084b 100644 (file)
@@ -49,9 +49,9 @@ pub struct CustomScopeIndex {
     index: uint
 }
 
-pub static EXIT_BREAK: uint = 0;
-pub static EXIT_LOOP: uint = 1;
-pub static EXIT_MAX: uint = 2;
+pub const EXIT_BREAK: uint = 0;
+pub const EXIT_LOOP: uint = 1;
+pub const EXIT_MAX: uint = 2;
 
 pub enum CleanupScopeKind<'blk, 'tcx: 'blk> {
     CustomScopeKind,
index e1491c1f49be24fc20680fb9c90a8f641ab6064b..cea74c6573d545ba89f37b7628194fdf07c87703 100644 (file)
@@ -68,7 +68,7 @@
 
 pub type Disr = u64;
 
-pub static INITIAL_DISCRIMINANT_VALUE: Disr = 0;
+pub const INITIAL_DISCRIMINANT_VALUE: Disr = 0;
 
 // Data types
 
@@ -918,7 +918,7 @@ macro_rules! def_prim_ty(
         flags: super::has_ty_err as uint,
     };
 
-    pub static LAST_PRIMITIVE_ID: uint = 18;
+    pub const LAST_PRIMITIVE_ID: uint = 18;
 }
 
 // NB: If you change this, you'll probably want to change the corresponding
@@ -2200,7 +2200,7 @@ mod $mname {
             use middle::ty::TypeContents;
             $(
                 #[allow(non_uppercase_statics)]
-                pub static $name: TypeContents = TypeContents { bits: $bits };
+                pub const $name: TypeContents = TypeContents { bits: $bits };
              )+
         }
     }
index 4d21090dd2c2aa14baa1b7d145b9881d101ee388..efd0a2a0e48b2fcad2f33bf012d70be8d8052f74 100644 (file)
@@ -440,8 +440,8 @@ pub fn ast_path_to_ty_relaxed<'tcx, AC: AstConv<'tcx>,
     }
 }
 
-pub static NO_REGIONS: uint = 1;
-pub static NO_TPS: uint = 2;
+pub const NO_REGIONS: uint = 1;
+pub const NO_TPS: uint = 2;
 
 fn check_path_args(tcx: &ty::ctxt,
                    path: &ast::Path,
index 13659d4b77e1c5e1a59e601c1eec6c55aa7b374a..87f3fd987871cdea8336a33a84896dcd4b364941 100644 (file)
 use syntax::codemap::Span;
 use util::ppaux::{Repr, ty_to_string};
 
-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_all: uint         = 0b0000001111;
-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_all: uint           = 0b0111100000;
+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_all: uint         = 0b0000001111;
+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_all: uint           = 0b0111100000;
 
-pub static not_regions: uint         = !(force_rvar | resolve_rvar);
+pub const not_regions: uint         = !(force_rvar | resolve_rvar);
 
-pub static try_resolve_tvar_shallow: uint = 0;
-pub static resolve_and_force_all_but_regions: uint =
+pub const try_resolve_tvar_shallow: uint = 0;
+pub const resolve_and_force_all_but_regions: uint =
     (resolve_all | force_all) & not_regions;
 
 pub struct ResolveState<'a, 'tcx: 'a> {
index 1e69ce003c557a9125d06d5a02c79e6accd3fe65..bf525db7661b008a41aa415a4fe066b413f714b3 100644 (file)
 
 #![allow(non_uppercase_statics)]
 
-pub static box_field_refcnt: uint = 0u;
-pub static box_field_drop_glue: uint = 1u;
-pub static box_field_body: uint = 4u;
+pub const box_field_refcnt: uint = 0u;
+pub const box_field_drop_glue: uint = 1u;
+pub const box_field_body: uint = 4u;
 
-pub static tydesc_field_visit_glue: uint = 3u;
+pub const tydesc_field_visit_glue: uint = 3u;
 
 // The two halves of a closure: code and environment.
-pub static fn_field_code: uint = 0u;
-pub static fn_field_box: uint = 1u;
+pub const fn_field_code: uint = 0u;
+pub const fn_field_box: uint = 1u;
 
 // The two fields of a trait object/trait instance: vtable and box.
 // The vtable contains the type descriptor as first element.
-pub static trt_field_box: uint = 0u;
-pub static trt_field_vtable: uint = 1u;
+pub const trt_field_box: uint = 0u;
+pub const trt_field_vtable: uint = 1u;
 
-pub static slice_elt_base: uint = 0u;
-pub static slice_elt_len: uint = 1u;
+pub const slice_elt_base: uint = 0u;
+pub const slice_elt_len: uint = 1u;
index ad2b6891dc99e43ffdb6de4629939efd3646c201..aa6023326d6c17e817cfd22ee71167f6201f8736 100644 (file)
@@ -43,8 +43,8 @@
 pub type Opcode = u32;
 pub type Bool = c_uint;
 
-pub static True: Bool = 1 as Bool;
-pub static False: Bool = 0 as Bool;
+pub const True: Bool = 1 as Bool;
+pub const False: Bool = 0 as Bool;
 
 // Consts for the LLVM CallConv type, pre-cast to uint.
 
@@ -93,32 +93,32 @@ pub enum DiagnosticSeverity {
 
 bitflags! {
     flags Attribute : u32 {
-        static ZExtAttribute = 1 << 0,
-        static SExtAttribute = 1 << 1,
-        static NoReturnAttribute = 1 << 2,
-        static InRegAttribute = 1 << 3,
-        static StructRetAttribute = 1 << 4,
-        static NoUnwindAttribute = 1 << 5,
-        static NoAliasAttribute = 1 << 6,
-        static ByValAttribute = 1 << 7,
-        static NestAttribute = 1 << 8,
-        static ReadNoneAttribute = 1 << 9,
-        static ReadOnlyAttribute = 1 << 10,
-        static NoInlineAttribute = 1 << 11,
-        static AlwaysInlineAttribute = 1 << 12,
-        static OptimizeForSizeAttribute = 1 << 13,
-        static StackProtectAttribute = 1 << 14,
-        static StackProtectReqAttribute = 1 << 15,
-        static AlignmentAttribute = 31 << 16,
-        static NoCaptureAttribute = 1 << 21,
-        static NoRedZoneAttribute = 1 << 22,
-        static NoImplicitFloatAttribute = 1 << 23,
-        static NakedAttribute = 1 << 24,
-        static InlineHintAttribute = 1 << 25,
-        static StackAttribute = 7 << 26,
-        static ReturnsTwiceAttribute = 1 << 29,
-        static UWTableAttribute = 1 << 30,
-        static NonLazyBindAttribute = 1 << 31,
+        const ZExtAttribute = 1 << 0,
+        const SExtAttribute = 1 << 1,
+        const NoReturnAttribute = 1 << 2,
+        const InRegAttribute = 1 << 3,
+        const StructRetAttribute = 1 << 4,
+        const NoUnwindAttribute = 1 << 5,
+        const NoAliasAttribute = 1 << 6,
+        const ByValAttribute = 1 << 7,
+        const NestAttribute = 1 << 8,
+        const ReadNoneAttribute = 1 << 9,
+        const ReadOnlyAttribute = 1 << 10,
+        const NoInlineAttribute = 1 << 11,
+        const AlwaysInlineAttribute = 1 << 12,
+        const OptimizeForSizeAttribute = 1 << 13,
+        const StackProtectAttribute = 1 << 14,
+        const StackProtectReqAttribute = 1 << 15,
+        const AlignmentAttribute = 31 << 16,
+        const NoCaptureAttribute = 1 << 21,
+        const NoRedZoneAttribute = 1 << 22,
+        const NoImplicitFloatAttribute = 1 << 23,
+        const NakedAttribute = 1 << 24,
+        const InlineHintAttribute = 1 << 25,
+        const StackAttribute = 7 << 26,
+        const ReturnsTwiceAttribute = 1 << 29,
+        const UWTableAttribute = 1 << 30,
+        const NonLazyBindAttribute = 1 << 31,
     }
 }