about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-07-14 01:43:31 -0700
committerAlex Crichton <alex@alexcrichton.com>2013-07-14 10:15:07 -0700
commit9fd2ac7428afa4f414f32b8b4876ca817ee85f16 (patch)
treed95eb9acc27f980f2365330b3aa9566e8eec2010 /src/libsyntax
parente3211fa1f1f24268b91b0c89cb312e70499d41f3 (diff)
downloadrust-9fd2ac7428afa4f414f32b8b4876ca817ee85f16.tar.gz
rust-9fd2ac7428afa4f414f32b8b4876ca817ee85f16.zip
Make TLS keys actually take up space
If the TLS key is 0-sized, then the linux linker is apparently smart enough to
put everything at the same pointer. OSX on the other hand, will reserve some
space for all of them. To get around this, the TLS key now actuall consumes
space to ensure that it gets a unique pointer
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast_util.rs2
-rw-r--r--src/libsyntax/ext/expand.rs8
-rw-r--r--src/libsyntax/parse/token.rs3
3 files changed, 9 insertions, 4 deletions
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs
index 0b876bf1f81..a1d209d19ac 100644
--- a/src/libsyntax/ast_util.rs
+++ b/src/libsyntax/ast_util.rs
@@ -695,7 +695,7 @@ pub fn new_sctable_internal() -> SCTable {
 // fetch the SCTable from TLS, create one if it doesn't yet exist.
 pub fn get_sctable() -> @mut SCTable {
     #[cfg(not(stage0))]
-    static sctable_key: local_data::Key<@@mut SCTable> = &[];
+    static sctable_key: local_data::Key<@@mut SCTable> = &local_data::Key;
     #[cfg(stage0)]
     fn sctable_key(_: @@mut SCTable) {}
     match local_data::get(sctable_key, |k| k.map(|&k| *k)) {
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index 4fbc3862848..b45cde6a8e3 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -580,7 +580,9 @@ pub fn core_macros() -> @str {
 
             pub mod $c {
                 #[allow(non_uppercase_statics)];
-                static key: &'static [@::std::condition::Handler<$in, $out>] = &[];
+                static key: ::std::local_data::Key<
+                    @::std::condition::Handler<$in, $out>> =
+                    &::std::local_data::Key;
 
                 pub static cond :
                     ::std::condition::Condition<$in,$out> =
@@ -596,7 +598,9 @@ pub fn core_macros() -> @str {
             // FIXME (#6009): remove mod's `pub` below once variant above lands.
             pub mod $c {
                 #[allow(non_uppercase_statics)];
-                static key: &'static [@::std::condition::Handler<$in, $out>] = &[];
+                static key: ::std::local_data::Key<
+                    @::std::condition::Handler<$in, $out>> =
+                    &::std::local_data::Key;
 
                 pub static cond :
                     ::std::condition::Condition<$in,$out> =
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index 8737e571399..01860c3ae99 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -485,7 +485,8 @@ fn mk_fresh_ident_interner() -> @ident_interner {
 // fresh one.
 pub fn get_ident_interner() -> @ident_interner {
     #[cfg(not(stage0))]
-    static key: local_data::Key<@@::parse::token::ident_interner> = &[];
+    static key: local_data::Key<@@::parse::token::ident_interner> =
+        &local_data::Key;
     #[cfg(stage0)]
     fn key(_: @@::parse::token::ident_interner) {}
     match local_data::get(key, |k| k.map(|&k| *k)) {