summary refs log tree commit diff
path: root/src/libstd/collections
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-10-06 16:29:47 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-10-09 09:44:51 -0700
commitab5935c88d259d511561ccb4177bb6924dab4a06 (patch)
treef23ddc5fb8733a5eeb5f3fbac06b99159139687e /src/libstd/collections
parentd9874bfb4079876dabc092c035d99b2d5b7f8a1c (diff)
downloadrust-ab5935c88d259d511561ccb4177bb6924dab4a06.tar.gz
rust-ab5935c88d259d511561ccb4177bb6924dab4a06.zip
std: Convert statics to constants
This commit repurposes most statics as constants in the standard library itself,
with the exception of TLS keys which precisely have their own memory location as
an implementation detail.

This commit also rewrites the bitflags syntax to use `const` instead of
`static`. All invocations will need to replace the word `static` with `const`
when declaring flags.

Due to the modification of the `bitflags!` syntax, this is a:

[breaking-change]
Diffstat (limited to 'src/libstd/collections')
-rw-r--r--src/libstd/collections/hashmap/map.rs4
-rw-r--r--src/libstd/collections/hashmap/table.rs2
2 files changed, 3 insertions, 3 deletions
diff --git a/src/libstd/collections/hashmap/map.rs b/src/libstd/collections/hashmap/map.rs
index 6b9c76e1568..ef40402105b 100644
--- a/src/libstd/collections/hashmap/map.rs
+++ b/src/libstd/collections/hashmap/map.rs
@@ -41,8 +41,8 @@ use super::table::{
     SafeHash
 };
 
-static INITIAL_LOG2_CAP: uint = 5;
-pub static INITIAL_CAPACITY: uint = 1 << INITIAL_LOG2_CAP; // 2^5
+const INITIAL_LOG2_CAP: uint = 5;
+pub const INITIAL_CAPACITY: uint = 1 << INITIAL_LOG2_CAP; // 2^5
 
 /// The default behavior of HashMap implements a load factor of 90.9%.
 /// This behavior is characterized by the following conditions:
diff --git a/src/libstd/collections/hashmap/table.rs b/src/libstd/collections/hashmap/table.rs
index bad5ce3e475..ee64a7931c0 100644
--- a/src/libstd/collections/hashmap/table.rs
+++ b/src/libstd/collections/hashmap/table.rs
@@ -24,7 +24,7 @@ use ptr::{RawPtr, copy_nonoverlapping_memory, zero_memory};
 use ptr;
 use rt::heap::{allocate, deallocate};
 
-static EMPTY_BUCKET: u64 = 0u64;
+const EMPTY_BUCKET: u64 = 0u64;
 
 /// The raw hashtable, providing safe-ish access to the unzipped and highly
 /// optimized arrays of hashes, keys, and values.