diff --git a/proxmox-api-macro/src/lib.rs b/proxmox-api-macro/src/lib.rs index 9888b76c..3c34b48b 100644 --- a/proxmox-api-macro/src/lib.rs +++ b/proxmox-api-macro/src/lib.rs @@ -313,7 +313,7 @@ pub fn derive_updater_type(item: TokenStream_1) -> TokenStream_1 { .into() } -thread_local!(static NON_FATAL_ERRORS: RefCell> = RefCell::new(None)); +thread_local!(static NON_FATAL_ERRORS: RefCell> = const { RefCell::new(None) }); /// The local error TLS must be freed at the end of a macro as any leftover `TokenStream` (even an /// empty one) will just panic between different runs as the multiple source files are handled by diff --git a/proxmox-router/src/cli/command.rs b/proxmox-router/src/cli/command.rs index a97c9d48..fca05e32 100644 --- a/proxmox-router/src/cli/command.rs +++ b/proxmox-router/src/cli/command.rs @@ -218,7 +218,7 @@ const API_METHOD_COMMAND_HELP: ApiMethod = ApiMethod::new( ); std::thread_local! { - static HELP_CONTEXT: RefCell>> = RefCell::new(None); + static HELP_CONTEXT: RefCell>> = const { RefCell::new(None) }; } fn help_command( diff --git a/proxmox-schema/src/de/mod.rs b/proxmox-schema/src/de/mod.rs index 09ccfeb3..79fb18e7 100644 --- a/proxmox-schema/src/de/mod.rs +++ b/proxmox-schema/src/de/mod.rs @@ -24,7 +24,7 @@ pub use no_schema::{split_list, SplitList}; // Used to disable calling `check_constraints` on a `StringSchema` if it is being deserialized // for a `PropertyString`, which performs its own checking. thread_local! { - static IN_PROPERTY_STRING: Cell = Cell::new(false); + static IN_PROPERTY_STRING: Cell = const { Cell::new(false) }; } pub(crate) struct InPropertyStringGuard; diff --git a/proxmox-schema/src/de/verify.rs b/proxmox-schema/src/de/verify.rs index 24a14772..615e69cf 100644 --- a/proxmox-schema/src/de/verify.rs +++ b/proxmox-schema/src/de/verify.rs @@ -16,8 +16,8 @@ struct VerifyState { } thread_local! { - static VERIFY_SCHEMA: RefCell> = RefCell::new(None); - static ERRORS: RefCell> = RefCell::new(Vec::new()); + static VERIFY_SCHEMA: RefCell> = const { RefCell::new(None) }; + static ERRORS: RefCell> = const { RefCell::new(Vec::new()) }; } pub(crate) struct SchemaGuard(Option);