auto merge of #8303 : brson/rust/tls-magic-wtf, r=brson

This commit is contained in:
bors 2013-08-05 00:56:00 -07:00
commit 7b2163d376

View File

@ -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(); }
}