2023-11-25 06:30:41 +00:00
|
|
|
error: expected `cancel_handle` or `from_py_with`
|
2021-10-12 00:52:24 +00:00
|
|
|
--> tests/ui/invalid_argument_attributes.rs:4:29
|
2021-02-20 15:15:20 +00:00
|
|
|
|
|
|
|
|
4 | fn invalid_attribute(#[pyo3(get)] param: String) {}
|
|
|
|
| ^^^
|
|
|
|
|
2021-04-17 21:22:06 +00:00
|
|
|
error: expected `=`
|
2021-12-03 23:29:02 +00:00
|
|
|
--> tests/ui/invalid_argument_attributes.rs:7:45
|
2021-02-20 15:15:20 +00:00
|
|
|
|
|
|
|
|
7 | fn from_py_with_no_value(#[pyo3(from_py_with)] param: String) {}
|
2021-12-03 23:29:02 +00:00
|
|
|
| ^
|
2021-02-20 15:15:20 +00:00
|
|
|
|
2023-11-25 06:30:41 +00:00
|
|
|
error: expected `cancel_handle` or `from_py_with`
|
2021-10-12 00:52:24 +00:00
|
|
|
--> tests/ui/invalid_argument_attributes.rs:10:31
|
2021-02-20 15:15:20 +00:00
|
|
|
|
|
|
|
|
10 | fn from_py_with_string(#[pyo3("from_py_with")] param: String) {}
|
|
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
|
2021-04-17 21:22:06 +00:00
|
|
|
error: expected string literal
|
2021-10-12 00:52:24 +00:00
|
|
|
--> tests/ui/invalid_argument_attributes.rs:13:58
|
2021-02-20 15:15:20 +00:00
|
|
|
|
|
|
|
|
13 | fn from_py_with_value_not_a_string(#[pyo3(from_py_with = func)] param: String) {}
|
|
|
|
| ^^^^
|
2023-11-25 06:30:41 +00:00
|
|
|
|
|
|
|
error: `from_py_with` may only be specified once per argument
|
|
|
|
--> tests/ui/invalid_argument_attributes.rs:16:56
|
|
|
|
|
|
|
|
|
16 | fn from_py_with_repeated(#[pyo3(from_py_with = "func", from_py_with = "func")] param: String) {}
|
|
|
|
| ^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: `from_py_with` and `cancel_handle` cannot be specified together
|
|
|
|
--> tests/ui/invalid_argument_attributes.rs:20:35
|
|
|
|
|
|
|
|
|
20 | #[pyo3(from_py_with = "func", cancel_handle)] _param: String,
|
|
|
|
| ^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: `cancel_handle` may only be specified once per argument
|
|
|
|
--> tests/ui/invalid_argument_attributes.rs:25:55
|
|
|
|
|
|
|
|
|
25 | async fn cancel_handle_repeated(#[pyo3(cancel_handle, cancel_handle)] _param: String) {}
|
|
|
|
| ^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: `cancel_handle` may only be specified once
|
|
|
|
--> tests/ui/invalid_argument_attributes.rs:30:28
|
|
|
|
|
|
|
|
|
30 | #[pyo3(cancel_handle)] _param2: String,
|
|
|
|
| ^^^^^^^
|
|
|
|
|
|
|
|
error: `cancel_handle` attribute can only be used with `async fn`
|
|
|
|
--> tests/ui/invalid_argument_attributes.rs:35:53
|
|
|
|
|
|
|
|
|
35 | fn cancel_handle_synchronous(#[pyo3(cancel_handle)] _param: String) {}
|
|
|
|
| ^^^^^^
|
|
|
|
|
|
|
|
error[E0308]: mismatched types
|
|
|
|
--> tests/ui/invalid_argument_attributes.rs:37:1
|
|
|
|
|
|
|
|
|
37 | #[pyfunction]
|
|
|
|
| ^^^^^^^^^^^^^
|
|
|
|
| |
|
|
|
|
| expected `String`, found `CancelHandle`
|
|
|
|
| arguments to this function are incorrect
|
|
|
|
|
|
|
|
|
note: function defined here
|
|
|
|
--> tests/ui/invalid_argument_attributes.rs:38:10
|
|
|
|
|
|
|
|
|
38 | 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_argument_attributes.rs:41:50
|
|
|
|
|
|
|
|
|
41 | async fn missing_cancel_handle_attribute(_param: pyo3::coroutine::CancelHandle) {}
|
|
|
|
| ^^^^ the trait `PyClass` is not implemented for `CancelHandle`
|
|
|
|
|
|
2023-12-29 13:02:44 +00:00
|
|
|
= help: the trait `PyClass` is implemented for `pyo3::coroutine::Coroutine`
|
2023-11-25 06:30:41 +00:00
|
|
|
= note: required for `CancelHandle` to implement `FromPyObject<'_>`
|
|
|
|
= 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_argument_attributes.rs:41:50
|
|
|
|
|
|
|
|
|
41 | async fn missing_cancel_handle_attribute(_param: pyo3::coroutine::CancelHandle) {}
|
|
|
|
| ^^^^ the trait `Clone` is not implemented for `CancelHandle`
|
|
|
|
|
|
|
|
|
= help: the following other types implement trait `PyFunctionArgument<'a, 'py>`:
|
2023-12-29 13:02:44 +00:00
|
|
|
&'a pyo3::coroutine::Coroutine
|
|
|
|
&'a mut pyo3::coroutine::Coroutine
|
2023-11-25 06:30:41 +00:00
|
|
|
= note: required for `CancelHandle` to implement `FromPyObject<'_>`
|
|
|
|
= 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`
|