cc7e16f4d6
* refactor `FnArg` * add UI tests * use enum variant types * add comment * remove dead code * remove last FIXME * review feedback davidhewitt
82 lines
3.7 KiB
Plaintext
82 lines
3.7 KiB
Plaintext
error: `cancel_handle` may only be specified once per argument
|
|
--> tests/ui/invalid_cancel_handle.rs:4:55
|
|
|
|
|
4 | async fn cancel_handle_repeated(#[pyo3(cancel_handle, cancel_handle)] _param: String) {}
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error: `cancel_handle` may only be specified once
|
|
--> tests/ui/invalid_cancel_handle.rs:9:28
|
|
|
|
|
9 | #[pyo3(cancel_handle)] _param2: String,
|
|
| ^^^^^^^
|
|
|
|
error: `cancel_handle` attribute can only be used with `async fn`
|
|
--> tests/ui/invalid_cancel_handle.rs:14:53
|
|
|
|
|
14 | fn cancel_handle_synchronous(#[pyo3(cancel_handle)] _param: String) {}
|
|
| ^^^^^^
|
|
|
|
error: `from_py_with` and `cancel_handle` cannot be specified together
|
|
--> tests/ui/invalid_cancel_handle.rs:24:12
|
|
|
|
|
24 | #[pyo3(cancel_handle, from_py_with = "cancel_handle")] _param: pyo3::coroutine::CancelHandle,
|
|
| ^^^^^^^^^^^^^
|
|
|
|
error[E0308]: mismatched types
|
|
--> tests/ui/invalid_cancel_handle.rs:16:1
|
|
|
|
|
16 | #[pyfunction]
|
|
| ^^^^^^^^^^^^^
|
|
| |
|
|
| expected `String`, found `CancelHandle`
|
|
| arguments to this function are incorrect
|
|
|
|
|
note: function defined here
|
|
--> tests/ui/invalid_cancel_handle.rs:17:10
|
|
|
|
|
17 | async fn cancel_handle_wrong_type(#[pyo3(cancel_handle)] _param: String) {}
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ --------------
|
|
= note: this error originates in the attribute macro `pyfunction` (in Nightly builds, run with -Z macro-backtrace for more info)
|
|
|
|
error[E0277]: the trait bound `CancelHandle: PyClass` is not satisfied
|
|
--> tests/ui/invalid_cancel_handle.rs:20:50
|
|
|
|
|
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 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<'_, '_>`
|
|
note: required by a bound in `extract_argument`
|
|
--> src/impl_/extract_argument.rs
|
|
|
|
|
| pub fn extract_argument<'a, 'py, T>(
|
|
| ---------------- required by a bound in this function
|
|
...
|
|
| T: PyFunctionArgument<'a, 'py>,
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `extract_argument`
|
|
|
|
error[E0277]: the trait bound `CancelHandle: Clone` is not satisfied
|
|
--> tests/ui/invalid_cancel_handle.rs:20:50
|
|
|
|
|
20 | async fn missing_cancel_handle_attribute(_param: pyo3::coroutine::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>`:
|
|
Option<&'a pyo3::Bound<'py, T>>
|
|
&'a pyo3::Bound<'py, T>
|
|
&'a pyo3::coroutine::Coroutine
|
|
&'a mut pyo3::coroutine::Coroutine
|
|
= note: required for `CancelHandle` to implement `FromPyObject<'_>`
|
|
= note: required for `CancelHandle` to implement `FromPyObjectBound<'_, '_>`
|
|
= note: required for `CancelHandle` to implement `PyFunctionArgument<'_, '_>`
|
|
note: required by a bound in `extract_argument`
|
|
--> src/impl_/extract_argument.rs
|
|
|
|
|
| pub fn extract_argument<'a, 'py, T>(
|
|
| ---------------- required by a bound in this function
|
|
...
|
|
| T: PyFunctionArgument<'a, 'py>,
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `extract_argument`
|