about summary refs log tree commit diff
path: root/src/librustc_data_structures
diff options
context:
space:
mode:
authorThomas Bächler <thomas.baechler@gmx.de>2020-03-21 19:48:23 +0100
committerThomas Bächler <thomas.baechler@gmx.de>2020-03-21 19:48:23 +0100
commitc8140a88f67cf1fea104b1aaa615af7816984615 (patch)
tree04f0a756194d67eec457b152a67d33c3cb725db4 /src/librustc_data_structures
parent98803c182b2ba6ef5dccb6bf501958249295eac0 (diff)
downloadrust-c8140a88f67cf1fea104b1aaa615af7816984615.tar.gz
rust-c8140a88f67cf1fea104b1aaa615af7816984615.zip
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/librustc_data_structures')
-rw-r--r--src/librustc_data_structures/profiling.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/librustc_data_structures/profiling.rs b/src/librustc_data_structures/profiling.rs
index a70314c35c0..a7cdc48d603 100644
--- a/src/librustc_data_structures/profiling.rs
+++ b/src/librustc_data_structures/profiling.rs
@@ -345,7 +345,7 @@ impl SelfProfilerRef {
     ) {
         drop(self.exec(event_filter, |profiler| {
             let event_id = StringId::new_virtual(query_invocation_id.0);
-            let thread_id = std::thread::current().id().as_u64() as u32;
+            let thread_id = std::thread::current().id().as_u64().get() as u32;
 
             profiler.profiler.record_instant_event(
                 event_kind(profiler),
@@ -522,7 +522,7 @@ impl<'a> TimingGuard<'a> {
         event_kind: StringId,
         event_id: EventId,
     ) -> TimingGuard<'a> {
-        let thread_id = std::thread::current().id().as_u64() as u32;
+        let thread_id = std::thread::current().id().as_u64().get() as u32;
         let raw_profiler = &profiler.profiler;
         let timing_guard =
             raw_profiler.start_recording_interval_event(event_kind, event_id, thread_id);