pyo3/tests/ui/invalid_pyfunctions.stderr
David Hewitt ec6d587218
support Bound for classmethod and pass_module (#3831)
* support `Bound` for `classmethod` and `pass_module`

* `from_ref_to_ptr` -> `ref_from_ptr`

* add detailed docs to `ref_from_ptr`
2024-02-16 00:36:11 +00:00

52 lines
2.1 KiB
Plaintext

error: Python functions cannot have generic type parameters
--> tests/ui/invalid_pyfunctions.rs:4:21
|
4 | fn generic_function<T>(value: T) {}
| ^
error: Python functions cannot have `impl Trait` arguments
--> tests/ui/invalid_pyfunctions.rs:7:36
|
7 | fn impl_trait_function(impl_trait: impl AsRef<PyAny>) {}
| ^^^^
error: wildcard argument names are not supported
--> tests/ui/invalid_pyfunctions.rs:10:22
|
10 | fn wildcard_argument(_: i32) {}
| ^
error: destructuring in arguments is not supported
--> tests/ui/invalid_pyfunctions.rs:13:26
|
13 | fn destructured_argument((a, b): (i32, i32)) {}
| ^^^^^^
error: required arguments after an `Option<_>` argument are ambiguous
= help: add a `#[pyo3(signature)]` annotation on this function to unambiguously specify the default values for all optional parameters
--> tests/ui/invalid_pyfunctions.rs:16:63
|
16 | fn function_with_required_after_option(_opt: Option<i32>, _x: i32) {}
| ^^^
error: expected `&PyModule` or `Py<PyModule>` as first argument with `pass_module`
--> tests/ui/invalid_pyfunctions.rs:19:37
|
19 | fn pass_module_but_no_arguments<'py>() {}
| ^^
error[E0277]: the trait bound `&str: From<BoundRef<'_, '_, pyo3::prelude::PyModule>>` is not satisfied
--> tests/ui/invalid_pyfunctions.rs:22:43
|
22 | fn first_argument_not_module<'py>(string: &str, module: &'py PyModule) -> PyResult<&'py str> {
| ^ the trait `From<BoundRef<'_, '_, pyo3::prelude::PyModule>>` is not implemented for `&str`
|
= help: the following other types implement trait `From<T>`:
<String as From<char>>
<String as From<Box<str>>>
<String as From<Cow<'a, str>>>
<String as From<&str>>
<String as From<&mut str>>
<String as From<&String>>
= note: required for `BoundRef<'_, '_, pyo3::prelude::PyModule>` to implement `Into<&str>`