tokio-rs / loom

Concurrency permutation testing tool for Rust.
MIT License
2.08k stars 110 forks source link

`loom::thread_local` does not support const-initialization #346

Open anko opened 4 months ago

anko commented 4 months ago

std::thread_local accepts this:

use std::cell::Cell;
thread_local! {
    pub static FOO: Cell<u32> = const { Cell::new(0) };
}

loom::thread_local does not:

error: no rules expected the token `const`
   --> src/test.rs:3:33
    |
3   |     pub static FOO: Cell<u32> = const { Cell::new(0) };
    |                                 ^^^^^ no rules expected this token in macro call