ci: updates for Rust 1.77 (#3978)

* ci: updates for Rust 1.77

* move `SendablePtr` inside of test which uses it
This commit is contained in:
David Hewitt 2024-03-22 20:43:23 +00:00 committed by GitHub
parent 351c6a0a49
commit d0f5b6af46
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 49 additions and 49 deletions

View File

@ -528,6 +528,11 @@ impl UnsendableTraversal {
#[test] #[test]
#[cfg(not(target_arch = "wasm32"))] // We are building wasm Python with pthreads disabled #[cfg(not(target_arch = "wasm32"))] // We are building wasm Python with pthreads disabled
fn unsendable_are_not_traversed_on_foreign_thread() { fn unsendable_are_not_traversed_on_foreign_thread() {
#[derive(Clone, Copy)]
struct SendablePtr(*mut pyo3::ffi::PyObject);
unsafe impl Send for SendablePtr {}
Python::with_gil(|py| unsafe { Python::with_gil(|py| unsafe {
let ty = py.get_type_bound::<UnsendableTraversal>(); let ty = py.get_type_bound::<UnsendableTraversal>();
let traverse = get_type_traverse(ty.as_type_ptr()).unwrap(); let traverse = get_type_traverse(ty.as_type_ptr()).unwrap();
@ -579,8 +584,3 @@ extern "C" fn visit_error(
) -> std::os::raw::c_int { ) -> std::os::raw::c_int {
-1 -1
} }
#[derive(Clone, Copy)]
struct SendablePtr(*mut pyo3::ffi::PyObject);
unsafe impl Send for SendablePtr {}

View File

@ -1,20 +1,8 @@
error[E0277]: the trait bound `PyDict: PyClass` is not satisfied
--> tests/ui/abi3_nativetype_inheritance.rs:5:1
|
5 | #[pyclass(extends=PyDict)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `PyClass` is not implemented for `PyDict`
|
= help: the following other types implement trait `PyClass`:
TestClass
pyo3::coroutine::Coroutine
= note: required for `PyDict` to implement `PyClassBaseType`
= note: this error originates in the attribute macro `pyclass` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `PyDict: PyClass` is not satisfied error[E0277]: the trait bound `PyDict: PyClass` is not satisfied
--> tests/ui/abi3_nativetype_inheritance.rs:5:19 --> tests/ui/abi3_nativetype_inheritance.rs:5:19
| |
5 | #[pyclass(extends=PyDict)] 5 | #[pyclass(extends=PyDict)]
| ^^^^^^ the trait `PyClass` is not implemented for `PyDict` | ^^^^^^ the trait `PyClass` is not implemented for `PyDict`, which is required by `PyDict: PyClassBaseType`
| |
= help: the following other types implement trait `PyClass`: = help: the following other types implement trait `PyClass`:
TestClass TestClass
@ -25,3 +13,15 @@ note: required by a bound in `PyClassImpl::BaseType`
| |
| type BaseType: PyTypeInfo + PyClassBaseType; | type BaseType: PyTypeInfo + PyClassBaseType;
| ^^^^^^^^^^^^^^^ required by this bound in `PyClassImpl::BaseType` | ^^^^^^^^^^^^^^^ required by this bound in `PyClassImpl::BaseType`
error[E0277]: the trait bound `PyDict: PyClass` is not satisfied
--> tests/ui/abi3_nativetype_inheritance.rs:5:1
|
5 | #[pyclass(extends=PyDict)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `PyClass` is not implemented for `PyDict`, which is required by `PyDict: PyClassBaseType`
|
= help: the following other types implement trait `PyClass`:
TestClass
pyo3::coroutine::Coroutine
= note: required for `PyDict` to implement `PyClassBaseType`
= note: this error originates in the attribute macro `pyclass` (in Nightly builds, run with -Z macro-backtrace for more info)

View File

@ -36,7 +36,7 @@ error[E0277]: the trait bound `CancelHandle: PyClass` is not satisfied
--> tests/ui/invalid_cancel_handle.rs:20:50 --> tests/ui/invalid_cancel_handle.rs:20:50
| |
20 | async fn missing_cancel_handle_attribute(_param: pyo3::coroutine::CancelHandle) {} 20 | async fn missing_cancel_handle_attribute(_param: pyo3::coroutine::CancelHandle) {}
| ^^^^ the trait `PyClass` is not implemented for `CancelHandle` | ^^^^ the trait `PyClass` is not implemented for `CancelHandle`, which is required by `CancelHandle: PyFunctionArgument<'_, '_>`
| |
= help: the trait `PyClass` is implemented for `pyo3::coroutine::Coroutine` = help: the trait `PyClass` is implemented for `pyo3::coroutine::Coroutine`
= note: required for `CancelHandle` to implement `FromPyObject<'_>` = note: required for `CancelHandle` to implement `FromPyObject<'_>`
@ -55,7 +55,7 @@ error[E0277]: the trait bound `CancelHandle: Clone` is not satisfied
--> tests/ui/invalid_cancel_handle.rs:20:50 --> tests/ui/invalid_cancel_handle.rs:20:50
| |
20 | async fn missing_cancel_handle_attribute(_param: pyo3::coroutine::CancelHandle) {} 20 | async fn missing_cancel_handle_attribute(_param: pyo3::coroutine::CancelHandle) {}
| ^^^^ the trait `Clone` is not implemented for `CancelHandle` | ^^^^ the trait `Clone` is not implemented for `CancelHandle`, which is required by `CancelHandle: PyFunctionArgument<'_, '_>`
| |
= help: the following other types implement trait `PyFunctionArgument<'a, 'py>`: = help: the following other types implement trait `PyFunctionArgument<'a, 'py>`:
Option<&'a pyo3::Bound<'py, T>> Option<&'a pyo3::Bound<'py, T>>

View File

@ -39,7 +39,7 @@ error[E0277]: the trait bound `&str: From<BoundRef<'_, '_, pyo3::prelude::PyModu
--> tests/ui/invalid_pyfunctions.rs:24:13 --> tests/ui/invalid_pyfunctions.rs:24:13
| |
24 | string: &str, 24 | string: &str,
| ^ the trait `From<BoundRef<'_, '_, pyo3::prelude::PyModule>>` is not implemented for `&str` | ^ the trait `From<BoundRef<'_, '_, pyo3::prelude::PyModule>>` is not implemented for `&str`, which is required by `BoundRef<'_, '_, pyo3::prelude::PyModule>: Into<_>`
| |
= help: the following other types implement trait `From<T>`: = help: the following other types implement trait `From<T>`:
<String as From<char>> <String as From<char>>

View File

@ -2,7 +2,7 @@ error[E0277]: the trait bound `i32: From<BoundRef<'_, '_, MyClass>>` is not sati
--> tests/ui/invalid_pymethod_receiver.rs:8:43 --> tests/ui/invalid_pymethod_receiver.rs:8:43
| |
8 | fn method_with_invalid_self_type(slf: i32, py: Python<'_>, index: u32) {} 8 | fn method_with_invalid_self_type(slf: i32, py: Python<'_>, index: u32) {}
| ^^^ the trait `From<BoundRef<'_, '_, MyClass>>` is not implemented for `i32` | ^^^ the trait `From<BoundRef<'_, '_, MyClass>>` is not implemented for `i32`, which is required by `i32: TryFrom<BoundRef<'_, '_, MyClass>>`
| |
= help: the following other types implement trait `From<T>`: = help: the following other types implement trait `From<T>`:
<i32 as From<bool>> <i32 as From<bool>>
@ -10,6 +10,6 @@ error[E0277]: the trait bound `i32: From<BoundRef<'_, '_, MyClass>>` is not sati
<i32 as From<i16>> <i32 as From<i16>>
<i32 as From<u8>> <i32 as From<u8>>
<i32 as From<u16>> <i32 as From<u16>>
<i32 as From<NonZeroI32>> <i32 as From<NonZero<i32>>>
= note: required for `BoundRef<'_, '_, MyClass>` to implement `Into<i32>` = note: required for `BoundRef<'_, '_, MyClass>` to implement `Into<i32>`
= note: required for `i32` to implement `TryFrom<BoundRef<'_, '_, MyClass>>` = note: required for `i32` to implement `TryFrom<BoundRef<'_, '_, MyClass>>`

View File

@ -183,7 +183,7 @@ error[E0277]: the trait bound `i32: From<BoundRef<'_, '_, PyType>>` is not satis
--> tests/ui/invalid_pymethods.rs:46:45 --> tests/ui/invalid_pymethods.rs:46:45
| |
46 | fn classmethod_wrong_first_argument(_x: i32) -> Self { 46 | fn classmethod_wrong_first_argument(_x: i32) -> Self {
| ^^^ the trait `From<BoundRef<'_, '_, PyType>>` is not implemented for `i32` | ^^^ the trait `From<BoundRef<'_, '_, PyType>>` is not implemented for `i32`, which is required by `BoundRef<'_, '_, PyType>: Into<_>`
| |
= help: the following other types implement trait `From<T>`: = help: the following other types implement trait `From<T>`:
<i32 as From<bool>> <i32 as From<bool>>
@ -191,5 +191,5 @@ error[E0277]: the trait bound `i32: From<BoundRef<'_, '_, PyType>>` is not satis
<i32 as From<i16>> <i32 as From<i16>>
<i32 as From<u8>> <i32 as From<u8>>
<i32 as From<u16>> <i32 as From<u16>>
<i32 as From<NonZeroI32>> <i32 as From<NonZero<i32>>>
= note: required for `BoundRef<'_, '_, PyType>` to implement `Into<i32>` = note: required for `BoundRef<'_, '_, PyType>` to implement `Into<i32>`

View File

@ -2,7 +2,7 @@ error[E0277]: the trait bound `PyErr: From<MyError>` is not satisfied
--> tests/ui/invalid_result_conversion.rs:21:1 --> tests/ui/invalid_result_conversion.rs:21:1
| |
21 | #[pyfunction] 21 | #[pyfunction]
| ^^^^^^^^^^^^^ the trait `From<MyError>` is not implemented for `PyErr` | ^^^^^^^^^^^^^ the trait `From<MyError>` is not implemented for `PyErr`, which is required by `MyError: Into<PyErr>`
| |
= help: the following other types implement trait `From<T>`: = help: the following other types implement trait `From<T>`:
<PyErr as From<pyo3::Bound<'py, T>>> <PyErr as From<pyo3::Bound<'py, T>>>

View File

@ -2,7 +2,7 @@ error[E0277]: the trait bound `Blah: IntoPy<Py<PyAny>>` is not satisfied
--> tests/ui/missing_intopy.rs:3:1 --> tests/ui/missing_intopy.rs:3:1
| |
3 | #[pyo3::pyfunction] 3 | #[pyo3::pyfunction]
| ^^^^^^^^^^^^^^^^^^^ the trait `IntoPy<Py<PyAny>>` is not implemented for `Blah` | ^^^^^^^^^^^^^^^^^^^ the trait `IntoPy<Py<PyAny>>` is not implemented for `Blah`, which is required by `Blah: OkWrap<_>`
| |
= help: the following other types implement trait `IntoPy<T>`: = help: the following other types implement trait `IntoPy<T>`:
<bool as IntoPy<Py<PyAny>>> <bool as IntoPy<Py<PyAny>>>

View File

@ -6,7 +6,7 @@ error[E0277]: `*mut pyo3::Python<'static>` cannot be shared between threads safe
| | | |
| required by a bound introduced by this call | required by a bound introduced by this call
| |
= help: within `pyo3::Python<'_>`, the trait `Sync` is not implemented for `*mut pyo3::Python<'static>` = help: within `pyo3::Python<'_>`, the trait `Sync` is not implemented for `*mut pyo3::Python<'static>`, which is required by `{closure@$DIR/tests/ui/not_send.rs:4:22: 4:24}: Ungil`
note: required because it appears within the type `PhantomData<*mut pyo3::Python<'static>>` note: required because it appears within the type `PhantomData<*mut pyo3::Python<'static>>`
--> $RUST/core/src/marker.rs --> $RUST/core/src/marker.rs
| |

View File

@ -9,7 +9,7 @@ error[E0277]: `*mut pyo3::Python<'static>` cannot be shared between threads safe
10 | | }); 10 | | });
| |_________^ `*mut pyo3::Python<'static>` cannot be shared between threads safely | |_________^ `*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>` = 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>>` note: required because it appears within the type `PhantomData<*mut pyo3::Python<'static>>`
--> $RUST/core/src/marker.rs --> $RUST/core/src/marker.rs
| |

View File

@ -4,26 +4,7 @@ error[E0277]: `Rc<i32>` cannot be sent between threads safely
4 | #[pyclass] 4 | #[pyclass]
| ^^^^^^^^^^ `Rc<i32>` cannot be sent between threads safely | ^^^^^^^^^^ `Rc<i32>` cannot be sent between threads safely
| |
= help: within `NotThreadSafe`, the trait `Send` is not implemented for `Rc<i32>` = help: within `NotThreadSafe`, the trait `Send` is not implemented for `Rc<i32>`, which is required by `SendablePyClass<NotThreadSafe>: pyo3::impl_::pyclass::PyClassThreadChecker<NotThreadSafe>`
note: required because it appears within the type `NotThreadSafe`
--> tests/ui/pyclass_send.rs:5:8
|
5 | struct NotThreadSafe {
| ^^^^^^^^^^^^^
note: required by a bound in `SendablePyClass`
--> src/impl_/pyclass.rs
|
| pub struct SendablePyClass<T: Send>(PhantomData<T>);
| ^^^^ required by this bound in `SendablePyClass`
= note: this error originates in the attribute macro `pyclass` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: `Rc<i32>` cannot be sent between threads safely
--> tests/ui/pyclass_send.rs:4:1
|
4 | #[pyclass]
| ^^^^^^^^^^ `Rc<i32>` cannot be sent between threads safely
|
= help: within `NotThreadSafe`, the trait `Send` is not implemented for `Rc<i32>`
= help: the trait `pyo3::impl_::pyclass::PyClassThreadChecker<T>` is implemented for `SendablePyClass<T>` = help: the trait `pyo3::impl_::pyclass::PyClassThreadChecker<T>` is implemented for `SendablePyClass<T>`
note: required because it appears within the type `NotThreadSafe` note: required because it appears within the type `NotThreadSafe`
--> tests/ui/pyclass_send.rs:5:8 --> tests/ui/pyclass_send.rs:5:8
@ -37,3 +18,22 @@ note: required by a bound in `PyClassImpl::ThreadChecker`
| type ThreadChecker: PyClassThreadChecker<Self>; | type ThreadChecker: PyClassThreadChecker<Self>;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `PyClassImpl::ThreadChecker` | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `PyClassImpl::ThreadChecker`
= note: this error originates in the attribute macro `pyclass` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the attribute macro `pyclass` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: `Rc<i32>` cannot be sent between threads safely
--> tests/ui/pyclass_send.rs:4:1
|
4 | #[pyclass]
| ^^^^^^^^^^ `Rc<i32>` cannot be sent between threads safely
|
= help: within `NotThreadSafe`, the trait `Send` is not implemented for `Rc<i32>`, which is required by `NotThreadSafe: Send`
note: required because it appears within the type `NotThreadSafe`
--> tests/ui/pyclass_send.rs:5:8
|
5 | struct NotThreadSafe {
| ^^^^^^^^^^^^^
note: required by a bound in `SendablePyClass`
--> src/impl_/pyclass.rs
|
| pub struct SendablePyClass<T: Send>(PhantomData<T>);
| ^^^^ required by this bound in `SendablePyClass`
= note: this error originates in the attribute macro `pyclass` (in Nightly builds, run with -Z macro-backtrace for more info)