Skip to content

Commit

Permalink
ci: updates for Rust 1.81 (PyO3#4533)
Browse files Browse the repository at this point in the history
  • Loading branch information
Icxolu authored Sep 5, 2024
1 parent 8ee5510 commit 699de42
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 37 deletions.
7 changes: 3 additions & 4 deletions src/conversions/anyhow.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
#![cfg(feature = "anyhow")]

//! A conversion from
//! [anyhow](https://docs.rs/anyhow/ "A trait object based error system for easy idiomatic error handling in Rust applications.")’s
//! [`Error`](https://docs.rs/anyhow/latest/anyhow/struct.Error.html "Anyhows `Error` type, a wrapper around a dynamic error type")
//! type to [`PyErr`].
//! A conversion from [anyhow]’s [`Error`][anyhow-error] type to [`PyErr`].
//!
//! Use of an error handling library like [anyhow] is common in application code and when you just
//! want error handling to be easy. If you are writing a library or you need more control over your
Expand Down Expand Up @@ -99,6 +96,8 @@
//! }
//! ```
//!
//! [anyhow]: https://docs.rs/anyhow/ "A trait object based error system for easy idiomatic error handling in Rust applications."
//! [anyhow-error]: https://docs.rs/anyhow/latest/anyhow/struct.Error.html "Anyhows `Error` type, a wrapper around a dynamic error type"
//! [`RuntimeError`]: https://docs.python.org/3/library/exceptions.html#RuntimeError "Built-in Exceptions — Python documentation"
//! [Error handling]: https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html "Recoverable Errors with Result - The Rust Programming Language"

Expand Down
6 changes: 1 addition & 5 deletions tests/ui/invalid_cancel_handle.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,7 @@ error[E0277]: the trait bound `CancelHandle: PyFunctionArgument<'_, '_>` is not
20 | async fn missing_cancel_handle_attribute(_param: pyo3::coroutine::CancelHandle) {}
| ^^^^ the trait `PyClass` is not implemented for `CancelHandle`, which is required by `CancelHandle: PyFunctionArgument<'_, '_>`
|
= help: the following other types implement trait `PyFunctionArgument<'a, 'py>`:
&'a mut pyo3::coroutine::Coroutine
&'a pyo3::Bound<'py, T>
&'a pyo3::coroutine::Coroutine
Option<&'a pyo3::Bound<'py, T>>
= help: the trait `PyClass` is implemented for `pyo3::coroutine::Coroutine`
= note: required for `CancelHandle` to implement `FromPyObject<'_>`
= note: required for `CancelHandle` to implement `FromPyObjectBound<'_, '_>`
= note: required for `CancelHandle` to implement `PyFunctionArgument<'_, '_>`
Expand Down
11 changes: 7 additions & 4 deletions tests/ui/invalid_intern_arg.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ error[E0435]: attempt to use a non-constant value in a constant
--> tests/ui/invalid_intern_arg.rs:5:55
|
5 | Python::with_gil(|py| py.import(pyo3::intern!(py, _foo)).unwrap());
| ------------------^^^^-
| | |
| | non-constant value
| help: consider using `let` instead of `static`: `let INTERNED`
| ^^^^ non-constant value
|
help: consider using `let` instead of `static`
--> src/sync.rs
|
| let INTERNED: $crate::sync::Interned = $crate::sync::Interned::new($text);
| ~~~

error: lifetime may not live long enough
--> tests/ui/invalid_intern_arg.rs:5:27
Expand Down
10 changes: 10 additions & 0 deletions tests/ui/invalid_property_args.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ error[E0277]: `PhantomData<i32>` cannot be converted to a Python object
|
= help: the trait `IntoPyObject<'_>` is not implemented for `PhantomData<i32>`, which is required by `for<'py> PhantomData<i32>: PyO3GetField<'py>`
= note: implement `IntoPyObject` for `&PhantomData<i32>` or `IntoPyObject + Clone` for `PhantomData<i32>` to define the conversion
= help: the following other types implement trait `IntoPyObject<'py>`:
&&str
&'a BTreeMap<K, V>
&'a BTreeSet<K>
&'a Cell<T>
&'a HashMap<K, V, H>
&'a HashSet<K, H>
&'a Option<T>
&'a Py<T>
and $N others
= note: required for `PhantomData<i32>` to implement `for<'py> PyO3GetField<'py>`
note: required by a bound in `PyClassGetterGenerator::<ClassT, FieldT, Offset, false, false, false, false, false>::generate`
--> src/impl_/pyclass.rs
Expand Down
12 changes: 6 additions & 6 deletions tests/ui/invalid_pyfunctions.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ error[E0277]: the trait bound `&str: From<BoundRef<'_, '_, pyo3::types::PyModule
| ^ the trait `From<BoundRef<'_, '_, pyo3::types::PyModule>>` is not implemented for `&str`, which is required by `BoundRef<'_, '_, pyo3::types::PyModule>: Into<_>`
|
= help: the following other types implement trait `From<T>`:
<String as From<&String>>
<String as From<&mut str>>
<String as From<&str>>
<String as From<Box<str>>>
<String as From<Cow<'a, str>>>
<String as From<char>>
`String` implements `From<&String>`
`String` implements `From<&mut str>`
`String` implements `From<&str>`
`String` implements `From<Box<str>>`
`String` implements `From<Cow<'a, str>>`
`String` implements `From<char>`
= note: required for `BoundRef<'_, '_, pyo3::types::PyModule>` to implement `Into<&str>`
10 changes: 5 additions & 5 deletions tests/ui/invalid_pymethod_receiver.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ error[E0277]: the trait bound `i32: TryFrom<BoundRef<'_, '_, MyClass>>` is not s
| ^^^ 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>`:
<i32 as From<bool>>
<i32 as From<i16>>
<i32 as From<i8>>
<i32 as From<u16>>
<i32 as From<u8>>
`i32` implements `From<bool>`
`i32` implements `From<i16>`
`i32` implements `From<i8>`
`i32` implements `From<u16>`
`i32` implements `From<u8>`
= note: required for `BoundRef<'_, '_, MyClass>` to implement `Into<i32>`
= note: required for `i32` to implement `TryFrom<BoundRef<'_, '_, MyClass>>`
10 changes: 5 additions & 5 deletions tests/ui/invalid_pymethods.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ error[E0277]: the trait bound `i32: From<BoundRef<'_, '_, PyType>>` is not satis
| ^^^ 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>`:
<i32 as From<bool>>
<i32 as From<i16>>
<i32 as From<i8>>
<i32 as From<u16>>
<i32 as From<u8>>
`i32` implements `From<bool>`
`i32` implements `From<i16>`
`i32` implements `From<i8>`
`i32` implements `From<u16>`
`i32` implements `From<u8>`
= note: required for `BoundRef<'_, '_, PyType>` to implement `Into<i32>`
16 changes: 8 additions & 8 deletions tests/ui/invalid_result_conversion.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ error[E0277]: the trait bound `PyErr: From<MyError>` is not satisfied
| ^^^^^^ 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>`:
<PyErr as From<AddrParseError>>
<PyErr as From<DecodeUtf16Error>>
<PyErr as From<DowncastError<'_, '_>>>
<PyErr as From<DowncastIntoError<'_>>>
<PyErr as From<FromUtf16Error>>
<PyErr as From<FromUtf8Error>>
<PyErr as From<Infallible>>
<PyErr as From<IntoInnerError<W>>>
`PyErr` implements `From<AddrParseError>`
`PyErr` implements `From<DecodeUtf16Error>`
`PyErr` implements `From<DowncastError<'_, '_>>`
`PyErr` implements `From<DowncastIntoError<'_>>`
`PyErr` implements `From<FromUtf16Error>`
`PyErr` implements `From<FromUtf8Error>`
`PyErr` implements `From<Infallible>`
`PyErr` implements `From<IntoInnerError<W>>`
and $N others
= note: required for `MyError` to implement `Into<PyErr>`

0 comments on commit 699de42

Please sign in to comment.