diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-10-06 17:30:54 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-10-09 09:44:51 -0700 |
| commit | 831f909484176c20a6acba0a689cb9787948e9d7 (patch) | |
| tree | 64c4dabdaa96609185e054f6cce848d7538f1ca0 | |
| parent | b8fb0cf789289fb7d350cc553d871f880e1b2b02 (diff) | |
| download | rust-831f909484176c20a6acba0a689cb9787948e9d7.tar.gz rust-831f909484176c20a6acba0a689cb9787948e9d7.zip | |
rustc: Convert statics to constants
| -rw-r--r-- | src/librustc/back/link.rs | 10 | ||||
| -rw-r--r-- | src/librustc/driver/config.rs | 6 | ||||
| -rw-r--r-- | src/librustc/lint/context.rs | 4 | ||||
| -rw-r--r-- | src/librustc/lint/mod.rs | 4 | ||||
| -rw-r--r-- | src/librustc/metadata/common.rs | 202 | ||||
| -rw-r--r-- | src/librustc/metadata/encoder.rs | 2 | ||||
| -rw-r--r-- | src/librustc/metadata/loader.rs | 24 | ||||
| -rw-r--r-- | src/librustc/middle/graph.rs | 8 | ||||
| -rw-r--r-- | src/librustc/middle/trans/cleanup.rs | 6 | ||||
| -rw-r--r-- | src/librustc/middle/ty.rs | 6 | ||||
| -rw-r--r-- | src/librustc/middle/typeck/astconv.rs | 4 | ||||
| -rw-r--r-- | src/librustc/middle/typeck/infer/resolve.rs | 26 | ||||
| -rw-r--r-- | src/librustc_back/abi.rs | 20 | ||||
| -rw-r--r-- | src/librustc_llvm/lib.rs | 56 |
14 files changed, 189 insertions, 189 deletions
diff --git a/src/librustc/back/link.rs b/src/librustc/back/link.rs index 295768d468e..fc5d726bf67 100644 --- a/src/librustc/back/link.rs +++ b/src/librustc/back/link.rs @@ -55,22 +55,22 @@ use syntax::parse::token; // 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; diff --git a/src/librustc/driver/config.rs b/src/librustc/driver/config.rs index 9ce01250244..fdd3c5b5a26 100644 --- a/src/librustc/driver/config.rs +++ b/src/librustc/driver/config.rs @@ -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 @@ macro_rules! cgoptions( } 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) ),* ]; diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index bb277511463..6d00724fb41 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -112,9 +112,9 @@ impl LintStore { 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) { diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs index 8047c12efc2..5afe5326171 100644 --- a/src/librustc/lint/mod.rs +++ b/src/librustc/lint/mod.rs @@ -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. /// diff --git a/src/librustc/metadata/common.rs b/src/librustc/metadata/common.rs index ef88795762e..492feee6f84 100644 --- a/src/librustc/metadata/common.rs +++ b/src/librustc/metadata/common.rs @@ -15,83 +15,83 @@ use back::svh::Svh; // 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 @@ pub static tag_item_variances: uint = 0x2a; 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 @@ impl 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 static tag_dylib_dependency_formats: uint = 0x67; // - 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; diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index 94d86956f70..02f6a4a78db 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -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(); diff --git a/src/librustc/metadata/loader.rs b/src/librustc/metadata/loader.rs index dc97b6c0df8..62c179f598c 100644 --- a/src/librustc/metadata/loader.rs +++ b/src/librustc/metadata/loader.rs @@ -241,23 +241,23 @@ use std::collections::hashmap::{Occupied, Vacant}; 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, diff --git a/src/librustc/middle/graph.rs b/src/librustc/middle/graph.rs index 9135ca07935..8484ec92934 100644 --- a/src/librustc/middle/graph.rs +++ b/src/librustc/middle/graph.rs @@ -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 } diff --git a/src/librustc/middle/trans/cleanup.rs b/src/librustc/middle/trans/cleanup.rs index 20fd0b0eb3d..392436d3a80 100644 --- a/src/librustc/middle/trans/cleanup.rs +++ b/src/librustc/middle/trans/cleanup.rs @@ -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, diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index e1491c1f49b..cea74c6573d 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -68,7 +68,7 @@ use std::collections::enum_set::{EnumSet, CLike}; pub type Disr = u64; -pub static INITIAL_DISCRIMINANT_VALUE: Disr = 0; +pub const INITIAL_DISCRIMINANT_VALUE: Disr = 0; // Data types @@ -918,7 +918,7 @@ mod primitives { 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 @@ macro_rules! def_type_content_sets( use middle::ty::TypeContents; $( #[allow(non_uppercase_statics)] - pub static $name: TypeContents = TypeContents { bits: $bits }; + pub const $name: TypeContents = TypeContents { bits: $bits }; )+ } } diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs index 4d21090dd2c..efd0a2a0e48 100644 --- a/src/librustc/middle/typeck/astconv.rs +++ b/src/librustc/middle/typeck/astconv.rs @@ -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, diff --git a/src/librustc/middle/typeck/infer/resolve.rs b/src/librustc/middle/typeck/infer/resolve.rs index 13659d4b77e..87f3fd98787 100644 --- a/src/librustc/middle/typeck/infer/resolve.rs +++ b/src/librustc/middle/typeck/infer/resolve.rs @@ -57,21 +57,21 @@ use middle::typeck::infer::{unresolved_int_ty,unresolved_float_ty,unresolved_ty} 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> { diff --git a/src/librustc_back/abi.rs b/src/librustc_back/abi.rs index 1e69ce003c5..bf525db7661 100644 --- a/src/librustc_back/abi.rs +++ b/src/librustc_back/abi.rs @@ -10,20 +10,20 @@ #![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; diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs index ad2b6891dc9..aa6023326d6 100644 --- a/src/librustc_llvm/lib.rs +++ b/src/librustc_llvm/lib.rs @@ -43,8 +43,8 @@ pub mod diagnostic; 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, } } |
