about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2022-06-22 15:16:13 +0900
committerGitHub <noreply@github.com>2022-06-22 15:16:13 +0900
commit8f861dae7a4069c2daa111bf9238032186be5c72 (patch)
tree583f5589ccbc788e7cedbdf623394c62799dc2db /compiler/rustc_data_structures/src
parentdfc6d7ac76b655a391c8c9b0feb841877fae2c1a (diff)
parent8b7299dd12b06b2f41707dda8562e0182c9d5672 (diff)
downloadrust-8f861dae7a4069c2daa111bf9238032186be5c72.tar.gz
rust-8f861dae7a4069c2daa111bf9238032186be5c72.zip
Rollup merge of #97895 - nbdd0121:unlikely, r=estebank
Simplify `likely!` and `unlikely!` macro

The corresponding intrinsics have long been safe-to-call, so the unsafe block is no longer needed.
Diffstat (limited to 'compiler/rustc_data_structures/src')
-rw-r--r--compiler/rustc_data_structures/src/lib.rs21
-rw-r--r--compiler/rustc_data_structures/src/profiling.rs3
2 files changed, 2 insertions, 22 deletions
diff --git a/compiler/rustc_data_structures/src/lib.rs b/compiler/rustc_data_structures/src/lib.rs
index 0d072046d58..390a44d3f33 100644
--- a/compiler/rustc_data_structures/src/lib.rs
+++ b/compiler/rustc_data_structures/src/lib.rs
@@ -11,7 +11,6 @@
 #![feature(associated_type_bounds)]
 #![feature(auto_traits)]
 #![feature(control_flow_enum)]
-#![feature(core_intrinsics)]
 #![feature(extend_one)]
 #![feature(let_else)]
 #![feature(hash_raw_entry)]
@@ -44,26 +43,6 @@ pub fn cold_path<F: FnOnce() -> R, R>(f: F) -> R {
     f()
 }
 
-#[macro_export]
-macro_rules! likely {
-    ($e:expr) => {
-        match $e {
-            #[allow(unused_unsafe)]
-            e => unsafe { std::intrinsics::likely(e) },
-        }
-    };
-}
-
-#[macro_export]
-macro_rules! unlikely {
-    ($e:expr) => {
-        match $e {
-            #[allow(unused_unsafe)]
-            e => unsafe { std::intrinsics::unlikely(e) },
-        }
-    };
-}
-
 pub mod base_n;
 pub mod binary_search_util;
 pub mod captures;
diff --git a/compiler/rustc_data_structures/src/profiling.rs b/compiler/rustc_data_structures/src/profiling.rs
index a1f42d8d3c0..88ff33b4d09 100644
--- a/compiler/rustc_data_structures/src/profiling.rs
+++ b/compiler/rustc_data_structures/src/profiling.rs
@@ -195,6 +195,7 @@ impl SelfProfilerRef {
         F: for<'a> FnOnce(&'a SelfProfiler) -> TimingGuard<'a>,
     {
         #[inline(never)]
+        #[cold]
         fn cold_call<F>(profiler_ref: &SelfProfilerRef, f: F) -> TimingGuard<'_>
         where
             F: for<'a> FnOnce(&'a SelfProfiler) -> TimingGuard<'a>,
@@ -203,7 +204,7 @@ impl SelfProfilerRef {
             f(&**profiler)
         }
 
-        if unlikely!(self.event_filter_mask.contains(event_filter)) {
+        if self.event_filter_mask.contains(event_filter) {
             cold_call(self, f)
         } else {
             TimingGuard::none()