about summary refs log tree commit diff
path: root/src/libstd/thread
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2015-09-03 23:30:37 +0530
committerManish Goregaokar <manishsmail@gmail.com>2015-09-04 01:40:02 +0530
commit9ea8f3e2ddf281ce02985a0757c599a9b9971616 (patch)
treec57519e0081e9b2bebd46c4536089b5602fc44e4 /src/libstd/thread
parent67616f71916c94b194164278f685fc7d82b3b4d0 (diff)
parent06fb196256bbab1e7aa4f43daf45321efaa6e0eb (diff)
downloadrust-9ea8f3e2ddf281ce02985a0757c599a9b9971616.tar.gz
rust-9ea8f3e2ddf281ce02985a0757c599a9b9971616.zip
Rollup merge of #28187 - petrochenkov:null, r=aturon
And replace more `0 as *const T`/`0 as *mut T`s with `null()`/`null_mut()`s

I'm not sure what is the general policy about making simple functions `const`, but `null()` and `null_mut()` seem to be good candidates.
Diffstat (limited to 'src/libstd/thread')
-rw-r--r--src/libstd/thread/scoped_tls.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libstd/thread/scoped_tls.rs b/src/libstd/thread/scoped_tls.rs
index bfcaabdbc17..87f58b4c849 100644
--- a/src/libstd/thread/scoped_tls.rs
+++ b/src/libstd/thread/scoped_tls.rs
@@ -226,6 +226,7 @@ impl<T> ScopedKey<T> {
 #[doc(hidden)]
 mod imp {
     use cell::Cell;
+    use ptr;
 
     pub struct KeyInner<T> { inner: Cell<*mut T> }
 
@@ -233,7 +234,7 @@ mod imp {
 
     impl<T> KeyInner<T> {
         pub const fn new() -> KeyInner<T> {
-            KeyInner { inner: Cell::new(0 as *mut _) }
+            KeyInner { inner: Cell::new(ptr::null_mut()) }
         }
         pub unsafe fn set(&self, ptr: *mut T) { self.inner.set(ptr); }
         pub unsafe fn get(&self) -> *mut T { self.inner.get() }