async_once
async_once copied to clipboard
Adding jwt-simple breaks compilation
Addition of jwt-simple to Cargo.toml breaks compilation of AsyncOnce blocks
error[E0277]: `*const u32` cannot be sent between threads safely
--> src/main.rs:4:1
|
4 | / lazy_static! {
5 | | static ref FOO: AsyncOnce<u32> = AsyncOnce::new(
6 | | async {
7 | | 1
... |
13 | | static ref BAR: u32 = 2;
14 | | }
| |_^ `*const u32` cannot be sent between threads safely
|
= help: the trait `Send` is not implemented for `*const u32`
= note: required because of the requirements on the impl of `Send` for `Cell<*const u32>`
= note: required because it appears within the type `AsyncOnce<u32>`
= note: required because of the requirements on the impl of `Sync` for `spin::once::Once<AsyncOnce<u32>>`
= note: required because it appears within the type `lazy_static::lazy::Lazy<AsyncOnce<u32>>`
= note: shared static variables must have a type that implements `Sync`
= note: this error originates in the macro `__lazy_static_create` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: `(dyn Future<Output = u32> + 'static)` cannot be sent between threads safely
--> src/main.rs:4:1
|
4 | / lazy_static! {
5 | | static ref FOO: AsyncOnce<u32> = AsyncOnce::new(
6 | | async {
7 | | 1
... |
13 | | static ref BAR: u32 = 2;
14 | | }
| |_^ `(dyn Future<Output = u32> + 'static)` cannot be sent between threads safely
|
= help: the trait `Send` is not implemented for `(dyn Future<Output = u32> + 'static)`
= note: required because of the requirements on the impl of `Send` for `Unique<(dyn Future<Output = u32> + 'static)>`
= note: required because it appears within the type `Box<(dyn Future<Output = u32> + 'static)>`
= note: required because it appears within the type `Pin<Box<(dyn Future<Output = u32> + 'static)>>`
= note: required because it appears within the type `Result<u32, Pin<Box<(dyn Future<Output = u32> + 'static)>>>`
= note: required because of the requirements on the impl of `Send` for `Mutex<Result<u32, Pin<Box<(dyn Future<Output = u32> + 'static)>>>>`
= note: required because it appears within the type `AsyncOnce<u32>`
= note: required because of the requirements on the impl of `Sync` for `spin::once::Once<AsyncOnce<u32>>`
= note: required because it appears within the type `lazy_static::lazy::Lazy<AsyncOnce<u32>>`
= note: shared static variables must have a type that implements `Sync`
= note: this error originates in the macro `__lazy_static_create` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0277`.
error: could not compile `async_once_jwt_simple` due to 2 previous errors
I honestly wish i was joking and I understood why.
Minimal reproducible example below: https://github.com/Charles-Schleich/async_once_jwt_simple
No work around or fix so far
Seems like a duplicate of #3.