Open MusicalNinjaDad opened 3 months ago
error[E0277]: `*mut pyo3::Python<'static>` cannot be shared between threads safely
--> rust/fizzbuzzo3/src/lib.rs:98:74
|
98 | FizzBuzzable::Vec(v) => Ok(FizzBuzzReturn::Many(v.fizzbuzz().map(|f: String| {f.into_py(py)}).collect())),
| --- -----------^^^^^^^^^^^^^^^^
| | |
| | `*mut pyo3::Python<'static>` cannot be shared between threads safely
| | within this `{closure@rust/fizzbuzzo3/src/lib.rs:98:74: 98:85}`
| required by a bound introduced by this call
|
= help: within `{closure@rust/fizzbuzzo3/src/lib.rs:98:74: 98:85}`, the trait `Sync` is not implemented for `*mut pyo3::Python<'static>`, which is required by `{closure@rust/fizzbuzzo3/src/lib.rs:98:74: 98:85}: Sync`
note: required because it appears within the type `PhantomData<*mut pyo3::Python<'static>>`
--> /opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
|
740 | pub struct PhantomData<T: ?Sized>;
| ^^^^^^^^^^^
note: required because it appears within the type `impl_::not_send::NotSend`
--> /opt/cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.21.2/src/impl_/not_send.rs:7:19
|
7 | pub(crate) struct NotSend(PhantomData<*mut Python<'static>>);
| ^^^^^^^
= note: required because it appears within the type `(&pyo3::gil::GILGuard, impl_::not_send::NotSend)`
note: required because it appears within the type `PhantomData<(&pyo3::gil::GILGuard, impl_::not_send::NotSend)>`
--> /opt/rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/marker.rs:740:12
|
740 | pub struct PhantomData<T: ?Sized>;
| ^^^^^^^^^^^
note: required because it appears within the type `pyo3::Python<'_>`
--> /opt/cargo/registry/src/index.crates.io-6f17d22bba15001f/pyo3-0.21.2/src/marker.rs:391:12
|
391 | pub struct Python<'py>(PhantomData<(&'py GILGuard, NotSend)>);
| ^^^^^^
= note: required because it appears within the type `&pyo3::Python<'_>`
note: required because it's used within this closure
--> rust/fizzbuzzo3/src/lib.rs:98:74
|
98 | FizzBuzzable::Vec(v) => Ok(FizzBuzzReturn::Many(v.fizzbuzz().map(|f: String| {f.into_py(py)}).collect())),
| ^^^^^^^^^^^
note: required by a bound in `rayon::iter::ParallelIterator::map`
--> /opt/cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/mod.rs:603:34
|
601 | fn map<F, R>(self, map_op: F) -> Map<Self, F>
| --- required by a bound in this associated function
602 | where
603 | F: Fn(Self::Item) -> R + Sync + Send,
| ^^^^ required by this bound in `ParallelIterator::map`
For more information about this error, try `rustc --explain E0277`.
warning: `fizzbuzzo3` (lib test) generated 1 warning
error: could not compile `fizzbuzzo3` (lib test) due to 1 previous error; 1 warning emitted
Newtype MyPyAny(Py(PyAny)) Impl MyPyAny into_mypy(FBAns, py) IntoPy for MyPyAny
Add py token to fizzbuzz signature
.map FBAns -> FBAns.into_mypy(py)