196 lines
6.2 KiB
Plaintext
196 lines
6.2 KiB
Plaintext
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() {}
|
|
| ^^
|
|
|
|
error: unexpected receiver
|
|
--> tests/ui/invalid_pymethods.rs:26:35
|
|
|
|
|
26 | fn staticmethod_with_receiver(&self) {}
|
|
| ^
|
|
|
|
error: Expected `&Bound<PyType>` or `Py<PyType>` as the first argument to `#[classmethod]`
|
|
--> tests/ui/invalid_pymethods.rs:32:33
|
|
|
|
|
32 | fn classmethod_with_receiver(&self) {}
|
|
| ^^^^^^^
|
|
|
|
error: Expected `&Bound<PyType>` or `Py<PyType>` as the first argument to `#[classmethod]`
|
|
--> tests/ui/invalid_pymethods.rs:38:36
|
|
|
|
|
38 | fn classmethod_missing_argument() -> Self {
|
|
| ^^
|
|
|
|
error: expected receiver for `#[getter]`
|
|
--> tests/ui/invalid_pymethods.rs:54:5
|
|
|
|
|
54 | fn getter_without_receiver() {}
|
|
| ^^
|
|
|
|
error: expected receiver for `#[setter]`
|
|
--> tests/ui/invalid_pymethods.rs:60:5
|
|
|
|
|
60 | fn setter_without_receiver() {}
|
|
| ^^
|
|
|
|
error: static method needs #[staticmethod] attribute
|
|
--> tests/ui/invalid_pymethods.rs:66:5
|
|
|
|
|
66 | fn text_signature_on_call() {}
|
|
| ^^
|
|
|
|
error: `text_signature` not allowed with `getter`
|
|
--> tests/ui/invalid_pymethods.rs:72:12
|
|
|
|
|
72 | #[pyo3(text_signature = "()")]
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
error: `text_signature` not allowed with `setter`
|
|
--> tests/ui/invalid_pymethods.rs:79:12
|
|
|
|
|
79 | #[pyo3(text_signature = "()")]
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
error: `text_signature` not allowed with `classattr`
|
|
--> tests/ui/invalid_pymethods.rs:86:12
|
|
|
|
|
86 | #[pyo3(text_signature = "()")]
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
error: expected a string literal or `None`
|
|
--> tests/ui/invalid_pymethods.rs:92:30
|
|
|
|
|
92 | #[pyo3(text_signature = 1)]
|
|
| ^
|
|
|
|
error: `text_signature` may only be specified once
|
|
--> tests/ui/invalid_pymethods.rs:99:12
|
|
|
|
|
99 | #[pyo3(text_signature = None)]
|
|
| ^^^^^^^^^^^^^^
|
|
|
|
error: `signature` not allowed with `getter`
|
|
--> tests/ui/invalid_pymethods.rs:106:12
|
|
|
|
|
106 | #[pyo3(signature = ())]
|
|
| ^^^^^^^^^
|
|
|
|
error: `signature` not allowed with `setter`
|
|
--> tests/ui/invalid_pymethods.rs:113:12
|
|
|
|
|
113 | #[pyo3(signature = ())]
|
|
| ^^^^^^^^^
|
|
|
|
error: `signature` not allowed with `classattr`
|
|
--> tests/ui/invalid_pymethods.rs:120:12
|
|
|
|
|
120 | #[pyo3(signature = ())]
|
|
| ^^^^^^^^^
|
|
|
|
error: `#[new]` may not be combined with `#[classmethod]` `#[staticmethod]`, `#[classattr]`, `#[getter]`, and `#[setter]`
|
|
--> tests/ui/invalid_pymethods.rs:126:7
|
|
|
|
|
126 | #[new]
|
|
| ^^^
|
|
|
|
error: `#[new]` does not take any arguments
|
|
= help: did you mean `#[new] #[pyo3(signature = ())]`?
|
|
--> tests/ui/invalid_pymethods.rs:137:7
|
|
|
|
|
137 | #[new(signature = ())]
|
|
| ^^^
|
|
|
|
error: `#[new]` does not take any arguments
|
|
= note: this was previously accepted and ignored
|
|
--> tests/ui/invalid_pymethods.rs:143:11
|
|
|
|
|
143 | #[new = ()] // in this form there's no suggestion to move arguments to `#[pyo3()]` attribute
|
|
| ^
|
|
|
|
error: `#[classmethod]` does not take any arguments
|
|
= help: did you mean `#[classmethod] #[pyo3(signature = ())]`?
|
|
--> tests/ui/invalid_pymethods.rs:149:7
|
|
|
|
|
149 | #[classmethod(signature = ())]
|
|
| ^^^^^^^^^^^
|
|
|
|
error: `#[staticmethod]` does not take any arguments
|
|
= help: did you mean `#[staticmethod] #[pyo3(signature = ())]`?
|
|
--> tests/ui/invalid_pymethods.rs:155:7
|
|
|
|
|
155 | #[staticmethod(signature = ())]
|
|
| ^^^^^^^^^^^^
|
|
|
|
error: `#[classattr]` does not take any arguments
|
|
= help: did you mean `#[classattr] #[pyo3(signature = ())]`?
|
|
--> tests/ui/invalid_pymethods.rs:161:7
|
|
|
|
|
161 | #[classattr(signature = ())]
|
|
| ^^^^^^^^^
|
|
|
|
error: Python functions cannot have generic type parameters
|
|
--> tests/ui/invalid_pymethods.rs:167:23
|
|
|
|
|
167 | fn generic_method<T>(value: T) {}
|
|
| ^
|
|
|
|
error: Python functions cannot have `impl Trait` arguments
|
|
--> tests/ui/invalid_pymethods.rs:172:48
|
|
|
|
|
172 | fn impl_trait_method_first_arg(impl_trait: impl AsRef<PyAny>) {}
|
|
| ^^^^
|
|
|
|
error: Python functions cannot have `impl Trait` arguments
|
|
--> tests/ui/invalid_pymethods.rs:177:56
|
|
|
|
|
177 | fn impl_trait_method_second_arg(&self, impl_trait: impl AsRef<PyAny>) {}
|
|
| ^^^^
|
|
|
|
error: `pass_module` cannot be used on Python methods
|
|
--> tests/ui/invalid_pymethods.rs:182:12
|
|
|
|
|
182 | #[pyo3(pass_module)]
|
|
| ^^^^^^^^^^^
|
|
|
|
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>`.
|
|
--> tests/ui/invalid_pymethods.rs:188:29
|
|
|
|
|
188 | fn method_self_by_value(self) {}
|
|
| ^^^^
|
|
|
|
error: macros cannot be used as items in `#[pymethods]` impl blocks
|
|
= note: this was previously accepted and ignored
|
|
--> tests/ui/invalid_pymethods.rs:197:5
|
|
|
|
|
197 | macro_invocation!();
|
|
| ^^^^^^^^^^^^^^^^
|
|
|
|
error[E0277]: the trait bound `i32: From<BoundRef<'_, '_, PyType>>` is not satisfied
|
|
--> tests/ui/invalid_pymethods.rs:46:45
|
|
|
|
|
46 | fn classmethod_wrong_first_argument(_x: i32) -> Self {
|
|
| ^^^ the trait `From<BoundRef<'_, '_, PyType>>` is not implemented for `i32`
|
|
|
|
|
= 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>>
|
|
= note: required for `BoundRef<'_, '_, PyType>` to implement `Into<i32>`
|