about summary refs log tree commit diff
path: root/src/libstd/thread
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-01-07 04:54:02 +0000
committerbors <bors@rust-lang.org>2020-01-07 04:54:02 +0000
commit4f074dea1dbf28d7519bf408b7530e8cba019243 (patch)
tree32898820efab3cbd1ab73a44cfdeeb49650880ff /src/libstd/thread
parentaa0769b92e60f5298f0b6326b8654c9b04351b98 (diff)
parent23d97880bc2b5022fb4331cdff90550de7fc5328 (diff)
downloadrust-4f074dea1dbf28d7519bf408b7530e8cba019243.tar.gz
rust-4f074dea1dbf28d7519bf408b7530e8cba019243.zip
Auto merge of #67964 - JohnTitor:rollup-pu5kosl, r=JohnTitor
Rollup of 13 pull requests

Successful merges:

 - #67566 (Add an unstable conversion from thread ID to u64)
 - #67671 (Account for `type X = impl Trait;` in lifetime suggestion)
 - #67727 (Stabilise vec::remove_item)
 - #67877 (Omit underscore constants from rustdoc)
 - #67880 (Handle multiple error fix suggestions carefuly)
 - #67898 (Improve hygiene of `newtype_index`)
 - #67908 (rustdoc: HTML escape const values)
 - #67909 (Fix ICE in const pretty printing and resolve FIXME)
 - #67929 (Formatting an example for method Vec.retain)
 - #67934 (Clean up E0178 explanation)
 - #67936 (fire "non_camel_case_types" for associated types)
 - #67943 (Missing module std in example.)
 - #67962 (Update books)

Failed merges:

r? @ghost
Diffstat (limited to 'src/libstd/thread')
-rw-r--r--src/libstd/thread/mod.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libstd/thread/mod.rs b/src/libstd/thread/mod.rs
index b1741891138..0dc43c7e651 100644
--- a/src/libstd/thread/mod.rs
+++ b/src/libstd/thread/mod.rs
@@ -1072,6 +1072,19 @@ impl ThreadId {
             ThreadId(NonZeroU64::new(id).unwrap())
         }
     }
+
+    /// This returns a numeric identifier for the thread identified by this
+    /// `ThreadId`.
+    ///
+    /// As noted in the documentation for the type itself, it is essentially an
+    /// opaque ID, but is guaranteed to be unique for each thread. The returned
+    /// value is entirely opaque -- only equality testing is stable. Note that
+    /// 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()
+    }
 }
 
 ////////////////////////////////////////////////////////////////////////////////