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
|
|
|
| ^
|
|
|
|
|
2024-02-16 00:36:11 +00:00
|
|
|
error: Expected `&Bound<PyType>` or `Py<PyType>` as the first argument to `#[classmethod]`
|
2023-11-24 03:11:05 +00:00
|
|
|
--> tests/ui/invalid_pymethods.rs:32:33
|
2023-10-10 05:30:19 +00:00
|
|
|
|
|
|
|
|
32 | fn classmethod_with_receiver(&self) {}
|
2023-11-24 03:11:05 +00:00
|
|
|
| ^^^^^^^
|
|
|
|
|
2024-02-16 00:36:11 +00:00
|
|
|
error: Expected `&Bound<PyType>` or `Py<PyType>` as the first argument to `#[classmethod]`
|
2023-11-24 03:11:05 +00:00
|
|
|
--> tests/ui/invalid_pymethods.rs:38:36
|
|
|
|
|
|
|
|
|
38 | fn classmethod_missing_argument() -> Self {
|
|
|
|
| ^^
|
2023-10-10 05:30:19 +00:00
|
|
|
|
2023-09-30 21:51:52 +00:00
|
|
|
error: expected receiver for `#[getter]`
|
2023-11-24 03:11:05 +00:00
|
|
|
--> tests/ui/invalid_pymethods.rs:54:5
|
2021-01-09 17:33:28 +00:00
|
|
|
|
|
2023-11-24 03:11:05 +00:00
|
|
|
54 | 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-11-24 03:11:05 +00:00
|
|
|
--> tests/ui/invalid_pymethods.rs:60:5
|
2021-01-09 17:33:28 +00:00
|
|
|
|
|
2023-11-24 03:11:05 +00:00
|
|
|
60 | 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-11-24 03:11:05 +00:00
|
|
|
--> tests/ui/invalid_pymethods.rs:66:5
|
2021-10-23 20:32:39 +00:00
|
|
|
|
|
2023-11-24 03:11:05 +00:00
|
|
|
66 | 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-11-24 03:11:05 +00:00
|
|
|
--> tests/ui/invalid_pymethods.rs:72:12
|
2021-01-09 17:33:28 +00:00
|
|
|
|
|
2023-11-24 03:11:05 +00:00
|
|
|
72 | #[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-11-24 03:11:05 +00:00
|
|
|
--> tests/ui/invalid_pymethods.rs:79:12
|
2021-01-09 17:33:28 +00:00
|
|
|
|
|
2023-11-24 03:11:05 +00:00
|
|
|
79 | #[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-11-24 03:11:05 +00:00
|
|
|
--> tests/ui/invalid_pymethods.rs:86:12
|
2021-01-09 17:33:28 +00:00
|
|
|
|
|
2023-11-24 03:11:05 +00:00
|
|
|
86 | #[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-11-24 03:11:05 +00:00
|
|
|
--> tests/ui/invalid_pymethods.rs:92:30
|
2022-11-24 22:05:16 +00:00
|
|
|
|
|
2023-11-24 03:11:05 +00:00
|
|
|
92 | #[pyo3(text_signature = 1)]
|
2022-11-24 22:05:16 +00:00
|
|
|
| ^
|
|
|
|
|
|
|
|
error: `text_signature` may only be specified once
|
2023-11-24 03:11:05 +00:00
|
|
|
--> tests/ui/invalid_pymethods.rs:99:12
|
2022-11-24 22:05:16 +00:00
|
|
|
|
|
2023-11-24 03:11:05 +00:00
|
|
|
99 | #[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-11-24 03:11:05 +00:00
|
|
|
--> tests/ui/invalid_pymethods.rs:106:12
|
|
|
|
|
|
|
|
|
106 | #[pyo3(signature = ())]
|
|
|
|
| ^^^^^^^^^
|
2023-02-07 21:15:32 +00:00
|
|
|
|
|
|
|
error: `signature` not allowed with `setter`
|
2023-11-24 03:11:05 +00:00
|
|
|
--> tests/ui/invalid_pymethods.rs:113:12
|
|
|
|
|
|
|
|
|
113 | #[pyo3(signature = ())]
|
|
|
|
| ^^^^^^^^^
|
2021-03-09 23:37:01 +00:00
|
|
|
|
2023-02-07 21:15:32 +00:00
|
|
|
error: `signature` not allowed with `classattr`
|
2023-11-24 03:11:05 +00:00
|
|
|
--> tests/ui/invalid_pymethods.rs:120:12
|
2022-11-24 22:05:16 +00:00
|
|
|
|
|
2023-11-24 03:11:05 +00:00
|
|
|
120 | #[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-11-24 03:11:05 +00:00
|
|
|
--> tests/ui/invalid_pymethods.rs:126:7
|
2022-11-15 20:10:19 +00:00
|
|
|
|
|
2023-11-24 03:11:05 +00:00
|
|
|
126 | #[new]
|
2023-09-30 21:51:52 +00:00
|
|
|
| ^^^
|
|
|
|
|
|
|
|
error: `#[new]` does not take any arguments
|
|
|
|
= help: did you mean `#[new] #[pyo3(signature = ())]`?
|
2023-11-24 03:11:05 +00:00
|
|
|
--> tests/ui/invalid_pymethods.rs:137:7
|
2023-09-30 21:51:52 +00:00
|
|
|
|
|
2023-11-24 03:11:05 +00:00
|
|
|
137 | #[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-11-24 03:11:05 +00:00
|
|
|
--> tests/ui/invalid_pymethods.rs:143:11
|
2023-09-30 21:51:52 +00:00
|
|
|
|
|
2023-11-24 03:11:05 +00:00
|
|
|
143 | #[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-11-24 03:11:05 +00:00
|
|
|
--> tests/ui/invalid_pymethods.rs:149:7
|
2023-09-30 21:51:52 +00:00
|
|
|
|
|
2023-11-24 03:11:05 +00:00
|
|
|
149 | #[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-11-24 03:11:05 +00:00
|
|
|
--> tests/ui/invalid_pymethods.rs:155:7
|
2023-09-30 21:51:52 +00:00
|
|
|
|
|
2023-11-24 03:11:05 +00:00
|
|
|
155 | #[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-11-24 03:11:05 +00:00
|
|
|
--> tests/ui/invalid_pymethods.rs:161:7
|
2023-09-30 21:51:52 +00:00
|
|
|
|
|
2023-11-24 03:11:05 +00:00
|
|
|
161 | #[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-11-24 03:11:05 +00:00
|
|
|
--> tests/ui/invalid_pymethods.rs:167:23
|
2022-11-15 20:10:19 +00:00
|
|
|
|
|
2023-11-24 03:11:05 +00:00
|
|
|
167 | fn generic_method<T>(value: T) {}
|
2022-11-15 20:10:19 +00:00
|
|
|
| ^
|
|
|
|
|
|
|
|
error: Python functions cannot have `impl Trait` arguments
|
2023-11-24 03:11:05 +00:00
|
|
|
--> tests/ui/invalid_pymethods.rs:172:48
|
2022-11-15 20:10:19 +00:00
|
|
|
|
|
2023-11-24 03:11:05 +00:00
|
|
|
172 | 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-11-24 03:11:05 +00:00
|
|
|
--> tests/ui/invalid_pymethods.rs:177:56
|
2021-04-17 21:22:06 +00:00
|
|
|
|
|
2023-11-24 03:11:05 +00:00
|
|
|
177 | 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-11-24 03:11:05 +00:00
|
|
|
--> tests/ui/invalid_pymethods.rs:182:12
|
2021-06-05 15:39:54 +00:00
|
|
|
|
|
2023-11-24 03:11:05 +00:00
|
|
|
182 | #[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-11-24 03:11:05 +00:00
|
|
|
--> tests/ui/invalid_pymethods.rs:188:29
|
2022-03-24 09:27:37 +00:00
|
|
|
|
|
2023-11-24 03:11:05 +00:00
|
|
|
188 | 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-11-24 03:11:05 +00:00
|
|
|
--> tests/ui/invalid_pymethods.rs:197:5
|
2023-10-02 20:49:19 +00:00
|
|
|
|
|
2023-11-24 03:11:05 +00:00
|
|
|
197 | macro_invocation!();
|
2023-10-02 20:49:19 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
|
2024-02-16 00:36:11 +00:00
|
|
|
error[E0277]: the trait bound `i32: From<BoundRef<'_, '_, PyType>>` is not satisfied
|
2023-11-24 03:11:05 +00:00
|
|
|
--> tests/ui/invalid_pymethods.rs:46:45
|
|
|
|
|
|
|
|
|
46 | fn classmethod_wrong_first_argument(_x: i32) -> Self {
|
2024-02-16 00:36:11 +00:00
|
|
|
| ^^^ the trait `From<BoundRef<'_, '_, PyType>>` is not implemented for `i32`
|
2023-11-24 03:11:05 +00:00
|
|
|
|
|
|
|
|
= help: the following other types implement trait `From<T>`:
|
|
|
|
<i32 as From<bool>>
|
|
|
|
<i32 as From<i8>>
|
|
|
|
<i32 as From<i16>>
|
|
|
|
<i32 as From<u8>>
|
|
|
|
<i32 as From<u16>>
|
|
|
|
<i32 as From<NonZeroI32>>
|
2024-02-16 00:36:11 +00:00
|
|
|
= note: required for `BoundRef<'_, '_, PyType>` to implement `Into<i32>`
|