about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-03-22 15:48:37 +0100
committerGitHub <noreply@github.com>2020-03-22 15:48:37 +0100
commitc882b10a9f5429ef3264ce9c239f2cd4025294dd (patch)
tree6b9f7b3979b92280874fb84332092c6e906cf364 /src/libstd
parente58fec0c1cfa6f306940edb20d8d5f7a3a468d6e (diff)
parentc8140a88f67cf1fea104b1aaa615af7816984615 (diff)
downloadrust-c882b10a9f5429ef3264ce9c239f2cd4025294dd.tar.gz
rust-c882b10a9f5429ef3264ce9c239f2cd4025294dd.zip
Rollup merge of #70240 - brain0:thread_id, r=Mark-Simulacrum
Return NonZeroU64 from ThreadId::as_u64.

As discussed in #67939, this allows turning Option<ThreadId> into Option<NonZeroU64> which
can then be stored inside an AtomicU64.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/thread/mod.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs
index 0dc43c7e651..282e268efd2 100644
--- a/src/libstd/thread/mod.rs
+++ b/src/libstd/thread/mod.rs
@@ -1082,8 +1082,8 @@ impl ThreadId {
     /// it is not guaranteed which values new threads will return, and this may
     /// change across Rust versions.
     #[unstable(feature = "thread_id_value", issue = "67939")]
-    pub fn as_u64(&self) -> u64 {
-        self.0.get()
+    pub fn as_u64(&self) -> NonZeroU64 {
+        self.0
     }
 }