提交 831f9094 编写于 作者: A Alex Crichton

rustc: Convert statics to constants

上级 b8fb0cf7
...@@ -55,22 +55,22 @@ ...@@ -55,22 +55,22 @@
// This is the "magic number" expected at the beginning of a LLVM bytecode // This is the "magic number" expected at the beginning of a LLVM bytecode
// object in an rlib. // 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 // 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 // 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 // The offset in bytes the size of the compressed bytecode can be found at in
// format version 1 // 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; RLIB_BYTECODE_OBJECT_VERSION_OFFSET + 4;
// The offset in bytes the compressed LLVM bytecode can be found at in format // The offset in bytes the compressed LLVM bytecode can be found at in format
// version 1 // 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; RLIB_BYTECODE_OBJECT_V1_DATASIZE_OFFSET + 8;
......
...@@ -154,10 +154,10 @@ pub enum CrateType { ...@@ -154,10 +154,10 @@ pub enum CrateType {
macro_rules! debugging_opts( macro_rules! debugging_opts(
([ $opt:ident ] $cnt:expr ) => ( ([ $opt:ident ] $cnt:expr ) => (
pub static $opt: u64 = 1 << $cnt; pub const $opt: u64 = 1 << $cnt;
); );
([ $opt:ident, $($rest:ident),* ] $cnt:expr ) => ( ([ $opt:ident, $($rest:ident),* ] $cnt:expr ) => (
pub static $opt: u64 = 1 << $cnt; pub const $opt: u64 = 1 << $cnt;
debugging_opts!([ $($rest),* ] $cnt + 1) debugging_opts!([ $($rest),* ] $cnt + 1)
) )
) )
...@@ -268,7 +268,7 @@ pub fn basic_codegen_options() -> CodegenOptions { ...@@ -268,7 +268,7 @@ pub fn basic_codegen_options() -> CodegenOptions {
} }
pub type CodegenSetter = fn(&mut CodegenOptions, v: Option<&str>) -> bool; 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)] = &'static str)] =
&[ $( (stringify!($opt), cgsetters::$opt, $desc) ),* ]; &[ $( (stringify!($opt), cgsetters::$opt, $desc) ),* ];
......
...@@ -112,9 +112,9 @@ pub fn get_lint_groups<'t>(&'t self) -> Vec<(&'static str, Vec<LintId>, bool)> { ...@@ -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>, pub fn register_pass(&mut self, sess: Option<&Session>,
from_plugin: bool, pass: LintPassObject) { from_plugin: bool, pass: LintPassObject) {
for &lint in pass.get_lints().iter() { 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) { if !self.by_name.insert(lint.name_lower(), id) {
let msg = format!("duplicate specification of lint {}", lint.name_lower()); let msg = format!("duplicate specification of lint {}", lint.name_lower());
match (sess, from_plugin) { match (sess, from_plugin) {
......
...@@ -99,12 +99,12 @@ pub fn name_lower(&self) -> String { ...@@ -99,12 +99,12 @@ pub fn name_lower(&self) -> String {
macro_rules! lint_array ( ($( $lint:expr ),*) => ( macro_rules! lint_array ( ($( $lint:expr ),*) => (
{ {
#[allow(non_uppercase_statics)] #[allow(non_uppercase_statics)]
static array: LintArray = &[ $( $lint ),* ]; static array: LintArray = &[ $( &$lint ),* ];
array array
} }
)) ))
pub type LintArray = &'static [&'static Lint]; pub type LintArray = &'static [&'static &'static Lint];
/// Trait for types providing lint checks. /// Trait for types providing lint checks.
/// ///
......
...@@ -15,83 +15,83 @@ ...@@ -15,83 +15,83 @@
// EBML enum definitions and utils shared by the encoder and decoder // 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 // 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 // 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 const tag_crate_hash: uint = 0x1a;
pub static tag_crate_crate_name: uint = 0x1b; pub const tag_crate_crate_name: uint = 0x1b;
pub static tag_crate_dep_crate_name: uint = 0x1d; pub const tag_crate_dep_crate_name: uint = 0x1d;
pub static tag_crate_dep_hash: uint = 0x1e; 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 const tag_item_trait_ref: uint = 0x21;
pub static tag_item_super_trait_ref: uint = 0x22; pub const tag_item_super_trait_ref: uint = 0x22;
// discriminator value for variants // discriminator value for variants
pub static tag_disr_val: uint = 0x23; pub const tag_disr_val: uint = 0x23;
// used to encode ast_map::PathElem // used to encode ast_map::PathElem
pub static tag_path: uint = 0x24; pub const tag_path: uint = 0x24;
pub static tag_path_len: uint = 0x25; pub const tag_path_len: uint = 0x25;
pub static tag_path_elem_mod: uint = 0x26; pub const tag_path_elem_mod: uint = 0x26;
pub static tag_path_elem_name: uint = 0x27; pub const tag_path_elem_name: uint = 0x27;
pub static tag_item_field: uint = 0x28; pub const tag_item_field: uint = 0x28;
pub static tag_item_field_origin: uint = 0x29; pub const tag_item_field_origin: uint = 0x29;
pub static tag_item_variances: uint = 0x2a; pub const tag_item_variances: uint = 0x2a;
/* /*
trait items contain tag_item_trait_item elements, trait items contain tag_item_trait_item elements,
impl items contain tag_item_impl_item elements, and classes impl items contain tag_item_impl_item elements, and classes
...@@ -100,15 +100,15 @@ 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 both, tag_item_trait_item and tag_item_impl_item have to be two
different tags. different tags.
*/ */
pub static tag_item_impl_item: uint = 0x30; pub const tag_item_impl_item: uint = 0x30;
pub static tag_item_trait_method_explicit_self: uint = 0x31; pub const tag_item_trait_method_explicit_self: uint = 0x31;
// Reexports are found within module tags. Each reexport contains def_ids // Reexports are found within module tags. Each reexport contains def_ids
// and names. // and names.
pub static tag_items_data_item_reexport: uint = 0x38; pub const tag_items_data_item_reexport: uint = 0x38;
pub static tag_items_data_item_reexport_def_id: uint = 0x39; pub const 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_name: uint = 0x3a;
// used to encode crate_ctxt side tables // used to encode crate_ctxt side tables
#[deriving(PartialEq)] #[deriving(PartialEq)]
...@@ -153,15 +153,15 @@ pub fn from_uint(value : uint) -> Option<astencode_tag> { ...@@ -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: // Language items are a top-level directory (for speed). Hierarchy:
// //
...@@ -170,51 +170,51 @@ pub fn from_uint(value : uint) -> Option<astencode_tag> { ...@@ -170,51 +170,51 @@ pub fn from_uint(value : uint) -> Option<astencode_tag> {
// - tag_lang_items_item_id: u32 // - tag_lang_items_item_id: u32
// - tag_lang_items_item_node_id: u32 // - tag_lang_items_item_node_id: u32
pub static tag_lang_items: uint = 0x70; pub const tag_lang_items: uint = 0x70;
pub static tag_lang_items_item: uint = 0x71; pub const tag_lang_items_item: uint = 0x71;
pub static tag_lang_items_item_id: uint = 0x72; pub const tag_lang_items_item_id: uint = 0x72;
pub static tag_lang_items_item_node_id: uint = 0x73; pub const tag_lang_items_item_node_id: uint = 0x73;
pub static tag_lang_items_missing: uint = 0x74; pub const tag_lang_items_missing: uint = 0x74;
pub static tag_item_unnamed_field: uint = 0x75; pub const tag_item_unnamed_field: uint = 0x75;
pub static tag_items_data_item_visibility: uint = 0x76; pub const tag_items_data_item_visibility: uint = 0x76;
pub static tag_item_method_tps: uint = 0x79; pub const tag_item_method_tps: uint = 0x79;
pub static tag_item_method_fty: uint = 0x7a; pub const tag_item_method_fty: uint = 0x7a;
pub static tag_mod_child: uint = 0x7b; pub const tag_mod_child: uint = 0x7b;
pub static tag_misc_info: uint = 0x7c; pub const tag_misc_info: uint = 0x7c;
pub static tag_misc_info_crate_items: uint = 0x7d; pub const tag_misc_info_crate_items: uint = 0x7d;
pub static tag_item_method_provided_source: uint = 0x7e; pub const tag_item_method_provided_source: uint = 0x7e;
pub static tag_item_impl_vtables: uint = 0x7f; pub const tag_item_impl_vtables: uint = 0x7f;
pub static tag_impls: uint = 0x80; pub const tag_impls: uint = 0x80;
pub static tag_impls_impl: uint = 0x81; pub const tag_impls_impl: uint = 0x81;
pub static tag_items_data_item_inherent_impl: uint = 0x82; pub const tag_items_data_item_inherent_impl: uint = 0x82;
pub static tag_items_data_item_extension_impl: uint = 0x83; pub const tag_items_data_item_extension_impl: uint = 0x83;
// GAP 0x84, 0x85, 0x86 // GAP 0x84, 0x85, 0x86
pub static tag_native_libraries: uint = 0x87; pub const tag_native_libraries: uint = 0x87;
pub static tag_native_libraries_lib: uint = 0x88; pub const tag_native_libraries_lib: uint = 0x88;
pub static tag_native_libraries_name: uint = 0x89; pub const tag_native_libraries_name: uint = 0x89;
pub static tag_native_libraries_kind: uint = 0x8a; pub const tag_native_libraries_kind: uint = 0x8a;
pub static tag_plugin_registrar_fn: uint = 0x8b; pub const tag_plugin_registrar_fn: uint = 0x8b;
pub static tag_exported_macros: uint = 0x8c; pub const tag_exported_macros: uint = 0x8c;
pub static tag_macro_def: uint = 0x8d; pub const tag_macro_def: uint = 0x8d;
pub static tag_method_argument_names: uint = 0x8e; pub const tag_method_argument_names: uint = 0x8e;
pub static tag_method_argument_name: uint = 0x8f; pub const tag_method_argument_name: uint = 0x8f;
pub static tag_reachable_extern_fns: uint = 0x90; pub const tag_reachable_extern_fns: uint = 0x90;
pub static tag_reachable_extern_fn_id: uint = 0x91; 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)] #[deriving(Clone, Show)]
pub struct LinkMeta { pub struct LinkMeta {
...@@ -222,29 +222,29 @@ pub struct LinkMeta { ...@@ -222,29 +222,29 @@ pub struct LinkMeta {
pub crate_hash: Svh, pub crate_hash: Svh,
} }
pub static tag_unboxed_closures: uint = 0x95; pub const tag_unboxed_closures: uint = 0x95;
pub static tag_unboxed_closure: uint = 0x96; pub const tag_unboxed_closure: uint = 0x96;
pub static tag_unboxed_closure_type: uint = 0x97; pub const tag_unboxed_closure_type: uint = 0x97;
pub static tag_unboxed_closure_kind: uint = 0x98; pub const tag_unboxed_closure_kind: uint = 0x98;
pub static tag_struct_fields: uint = 0x99; pub const tag_struct_fields: uint = 0x99;
pub static tag_struct_field: uint = 0x9a; pub const tag_struct_field: uint = 0x9a;
pub static tag_struct_field_id: uint = 0x9b; 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 const tag_region_param_def: uint = 0xa0;
pub static tag_region_param_def_ident: uint = 0xa1; pub const tag_region_param_def_ident: uint = 0xa1;
pub static tag_region_param_def_def_id: uint = 0xa2; pub const tag_region_param_def_def_id: uint = 0xa2;
pub static tag_region_param_def_space: uint = 0xa3; pub const tag_region_param_def_space: uint = 0xa3;
pub static tag_region_param_def_index: uint = 0xa4; 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 const tag_item_generics: uint = 0xa6;
pub static tag_method_ty_generics: uint = 0xa7; pub const tag_method_ty_generics: uint = 0xa7;
...@@ -2035,7 +2035,7 @@ fn encode_dylib_dependency_formats(rbml_w: &mut Encoder, ecx: &EncodeContext) { ...@@ -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. // NB: Increment this as you change the metadata encoding version.
#[allow(non_uppercase_statics)] #[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> { pub fn encode_metadata(parms: EncodeParams, krate: &Crate) -> Vec<u8> {
let mut wr = SeekableMemWriter::new(); let mut wr = SeekableMemWriter::new();
......
...@@ -241,23 +241,23 @@ ...@@ -241,23 +241,23 @@
use flate; use flate;
use time; use time;
pub static MACOS_DLL_PREFIX: &'static str = "lib"; pub const MACOS_DLL_PREFIX: &'static str = "lib";
pub static MACOS_DLL_SUFFIX: &'static str = ".dylib"; pub const MACOS_DLL_SUFFIX: &'static str = ".dylib";
pub static WIN32_DLL_PREFIX: &'static str = ""; pub const WIN32_DLL_PREFIX: &'static str = "";
pub static WIN32_DLL_SUFFIX: &'static str = ".dll"; pub const WIN32_DLL_SUFFIX: &'static str = ".dll";
pub static LINUX_DLL_PREFIX: &'static str = "lib"; pub const LINUX_DLL_PREFIX: &'static str = "lib";
pub static LINUX_DLL_SUFFIX: &'static str = ".so"; pub const LINUX_DLL_SUFFIX: &'static str = ".so";
pub static FREEBSD_DLL_PREFIX: &'static str = "lib"; pub const FREEBSD_DLL_PREFIX: &'static str = "lib";
pub static FREEBSD_DLL_SUFFIX: &'static str = ".so"; pub const FREEBSD_DLL_SUFFIX: &'static str = ".so";
pub static DRAGONFLY_DLL_PREFIX: &'static str = "lib"; pub const DRAGONFLY_DLL_PREFIX: &'static str = "lib";
pub static DRAGONFLY_DLL_SUFFIX: &'static str = ".so"; pub const DRAGONFLY_DLL_SUFFIX: &'static str = ".so";
pub static ANDROID_DLL_PREFIX: &'static str = "lib"; pub const ANDROID_DLL_PREFIX: &'static str = "lib";
pub static ANDROID_DLL_SUFFIX: &'static str = ".so"; pub const ANDROID_DLL_SUFFIX: &'static str = ".so";
pub struct CrateMismatch { pub struct CrateMismatch {
path: Path, path: Path,
......
...@@ -58,20 +58,20 @@ pub struct Edge<E> { ...@@ -58,20 +58,20 @@ pub struct Edge<E> {
#[deriving(Clone, PartialEq, Show)] #[deriving(Clone, PartialEq, Show)]
pub struct NodeIndex(pub uint); pub struct NodeIndex(pub uint);
#[allow(non_uppercase_statics)] #[allow(non_uppercase_statics)]
pub static InvalidNodeIndex: NodeIndex = NodeIndex(uint::MAX); pub const InvalidNodeIndex: NodeIndex = NodeIndex(uint::MAX);
#[deriving(PartialEq)] #[deriving(PartialEq)]
pub struct EdgeIndex(pub uint); pub struct EdgeIndex(pub uint);
#[allow(non_uppercase_statics)] #[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: // Use a private field here to guarantee no more instances are created:
#[deriving(Show)] #[deriving(Show)]
pub struct Direction { repr: uint } pub struct Direction { repr: uint }
#[allow(non_uppercase_statics)] #[allow(non_uppercase_statics)]
pub static Outgoing: Direction = Direction { repr: 0 }; pub const Outgoing: Direction = Direction { repr: 0 };
#[allow(non_uppercase_statics)] #[allow(non_uppercase_statics)]
pub static Incoming: Direction = Direction { repr: 1 }; pub const Incoming: Direction = Direction { repr: 1 };
impl NodeIndex { impl NodeIndex {
fn get(&self) -> uint { let NodeIndex(v) = *self; v } fn get(&self) -> uint { let NodeIndex(v) = *self; v }
......
...@@ -49,9 +49,9 @@ pub struct CustomScopeIndex { ...@@ -49,9 +49,9 @@ pub struct CustomScopeIndex {
index: uint index: uint
} }
pub static EXIT_BREAK: uint = 0; pub const EXIT_BREAK: uint = 0;
pub static EXIT_LOOP: uint = 1; pub const EXIT_LOOP: uint = 1;
pub static EXIT_MAX: uint = 2; pub const EXIT_MAX: uint = 2;
pub enum CleanupScopeKind<'blk, 'tcx: 'blk> { pub enum CleanupScopeKind<'blk, 'tcx: 'blk> {
CustomScopeKind, CustomScopeKind,
......
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
pub type Disr = u64; pub type Disr = u64;
pub static INITIAL_DISCRIMINANT_VALUE: Disr = 0; pub const INITIAL_DISCRIMINANT_VALUE: Disr = 0;
// Data types // Data types
...@@ -918,7 +918,7 @@ mod primitives { ...@@ -918,7 +918,7 @@ mod primitives {
flags: super::has_ty_err as uint, 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 // NB: If you change this, you'll probably want to change the corresponding
...@@ -2200,7 +2200,7 @@ mod $mname { ...@@ -2200,7 +2200,7 @@ mod $mname {
use middle::ty::TypeContents; use middle::ty::TypeContents;
$( $(
#[allow(non_uppercase_statics)] #[allow(non_uppercase_statics)]
pub static $name: TypeContents = TypeContents { bits: $bits }; pub const $name: TypeContents = TypeContents { bits: $bits };
)+ )+
} }
} }
......
...@@ -440,8 +440,8 @@ pub fn ast_path_to_ty_relaxed<'tcx, AC: AstConv<'tcx>, ...@@ -440,8 +440,8 @@ pub fn ast_path_to_ty_relaxed<'tcx, AC: AstConv<'tcx>,
} }
} }
pub static NO_REGIONS: uint = 1; pub const NO_REGIONS: uint = 1;
pub static NO_TPS: uint = 2; pub const NO_TPS: uint = 2;
fn check_path_args(tcx: &ty::ctxt, fn check_path_args(tcx: &ty::ctxt,
path: &ast::Path, path: &ast::Path,
......
...@@ -57,21 +57,21 @@ ...@@ -57,21 +57,21 @@
use syntax::codemap::Span; use syntax::codemap::Span;
use util::ppaux::{Repr, ty_to_string}; use util::ppaux::{Repr, ty_to_string};
pub static resolve_nested_tvar: uint = 0b0000000001; pub const resolve_nested_tvar: uint = 0b0000000001;
pub static resolve_rvar: uint = 0b0000000010; pub const resolve_rvar: uint = 0b0000000010;
pub static resolve_ivar: uint = 0b0000000100; pub const resolve_ivar: uint = 0b0000000100;
pub static resolve_fvar: uint = 0b0000001000; pub const resolve_fvar: uint = 0b0000001000;
pub static resolve_all: uint = 0b0000001111; pub const resolve_all: uint = 0b0000001111;
pub static force_tvar: uint = 0b0000100000; pub const force_tvar: uint = 0b0000100000;
pub static force_rvar: uint = 0b0001000000; pub const force_rvar: uint = 0b0001000000;
pub static force_ivar: uint = 0b0010000000; pub const force_ivar: uint = 0b0010000000;
pub static force_fvar: uint = 0b0100000000; pub const force_fvar: uint = 0b0100000000;
pub static force_all: uint = 0b0111100000; 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 const try_resolve_tvar_shallow: uint = 0;
pub static resolve_and_force_all_but_regions: uint = pub const resolve_and_force_all_but_regions: uint =
(resolve_all | force_all) & not_regions; (resolve_all | force_all) & not_regions;
pub struct ResolveState<'a, 'tcx: 'a> { pub struct ResolveState<'a, 'tcx: 'a> {
......
...@@ -10,20 +10,20 @@ ...@@ -10,20 +10,20 @@
#![allow(non_uppercase_statics)] #![allow(non_uppercase_statics)]
pub static box_field_refcnt: uint = 0u; pub const box_field_refcnt: uint = 0u;
pub static box_field_drop_glue: uint = 1u; pub const box_field_drop_glue: uint = 1u;
pub static box_field_body: uint = 4u; 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. // The two halves of a closure: code and environment.
pub static fn_field_code: uint = 0u; pub const fn_field_code: uint = 0u;
pub static fn_field_box: uint = 1u; pub const fn_field_box: uint = 1u;
// The two fields of a trait object/trait instance: vtable and box. // The two fields of a trait object/trait instance: vtable and box.
// The vtable contains the type descriptor as first element. // The vtable contains the type descriptor as first element.
pub static trt_field_box: uint = 0u; pub const trt_field_box: uint = 0u;
pub static trt_field_vtable: uint = 1u; pub const trt_field_vtable: uint = 1u;
pub static slice_elt_base: uint = 0u; pub const slice_elt_base: uint = 0u;
pub static slice_elt_len: uint = 1u; pub const slice_elt_len: uint = 1u;
...@@ -43,8 +43,8 @@ ...@@ -43,8 +43,8 @@
pub type Opcode = u32; pub type Opcode = u32;
pub type Bool = c_uint; pub type Bool = c_uint;
pub static True: Bool = 1 as Bool; pub const True: Bool = 1 as Bool;
pub static False: Bool = 0 as Bool; pub const False: Bool = 0 as Bool;
// Consts for the LLVM CallConv type, pre-cast to uint. // Consts for the LLVM CallConv type, pre-cast to uint.
...@@ -93,32 +93,32 @@ pub enum DiagnosticSeverity { ...@@ -93,32 +93,32 @@ pub enum DiagnosticSeverity {
bitflags! { bitflags! {
flags Attribute : u32 { flags Attribute : u32 {
static ZExtAttribute = 1 << 0, const ZExtAttribute = 1 << 0,
static SExtAttribute = 1 << 1, const SExtAttribute = 1 << 1,
static NoReturnAttribute = 1 << 2, const NoReturnAttribute = 1 << 2,
static InRegAttribute = 1 << 3, const InRegAttribute = 1 << 3,
static StructRetAttribute = 1 << 4, const StructRetAttribute = 1 << 4,
static NoUnwindAttribute = 1 << 5, const NoUnwindAttribute = 1 << 5,
static NoAliasAttribute = 1 << 6, const NoAliasAttribute = 1 << 6,
static ByValAttribute = 1 << 7, const ByValAttribute = 1 << 7,
static NestAttribute = 1 << 8, const NestAttribute = 1 << 8,
static ReadNoneAttribute = 1 << 9, const ReadNoneAttribute = 1 << 9,
static ReadOnlyAttribute = 1 << 10, const ReadOnlyAttribute = 1 << 10,
static NoInlineAttribute = 1 << 11, const NoInlineAttribute = 1 << 11,
static AlwaysInlineAttribute = 1 << 12, const AlwaysInlineAttribute = 1 << 12,
static OptimizeForSizeAttribute = 1 << 13, const OptimizeForSizeAttribute = 1 << 13,
static StackProtectAttribute = 1 << 14, const StackProtectAttribute = 1 << 14,
static StackProtectReqAttribute = 1 << 15, const StackProtectReqAttribute = 1 << 15,
static AlignmentAttribute = 31 << 16, const AlignmentAttribute = 31 << 16,
static NoCaptureAttribute = 1 << 21, const NoCaptureAttribute = 1 << 21,
static NoRedZoneAttribute = 1 << 22, const NoRedZoneAttribute = 1 << 22,
static NoImplicitFloatAttribute = 1 << 23, const NoImplicitFloatAttribute = 1 << 23,
static NakedAttribute = 1 << 24, const NakedAttribute = 1 << 24,
static InlineHintAttribute = 1 << 25, const InlineHintAttribute = 1 << 25,
static StackAttribute = 7 << 26, const StackAttribute = 7 << 26,
static ReturnsTwiceAttribute = 1 << 29, const ReturnsTwiceAttribute = 1 << 29,
static UWTableAttribute = 1 << 30, const UWTableAttribute = 1 << 30,
static NonLazyBindAttribute = 1 << 31, const NonLazyBindAttribute = 1 << 31,
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册