46 lines
1.9 KiB
Plaintext
46 lines
1.9 KiB
Plaintext
error[E0277]: `*mut pyo3::Python<'static>` cannot be shared between threads safely
|
|
--> tests/ui/not_send.rs:4:22
|
|
|
|
|
4 | py.allow_threads(|| { drop(py); });
|
|
| ------------- ^^^^^^^^^^^^^^^^ `*mut pyo3::Python<'static>` cannot be shared between threads safely
|
|
| |
|
|
| required by a bound introduced by this call
|
|
|
|
|
= help: within `pyo3::Python<'_>`, the trait `Sync` is not implemented for `*mut pyo3::Python<'static>`
|
|
note: required because it appears within the type `PhantomData<*mut Python<'static>>`
|
|
--> $RUST/core/src/marker.rs
|
|
|
|
|
| pub struct PhantomData<T: ?Sized>;
|
|
| ^^^^^^^^^^^
|
|
note: required because it appears within the type `NotSend`
|
|
--> src/impl_/not_send.rs
|
|
|
|
|
| pub(crate) struct NotSend(PhantomData<*mut Python<'static>>);
|
|
| ^^^^^^^
|
|
= note: required because it appears within the type `(&GILGuard, NotSend)`
|
|
note: required because it appears within the type `PhantomData<(&GILGuard, NotSend)>`
|
|
--> $RUST/core/src/marker.rs
|
|
|
|
|
| pub struct PhantomData<T: ?Sized>;
|
|
| ^^^^^^^^^^^
|
|
note: required because it appears within the type `Python<'_>`
|
|
--> src/marker.rs
|
|
|
|
|
| pub struct Python<'py>(PhantomData<(&'py GILGuard, NotSend)>);
|
|
| ^^^^^^
|
|
= note: required for `&pyo3::Python<'_>` to implement `Send`
|
|
note: required because it's used within this closure
|
|
--> tests/ui/not_send.rs:4:22
|
|
|
|
|
4 | py.allow_threads(|| { drop(py); });
|
|
| ^^
|
|
= note: required for `[closure@$DIR/tests/ui/not_send.rs:4:22: 4:24]` to implement `Ungil`
|
|
note: required by a bound in `pyo3::Python::<'py>::allow_threads`
|
|
--> src/marker.rs
|
|
|
|
|
| pub fn allow_threads<T, F>(self, f: F) -> T
|
|
| ------------- required by a bound in this associated function
|
|
| where
|
|
| F: Ungil + FnOnce() -> T,
|
|
| ^^^^^ required by this bound in `Python::<'py>::allow_threads`
|