Skip to content

Commit

Permalink
try to disambiguate macro resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkw committed Oct 12, 2022
1 parent 6350e87 commit 61b29c6
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion tokio/src/coop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

use std::cell::Cell;

thread_local! {
tokio_thread_local! {
static CURRENT: Cell<Budget> = const { Cell::new(Budget::unconstrained()) };
}

Expand Down
2 changes: 1 addition & 1 deletion tokio/src/fs/mocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl Write for &'_ MockFile {
}
}

thread_local! {
tokio_thread_local! {
static QUEUE: RefCell<VecDeque<Box<dyn FnOnce() + Send>>> = RefCell::new(VecDeque::new())
}

Expand Down
2 changes: 1 addition & 1 deletion tokio/src/macros/scoped_tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ macro_rules! scoped_thread_local {
$vis static $name: $crate::macros::scoped_tls::ScopedKey<$ty>
= $crate::macros::scoped_tls::ScopedKey {
inner: {
thread_local!(static FOO: ::std::cell::Cell<*const ()> = const {
tokio_thread_local!(static FOO: ::std::cell::Cell<*const ()> = const {
std::cell::Cell::new(::std::ptr::null())
});
&FOO
Expand Down
6 changes: 3 additions & 3 deletions tokio/src/macros/thread_local.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[cfg(all(loom, test))]
macro_rules! thread_local {
macro_rules! tokio_thread_local {
($(#[$attrs:meta])* $vis:vis static $name:ident: $ty:ty = const { $expr:expr } $(;)?) => {
loom::thread_local! {
$(#[$attrs])*
Expand All @@ -12,13 +12,13 @@ macro_rules! thread_local {

#[cfg(not(tokio_no_const_thread_local))]
#[cfg(not(all(loom, test)))]
macro_rules! thread_local {
macro_rules! tokio_thread_local {
($($tts:tt)+) => { ::std::thread_local!{ $($tts)+ } }
}

#[cfg(tokio_no_const_thread_local)]
#[cfg(not(all(loom, test)))]
macro_rules! thread_local {
macro_rules! tokio_thread_local {
($(#[$attrs:meta])* $vis:vis static $name:ident: $ty:ty = const { $expr:expr } $(;)?) => {
::std::thread_local! {
$(#[$attrs])*
Expand Down
2 changes: 1 addition & 1 deletion tokio/src/runtime/enter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ impl EnterContext {
}
}

thread_local!(static ENTERED: Cell<EnterContext> = const { Cell::new(EnterContext::NotEntered) });
tokio_thread_local!(static ENTERED: Cell<EnterContext> = const { Cell::new(EnterContext::NotEntered) });

/// Represents an executor context.
pub(crate) struct Enter {
Expand Down
2 changes: 1 addition & 1 deletion tokio/src/task/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ pin_project! {
}
}

thread_local!(static CURRENT: LocalData = const { LocalData {
tokio_thread_local!(static CURRENT: LocalData = const { LocalData {
thread_id: Cell::new(None),
ctx: RcCell::new(),
} });
Expand Down
2 changes: 1 addition & 1 deletion tokio/src/util/rand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ impl FastRand {
}
}

thread_local! {
tokio_thread_local! {
static THREAD_RNG: FastRand = FastRand::new(RngSeed::new());
}

Expand Down

0 comments on commit 61b29c6

Please sign in to comment.