@@ -6,11 +6,7 @@ error[E0277]: `AtomicPtr<()>` cannot be used as a Python function argument
66 |
77 = note: implement `FromPyObject` to enable using `AtomicPtr<()>` as a function argument
88 = note: `Python<'py>` is also a valid argument type to pass the Python token into `#[pyfunction]`s and `#[pymethods]`
9- = help: the following other types implement trait `PyFunctionArgument<'a, 'holder, 'py, IMPLEMENTS_FROMPYOBJECT>`:
10- `&'a pyo3::Bound<'py, T>` implements `PyFunctionArgument<'a, '_, 'py, false>`
11- `&'holder T` implements `PyFunctionArgument<'a, 'holder, '_, false>`
12- `&'holder mut T` implements `PyFunctionArgument<'a, 'holder, '_, false>`
13- `Option<T>` implements `PyFunctionArgument<'a, 'holder, 'py, false>`
9+ = help: the trait `PyClass` is implemented for `Foo`
1410 = note: required for `AtomicPtr<()>` to implement `FromPyObject<'_, '_>`
1511 = note: required for `AtomicPtr<()>` to implement `PyFunctionArgument<'_, '_, '_, true>`
1612note: required by a bound in `extract_argument`
@@ -69,3 +65,27 @@ note: required by a bound in `extract_argument`
6965...
7066 | T: PyFunctionArgument<'a, 'holder, 'py, IMPLEMENTS_FROMPYOBJECT>,
7167 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `extract_argument`
68+
69+ error[E0277]: `Foo` cannot be used as a Python function argument
70+ --> tests/ui/invalid_pyfunction_argument.rs:14:59
71+ |
72+ 14 | fn skip_from_py_object_without_custom_from_py_object(arg: Foo) {
73+ | ^^^ the trait `ExtractPyClassWithClone` is not implemented for `Foo`
74+ |
75+ = note: implement `FromPyObject` to enable using `Foo` as a function argument
76+ = note: `Python<'py>` is also a valid argument type to pass the Python token into `#[pyfunction]`s and `#[pymethods]`
77+ = help: the following other types implement trait `PyFunctionArgument<'a, 'holder, 'py, IMPLEMENTS_FROMPYOBJECT>`:
78+ `&'a pyo3::Bound<'py, T>` implements `PyFunctionArgument<'a, '_, 'py, false>`
79+ `&'holder T` implements `PyFunctionArgument<'a, 'holder, '_, false>`
80+ `&'holder mut T` implements `PyFunctionArgument<'a, 'holder, '_, false>`
81+ `Option<T>` implements `PyFunctionArgument<'a, 'holder, 'py, false>`
82+ = note: required for `Foo` to implement `FromPyObject<'_, '_>`
83+ = note: required for `Foo` to implement `PyFunctionArgument<'_, '_, '_, true>`
84+ note: required by a bound in `extract_argument`
85+ --> src/impl_/extract_argument.rs
86+ |
87+ | pub fn extract_argument<'a, 'holder, 'py, T, const IMPLEMENTS_FROMPYOBJECT: bool>(
88+ | ---------------- required by a bound in this function
89+ ...
90+ | T: PyFunctionArgument<'a, 'holder, 'py, IMPLEMENTS_FROMPYOBJECT>,
91+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `extract_argument`
0 commit comments