From 4bb957758c43c7cb4eaf5f50170d5c1898534f4f Mon Sep 17 00:00:00 2001 From: Xudong-Huang Date: Tue, 20 Feb 2024 09:45:05 +0800 Subject: [PATCH] :pencil: use stable likely/unlikely --- src/lib.rs | 1 - src/likely.rs | 6 ------ tests/lib.rs | 2 +- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 999f98c3..b09ba22e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -22,7 +22,6 @@ // #![deny(missing_docs)] #![cfg_attr(nightly, feature(thread_local))] -#![cfg_attr(nightly, feature(core_intrinsics))] #[macro_use] extern crate log; diff --git a/src/likely.rs b/src/likely.rs index 046fecb6..41b9a2f5 100644 --- a/src/likely.rs +++ b/src/likely.rs @@ -1,12 +1,7 @@ -#[cfg(nightly)] -pub use std::intrinsics::{likely, unlikely}; - -#[cfg(not(nightly))] #[inline] #[cold] const fn cold() {} -#[cfg(not(nightly))] #[inline] pub const fn likely(b: bool) -> bool { if !b { @@ -15,7 +10,6 @@ pub const fn likely(b: bool) -> bool { b } -#[cfg(not(nightly))] #[inline] pub const fn unlikely(b: bool) -> bool { if b { diff --git a/tests/lib.rs b/tests/lib.rs index 3c26bf86..56429598 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -199,7 +199,7 @@ fn yield_from_gen() { go!(scope, || { let g = Gn::<()>::new_scoped(|mut scope| { while a < 10 { - scope.yield_(a); + unsafe { scope.yield_unsafe(a) }; // this is yield from the generator context! yield_now(); a += 1;