Skip to content

Commit

Permalink
📝 use stable likely/unlikely
Browse files Browse the repository at this point in the history
  • Loading branch information
Xudong-Huang committed Feb 20, 2024
1 parent 1e6fad4 commit 4bb9577
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 8 deletions.
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
// #![deny(missing_docs)]
#![cfg_attr(nightly, feature(thread_local))]
#![cfg_attr(nightly, feature(core_intrinsics))]

#[macro_use]
extern crate log;
Expand Down
6 changes: 0 additions & 6 deletions src/likely.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4bb9577

Please sign in to comment.