Skip to content

Commit

Permalink
Use const thread_local
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Jan 8, 2024
1 parent 5a15fc2 commit e02133b
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion crossbeam-channel/benchmarks/flume.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub fn shuffle<T>(v: &mut [T]) {
}

thread_local! {
static RNG: Cell<Wrapping<u32>> = Cell::new(Wrapping(1));
static RNG: Cell<Wrapping<u32>> = const { Cell::new(Wrapping(1)) };
}

RNG.with(|rng| {
Expand Down
2 changes: 1 addition & 1 deletion crossbeam-channel/benchmarks/mpsc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub fn shuffle<T>(v: &mut [T]) {
}

thread_local! {
static RNG: Cell<Wrapping<u32>> = Cell::new(Wrapping(1));
static RNG: Cell<Wrapping<u32>> = const { Cell::new(Wrapping(1)) };
}

RNG.with(|rng| {
Expand Down
2 changes: 1 addition & 1 deletion crossbeam-channel/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub(crate) fn shuffle<T>(v: &mut [T]) {
}

thread_local! {
static RNG: Cell<Wrapping<u32>> = Cell::new(Wrapping(1_406_868_647));
static RNG: Cell<Wrapping<u32>> = const { Cell::new(Wrapping(1_406_868_647)) };
}

let _ = RNG.try_with(|rng| {
Expand Down
2 changes: 1 addition & 1 deletion crossbeam-channel/tests/thread_locals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ fn use_while_exiting() {
}

thread_local! {
static FOO: Foo = Foo;
static FOO: Foo = const { Foo };
}

let (s, r) = unbounded::<()>();
Expand Down
2 changes: 1 addition & 1 deletion crossbeam-epoch/src/default.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ mod tests {
}

thread_local! {
static FOO: Foo = Foo;
static FOO: Foo = const { Foo };
}

thread::scope(|scope| {
Expand Down

0 comments on commit e02133b

Please sign in to comment.