pyo3/tests/ui/invalid_pymethods.stderr

168 lines
5.2 KiB
Plaintext
Raw Normal View History

error: #[classattr] can only have one argument (of type pyo3::Python)
--> tests/ui/invalid_pymethods.rs:9:34
|
9 | fn class_attr_with_args(foo: i32) {}
| ^^^
error: `#[classattr]` does not take any arguments
--> tests/ui/invalid_pymethods.rs:14:5
|
14 | #[classattr(foobar)]
| ^
error: static method needs #[staticmethod] attribute
--> tests/ui/invalid_pymethods.rs:20:5
|
20 | fn staticmethod_without_attribute() {}
| ^^
2021-03-09 23:37:01 +00:00
error: unexpected receiver
--> tests/ui/invalid_pymethods.rs:26:35
|
26 | fn staticmethod_with_receiver(&self) {}
| ^
error: expected receiver for #[getter]
--> tests/ui/invalid_pymethods.rs:39:5
|
39 | fn getter_without_receiver() {}
| ^^
error: expected receiver for #[setter]
--> tests/ui/invalid_pymethods.rs:45:5
|
45 | fn setter_without_receiver() {}
| ^^
error: static method needs #[staticmethod] attribute
2023-02-07 21:15:32 +00:00
--> tests/ui/invalid_pymethods.rs:51:5
2021-10-23 20:32:39 +00:00
|
2023-02-07 21:15:32 +00:00
51 | fn text_signature_on_call() {}
| ^^
2021-10-23 20:32:39 +00:00
error: `text_signature` not allowed with `getter`
2023-02-07 21:15:32 +00:00
--> tests/ui/invalid_pymethods.rs:57:12
|
2023-02-07 21:15:32 +00:00
57 | #[pyo3(text_signature = "()")]
| ^^^^^^^^^^^^^^
error: `text_signature` not allowed with `setter`
2023-02-07 21:15:32 +00:00
--> tests/ui/invalid_pymethods.rs:64:12
|
2023-02-07 21:15:32 +00:00
64 | #[pyo3(text_signature = "()")]
| ^^^^^^^^^^^^^^
error: `text_signature` not allowed with `classattr`
2023-02-07 21:15:32 +00:00
--> tests/ui/invalid_pymethods.rs:71:12
|
2023-02-07 21:15:32 +00:00
71 | #[pyo3(text_signature = "()")]
| ^^^^^^^^^^^^^^
error: expected a string literal or `None`
2023-02-07 21:15:32 +00:00
--> tests/ui/invalid_pymethods.rs:77:30
|
2023-02-07 21:15:32 +00:00
77 | #[pyo3(text_signature = 1)]
| ^
error: `text_signature` may only be specified once
2023-02-07 21:15:32 +00:00
--> tests/ui/invalid_pymethods.rs:84:12
|
2023-02-07 21:15:32 +00:00
84 | #[pyo3(text_signature = None)]
| ^^^^^^^^^^^^^^
error: `signature` not allowed with `getter`
2023-02-07 21:15:32 +00:00
--> tests/ui/invalid_pymethods.rs:91:12
|
91 | #[pyo3(signature = ())]
| ^^^^^^^^^
error: `signature` not allowed with `setter`
--> tests/ui/invalid_pymethods.rs:98:12
|
98 | #[pyo3(signature = ())]
| ^^^^^^^^^
2021-03-09 23:37:01 +00:00
2023-02-07 21:15:32 +00:00
error: `signature` not allowed with `classattr`
--> tests/ui/invalid_pymethods.rs:105:12
|
105 | #[pyo3(signature = ())]
| ^^^^^^^^^
2021-03-09 23:37:01 +00:00
error: cannot combine these method types
2023-02-07 21:15:32 +00:00
--> tests/ui/invalid_pymethods.rs:112:7
|
2023-02-07 21:15:32 +00:00
112 | #[staticmethod]
| ^^^^^^^^^^^^
error: Python functions cannot have generic type parameters
2023-02-07 21:15:32 +00:00
--> tests/ui/invalid_pymethods.rs:118:23
|
2023-02-07 21:15:32 +00:00
118 | fn generic_method<T>(value: T) {}
| ^
error: Python functions cannot have `impl Trait` arguments
2023-02-07 21:15:32 +00:00
--> tests/ui/invalid_pymethods.rs:123:48
|
2023-02-07 21:15:32 +00:00
123 | 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
2023-02-07 21:15:32 +00:00
--> tests/ui/invalid_pymethods.rs:128:56
|
2023-02-07 21:15:32 +00:00
128 | fn impl_trait_method_second_arg(&self, impl_trait: impl AsRef<PyAny>) {}
| ^^^^
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
2023-02-07 21:15:32 +00:00
--> tests/ui/invalid_pymethods.rs:133:5
|
2023-02-07 21:15:32 +00:00
133 | async fn async_method(&self) {}
| ^^^^^
error: `pass_module` cannot be used on Python methods
2023-02-07 21:15:32 +00:00
--> tests/ui/invalid_pymethods.rs:138:12
|
2023-02-07 21:15:32 +00:00
138 | #[pyo3(pass_module)]
| ^^^^^^^^^^^
2022-02-08 23:44:23 +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>`.
2023-02-07 21:15:32 +00:00
--> tests/ui/invalid_pymethods.rs:144:29
|
2023-02-07 21:15:32 +00:00
144 | fn method_self_by_value(self) {}
| ^^^^
2023-02-07 21:15:32 +00:00
error[E0119]: conflicting implementations of trait `pyo3::impl_::pyclass::PyClassNewTextSignature<TwoNew>` for type `pyo3::impl_::pyclass::PyClassImplCollector<TwoNew>`
--> tests/ui/invalid_pymethods.rs:149:1
|
149 | #[pymethods]
| ^^^^^^^^^^^^
| |
| first implementation here
| conflicting implementation for `pyo3::impl_::pyclass::PyClassImplCollector<TwoNew>`
|
= note: this error originates in the attribute macro `pymethods` (in Nightly builds, run with -Z macro-backtrace for more info)
2022-12-16 20:56:15 +00:00
error[E0592]: duplicate definitions with name `__pymethod___new____`
2023-02-07 21:15:32 +00:00
--> tests/ui/invalid_pymethods.rs:149:1
2022-02-08 23:44:23 +00:00
|
2023-02-07 21:15:32 +00:00
149 | #[pymethods]
2022-02-08 23:44:23 +00:00
| ^^^^^^^^^^^^
| |
2022-12-16 20:56:15 +00:00
| duplicate definitions for `__pymethod___new____`
| other definition for `__pymethod___new____`
|
= note: this error originates in the attribute macro `pymethods` (in Nightly builds, run with -Z macro-backtrace for more info)
2022-12-16 20:56:15 +00:00
error[E0592]: duplicate definitions with name `__pymethod_func__`
2023-02-07 21:15:32 +00:00
--> tests/ui/invalid_pymethods.rs:164:1
|
2023-02-07 21:15:32 +00:00
164 | #[pymethods]
| ^^^^^^^^^^^^
| |
2022-12-16 20:56:15 +00:00
| duplicate definitions for `__pymethod_func__`
| other definition for `__pymethod_func__`
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)