2021-01-09 17:33:28 +00:00
|
|
|
error: getter function can only have one argument (of type pyo3::Python)
|
2024-05-03 07:42:30 +00:00
|
|
|
--> tests/ui/invalid_property_args.rs:9:56
|
2020-02-08 18:50:55 +00:00
|
|
|
|
|
2024-05-03 07:42:30 +00:00
|
|
|
9 | fn getter_with_arg(&self, _py: Python<'_>, _index: u32) {}
|
|
|
|
| ^^^
|
2020-02-08 18:50:55 +00:00
|
|
|
|
2021-01-09 17:33:28 +00:00
|
|
|
error: setter function expected to have one argument
|
2021-10-12 00:52:24 +00:00
|
|
|
--> tests/ui/invalid_property_args.rs:18:8
|
2020-02-08 18:50:55 +00:00
|
|
|
|
|
2024-05-03 07:42:30 +00:00
|
|
|
18 | fn setter_with_no_arg(&mut self, _py: Python<'_>) {}
|
2020-02-08 18:50:55 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2021-01-09 17:33:28 +00:00
|
|
|
error: setter function can have at most two arguments ([pyo3::Python,] and value)
|
2024-05-03 07:42:30 +00:00
|
|
|
--> tests/ui/invalid_property_args.rs:24:79
|
2020-02-08 18:50:55 +00:00
|
|
|
|
|
2024-05-03 07:42:30 +00:00
|
|
|
24 | fn setter_with_too_many_args(&mut self, _py: Python<'_>, _foo: u32, _bar: u32) {}
|
|
|
|
| ^^^
|
2021-03-18 10:27:18 +00:00
|
|
|
|
2021-06-04 10:16:25 +00:00
|
|
|
error: `get` and `set` with tuple struct fields require `name`
|
2021-10-12 00:52:24 +00:00
|
|
|
--> tests/ui/invalid_property_args.rs:28:50
|
2021-03-18 10:27:18 +00:00
|
|
|
|
|
2021-06-04 10:16:25 +00:00
|
|
|
28 | struct TupleGetterSetterNoName(#[pyo3(get, set)] i32);
|
|
|
|
| ^^^
|
|
|
|
|
|
|
|
error: `get` may only be specified once
|
2021-10-12 00:52:24 +00:00
|
|
|
--> tests/ui/invalid_property_args.rs:31:32
|
2021-06-04 10:16:25 +00:00
|
|
|
|
|
|
|
|
31 | struct MultipleGet(#[pyo3(get, get)] i32);
|
|
|
|
| ^^^
|
|
|
|
|
|
|
|
error: `set` may only be specified once
|
2021-10-12 00:52:24 +00:00
|
|
|
--> tests/ui/invalid_property_args.rs:34:32
|
2021-06-04 10:16:25 +00:00
|
|
|
|
|
|
|
|
34 | struct MultipleSet(#[pyo3(set, set)] i32);
|
|
|
|
| ^^^
|
|
|
|
|
|
|
|
error: `name` may only be specified once
|
2022-03-18 14:58:44 +00:00
|
|
|
--> tests/ui/invalid_property_args.rs:37:42
|
2021-06-04 10:16:25 +00:00
|
|
|
|
|
|
|
|
37 | struct MultipleName(#[pyo3(name = "foo", name = "bar")] i32);
|
2022-03-18 14:58:44 +00:00
|
|
|
| ^^^^
|
2021-06-04 10:16:25 +00:00
|
|
|
|
|
|
|
error: `name` is useless without `get` or `set`
|
2022-03-18 14:58:44 +00:00
|
|
|
--> tests/ui/invalid_property_args.rs:40:33
|
2021-06-04 10:16:25 +00:00
|
|
|
|
|
|
|
|
40 | struct NameWithoutGetSet(#[pyo3(name = "value")] i32);
|
2022-10-18 19:14:22 +00:00
|
|
|
| ^^^^^^^^^^^^^^
|
2024-06-21 23:33:34 +00:00
|
|
|
|
|
|
|
error[E0277]: `PhantomData<i32>` cannot be converted to a Python object
|
|
|
|
--> tests/ui/invalid_property_args.rs:45:12
|
|
|
|
|
|
|
|
|
45 | value: ::std::marker::PhantomData<i32>,
|
|
|
|
| ^ required by `#[pyo3(get)]` to create a readable property from a field of type `PhantomData<i32>`
|
|
|
|
|
|
|
|
|
= help: the trait `IntoPy<Py<PyAny>>` is not implemented for `PhantomData<i32>`, which is required by `PhantomData<i32>: PyO3GetField`
|
|
|
|
= note: implement `ToPyObject` or `IntoPy<PyObject> + Clone` for `PhantomData<i32>` to define the conversion
|
|
|
|
= note: required for `PhantomData<i32>` to implement `PyO3GetField`
|
|
|
|
note: required by a bound in `PyClassGetterGenerator::<ClassT, FieldT, Offset, false, false>::generate`
|
|
|
|
--> src/impl_/pyclass.rs
|
|
|
|
|
|
|
|
|
| pub const fn generate(&self, name: &'static CStr, doc: &'static CStr) -> PyMethodDefType
|
|
|
|
| -------- required by a bound in this associated function
|
|
|
|
...
|
|
|
|
| FieldT: PyO3GetField,
|
|
|
|
| ^^^^^^^^^^^^ required by this bound in `PyClassGetterGenerator::<ClassT, FieldT, Offset, false, false>::generate`
|