Skip to content

Commit

Permalink
Get rid of likely_stable
Browse files Browse the repository at this point in the history
  • Loading branch information
terrarier2111 committed Jul 22, 2023
1 parent 7d6cdf8 commit d5330fe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 12 deletions.
3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ once_cell = "1.5.2"
# this is required to gate `nightly` related code paths
cfg-if = "1.0.0"
crossbeam-utils = "0.8.15"
likely_stable = "0.1.2"
memoffset = "0.9.0"

[dev-dependencies]
criterion = "0.4.0"
criterion = "0.5.1"

[[bench]]
name = "thread_local"
Expand Down
4 changes: 1 addition & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,9 +504,7 @@ impl<T: Send> Iterator for IntoIter<T> {
fn next(&mut self) -> Option<T> {
self.raw.next_mut(&mut self.thread_local).map(|entry| {
*entry.present.get_mut() = false;
unsafe {
std::mem::replace(&mut *entry.value.get(), MaybeUninit::uninit()).assume_init()
}
unsafe { mem::replace(&mut *entry.value.get(), MaybeUninit::uninit()).assume_init() }
})
}
fn size_hint(&self) -> (usize, Option<usize>) {
Expand Down
12 changes: 5 additions & 7 deletions src/thread_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,10 @@

use crate::mutex::Mutex;
use crate::POINTER_WIDTH;
use likely_stable::likely;
use memoffset::offset_of;
use once_cell::sync::Lazy;
use std::cell::{Cell, UnsafeCell};
use std::cell::Cell;
use std::cmp::Reverse;
use std::collections::BinaryHeap;
use std::mem::MaybeUninit;
use std::num::NonZeroUsize;
use std::ptr::{addr_of, null};
use std::{mem, ptr};

/// Thread ID manager which allocates thread IDs. It attempts to aggressively
/// reuse thread IDs where possible to avoid cases where a ThreadLocal grows
Expand Down Expand Up @@ -81,6 +75,10 @@ impl Thread {

cfg_if::cfg_if! {
if #[cfg(feature = "nightly")] {
use memoffset::offset_of;
use std::ptr::null;
use std::cell::UnsafeCell;

// This is split into 2 thread-local variables so that we can check whether the
// thread is initialized without having to register a thread-local destructor.
//
Expand Down

0 comments on commit d5330fe

Please sign in to comment.