pyo3/tests/ui/not_send2.stderr

54 lines
2.4 KiB
Plaintext

error[E0277]: `*mut pyo3::Python<'static>` cannot be shared between threads safely
--> tests/ui/not_send2.rs:8:26
|
8 | py.allow_threads(|| {
| ____________-------------_^
| | |
| | required by a bound introduced by this call
9 | | println!("{:?}", string);
10 | | });
| |_________^ `*mut pyo3::Python<'static>` cannot be shared between threads safely
|
= help: within `pyo3::Bound<'_, PyString>`, the trait `Sync` is not implemented for `*mut pyo3::Python<'static>`, which is required by `{closure@$DIR/tests/ui/not_send2.rs:8:26: 8:28}: Ungil`
note: required because it appears within the type `PhantomData<*mut pyo3::Python<'static>>`
--> $RUST/core/src/marker.rs
|
| pub struct PhantomData<T: ?Sized>;
| ^^^^^^^^^^^
note: required because it appears within the type `impl_::not_send::NotSend`
--> src/impl_/not_send.rs
|
| 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)>`
--> $RUST/core/src/marker.rs
|
| pub struct PhantomData<T: ?Sized>;
| ^^^^^^^^^^^
note: required because it appears within the type `pyo3::Python<'_>`
--> src/marker.rs
|
| pub struct Python<'py>(PhantomData<(&'py GILGuard, NotSend)>);
| ^^^^^^
note: required because it appears within the type `pyo3::Bound<'_, PyString>`
--> src/instance.rs
|
| pub struct Bound<'py, T>(Python<'py>, ManuallyDrop<Py<T>>);
| ^^^^^
= note: required for `&pyo3::Bound<'_, PyString>` to implement `Send`
note: required because it's used within this closure
--> tests/ui/not_send2.rs:8:26
|
8 | py.allow_threads(|| {
| ^^
= note: required for `{closure@$DIR/tests/ui/not_send2.rs:8:26: 8:28}` 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`