diff --git a/tests/test_compile_error.rs b/tests/test_compile_error.rs index 181fcefb..edd5164f 100644 --- a/tests/test_compile_error.rs +++ b/tests/test_compile_error.rs @@ -52,6 +52,7 @@ fn _test_compile_errors() { tests_rust_1_58(&t); tests_rust_1_60(&t); tests_rust_1_62(&t); + tests_rust_1_63(&t); #[rustversion::since(1.49)] fn tests_rust_1_49(t: &trybuild::TestCases) { @@ -85,9 +86,6 @@ fn _test_compile_errors() { fn tests_rust_1_58(t: &trybuild::TestCases) { t.compile_fail("tests/ui/invalid_pyfunctions.rs"); t.compile_fail("tests/ui/invalid_pymethods.rs"); - t.compile_fail("tests/ui/not_send.rs"); - t.compile_fail("tests/ui/not_send2.rs"); - t.compile_fail("tests/ui/not_send3.rs"); #[cfg(Py_LIMITED_API)] t.compile_fail("tests/ui/abi3_nativetype_inheritance.rs"); } @@ -107,12 +105,22 @@ fn _test_compile_errors() { #[rustversion::since(1.62)] fn tests_rust_1_62(t: &trybuild::TestCases) { t.compile_fail("tests/ui/invalid_pymethod_receiver.rs"); - t.compile_fail("tests/ui/invalid_result_conversion.rs"); t.compile_fail("tests/ui/missing_intopy.rs"); } #[rustversion::before(1.62)] fn tests_rust_1_62(_t: &trybuild::TestCases) {} + + #[rustversion::since(1.63)] + fn tests_rust_1_63(t: &trybuild::TestCases) { + t.compile_fail("tests/ui/invalid_result_conversion.rs"); + t.compile_fail("tests/ui/not_send.rs"); + t.compile_fail("tests/ui/not_send2.rs"); + t.compile_fail("tests/ui/not_send3.rs"); + } + + #[rustversion::before(1.63)] + fn tests_rust_1_63(_t: &trybuild::TestCases) {} } #[cfg(feature = "nightly")] diff --git a/tests/test_enum.rs b/tests/test_enum.rs index d6ae380f..54fdd6eb 100644 --- a/tests/test_enum.rs +++ b/tests/test_enum.rs @@ -6,7 +6,7 @@ use pyo3::{py_run, wrap_pyfunction}; mod common; #[pyclass] -#[derive(Debug, PartialEq, Clone)] +#[derive(Debug, PartialEq, Eq, Clone)] pub enum MyEnum { Variant, OtherVariant, @@ -163,7 +163,7 @@ fn test_repr_parse() { } #[pyclass(name = "MyEnum")] -#[derive(Debug, PartialEq, Clone)] +#[derive(Debug, PartialEq, Eq, Clone)] pub enum RenameEnum { Variant, } @@ -177,7 +177,7 @@ fn test_rename_enum_repr_correct() { } #[pyclass] -#[derive(Debug, PartialEq, Clone)] +#[derive(Debug, PartialEq, Eq, Clone)] pub enum RenameVariantEnum { #[pyo3(name = "VARIANT")] Variant, diff --git a/tests/test_frompyobject.rs b/tests/test_frompyobject.rs index f429ce26..d83f8b89 100644 --- a/tests/test_frompyobject.rs +++ b/tests/test_frompyobject.rs @@ -532,7 +532,7 @@ fn test_from_py_with_tuple_struct_error() { }); } -#[derive(Debug, FromPyObject, PartialEq)] +#[derive(Debug, FromPyObject, PartialEq, Eq)] pub enum ZapEnum { Zip(#[pyo3(from_py_with = "PyAny::len")] usize), Zap(String, #[pyo3(from_py_with = "PyAny::len")] usize), @@ -552,7 +552,7 @@ fn test_from_py_with_enum() { }); } -#[derive(Debug, FromPyObject, PartialEq)] +#[derive(Debug, FromPyObject, PartialEq, Eq)] #[pyo3(transparent)] pub struct TransparentFromPyWith { #[pyo3(from_py_with = "PyAny::len")] diff --git a/tests/test_gc.rs b/tests/test_gc.rs index 33a47d97..0184719c 100644 --- a/tests/test_gc.rs +++ b/tests/test_gc.rs @@ -176,7 +176,7 @@ fn inheritance_with_new_methods_with_drop() { let typeobj = py.get_type::(); let inst = typeobj.call((), None).unwrap(); - let obj: &PyCell = PyTryInto::try_into(&*inst).unwrap(); + let obj: &PyCell = PyTryInto::try_into(inst).unwrap(); let mut obj_ref_mut = obj.borrow_mut(); obj_ref_mut.data = Some(Arc::clone(&drop_called1)); let base: &mut BaseClassWithDrop = obj_ref_mut.as_mut(); diff --git a/tests/test_gc_pyproto.rs b/tests/test_gc_pyproto.rs index c4113070..de887c76 100644 --- a/tests/test_gc_pyproto.rs +++ b/tests/test_gc_pyproto.rs @@ -195,7 +195,7 @@ fn inheritance_with_new_methods_with_drop() { let typeobj = py.get_type::(); let inst = typeobj.call((), None).unwrap(); - let obj: &PyCell = PyTryInto::try_into(&*inst).unwrap(); + let obj: &PyCell = PyTryInto::try_into(inst).unwrap(); let mut obj_ref_mut = obj.borrow_mut(); obj_ref_mut.data = Some(Arc::clone(&drop_called1)); let base: &mut BaseClassWithDrop = obj_ref_mut.as_mut(); diff --git a/tests/ui/invalid_result_conversion.stderr b/tests/ui/invalid_result_conversion.stderr index d1905eef..a92e8ccc 100644 --- a/tests/ui/invalid_result_conversion.stderr +++ b/tests/ui/invalid_result_conversion.stderr @@ -4,7 +4,16 @@ error[E0599]: no method named `assert_into_py_result` found for enum `Result` in 21 | #[pyfunction] | ^^^^^^^^^^^^^ method not found in `Result<(), MyError>` | +note: the method `assert_into_py_result` exists on the type `()` + --> src/impl_/ghost.rs + | + | fn assert_into_py_result(&mut self) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the attribute macro `pyfunction` (in Nightly builds, run with -Z macro-backtrace for more info) +help: use the `?` operator to extract the `()` value, propagating a `Result::Err` value to the caller + | +21 | #[pyfunction]? + | + error[E0277]: the trait bound `Result<(), MyError>: IntoPyCallbackOutput<_>` is not satisfied --> tests/ui/invalid_result_conversion.rs:21:1 diff --git a/tests/ui/not_send.stderr b/tests/ui/not_send.stderr index 69e07ac0..a287f26d 100644 --- a/tests/ui/not_send.stderr +++ b/tests/ui/not_send.stderr @@ -11,7 +11,11 @@ error[E0277]: `*mut pyo3::Python<'static>` cannot be shared between threads safe = note: required because it appears within the type `PhantomData<(&GILGuard, impl_::not_send::NotSend)>` = note: required because it appears within the type `pyo3::Python<'_>` = note: required because of the requirements on the impl of `Send` for `&pyo3::Python<'_>` - = note: required because it appears within the type `[closure@$DIR/tests/ui/not_send.rs:4:22: 4:38]` +note: required because it's used within this closure + --> tests/ui/not_send.rs:4:22 + | +4 | py.allow_threads(|| { drop(py); }); + | ^^^^^^^^^^^^^^^^ = note: required because of the requirements on the impl of `Ungil` for `[closure@$DIR/tests/ui/not_send.rs:4:22: 4:38]` note: required by a bound in `pyo3::Python::<'py>::allow_threads` --> src/marker.rs diff --git a/tests/ui/not_send2.stderr b/tests/ui/not_send2.stderr index c33ee4fc..d0735238 100644 --- a/tests/ui/not_send2.stderr +++ b/tests/ui/not_send2.stderr @@ -9,7 +9,14 @@ error[E0277]: `UnsafeCell` cannot be shared between threads safely = note: required because it appears within the type `PyString` = note: required because it appears within the type `&PyString` = note: required because of the requirements on the impl of `Send` for `&&PyString` - = note: required because it appears within the type `[closure@$DIR/tests/ui/not_send2.rs:8:26: 10:10]` +note: required because it's used within this closure + --> tests/ui/not_send2.rs:8:26 + | +8 | py.allow_threads(|| { + | __________________________^ +9 | | println!("{:?}", string); +10 | | }); + | |_________^ = note: required because of the requirements on the impl of `Ungil` for `[closure@$DIR/tests/ui/not_send2.rs:8:26: 10:10]` note: required by a bound in `pyo3::Python::<'py>::allow_threads` --> src/marker.rs diff --git a/tests/ui/not_send3.stderr b/tests/ui/not_send3.stderr index b152d076..0ea0fa48 100644 --- a/tests/ui/not_send3.stderr +++ b/tests/ui/not_send3.stderr @@ -6,7 +6,14 @@ error[E0277]: `Rc` cannot be shared between threads safely | = help: the trait `Sync` is not implemented for `Rc` = note: required because of the requirements on the impl of `Send` for `&Rc` - = note: required because it appears within the type `[closure@$DIR/tests/ui/not_send3.rs:8:26: 10:10]` +note: required because it's used within this closure + --> tests/ui/not_send3.rs:8:26 + | +8 | py.allow_threads(|| { + | __________________________^ +9 | | println!("{:?}", rc); +10 | | }); + | |_________^ = note: required because of the requirements on the impl of `Ungil` for `[closure@$DIR/tests/ui/not_send3.rs:8:26: 10:10]` note: required by a bound in `pyo3::Python::<'py>::allow_threads` --> src/marker.rs