mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-30 18:53:39 +00:00
Use const {} for the THREAD_INFO thread local
This makes accesses to it cheaper
This commit is contained in:
parent
f78cd44602
commit
a8bb3bcd38
@ -1,4 +1,5 @@
|
||||
#![allow(dead_code)] // stack_guard isn't used right now on all platforms
|
||||
#![allow(unused_unsafe)] // thread_local with `const {}` triggers this liny
|
||||
|
||||
use crate::cell::RefCell;
|
||||
use crate::sys::thread::guard::Guard;
|
||||
@ -9,7 +10,7 @@ struct ThreadInfo {
|
||||
thread: Thread,
|
||||
}
|
||||
|
||||
thread_local! { static THREAD_INFO: RefCell<Option<ThreadInfo>> = RefCell::new(None) }
|
||||
thread_local! { static THREAD_INFO: RefCell<Option<ThreadInfo>> = const { RefCell::new(None) } }
|
||||
|
||||
impl ThreadInfo {
|
||||
fn with<R, F>(f: F) -> Option<R>
|
||||
|
Loading…
Reference in New Issue
Block a user