constify a couple thread_local statics
This commit is contained in:
parent
ed19532868
commit
d0873c7a11
4 changed files with 5 additions and 5 deletions
|
@ -42,7 +42,7 @@ pub struct Registry(Arc<RegistryData>);
|
||||||
thread_local! {
|
thread_local! {
|
||||||
/// The registry associated with the thread.
|
/// The registry associated with the thread.
|
||||||
/// This allows the `WorkerLocal` type to clone the registry in its constructor.
|
/// This allows the `WorkerLocal` type to clone the registry in its constructor.
|
||||||
static REGISTRY: OnceCell<Registry> = OnceCell::new();
|
static REGISTRY: OnceCell<Registry> = const { OnceCell::new() };
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ThreadData {
|
struct ThreadData {
|
||||||
|
|
|
@ -9,9 +9,9 @@ const DEFAULT_COLUMN_WIDTH: usize = 140;
|
||||||
|
|
||||||
thread_local! {
|
thread_local! {
|
||||||
/// Track the position of viewable characters in our buffer
|
/// Track the position of viewable characters in our buffer
|
||||||
static CURSOR: Cell<usize> = Cell::new(0);
|
static CURSOR: Cell<usize> = const { Cell::new(0) };
|
||||||
/// Width of the terminal
|
/// Width of the terminal
|
||||||
static WIDTH: Cell<usize> = Cell::new(DEFAULT_COLUMN_WIDTH);
|
static WIDTH: Cell<usize> = const { Cell::new(DEFAULT_COLUMN_WIDTH) };
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Print to terminal output to a buffer
|
/// Print to terminal output to a buffer
|
||||||
|
|
|
@ -284,7 +284,7 @@ impl<'a> scoped_cell::ApplyL<'a> for BridgeStateL {
|
||||||
|
|
||||||
thread_local! {
|
thread_local! {
|
||||||
static BRIDGE_STATE: scoped_cell::ScopedCell<BridgeStateL> =
|
static BRIDGE_STATE: scoped_cell::ScopedCell<BridgeStateL> =
|
||||||
scoped_cell::ScopedCell::new(BridgeState::NotConnected);
|
const { scoped_cell::ScopedCell::new(BridgeState::NotConnected) };
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BridgeState<'_> {
|
impl BridgeState<'_> {
|
||||||
|
|
|
@ -152,7 +152,7 @@ thread_local! {
|
||||||
/// This is required as the thread-local state in the proc_macro client does
|
/// This is required as the thread-local state in the proc_macro client does
|
||||||
/// not handle being re-entered, and will invalidate all `Symbol`s when
|
/// not handle being re-entered, and will invalidate all `Symbol`s when
|
||||||
/// entering a nested macro.
|
/// entering a nested macro.
|
||||||
static ALREADY_RUNNING_SAME_THREAD: Cell<bool> = Cell::new(false);
|
static ALREADY_RUNNING_SAME_THREAD: Cell<bool> = const { Cell::new(false) };
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Keep `ALREADY_RUNNING_SAME_THREAD` (see also its documentation)
|
/// Keep `ALREADY_RUNNING_SAME_THREAD` (see also its documentation)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue