Use const-initialized thread locals (#3923)

This was a relatively recent feature added to the Rust standard library
which should help accelerate calls into WebAssembly slightly.
This commit is contained in:
Alex Crichton
2022-03-14 12:29:58 -05:00
committed by GitHub
parent 884ca1f75b
commit 62a6a7ab6c
3 changed files with 13 additions and 7 deletions

View File

@@ -257,7 +257,7 @@ pub fn lazy_per_thread_init() -> Result<(), Box<Trap>> {
// when the thread exists. Otherwise this function is only ever called at
// most once per-thread.
thread_local! {
static STACK: RefCell<Option<Stack>> = RefCell::new(None);
static STACK: RefCell<Option<Stack>> = const { RefCell::new(None) };
}
/// The size of the sigaltstack (not including the guard, which will be