pyo3/tests/ui/invalid_pymethods.stderr

196 lines
6.1 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 `&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 `&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
2021-10-23 20:32:39 +00:00
|
66 | fn text_signature_on_call() {}
| ^^
2021-10-23 20:32:39 +00:00
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 = ())]
| ^^^^^^^^^
2023-02-07 21:15:32 +00:00
error: `signature` not allowed with `setter`
--> 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`
--> tests/ui/invalid_pymethods.rs:120:12
|
120 | #[pyo3(signature = ())]
| ^^^^^^^^^
2021-03-09 23:37:01 +00:00
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>) {}
| ^^^^
2021-03-09 23:37:01 +00:00
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)]
| ^^^^^^^^^^^
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>`.
--> 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<&PyType>` is not satisfied
--> tests/ui/invalid_pymethods.rs:46:45
|
46 | fn classmethod_wrong_first_argument(_x: i32) -> Self {
| ^^^ the trait `From<&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 `&PyType` to implement `Into<i32>`