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
| ^
2023-10-10 05:30:19 +00:00
error: Expected `cls: &PyType` as the first argument to `#[classmethod]`
--> tests/ui/invalid_pymethods.rs:32:34
|
32 | fn classmethod_with_receiver(&self) {}
| ^
2023-09-30 21:51:52 +00:00
error: expected receiver for `#[getter]`
2023-10-10 05:30:19 +00:00
--> tests/ui/invalid_pymethods.rs:38:5
2021-01-09 17:33:28 +00:00
|
2023-10-10 05:30:19 +00:00
38 | fn getter_without_receiver() {}
2021-01-09 17:33:28 +00:00
| ^^
2023-09-30 21:51:52 +00:00
error: expected receiver for `#[setter]`
2023-10-10 05:30:19 +00:00
--> tests/ui/invalid_pymethods.rs:44:5
2021-01-09 17:33:28 +00:00
|
2023-10-10 05:30:19 +00:00
44 | fn setter_without_receiver() {}
2021-01-09 17:33:28 +00:00
| ^^
2022-11-15 20:10:19 +00:00
error: static method needs #[staticmethod] attribute
2023-10-10 05:30:19 +00:00
--> tests/ui/invalid_pymethods.rs:50:5
2021-10-23 20:32:39 +00:00
|
2023-10-10 05:30:19 +00:00
50 | fn text_signature_on_call() {}
2022-11-15 20:10:19 +00:00
| ^^
2021-10-23 20:32:39 +00:00
2022-11-15 20:10:19 +00:00
error: `text_signature` not allowed with `getter`
2023-10-10 05:30:19 +00:00
--> tests/ui/invalid_pymethods.rs:56:12
2021-01-09 17:33:28 +00:00
|
2023-10-10 05:30:19 +00:00
56 | #[pyo3(text_signature = "()")]
2021-06-05 15:28:31 +00:00
| ^^^^^^^^^^^^^^
2021-01-09 17:33:28 +00:00
2022-11-15 20:10:19 +00:00
error: `text_signature` not allowed with `setter`
2023-10-10 05:30:19 +00:00
--> tests/ui/invalid_pymethods.rs:63:12
2021-01-09 17:33:28 +00:00
|
2023-10-10 05:30:19 +00:00
63 | #[pyo3(text_signature = "()")]
2021-06-05 15:28:31 +00:00
| ^^^^^^^^^^^^^^
2021-01-09 17:33:28 +00:00
2022-11-15 20:10:19 +00:00
error: `text_signature` not allowed with `classattr`
2023-10-10 05:30:19 +00:00
--> tests/ui/invalid_pymethods.rs:70:12
2021-01-09 17:33:28 +00:00
|
2023-10-10 05:30:19 +00:00
70 | #[pyo3(text_signature = "()")]
2021-06-05 15:28:31 +00:00
| ^^^^^^^^^^^^^^
2021-01-09 17:33:28 +00:00
2022-11-24 22:05:16 +00:00
error: expected a string literal or `None`
2023-10-10 05:30:19 +00:00
--> tests/ui/invalid_pymethods.rs:76:30
2022-11-24 22:05:16 +00:00
|
2023-10-10 05:30:19 +00:00
76 | #[pyo3(text_signature = 1)]
2022-11-24 22:05:16 +00:00
| ^
error: `text_signature` may only be specified once
2023-10-10 05:30:19 +00:00
--> tests/ui/invalid_pymethods.rs:83:12
2022-11-24 22:05:16 +00:00
|
2023-10-10 05:30:19 +00:00
83 | #[pyo3(text_signature = None)]
2022-11-24 22:05:16 +00:00
| ^^^^^^^^^^^^^^
2022-11-15 20:10:19 +00:00
error: `signature` not allowed with `getter`
2023-10-10 05:30:19 +00:00
--> tests/ui/invalid_pymethods.rs:90:12
2023-02-07 21:15:32 +00:00
|
2023-10-10 05:30:19 +00:00
90 | #[pyo3(signature = ())]
2023-02-07 21:15:32 +00:00
| ^^^^^^^^^
error: `signature` not allowed with `setter`
2023-10-10 05:30:19 +00:00
--> tests/ui/invalid_pymethods.rs:97:12
2021-01-09 17:33:28 +00:00
|
2023-10-10 05:30:19 +00:00
97 | #[pyo3(signature = ())]
2022-11-15 20:10:19 +00:00
| ^^^^^^^^^
2021-03-09 23:37:01 +00:00
2023-02-07 21:15:32 +00:00
error: `signature` not allowed with `classattr`
2023-10-10 05:30:19 +00:00
--> tests/ui/invalid_pymethods.rs:104:12
2022-11-24 22:05:16 +00:00
|
2023-10-10 05:30:19 +00:00
104 | #[pyo3(signature = ())]
2022-11-24 22:05:16 +00:00
| ^^^^^^^^^
2021-03-09 23:37:01 +00:00
2023-09-30 21:51:52 +00:00
error: `#[new]` may not be combined with `#[classmethod]` `#[staticmethod]`, `#[classattr]`, `#[getter]`, and `#[setter]`
2023-10-10 05:30:19 +00:00
--> tests/ui/invalid_pymethods.rs:110:7
2022-11-15 20:10:19 +00:00
|
2023-10-10 05:30:19 +00:00
110 | #[new]
2023-09-30 21:51:52 +00:00
| ^^^
error: `#[new]` does not take any arguments
= help: did you mean `#[new] #[pyo3(signature = ())]`?
2023-10-10 05:30:19 +00:00
--> tests/ui/invalid_pymethods.rs:121:7
2023-09-30 21:51:52 +00:00
|
2023-10-10 05:30:19 +00:00
121 | #[new(signature = ())]
2023-09-30 21:51:52 +00:00
| ^^^
error: `#[new]` does not take any arguments
= note: this was previously accepted and ignored
2023-10-10 05:30:19 +00:00
--> tests/ui/invalid_pymethods.rs:127:11
2023-09-30 21:51:52 +00:00
|
2023-10-10 05:30:19 +00:00
127 | #[new = ()] // in this form there's no suggestion to move arguments to `#[pyo3()]` attribute
2023-09-30 21:51:52 +00:00
| ^
error: `#[classmethod]` does not take any arguments
= help: did you mean `#[classmethod] #[pyo3(signature = ())]`?
2023-10-10 05:30:19 +00:00
--> tests/ui/invalid_pymethods.rs:133:7
2023-09-30 21:51:52 +00:00
|
2023-10-10 05:30:19 +00:00
133 | #[classmethod(signature = ())]
2023-09-30 21:51:52 +00:00
| ^^^^^^^^^^^
error: `#[staticmethod]` does not take any arguments
= help: did you mean `#[staticmethod] #[pyo3(signature = ())]`?
2023-10-10 05:30:19 +00:00
--> tests/ui/invalid_pymethods.rs:139:7
2023-09-30 21:51:52 +00:00
|
2023-10-10 05:30:19 +00:00
139 | #[staticmethod(signature = ())]
2022-11-15 20:10:19 +00:00
| ^^^^^^^^^^^^
2023-09-30 21:51:52 +00:00
error: `#[classattr]` does not take any arguments
= help: did you mean `#[classattr] #[pyo3(signature = ())]`?
2023-10-10 05:30:19 +00:00
--> tests/ui/invalid_pymethods.rs:145:7
2023-09-30 21:51:52 +00:00
|
2023-10-10 05:30:19 +00:00
145 | #[classattr(signature = ())]
2023-09-30 21:51:52 +00:00
| ^^^^^^^^^
2022-11-15 20:10:19 +00:00
error: Python functions cannot have generic type parameters
2023-10-10 05:30:19 +00:00
--> tests/ui/invalid_pymethods.rs:151:23
2022-11-15 20:10:19 +00:00
|
2023-10-10 05:30:19 +00:00
151 | fn generic_method<T>(value: T) {}
2022-11-15 20:10:19 +00:00
| ^
error: Python functions cannot have `impl Trait` arguments
2023-10-10 05:30:19 +00:00
--> tests/ui/invalid_pymethods.rs:156:48
2022-11-15 20:10:19 +00:00
|
2023-10-10 05:30:19 +00:00
156 | fn impl_trait_method_first_arg(impl_trait: impl AsRef<PyAny>) {}
2022-11-15 20:10:19 +00:00
| ^^^^
2021-03-09 23:37:01 +00:00
error: Python functions cannot have `impl Trait` arguments
2023-10-10 05:30:19 +00:00
--> tests/ui/invalid_pymethods.rs:161:56
2021-04-17 21:22:06 +00:00
|
2023-10-10 05:30:19 +00:00
161 | 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
2021-06-05 15:39:54 +00:00
error: `pass_module` cannot be used on Python methods
2023-10-23 12:43:12 +00:00
--> tests/ui/invalid_pymethods.rs:166:12
2021-06-05 15:39:54 +00:00
|
2023-10-23 12:43:12 +00:00
166 | #[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>`.
2023-10-23 12:43:12 +00:00
--> tests/ui/invalid_pymethods.rs:172:29
2022-03-24 09:27:37 +00:00
|
2023-10-23 12:43:12 +00:00
172 | fn method_self_by_value(self) {}
2022-03-24 09:27:37 +00:00
| ^^^^
2023-10-02 20:49:19 +00:00
error: macros cannot be used as items in `#[pymethods]` impl blocks
= note: this was previously accepted and ignored
2023-10-23 12:43:12 +00:00
--> tests/ui/invalid_pymethods.rs:207:5
2023-10-02 20:49:19 +00:00
|
2023-10-23 12:43:12 +00:00
207 | macro_invocation!();
2023-10-02 20:49:19 +00:00
| ^^^^^^^^^^^^^^^^
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>`
2023-10-23 12:43:12 +00:00
--> tests/ui/invalid_pymethods.rs:177:1
2023-02-07 21:15:32 +00:00
|
2023-10-23 12:43:12 +00:00
177 | #[pymethods]
2023-02-07 21:15:32 +00:00
| ^^^^^^^^^^^^
| |
| 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-10-23 12:43:12 +00:00
--> tests/ui/invalid_pymethods.rs:177:1
2022-02-08 23:44:23 +00:00
|
2023-10-23 12:43:12 +00:00
177 | #[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____`
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-12-16 20:56:15 +00:00
error[E0592]: duplicate definitions with name `__pymethod_func__`
2023-10-23 12:43:12 +00:00
--> tests/ui/invalid_pymethods.rs:192:1
2022-05-24 18:36:24 +00:00
|
2023-10-23 12:43:12 +00:00
192 | #[pymethods]
2022-05-24 18:36:24 +00:00
| ^^^^^^^^^^^^
| |
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)