2022-06-16 10:08:53 +00:00
error: #[classattr] can only have one argument (of type pyo3::Python)
--> tests/ui/invalid_pymethods.rs:9:34
2021-01-09 17:33:28 +00:00
|
9 | fn class_attr_with_args(foo: i32) {}
2022-06-16 10:08:53 +00:00
| ^^^
2021-01-09 17:33:28 +00:00
2021-04-17 21:22:06 +00:00
error: `#[classattr]` does not take any arguments
2021-10-12 00:52:24 +00:00
--> tests/ui/invalid_pymethods.rs:14:5
2021-01-09 17:33:28 +00:00
|
2021-04-17 21:22:06 +00:00
14 | #[classattr(foobar)]
| ^
error: static method needs #[staticmethod] attribute
2021-10-12 00:52:24 +00:00
--> tests/ui/invalid_pymethods.rs:20:5
2021-04-17 21:22:06 +00:00
|
20 | fn staticmethod_without_attribute() {}
2021-01-09 17:33:28 +00:00
| ^^
2021-03-09 23:37:01 +00:00
error: unexpected receiver
2021-10-12 00:52:24 +00:00
--> tests/ui/invalid_pymethods.rs:26:35
2021-01-09 17:33:28 +00:00
|
2021-04-17 21:22:06 +00:00
26 | fn staticmethod_with_receiver(&self) {}
2021-01-09 17:33:28 +00:00
| ^
error: expected receiver for #[getter]
2021-10-12 00:52:24 +00:00
--> tests/ui/invalid_pymethods.rs:39:5
2021-01-09 17:33:28 +00:00
|
2021-04-17 21:22:06 +00:00
39 | fn getter_without_receiver() {}
2021-01-09 17:33:28 +00:00
| ^^
error: expected receiver for #[setter]
2021-10-12 00:52:24 +00:00
--> tests/ui/invalid_pymethods.rs:45:5
2021-01-09 17:33:28 +00:00
|
2021-04-17 21:22:06 +00:00
45 | fn setter_without_receiver() {}
2021-01-09 17:33:28 +00:00
| ^^
error: text_signature not allowed on __new__; if you want to add a signature on __new__, put it on the struct definition instead
2021-10-12 00:52:24 +00:00
--> tests/ui/invalid_pymethods.rs:51:12
2021-01-09 17:33:28 +00:00
|
2021-06-05 15:28:31 +00:00
51 | #[pyo3(text_signature = "()")]
| ^^^^^^^^^^^^^^
2021-01-09 17:33:28 +00:00
2021-10-23 20:32:39 +00:00
error: `text_signature` cannot be used with `__call__`
--> tests/ui/invalid_pymethods.rs:57:12
|
57 | #[pyo3(text_signature = "()")]
| ^^^^^^^^^^^^^^
2021-01-09 17:33:28 +00:00
error: text_signature not allowed with this method type
2021-10-23 20:32:39 +00:00
--> tests/ui/invalid_pymethods.rs:64:12
2021-01-09 17:33:28 +00:00
|
2021-10-23 20:32:39 +00:00
64 | #[pyo3(text_signature = "()")]
2021-06-05 15:28:31 +00:00
| ^^^^^^^^^^^^^^
2021-01-09 17:33:28 +00:00
error: text_signature not allowed with this method type
2021-10-23 20:32:39 +00:00
--> tests/ui/invalid_pymethods.rs:71:12
2021-01-09 17:33:28 +00:00
|
2021-10-23 20:32:39 +00:00
71 | #[pyo3(text_signature = "()")]
2021-06-05 15:28:31 +00:00
| ^^^^^^^^^^^^^^
2021-01-09 17:33:28 +00:00
error: text_signature not allowed with this method type
2021-10-23 20:32:39 +00:00
--> tests/ui/invalid_pymethods.rs:78:12
2021-01-09 17:33:28 +00:00
|
2021-10-23 20:32:39 +00:00
78 | #[pyo3(text_signature = "()")]
2021-06-05 15:28:31 +00:00
| ^^^^^^^^^^^^^^
2021-01-09 17:33:28 +00:00
error: cannot specify a second method type
2021-10-23 20:32:39 +00:00
--> tests/ui/invalid_pymethods.rs:85:7
2021-01-09 17:33:28 +00:00
|
2021-10-23 20:32:39 +00:00
85 | #[staticmethod]
2021-01-09 17:33:28 +00:00
| ^^^^^^^^^^^^
2021-03-09 23:37:01 +00:00
error: Python functions cannot have generic type parameters
2021-10-23 20:32:39 +00:00
--> tests/ui/invalid_pymethods.rs:91:23
2021-03-09 23:37:01 +00:00
|
2021-10-23 20:32:39 +00:00
91 | fn generic_method<T>(value: T) {}
2021-03-09 23:37:01 +00:00
| ^
error: Python functions cannot have `impl Trait` arguments
2021-10-23 20:32:39 +00:00
--> tests/ui/invalid_pymethods.rs:97:48
2021-03-09 23:37:01 +00:00
|
2021-10-23 20:32:39 +00:00
97 | fn impl_trait_method_first_arg(impl_trait: impl AsRef<PyAny>) {}
2021-03-09 23:37:01 +00:00
| ^^^^
error: Python functions cannot have `impl Trait` arguments
2021-10-23 20:32:39 +00:00
--> tests/ui/invalid_pymethods.rs:102:56
2021-04-17 21:22:06 +00:00
|
2021-10-23 20:32:39 +00:00
102 | fn impl_trait_method_second_arg(&self, impl_trait: impl AsRef<PyAny>) {}
2021-04-17 21:22:06 +00:00
| ^^^^
2021-05-25 10:31:48 +00:00
error: `async fn` is not yet supported for Python functions.
2022-01-13 21:25:23 +00:00
Additional crates such as `pyo3-asyncio` can be used to integrate async Rust and Python. For more information, see https://github.com/PyO3/pyo3/issues/1632
2021-10-23 20:32:39 +00:00
--> tests/ui/invalid_pymethods.rs:107:5
2021-05-25 10:31:48 +00:00
|
2021-10-23 20:32:39 +00:00
107 | async fn async_method(&self) {}
2021-05-25 10:31:48 +00:00
| ^^^^^
2021-06-05 15:39:54 +00:00
error: `pass_module` cannot be used on Python methods
2021-10-23 20:32:39 +00:00
--> tests/ui/invalid_pymethods.rs:112:12
2021-06-05 15:39:54 +00:00
|
2021-10-23 20:32:39 +00:00
112 | #[pyo3(pass_module)]
2021-06-05 15:39:54 +00:00
| ^^^^^^^^^^^
2022-02-08 23:44:23 +00:00
2022-03-24 09:27:37 +00:00
error: Python objects are shared, so 'self' cannot be moved out of the Python interpreter.
Try `&self`, `&mut self, `slf: PyRef<'_, Self>` or `slf: PyRefMut<'_, Self>`.
2022-10-25 06:23:21 +00:00
--> tests/ui/invalid_pymethods.rs:118:29
2022-03-24 09:27:37 +00:00
|
2022-10-25 06:23:21 +00:00
118 | fn method_self_by_value(self){}
2022-03-24 09:27:37 +00:00
| ^^^^
2022-06-16 21:06:17 +00:00
error[E0201]: duplicate definitions with name `__pymethod___new____`:
2022-10-25 06:23:21 +00:00
--> tests/ui/invalid_pymethods.rs:123:1
2022-02-08 23:44:23 +00:00
|
2022-10-25 06:23:21 +00:00
123 | #[pymethods]
2022-02-08 23:44:23 +00:00
| ^^^^^^^^^^^^
| |
2022-06-16 21:06:17 +00:00
| previous definition of `__pymethod___new____` here
| duplicate definition
2022-05-24 18:36:24 +00:00
|
= note: this error originates in the attribute macro `pymethods` (in Nightly builds, run with -Z macro-backtrace for more info)
2022-06-16 21:06:17 +00:00
error[E0201]: duplicate definitions with name `__pymethod_func__`:
2022-10-25 06:23:21 +00:00
--> tests/ui/invalid_pymethods.rs:134:1
2022-05-24 18:36:24 +00:00
|
2022-10-25 06:23:21 +00:00
134 | #[pymethods]
2022-05-24 18:36:24 +00:00
| ^^^^^^^^^^^^
| |
2022-06-16 21:06:17 +00:00
| previous definition of `__pymethod_func__` here
| duplicate definition
2022-02-08 23:44:23 +00:00
|
= note: this error originates in the attribute macro `pymethods` (in Nightly builds, run with -Z macro-backtrace for more info)