In the compiled version of local_ptr (that with #[thread_local]), the take()
funciton didn't zero-out the previous pointer, allowing for multiple takes (with
fewer runtime assertions being tripped).
/// Does not validate the pointer type.
#[inline]
pub unsafe fn take<T>() -> ~T {
- let ptr: ~T = cast::transmute(RT_TLS_PTR);
+ let ptr = RT_TLS_PTR;
+ assert!(!ptr.is_null());
+ let ptr: ~T = cast::transmute(ptr);
// can't use `as`, due to type not matching with `cfg(test)`
RT_TLS_PTR = cast::transmute(0);
ptr