about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-08-05 00:56:00 -0700
committerbors <bors@rust-lang.org>2013-08-05 00:56:00 -0700
commit7b2163d376c8529761cef99b691eed6ff922569a (patch)
treee0640958392269d8d6548142bbc965b91aeaa954 /src/libstd
parent4fdd7204215662232491ed0737bc43a569204607 (diff)
parent1c1add23f60d87bdb215f627896792748004552c (diff)
downloadrust-7b2163d376c8529761cef99b691eed6ff922569a.tar.gz
rust-7b2163d376c8529761cef99b691eed6ff922569a.zip
auto merge of #8303 : brson/rust/tls-magic-wtf, r=brson
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/rt/task.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libstd/rt/task.rs b/src/libstd/rt/task.rs
index ffe9f118b47..cb949edd7bb 100644
--- a/src/libstd/rt/task.rs
+++ b/src/libstd/rt/task.rs
@@ -228,6 +228,19 @@ impl Task {
                     _ => ()
                 }
 
+                // FIXME #8302: Dear diary. I'm so tired and confused.
+                // There's some interaction in rustc between the box
+                // annihilator and the TLS dtor by which TLS is
+                // accessed from annihilated box dtors *after* TLS is
+                // destroyed. Somehow setting TLS back to null, as the
+                // old runtime did, makes this work, but I don't currently
+                // understand how. I would expect that, if the annihilator
+                // reinvokes TLS while TLS is uninitialized, that
+                // TLS would be reinitialized but never destroyed,
+                // but somehow this works. I have no idea what's going
+                // on but this seems to make things magically work. FML.
+                self.storage = LocalStorage(ptr::null(), None);
+
                 // Destroy remaining boxes. Also may run user dtors.
                 unsafe { cleanup::annihilate(); }
             }