Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
anko opened this issue Apr 20, 2024 · 0 comments
Open

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

anko opened this issue Apr 20, 2024 · 0 comments

Comments

@anko
Copy link

anko commented Apr 20, 2024

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
@anko anko changed the title loom::lazy_static does not support const-initialised thread locals loom::thread_local does not support const-initialization Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant