-
Notifications
You must be signed in to change notification settings - Fork 953
Open
Description
I think recent changes to the experimental-inspect feature might have caused some unintended breakage when the feature isn't turned on.
If I do cargo test --features=macros --no-default-features --test test_compile_errors, that fails with the following output:
Details
goldbaum at Nathans-MBP in ~/Documents/pyo3 on main
± cargo test --test test_compile_error --features=macros
warning: pyo3-ffi@0.28.2: Using experimental support for the Python 3.15 ABI. Build artifacts may not be compatible with the final release of CPython, so do not distribute them.
Compiling pyo3 v0.28.2 (/Users/goldbaum/Documents/pyo3)
Finished `test` profile [unoptimized + debuginfo] target(s) in 1.02s
Running tests/test_compile_error.rs (target/debug/deps/test_compile_error-5441cf4e0f63222d)
running 1 test
warning: pyo3-ffi@0.28.2: Using experimental support for the Python 3.15 ABI. Build artifacts may not be compatible with the final release of CPython, so do not distribute them.
Compiling pyo3-tests v0.0.0 (/Users/goldbaum/Documents/pyo3/target/tests/trybuild/pyo3)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.15s
test tests/ui/deprecated_pyfn.rs [should fail to compile] ... ok
test tests/ui/invalid_property_args.rs [should fail to compile] ... ok
test tests/ui/invalid_proto_pymethods.rs [should fail to compile] ... ok
test tests/ui/invalid_pyclass_args.rs [should fail to compile] ... mismatch
EXPECTED:
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
error: expected one of: `crate`, `dict`, `eq`, `eq_int`, `extends`, `freelist`, `frozen`, `get_all`, `hash`, `immutable_type`, `mapping`, `module`, `name`, `ord`, `rename_all`, `sequence`, `set_all`, `new`, `str`, `subclass`, `unsendable`, `weakref`, `generic`, `from_py_object`, `skip_from_py_object`
--> tests/ui/invalid_pyclass_args.rs:4:11
|
4 | #[pyclass(extend=pyo3::types::PyDict)]
| ^^^^^^
error: expected identifier
--> tests/ui/invalid_pyclass_args.rs:7:21
|
7 | #[pyclass(extends = "PyDict")]
| ^^^^^^^^
error: expected string literal
--> tests/ui/invalid_pyclass_args.rs:10:18
|
10 | #[pyclass(name = m::MyClass)]
| ^
error: expected a single identifier in double quotes
--> tests/ui/invalid_pyclass_args.rs:13:18
|
13 | #[pyclass(name = "Custom Name")]
| ^^^^^^^^^^^^^
error: expected string literal
--> tests/ui/invalid_pyclass_args.rs:16:18
|
16 | #[pyclass(name = CustomName)]
| ^^^^^^^^^^
error: expected string literal
--> tests/ui/invalid_pyclass_args.rs:19:24
|
19 | #[pyclass(rename_all = camelCase)]
| ^^^^^^^^^
error: expected a valid renaming rule, possible values are: "camelCase", "kebab-case", "lowercase", "PascalCase", "SCREAMING-KEBAB-CASE", "SCREAMING_SNAKE_CASE", "snake_case", "UPPERCASE"
--> tests/ui/invalid_pyclass_args.rs:22:24
|
22 | #[pyclass(rename_all = "Camel-Case")]
| ^^^^^^^^^^^^
error: expected string literal
--> tests/ui/invalid_pyclass_args.rs:25:20
|
25 | #[pyclass(module = my_module)]
| ^^^^^^^^^
error: expected one of: `crate`, `dict`, `eq`, `eq_int`, `extends`, `freelist`, `frozen`, `get_all`, `hash`, `immutable_type`, `mapping`, `module`, `name`, `ord`, `rename_all`, `sequence`, `set_all`, `new`, `str`, `subclass`, `unsendable`, `weakref`, `generic`, `from_py_object`, `skip_from_py_object`
--> tests/ui/invalid_pyclass_args.rs:28:11
|
28 | #[pyclass(weakrev)]
| ^^^^^^^
error: a `#[pyclass]` cannot be both a `mapping` and a `sequence`
--> tests/ui/invalid_pyclass_args.rs:32:8
|
32 | struct CannotBeMappingAndSequence {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: `eq_int` can only be used on simple enums.
--> tests/ui/invalid_pyclass_args.rs:53:11
|
53 | #[pyclass(eq_int)]
| ^^^^^^
error: The `hash` option requires the `frozen` option.
--> tests/ui/invalid_pyclass_args.rs:60:11
|
60 | #[pyclass(hash)]
| ^^^^
error: The `hash` option requires the `eq` option.
--> tests/ui/invalid_pyclass_args.rs:60:11
|
60 | #[pyclass(hash)]
| ^^^^
error: The `ord` option requires the `eq` option.
--> tests/ui/invalid_pyclass_args.rs:75:11
|
75 | #[pyclass(ord)]
| ^^^
error: expected one of: `get`, `set`, `name`
--> tests/ui/invalid_pyclass_args.rs:82:12
|
82 | #[pyo3(foo)]
| ^^^
error: expected one of: `get`, `set`, `name`
--> tests/ui/invalid_pyclass_args.rs:83:12
|
83 | #[pyo3(blah)]
| ^^^^
error: expected one of: `get`, `set`, `name`
--> tests/ui/invalid_pyclass_args.rs:85:12
|
85 | #[pyo3(pop)]
| ^^^
error: invalid format string: expected `}` but string was terminated
--> tests/ui/invalid_pyclass_args.rs:105:19
|
105 | #[pyclass(str = "{")]
| -^ expected `}` in format string
| |
| because of this opening brace
|
= note: if you intended to print `{`, you can escape it using `{{`
error: invalid format string: expected `}`, found `$`
--> tests/ui/invalid_pyclass_args.rs:109:19
|
109 | #[pyclass(str = "{$}")]
| -^ expected `}` in format string
| |
| because of this opening brace
|
= note: if you intended to print `{`, you can escape it using `{{`
error: The format string syntax is incompatible with any renaming via `name` or `rename_all`
--> tests/ui/invalid_pyclass_args.rs:133:31
|
133 | #[pyclass(name = "aaa", str = "unsafe: {unsafe_variable}")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: The format string syntax is incompatible with any renaming via `name` or `rename_all`
--> tests/ui/invalid_pyclass_args.rs:139:31
|
139 | #[pyclass(name = "aaa", str = "unsafe: {unsafe_variable}")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: The format string syntax is incompatible with any renaming via `name` or `rename_all`
--> tests/ui/invalid_pyclass_args.rs:144:17
|
144 | #[pyclass(str = "unsafe: {unsafe_variable}")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: The format string syntax is incompatible with any renaming via `name` or `rename_all`
--> tests/ui/invalid_pyclass_args.rs:150:54
|
150 | #[pyclass(rename_all = "SCREAMING_SNAKE_CASE", str = "{a_a}, {b_b}, {c_d_e}")]
| ^^^^^^^^^^^^^^^^^^^^^^^
error: No member found, you must provide a named or positionally specified member.
--> tests/ui/invalid_pyclass_args.rs:157:17
|
157 | #[pyclass(str = "{:?}")]
| ^^^^^^
error: No member found, you must provide a named or positionally specified member.
--> tests/ui/invalid_pyclass_args.rs:164:17
|
164 | #[pyclass(str = "{}")]
| ^^^^
error: The format string syntax cannot be used with enums
--> tests/ui/invalid_pyclass_args.rs:171:21
|
171 | #[pyclass(eq, str = "Stuff...")]
| ^^^^^^^^^^
error: `skip_from_py_object` and `from_py_object` are mutually exclusive
--> tests/ui/invalid_pyclass_args.rs:184:27
|
184 | #[pyclass(from_py_object, skip_from_py_object)]
| ^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `StructFromPyObjectNoClone: Clone` is not satisfied
--> tests/ui/invalid_pyclass_args.rs:190:11
|
190 | #[pyclass(from_py_object)]
| ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `StructFromPyObjectNoClone`
|
= help: see issue #48214
help: consider annotating `StructFromPyObjectNoClone` with `#[derive(Clone)]`
|
191 + #[derive(Clone)]
192 | struct StructFromPyObjectNoClone {
|
error[E0119]: conflicting implementations of trait `PyClassNewTextSignature` for type `NewFromFieldsWithManualNew`
--> tests/ui/invalid_pyclass_args.rs:213:1
|
208 | #[pyclass(new = "from_fields")]
| ------------------------------- first implementation here
...
213 | #[pymethods]
| ^^^^^^^^^^^^ conflicting implementation for `NewFromFieldsWithManualNew`
|
= note: this error originates in the attribute macro `pymethods` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: `Box<dyn std::error::Error + Send + Sync>` cannot be used as a Python function argument
--> tests/ui/invalid_pyclass_args.rs:205:12
|
205 | field: Box<dyn std::error::Error + Send + Sync>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `PyFunctionArgument<'_, '_, '_, false>` is not implemented for `Box<dyn std::error::Error + Send + Sync>`
|
= note: implement `FromPyObject` to enable using `Box<dyn std::error::Error + Send + Sync>` as a function argument
= note: `Python<'py>` is also a valid argument type to pass the Python token into `#[pyfunction]`s and `#[pymethods]`
help: the following other types implement trait `PyFunctionArgument<'a, 'holder, 'py, IMPLEMENTS_FROMPYOBJECT>`
--> src/impl_/extract_argument.rs
|
| / impl<'a, 'holder, 'py, T: 'a + 'py> PyFunctionArgument<'a, 'holder, 'py, false>
| | for &'holder Bound<'py, T>
| | where
| | T: PyTypeCheck,
| |___________________^ `&'holder pyo3::Bound<'py, T>` implements `PyFunctionArgument<'a, 'holder, 'py, false>`
...
| / impl<'a, 'holder, 'py, T> PyFunctionArgument<'a, 'holder, 'py, false> for Option<T>
| | where
| | T: PyFunctionArgument<'a, 'holder, 'py, false>,
| |___________________________________________________^ `Option<T>` implements `PyFunctionArgument<'a, 'holder, 'py, false>`
...
| impl<'a, 'holder, T: PyClass> PyFunctionArgument<'a, 'holder, '_, false> for &'holder T {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&'holder T` implements `PyFunctionArgument<'a, 'holder, '_, false>`
...
| / impl<'a, 'holder, T: PyClass<Frozen = False>> PyFunctionArgument<'a, 'holder, '_, false>
| | for &'holder mut T
| |______________________^ `&'holder mut T` implements `PyFunctionArgument<'a, 'holder, '_, false>`
error[E0592]: duplicate definitions with name `__pymethod___richcmp____`
--> tests/ui/invalid_pyclass_args.rs:37:1
|
37 | #[pyclass(eq)]
| ^^^^^^^^^^^^^^ duplicate definitions for `__pymethod___richcmp____`
...
41 | #[pymethods]
| ------------ other definition for `__pymethod___richcmp____`
|
= note: this error originates in the attribute macro `pyclass` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0592]: duplicate definitions with name `__pymethod___hash____`
--> tests/ui/invalid_pyclass_args.rs:64:1
|
64 | #[pyclass(frozen, eq, hash)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ duplicate definitions for `__pymethod___hash____`
...
68 | #[pymethods]
| ------------ other definition for `__pymethod___hash____`
|
= note: this error originates in the attribute macro `pyclass` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0592]: duplicate definitions with name `__pymethod___str____`
--> tests/ui/invalid_pyclass_args.rs:89:1
|
89 | #[pyclass(str)]
| ^^^^^^^^^^^^^^^ duplicate definitions for `__pymethod___str____`
...
98 | #[pymethods]
| ------------ other definition for `__pymethod___str____`
|
= note: this error originates in the attribute macro `pyclass` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0592]: duplicate definitions with name `__pymethod___new____`
--> tests/ui/invalid_pyclass_args.rs:208:1
|
208 | #[pyclass(new = "from_fields")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ duplicate definitions for `__pymethod___new____`
...
213 | #[pymethods]
| ------------ other definition for `__pymethod___new____`
|
= note: this error originates in the attribute macro `pyclass` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0369]: binary operation `==` cannot be applied to type `&EqOptRequiresEq`
--> tests/ui/invalid_pyclass_args.rs:34:11
|
34 | #[pyclass(eq)]
| ^^
|
note: an implementation of `PartialEq` might be missing for `EqOptRequiresEq`
--> tests/ui/invalid_pyclass_args.rs:35:1
|
35 | struct EqOptRequiresEq {}
| ^^^^^^^^^^^^^^^^^^^^^^ must implement `PartialEq`
help: consider annotating `EqOptRequiresEq` with `#[derive(PartialEq)]`
|
35 + #[derive(PartialEq)]
36 | struct EqOptRequiresEq {}
|
error[E0369]: binary operation `!=` cannot be applied to type `&EqOptRequiresEq`
--> tests/ui/invalid_pyclass_args.rs:34:11
|
34 | #[pyclass(eq)]
| ^^
|
note: an implementation of `PartialEq` might be missing for `EqOptRequiresEq`
--> tests/ui/invalid_pyclass_args.rs:35:1
|
35 | struct EqOptRequiresEq {}
| ^^^^^^^^^^^^^^^^^^^^^^ must implement `PartialEq`
help: consider annotating `EqOptRequiresEq` with `#[derive(PartialEq)]`
|
35 + #[derive(PartialEq)]
36 | struct EqOptRequiresEq {}
|
error[E0034]: multiple applicable items in scope
--> tests/ui/invalid_pyclass_args.rs:37:1
|
37 | #[pyclass(eq)]
| ^^^^^^^^^^^^^^ multiple `__pymethod___richcmp____` found
|
note: candidate #1 is defined in an impl for the type `EqOptAndManualRichCmp`
--> tests/ui/invalid_pyclass_args.rs:37:1
|
37 | #[pyclass(eq)]
| ^^^^^^^^^^^^^^
note: candidate #2 is defined in an impl for the type `EqOptAndManualRichCmp`
--> tests/ui/invalid_pyclass_args.rs:41:1
|
41 | #[pymethods]
| ^^^^^^^^^^^^
= note: this error originates in the attribute macro `pyclass` which comes from the expansion of the attribute macro `pymethods` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0034]: multiple applicable items in scope
--> tests/ui/invalid_pyclass_args.rs:41:1
|
41 | #[pymethods]
| ^^^^^^^^^^^^ multiple `__pymethod___richcmp____` found
|
note: candidate #1 is defined in an impl for the type `EqOptAndManualRichCmp`
--> tests/ui/invalid_pyclass_args.rs:37:1
|
37 | #[pyclass(eq)]
| ^^^^^^^^^^^^^^
note: candidate #2 is defined in an impl for the type `EqOptAndManualRichCmp`
--> tests/ui/invalid_pyclass_args.rs:41:1
|
41 | #[pymethods]
| ^^^^^^^^^^^^
= note: this error originates in the attribute macro `pymethods` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `HashOptRequiresHash: Hash` is not satisfied
--> tests/ui/invalid_pyclass_args.rs:56:23
|
56 | #[pyclass(frozen, eq, hash)]
| ^^^^ the trait `Hash` is not implemented for `HashOptRequiresHash`
|
help: consider annotating `HashOptRequiresHash` with `#[derive(Hash)]`
|
58 + #[derive(Hash)]
59 | struct HashOptRequiresHash;
|
error[E0034]: multiple applicable items in scope
--> tests/ui/invalid_pyclass_args.rs:64:1
|
64 | #[pyclass(frozen, eq, hash)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ multiple `__pymethod___hash____` found
|
note: candidate #1 is defined in an impl for the type `HashOptAndManualHash`
--> tests/ui/invalid_pyclass_args.rs:64:1
|
64 | #[pyclass(frozen, eq, hash)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in an impl for the type `HashOptAndManualHash`
--> tests/ui/invalid_pyclass_args.rs:68:1
|
68 | #[pymethods]
| ^^^^^^^^^^^^
= note: this error originates in the attribute macro `pyclass` which comes from the expansion of the attribute macro `pymethods` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0034]: multiple applicable items in scope
--> tests/ui/invalid_pyclass_args.rs:68:1
|
68 | #[pymethods]
| ^^^^^^^^^^^^ multiple `__pymethod___hash____` found
|
note: candidate #1 is defined in an impl for the type `HashOptAndManualHash`
--> tests/ui/invalid_pyclass_args.rs:64:1
|
64 | #[pyclass(frozen, eq, hash)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in an impl for the type `HashOptAndManualHash`
--> tests/ui/invalid_pyclass_args.rs:68:1
|
68 | #[pymethods]
| ^^^^^^^^^^^^
= note: this error originates in the attribute macro `pymethods` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0034]: multiple applicable items in scope
--> tests/ui/invalid_pyclass_args.rs:89:1
|
89 | #[pyclass(str)]
| ^^^^^^^^^^^^^^^ multiple `__pymethod___str____` found
|
note: candidate #1 is defined in an impl for the type `StrOptAndManualStr`
--> tests/ui/invalid_pyclass_args.rs:89:1
|
89 | #[pyclass(str)]
| ^^^^^^^^^^^^^^^
note: candidate #2 is defined in an impl for the type `StrOptAndManualStr`
--> tests/ui/invalid_pyclass_args.rs:98:1
|
98 | #[pymethods]
| ^^^^^^^^^^^^
= note: this error originates in the attribute macro `pyclass` which comes from the expansion of the attribute macro `pymethods` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0034]: multiple applicable items in scope
--> tests/ui/invalid_pyclass_args.rs:98:1
|
98 | #[pymethods]
| ^^^^^^^^^^^^ multiple `__pymethod___str____` found
|
note: candidate #1 is defined in an impl for the type `StrOptAndManualStr`
--> tests/ui/invalid_pyclass_args.rs:89:1
|
89 | #[pyclass(str)]
| ^^^^^^^^^^^^^^^
note: candidate #2 is defined in an impl for the type `StrOptAndManualStr`
--> tests/ui/invalid_pyclass_args.rs:98:1
|
98 | #[pymethods]
| ^^^^^^^^^^^^
= note: this error originates in the attribute macro `pymethods` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0609]: no field `aaaa` on type `&Point`
--> tests/ui/invalid_pyclass_args.rs:113:17
|
113 | #[pyclass(str = "X: {aaaa}, Y: {y}, Z: {z}", skip_from_py_object)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ unknown field
|
= note: available fields are: `x`, `y`, `z`
error[E0609]: no field `zzz` on type `&Point2`
--> tests/ui/invalid_pyclass_args.rs:121:17
|
121 | #[pyclass(str = "X: {x}, Y: {y}}}, Z: {zzz}", skip_from_py_object)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unknown field
|
= note: available fields are: `x`, `y`, `z`
error[E0609]: no field `162543` on type `&Coord3`
--> tests/ui/invalid_pyclass_args.rs:129:17
|
129 | #[pyclass(str = "{0}, {162543}, {2}")]
| ^^^^^^^^^^^^^^^^^^^^ unknown field
|
= note: available fields are: `0`, `1`, `2`
warning: use of deprecated associated constant `pyo3::impl_::deprecated::HasAutomaticFromPyObject::<true>::MSG`: The `FromPyObject` implementation for `#[pyclass]` types which implement `Clone` is changing to an opt-in option. Use `#[pyclass(from_py_object)]` to opt-in to the `FromPyObject` derive now, or `#[pyclass(skip_from_py_object)]` to skip the `FromPyObject` implementation.
--> tests/ui/invalid_pyclass_args.rs:196:1
|
196 | #[pyclass]
| ^^^^^^^^^^
|
= note: `#[warn(deprecated)]` on by default
= note: this warning originates in the attribute macro `pyclass` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: `Box<dyn std::error::Error + Send + Sync>` cannot be used as a Python function argument
--> tests/ui/invalid_pyclass_args.rs:205:12
|
205 | field: Box<dyn std::error::Error + Send + Sync>,
| ^^^ the trait `pyo3::PyClass` is not implemented for `Box<dyn std::error::Error + Send + Sync>`
|
= note: implement `FromPyObject` to enable using `Box<dyn std::error::Error + Send + Sync>` as a function argument
= note: `Python<'py>` is also a valid argument type to pass the Python token into `#[pyfunction]`s and `#[pymethods]`
= help: the following other types implement trait `pyo3::PyClass`:
Coord
Coord2
Coord3
EqOptAndManualRichCmp
EqOptRequiresEq
HashOptAndManualHash
HashOptRequiresHash
NewFromFieldsWithManualNew
and $N others
= note: required for `Box<dyn std::error::Error + Send + Sync>` to implement `pyo3::FromPyObject<'_, '_>`
= note: required for `Box<dyn std::error::Error + Send + Sync>` to implement `PyFunctionArgument<'_, '_, '_, true>`
note: required by a bound in `extract_argument`
--> src/impl_/extract_argument.rs
|
| pub fn extract_argument<'a, 'holder, 'py, T, const IMPLEMENTS_FROMPYOBJECT: bool>(
| ---------------- required by a bound in this function
...
| T: PyFunctionArgument<'a, 'holder, 'py, IMPLEMENTS_FROMPYOBJECT>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `extract_argument`
error[E0277]: `Box<dyn std::error::Error + Send + Sync>` cannot be used as a Python function argument
--> tests/ui/invalid_pyclass_args.rs:205:12
|
205 | field: Box<dyn std::error::Error + Send + Sync>,
| ^^^ the trait `ExtractPyClassWithClone` is not implemented for `Box<dyn std::error::Error + Send + Sync>`
|
= note: implement `FromPyObject` to enable using `Box<dyn std::error::Error + Send + Sync>` as a function argument
= note: `Python<'py>` is also a valid argument type to pass the Python token into `#[pyfunction]`s and `#[pymethods]`
= help: the following other types implement trait `ExtractPyClassWithClone`:
Coord
Coord2
Coord3
EqOptAndManualRichCmp
EqOptRequiresEq
HashOptAndManualHash
HashOptRequiresHash
NewFromFieldsWithManualNew
and $N others
= note: required for `Box<dyn std::error::Error + Send + Sync>` to implement `pyo3::FromPyObject<'_, '_>`
= note: required for `Box<dyn std::error::Error + Send + Sync>` to implement `PyFunctionArgument<'_, '_, '_, true>`
note: required by a bound in `extract_argument`
--> src/impl_/extract_argument.rs
|
| pub fn extract_argument<'a, 'holder, 'py, T, const IMPLEMENTS_FROMPYOBJECT: bool>(
| ---------------- required by a bound in this function
...
| T: PyFunctionArgument<'a, 'holder, 'py, IMPLEMENTS_FROMPYOBJECT>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `extract_argument`
error[E0277]: the trait bound `dyn std::error::Error + Send + Sync: Clone` is not satisfied
--> tests/ui/invalid_pyclass_args.rs:205:12
|
205 | field: Box<dyn std::error::Error + Send + Sync>,
| ^^^ the trait `Clone` is not implemented for `dyn std::error::Error + Send + Sync`
|
help: the following other types implement trait `PyFunctionArgument<'a, 'holder, 'py, IMPLEMENTS_FROMPYOBJECT>`
--> src/impl_/extract_argument.rs
|
| / impl<'a, 'holder, 'py, T: 'a + 'py> PyFunctionArgument<'a, 'holder, 'py, false>
| | for &'holder Bound<'py, T>
| | where
| | T: PyTypeCheck,
| |___________________^ `&'holder pyo3::Bound<'py, T>` implements `PyFunctionArgument<'a, 'holder, 'py, false>`
...
| / impl<'a, 'holder, 'py, T> PyFunctionArgument<'a, 'holder, 'py, false> for Option<T>
| | where
| | T: PyFunctionArgument<'a, 'holder, 'py, false>,
| |___________________________________________________^ `Option<T>` implements `PyFunctionArgument<'a, 'holder, 'py, false>`
...
| impl<'a, 'holder, T: PyClass> PyFunctionArgument<'a, 'holder, '_, false> for &'holder T {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&'holder T` implements `PyFunctionArgument<'a, 'holder, '_, false>`
...
| / impl<'a, 'holder, T: PyClass<Frozen = False>> PyFunctionArgument<'a, 'holder, '_, false>
| | for &'holder mut T
| |______________________^ `&'holder mut T` implements `PyFunctionArgument<'a, 'holder, '_, false>`
= note: required for `Box<dyn std::error::Error + Send + Sync>` to implement `Clone`
= note: required for `Box<dyn std::error::Error + Send + Sync>` to implement `pyo3::FromPyObject<'_, '_>`
= note: required for `Box<dyn std::error::Error + Send + Sync>` to implement `PyFunctionArgument<'_, '_, '_, true>`
note: required by a bound in `extract_argument`
--> src/impl_/extract_argument.rs
|
| pub fn extract_argument<'a, 'holder, 'py, T, const IMPLEMENTS_FROMPYOBJECT: bool>(
| ---------------- required by a bound in this function
...
| T: PyFunctionArgument<'a, 'holder, 'py, IMPLEMENTS_FROMPYOBJECT>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `extract_argument`
error[E0034]: multiple applicable items in scope
--> tests/ui/invalid_pyclass_args.rs:208:1
|
208 | #[pyclass(new = "from_fields")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ multiple `__pymethod___new____` found
|
note: candidate #1 is defined in an impl for the type `NewFromFieldsWithManualNew`
--> tests/ui/invalid_pyclass_args.rs:208:1
|
208 | #[pyclass(new = "from_fields")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in an impl for the type `NewFromFieldsWithManualNew`
--> tests/ui/invalid_pyclass_args.rs:213:1
|
213 | #[pymethods]
| ^^^^^^^^^^^^
= note: this error originates in the attribute macro `pyclass` which comes from the expansion of the attribute macro `pymethods` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0034]: multiple applicable items in scope
--> tests/ui/invalid_pyclass_args.rs:213:1
|
213 | #[pymethods]
| ^^^^^^^^^^^^ multiple `__pymethod___new____` found
|
note: candidate #1 is defined in an impl for the type `NewFromFieldsWithManualNew`
--> tests/ui/invalid_pyclass_args.rs:208:1
|
208 | #[pyclass(new = "from_fields")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in an impl for the type `NewFromFieldsWithManualNew`
--> tests/ui/invalid_pyclass_args.rs:213:1
|
213 | #[pymethods]
| ^^^^^^^^^^^^
= note: this error originates in the attribute macro `pymethods` (in Nightly builds, run with -Z macro-backtrace for more info)
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
ACTUAL OUTPUT:
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
error: expected one of: `crate`, `dict`, `eq`, `eq_int`, `extends`, `freelist`, `frozen`, `get_all`, `hash`, `immutable_type`, `mapping`, `module`, `name`, `ord`, `rename_all`, `sequence`, `set_all`, `new`, `str`, `subclass`, `unsendable`, `weakref`, `generic`, `from_py_object`, `skip_from_py_object`
--> tests/ui/invalid_pyclass_args.rs:4:11
|
4 | #[pyclass(extend=pyo3::types::PyDict)]
| ^^^^^^
error: expected identifier
--> tests/ui/invalid_pyclass_args.rs:7:21
|
7 | #[pyclass(extends = "PyDict")]
| ^^^^^^^^
error: expected string literal
--> tests/ui/invalid_pyclass_args.rs:10:18
|
10 | #[pyclass(name = m::MyClass)]
| ^
error: expected a single identifier in double quotes
--> tests/ui/invalid_pyclass_args.rs:13:18
|
13 | #[pyclass(name = "Custom Name")]
| ^^^^^^^^^^^^^
error: expected string literal
--> tests/ui/invalid_pyclass_args.rs:16:18
|
16 | #[pyclass(name = CustomName)]
| ^^^^^^^^^^
error: expected string literal
--> tests/ui/invalid_pyclass_args.rs:19:24
|
19 | #[pyclass(rename_all = camelCase)]
| ^^^^^^^^^
error: expected a valid renaming rule, possible values are: "camelCase", "kebab-case", "lowercase", "PascalCase", "SCREAMING-KEBAB-CASE", "SCREAMING_SNAKE_CASE", "snake_case", "UPPERCASE"
--> tests/ui/invalid_pyclass_args.rs:22:24
|
22 | #[pyclass(rename_all = "Camel-Case")]
| ^^^^^^^^^^^^
error: expected string literal
--> tests/ui/invalid_pyclass_args.rs:25:20
|
25 | #[pyclass(module = my_module)]
| ^^^^^^^^^
error: expected one of: `crate`, `dict`, `eq`, `eq_int`, `extends`, `freelist`, `frozen`, `get_all`, `hash`, `immutable_type`, `mapping`, `module`, `name`, `ord`, `rename_all`, `sequence`, `set_all`, `new`, `str`, `subclass`, `unsendable`, `weakref`, `generic`, `from_py_object`, `skip_from_py_object`
--> tests/ui/invalid_pyclass_args.rs:28:11
|
28 | #[pyclass(weakrev)]
| ^^^^^^^
error: a `#[pyclass]` cannot be both a `mapping` and a `sequence`
--> tests/ui/invalid_pyclass_args.rs:32:8
|
32 | struct CannotBeMappingAndSequence {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: `eq_int` can only be used on simple enums.
--> tests/ui/invalid_pyclass_args.rs:53:11
|
53 | #[pyclass(eq_int)]
| ^^^^^^
error: The `hash` option requires the `frozen` option.
--> tests/ui/invalid_pyclass_args.rs:60:11
|
60 | #[pyclass(hash)]
| ^^^^
error: The `hash` option requires the `eq` option.
--> tests/ui/invalid_pyclass_args.rs:60:11
|
60 | #[pyclass(hash)]
| ^^^^
error: The `ord` option requires the `eq` option.
--> tests/ui/invalid_pyclass_args.rs:75:11
|
75 | #[pyclass(ord)]
| ^^^
error: expected one of: `get`, `set`, `name`
--> tests/ui/invalid_pyclass_args.rs:82:12
|
82 | #[pyo3(foo)]
| ^^^
error: expected one of: `get`, `set`, `name`
--> tests/ui/invalid_pyclass_args.rs:83:12
|
83 | #[pyo3(blah)]
| ^^^^
error: expected one of: `get`, `set`, `name`
--> tests/ui/invalid_pyclass_args.rs:85:12
|
85 | #[pyo3(pop)]
| ^^^
error: invalid format string: expected `}` but string was terminated
--> tests/ui/invalid_pyclass_args.rs:105:19
|
105 | #[pyclass(str = "{")]
| -^ expected `}` in format string
| |
| because of this opening brace
|
= note: if you intended to print `{`, you can escape it using `{{`
error: invalid format string: expected `}`, found `$`
--> tests/ui/invalid_pyclass_args.rs:109:19
|
109 | #[pyclass(str = "{$}")]
| -^ expected `}` in format string
| |
| because of this opening brace
|
= note: if you intended to print `{`, you can escape it using `{{`
error: The format string syntax is incompatible with any renaming via `name` or `rename_all`
--> tests/ui/invalid_pyclass_args.rs:133:31
|
133 | #[pyclass(name = "aaa", str = "unsafe: {unsafe_variable}")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: The format string syntax is incompatible with any renaming via `name` or `rename_all`
--> tests/ui/invalid_pyclass_args.rs:139:31
|
139 | #[pyclass(name = "aaa", str = "unsafe: {unsafe_variable}")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: The format string syntax is incompatible with any renaming via `name` or `rename_all`
--> tests/ui/invalid_pyclass_args.rs:144:17
|
144 | #[pyclass(str = "unsafe: {unsafe_variable}")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: The format string syntax is incompatible with any renaming via `name` or `rename_all`
--> tests/ui/invalid_pyclass_args.rs:150:54
|
150 | #[pyclass(rename_all = "SCREAMING_SNAKE_CASE", str = "{a_a}, {b_b}, {c_d_e}")]
| ^^^^^^^^^^^^^^^^^^^^^^^
error: No member found, you must provide a named or positionally specified member.
--> tests/ui/invalid_pyclass_args.rs:157:17
|
157 | #[pyclass(str = "{:?}")]
| ^^^^^^
error: No member found, you must provide a named or positionally specified member.
--> tests/ui/invalid_pyclass_args.rs:164:17
|
164 | #[pyclass(str = "{}")]
| ^^^^
error: The format string syntax cannot be used with enums
--> tests/ui/invalid_pyclass_args.rs:171:21
|
171 | #[pyclass(eq, str = "Stuff...")]
| ^^^^^^^^^^
error: `skip_from_py_object` and `from_py_object` are mutually exclusive
--> tests/ui/invalid_pyclass_args.rs:184:27
|
184 | #[pyclass(from_py_object, skip_from_py_object)]
| ^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `StructFromPyObjectNoClone: Clone` is not satisfied
--> tests/ui/invalid_pyclass_args.rs:190:11
|
190 | #[pyclass(from_py_object)]
| ^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `StructFromPyObjectNoClone`
|
= help: see issue #48214
help: consider annotating `StructFromPyObjectNoClone` with `#[derive(Clone)]`
|
191 + #[derive(Clone)]
192 | struct StructFromPyObjectNoClone {
|
error[E0119]: conflicting implementations of trait `PyClassNewTextSignature` for type `NewFromFieldsWithManualNew`
--> tests/ui/invalid_pyclass_args.rs:213:1
|
208 | #[pyclass(new = "from_fields")]
| ------------------------------- first implementation here
...
213 | #[pymethods]
| ^^^^^^^^^^^^ conflicting implementation for `NewFromFieldsWithManualNew`
|
= note: this error originates in the attribute macro `pymethods` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0592]: duplicate definitions with name `__pymethod___richcmp____`
--> tests/ui/invalid_pyclass_args.rs:37:1
|
37 | #[pyclass(eq)]
| ^^^^^^^^^^^^^^ duplicate definitions for `__pymethod___richcmp____`
...
41 | #[pymethods]
| ------------ other definition for `__pymethod___richcmp____`
|
= note: this error originates in the attribute macro `pyclass` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0592]: duplicate definitions with name `__pymethod___hash____`
--> tests/ui/invalid_pyclass_args.rs:64:1
|
64 | #[pyclass(frozen, eq, hash)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ duplicate definitions for `__pymethod___hash____`
...
68 | #[pymethods]
| ------------ other definition for `__pymethod___hash____`
|
= note: this error originates in the attribute macro `pyclass` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0592]: duplicate definitions with name `__pymethod___str____`
--> tests/ui/invalid_pyclass_args.rs:89:1
|
89 | #[pyclass(str)]
| ^^^^^^^^^^^^^^^ duplicate definitions for `__pymethod___str____`
...
98 | #[pymethods]
| ------------ other definition for `__pymethod___str____`
|
= note: this error originates in the attribute macro `pyclass` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0592]: duplicate definitions with name `__pymethod___new____`
--> tests/ui/invalid_pyclass_args.rs:208:1
|
208 | #[pyclass(new = "from_fields")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ duplicate definitions for `__pymethod___new____`
...
213 | #[pymethods]
| ------------ other definition for `__pymethod___new____`
|
= note: this error originates in the attribute macro `pyclass` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0369]: binary operation `==` cannot be applied to type `&EqOptRequiresEq`
--> tests/ui/invalid_pyclass_args.rs:34:11
|
34 | #[pyclass(eq)]
| ^^
|
note: an implementation of `PartialEq` might be missing for `EqOptRequiresEq`
--> tests/ui/invalid_pyclass_args.rs:35:1
|
35 | struct EqOptRequiresEq {}
| ^^^^^^^^^^^^^^^^^^^^^^ must implement `PartialEq`
help: consider annotating `EqOptRequiresEq` with `#[derive(PartialEq)]`
|
35 + #[derive(PartialEq)]
36 | struct EqOptRequiresEq {}
|
error[E0369]: binary operation `!=` cannot be applied to type `&EqOptRequiresEq`
--> tests/ui/invalid_pyclass_args.rs:34:11
|
34 | #[pyclass(eq)]
| ^^
|
note: an implementation of `PartialEq` might be missing for `EqOptRequiresEq`
--> tests/ui/invalid_pyclass_args.rs:35:1
|
35 | struct EqOptRequiresEq {}
| ^^^^^^^^^^^^^^^^^^^^^^ must implement `PartialEq`
help: consider annotating `EqOptRequiresEq` with `#[derive(PartialEq)]`
|
35 + #[derive(PartialEq)]
36 | struct EqOptRequiresEq {}
|
error[E0034]: multiple applicable items in scope
--> tests/ui/invalid_pyclass_args.rs:37:1
|
37 | #[pyclass(eq)]
| ^^^^^^^^^^^^^^ multiple `__pymethod___richcmp____` found
|
note: candidate #1 is defined in an impl for the type `EqOptAndManualRichCmp`
--> tests/ui/invalid_pyclass_args.rs:37:1
|
37 | #[pyclass(eq)]
| ^^^^^^^^^^^^^^
note: candidate #2 is defined in an impl for the type `EqOptAndManualRichCmp`
--> tests/ui/invalid_pyclass_args.rs:41:1
|
41 | #[pymethods]
| ^^^^^^^^^^^^
= note: this error originates in the attribute macro `pyclass` which comes from the expansion of the attribute macro `pymethods` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0034]: multiple applicable items in scope
--> tests/ui/invalid_pyclass_args.rs:41:1
|
41 | #[pymethods]
| ^^^^^^^^^^^^ multiple `__pymethod___richcmp____` found
|
note: candidate #1 is defined in an impl for the type `EqOptAndManualRichCmp`
--> tests/ui/invalid_pyclass_args.rs:37:1
|
37 | #[pyclass(eq)]
| ^^^^^^^^^^^^^^
note: candidate #2 is defined in an impl for the type `EqOptAndManualRichCmp`
--> tests/ui/invalid_pyclass_args.rs:41:1
|
41 | #[pymethods]
| ^^^^^^^^^^^^
= note: this error originates in the attribute macro `pymethods` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: the trait bound `HashOptRequiresHash: Hash` is not satisfied
--> tests/ui/invalid_pyclass_args.rs:56:23
|
56 | #[pyclass(frozen, eq, hash)]
| ^^^^ the trait `Hash` is not implemented for `HashOptRequiresHash`
|
help: consider annotating `HashOptRequiresHash` with `#[derive(Hash)]`
|
58 + #[derive(Hash)]
59 | struct HashOptRequiresHash;
|
error[E0034]: multiple applicable items in scope
--> tests/ui/invalid_pyclass_args.rs:64:1
|
64 | #[pyclass(frozen, eq, hash)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ multiple `__pymethod___hash____` found
|
note: candidate #1 is defined in an impl for the type `HashOptAndManualHash`
--> tests/ui/invalid_pyclass_args.rs:64:1
|
64 | #[pyclass(frozen, eq, hash)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in an impl for the type `HashOptAndManualHash`
--> tests/ui/invalid_pyclass_args.rs:68:1
|
68 | #[pymethods]
| ^^^^^^^^^^^^
= note: this error originates in the attribute macro `pyclass` which comes from the expansion of the attribute macro `pymethods` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0034]: multiple applicable items in scope
--> tests/ui/invalid_pyclass_args.rs:68:1
|
68 | #[pymethods]
| ^^^^^^^^^^^^ multiple `__pymethod___hash____` found
|
note: candidate #1 is defined in an impl for the type `HashOptAndManualHash`
--> tests/ui/invalid_pyclass_args.rs:64:1
|
64 | #[pyclass(frozen, eq, hash)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in an impl for the type `HashOptAndManualHash`
--> tests/ui/invalid_pyclass_args.rs:68:1
|
68 | #[pymethods]
| ^^^^^^^^^^^^
= note: this error originates in the attribute macro `pymethods` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0034]: multiple applicable items in scope
--> tests/ui/invalid_pyclass_args.rs:89:1
|
89 | #[pyclass(str)]
| ^^^^^^^^^^^^^^^ multiple `__pymethod___str____` found
|
note: candidate #1 is defined in an impl for the type `StrOptAndManualStr`
--> tests/ui/invalid_pyclass_args.rs:89:1
|
89 | #[pyclass(str)]
| ^^^^^^^^^^^^^^^
note: candidate #2 is defined in an impl for the type `StrOptAndManualStr`
--> tests/ui/invalid_pyclass_args.rs:98:1
|
98 | #[pymethods]
| ^^^^^^^^^^^^
= note: this error originates in the attribute macro `pyclass` which comes from the expansion of the attribute macro `pymethods` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0034]: multiple applicable items in scope
--> tests/ui/invalid_pyclass_args.rs:98:1
|
98 | #[pymethods]
| ^^^^^^^^^^^^ multiple `__pymethod___str____` found
|
note: candidate #1 is defined in an impl for the type `StrOptAndManualStr`
--> tests/ui/invalid_pyclass_args.rs:89:1
|
89 | #[pyclass(str)]
| ^^^^^^^^^^^^^^^
note: candidate #2 is defined in an impl for the type `StrOptAndManualStr`
--> tests/ui/invalid_pyclass_args.rs:98:1
|
98 | #[pymethods]
| ^^^^^^^^^^^^
= note: this error originates in the attribute macro `pymethods` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0609]: no field `aaaa` on type `&Point`
--> tests/ui/invalid_pyclass_args.rs:113:17
|
113 | #[pyclass(str = "X: {aaaa}, Y: {y}, Z: {z}", skip_from_py_object)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ unknown field
|
= note: available fields are: `x`, `y`, `z`
error[E0609]: no field `zzz` on type `&Point2`
--> tests/ui/invalid_pyclass_args.rs:121:17
|
121 | #[pyclass(str = "X: {x}, Y: {y}}}, Z: {zzz}", skip_from_py_object)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unknown field
|
= note: available fields are: `x`, `y`, `z`
error[E0609]: no field `162543` on type `&Coord3`
--> tests/ui/invalid_pyclass_args.rs:129:17
|
129 | #[pyclass(str = "{0}, {162543}, {2}")]
| ^^^^^^^^^^^^^^^^^^^^ unknown field
|
= note: available fields are: `0`, `1`, `2`
warning: use of deprecated associated constant `pyo3::impl_::deprecated::HasAutomaticFromPyObject::<true>::MSG`: The `FromPyObject` implementation for `#[pyclass]` types which implement `Clone` is changing to an opt-in option. Use `#[pyclass(from_py_object)]` to opt-in to the `FromPyObject` derive now, or `#[pyclass(skip_from_py_object)]` to skip the `FromPyObject` implementation.
--> tests/ui/invalid_pyclass_args.rs:196:1
|
196 | #[pyclass]
| ^^^^^^^^^^
|
= note: `#[warn(deprecated)]` on by default
= note: this warning originates in the attribute macro `pyclass` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0277]: `Box<dyn std::error::Error + Send + Sync>` cannot be used as a Python function argument
--> tests/ui/invalid_pyclass_args.rs:205:12
|
205 | field: Box<dyn std::error::Error + Send + Sync>,
| ^^^ the trait `PyClass` is not implemented for `Box<dyn std::error::Error + Send + Sync>`
|
= note: implement `FromPyObject` to enable using `Box<dyn std::error::Error + Send + Sync>` as a function argument
= note: `Python<'py>` is also a valid argument type to pass the Python token into `#[pyfunction]`s and `#[pymethods]`
= help: the following other types implement trait `PyClass`:
Coord
Coord2
Coord3
EqOptAndManualRichCmp
EqOptRequiresEq
HashOptAndManualHash
HashOptRequiresHash
NewFromFieldsWithManualNew
and $N others
= note: required for `Box<dyn std::error::Error + Send + Sync>` to implement `pyo3::FromPyObject<'_, '_>`
= note: required for `Box<dyn std::error::Error + Send + Sync>` to implement `PyFunctionArgument<'_, '_, '_, true>`
note: required by a bound in `extract_argument`
--> src/impl_/extract_argument.rs
|
| pub fn extract_argument<'a, 'holder, 'py, T, const IMPLEMENTS_FROMPYOBJECT: bool>(
| ---------------- required by a bound in this function
...
| T: PyFunctionArgument<'a, 'holder, 'py, IMPLEMENTS_FROMPYOBJECT>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `extract_argument`
error[E0277]: `Box<dyn std::error::Error + Send + Sync>` cannot be used as a Python function argument
--> tests/ui/invalid_pyclass_args.rs:205:12
|
205 | field: Box<dyn std::error::Error + Send + Sync>,
| ^^^ the trait `ExtractPyClassWithClone` is not implemented for `Box<dyn std::error::Error + Send + Sync>`
|
= note: implement `FromPyObject` to enable using `Box<dyn std::error::Error + Send + Sync>` as a function argument
= note: `Python<'py>` is also a valid argument type to pass the Python token into `#[pyfunction]`s and `#[pymethods]`
= help: the following other types implement trait `ExtractPyClassWithClone`:
Coord
Coord2
Coord3
EqOptAndManualRichCmp
EqOptRequiresEq
HashOptAndManualHash
HashOptRequiresHash
NewFromFieldsWithManualNew
and $N others
= note: required for `Box<dyn std::error::Error + Send + Sync>` to implement `pyo3::FromPyObject<'_, '_>`
= note: required for `Box<dyn std::error::Error + Send + Sync>` to implement `PyFunctionArgument<'_, '_, '_, true>`
note: required by a bound in `extract_argument`
--> src/impl_/extract_argument.rs
|
| pub fn extract_argument<'a, 'holder, 'py, T, const IMPLEMENTS_FROMPYOBJECT: bool>(
| ---------------- required by a bound in this function
...
| T: PyFunctionArgument<'a, 'holder, 'py, IMPLEMENTS_FROMPYOBJECT>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `extract_argument`
error[E0277]: the trait bound `dyn std::error::Error + Send + Sync: Clone` is not satisfied
--> tests/ui/invalid_pyclass_args.rs:205:12
|
205 | field: Box<dyn std::error::Error + Send + Sync>,
| ^^^ the trait `Clone` is not implemented for `dyn std::error::Error + Send + Sync`
|
help: the following other types implement trait `PyFunctionArgument<'a, 'holder, 'py, IMPLEMENTS_FROMPYOBJECT>`
--> src/impl_/extract_argument.rs
|
| / impl<'a, 'holder, 'py, T: 'a + 'py> PyFunctionArgument<'a, 'holder, 'py, false>
| | for &'holder Bound<'py, T>
| | where
| | T: PyTypeCheck,
| |___________________^ `&'holder pyo3::Bound<'py, T>` implements `PyFunctionArgument<'a, 'holder, 'py, false>`
...
| / impl<'a, 'holder, 'py, T> PyFunctionArgument<'a, 'holder, 'py, false> for Option<T>
| | where
| | T: PyFunctionArgument<'a, 'holder, 'py, false>,
| |___________________________________________________^ `Option<T>` implements `PyFunctionArgument<'a, 'holder, 'py, false>`
...
| impl<'a, 'holder, T: PyClass> PyFunctionArgument<'a, 'holder, '_, false> for &'holder T {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `&'holder T` implements `PyFunctionArgument<'a, 'holder, '_, false>`
...
| / impl<'a, 'holder, T: PyClass<Frozen = False>> PyFunctionArgument<'a, 'holder, '_, false>
| | for &'holder mut T
| |______________________^ `&'holder mut T` implements `PyFunctionArgument<'a, 'holder, '_, false>`
= note: required for `Box<dyn std::error::Error + Send + Sync>` to implement `Clone`
= note: required for `Box<dyn std::error::Error + Send + Sync>` to implement `pyo3::FromPyObject<'_, '_>`
= note: required for `Box<dyn std::error::Error + Send + Sync>` to implement `PyFunctionArgument<'_, '_, '_, true>`
note: required by a bound in `extract_argument`
--> src/impl_/extract_argument.rs
|
| pub fn extract_argument<'a, 'holder, 'py, T, const IMPLEMENTS_FROMPYOBJECT: bool>(
| ---------------- required by a bound in this function
...
| T: PyFunctionArgument<'a, 'holder, 'py, IMPLEMENTS_FROMPYOBJECT>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `extract_argument`
error[E0034]: multiple applicable items in scope
--> tests/ui/invalid_pyclass_args.rs:208:1
|
208 | #[pyclass(new = "from_fields")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ multiple `__pymethod___new____` found
|
note: candidate #1 is defined in an impl for the type `NewFromFieldsWithManualNew`
--> tests/ui/invalid_pyclass_args.rs:208:1
|
208 | #[pyclass(new = "from_fields")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in an impl for the type `NewFromFieldsWithManualNew`
--> tests/ui/invalid_pyclass_args.rs:213:1
|
213 | #[pymethods]
| ^^^^^^^^^^^^
= note: this error originates in the attribute macro `pyclass` which comes from the expansion of the attribute macro `pymethods` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0034]: multiple applicable items in scope
--> tests/ui/invalid_pyclass_args.rs:213:1
|
213 | #[pymethods]
| ^^^^^^^^^^^^ multiple `__pymethod___new____` found
|
note: candidate #1 is defined in an impl for the type `NewFromFieldsWithManualNew`
--> tests/ui/invalid_pyclass_args.rs:208:1
|
208 | #[pyclass(new = "from_fields")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: candidate #2 is defined in an impl for the type `NewFromFieldsWithManualNew`
--> tests/ui/invalid_pyclass_args.rs:213:1
|
213 | #[pymethods]
| ^^^^^^^^^^^^
= note: this error originates in the attribute macro `pymethods` (in Nightly builds, run with -Z macro-backtrace for more info)
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
note: If the actual output is the correct output you can bless it by rerunning
your test with the environment variable TRYBUILD=overwrite
test tests/ui/invalid_pyclass_doc.rs [should fail to compile] ... ok
test tests/ui/invalid_pyclass_enum.rs [should fail to compile] ... ok
test tests/ui/invalid_pyclass_init.rs [should fail to compile] ... ok
test tests/ui/invalid_pyclass_item.rs [should fail to compile] ... ok
test tests/ui/invalid_pyclass_generic.rs [should fail to compile] ... ok
test tests/ui/pyclass_generic_enum.rs [should fail to compile] ... ok
test tests/ui/invalid_pyfunction_argument.rs [should fail to compile] ... ok
test tests/ui/invalid_pyfunction_definition.rs [should fail to compile] ... ok
test tests/ui/invalid_pyfunction_signatures.rs [should fail to compile] ... ok
test tests/ui/invalid_pymethods_buffer.rs [should fail to compile] ... ok
test tests/ui/invalid_pymethod_enum.rs [should fail to compile] ... ok
test tests/ui/invalid_pymethod_names.rs [should fail to compile] ... ok
test tests/ui/invalid_pymodule_args.rs [should fail to compile] ... ok
test tests/ui/invalid_pycallargs.rs [should fail to compile] ... ok
test tests/ui/reject_generics.rs [should fail to compile] ... ok
test tests/ui/invalid_closure.rs [should fail to compile] ... ok
test tests/ui/pyclass_send.rs [should fail to compile] ... ok
test tests/ui/invalid_annotation.rs [should fail to compile] ... ok
test tests/ui/invalid_annotation_return.rs [should fail to compile] ... ok
test tests/ui/invalid_argument_attributes.rs [should fail to compile] ... ok
test tests/ui/invalid_intopy_derive.rs [should fail to compile] ... ok
test tests/ui/invalid_intopy_with.rs [should fail to compile] ... ok
test tests/ui/invalid_frompy_derive.rs [should fail to compile] ... ok
test tests/ui/static_ref.rs [should fail to compile] ... ok
test tests/ui/wrong_aspyref_lifetimes.rs [should fail to compile] ... ok
test tests/ui/invalid_pyfunctions.rs [should fail to compile] ... ok
test tests/ui/invalid_pymethods.rs [should fail to compile] ... ok
test tests/ui/invalid_async.rs [should fail to compile] ... ok
test tests/ui/invalid_intern_arg.rs [should fail to compile] ... ok
test tests/ui/invalid_frozen_pyclass_borrow.rs [should fail to compile] ... ok
test tests/ui/invalid_pymethod_receiver.rs [should fail to compile] ... ok
test tests/ui/missing_intopy.rs [should fail to compile] ... ok
test tests/ui/invalid_result_conversion.rs [should fail to compile] ... ok
test tests/ui/not_send.rs [should fail to compile] ... ok
test tests/ui/not_send2.rs [should fail to compile] ... ok
test tests/ui/get_set_all.rs [should fail to compile] ... ok
test tests/ui/traverse.rs [should fail to compile] ... ok
test tests/ui/invalid_pymodule_in_root.rs [should fail to compile] ... ok
test tests/ui/invalid_pymodule_glob.rs [should fail to compile] ... ok
test tests/ui/invalid_pymodule_trait.rs [should fail to compile] ... ok
test tests/ui/invalid_pymodule_two_pymodule_init.rs [should fail to compile] ... ok
test tests/ui/pymodule_missing_docs.rs [should pass] ... ok
test tests/ui/forbid_unsafe.rs [should pass] ... ok
WARNINGS:
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
warning: unexpected `cfg` condition name: `Py_3_9`
--> tests/ui/../../src/tests/hygiene/pyclass.rs
|
| #[cfg_attr(any(Py_3_9, not(Py_LIMITED_API)), crate::pyclass(
| ^^^^^^
|
= help: expected names are: `docsrs`, `feature`, and `test` and 31 more
= help: consider using a Cargo feature instead
= help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(Py_3_9)'] }
= help: or consider adding `println!("cargo::rustc-check-cfg=cfg(Py_3_9)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition name: `Py_LIMITED_API`
--> tests/ui/../../src/tests/hygiene/pyclass.rs
|
| #[cfg_attr(any(Py_3_9, not(Py_LIMITED_API)), crate::pyclass(
| ^^^^^^^^^^^^^^
|
= help: consider using a Cargo feature instead
= help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(Py_LIMITED_API)'] }
= help: or consider adding `println!("cargo::rustc-check-cfg=cfg(Py_LIMITED_API)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `Py_3_9`
--> tests/ui/../../src/tests/hygiene/pyclass.rs
|
| #[cfg_attr(not(any(Py_3_9, not(Py_LIMITED_API))), crate::pyclass(
| ^^^^^^
|
= help: consider using a Cargo feature instead
= help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(Py_3_9)'] }
= help: or consider adding `println!("cargo::rustc-check-cfg=cfg(Py_3_9)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `Py_LIMITED_API`
--> tests/ui/../../src/tests/hygiene/pyclass.rs
|
| #[cfg_attr(not(any(Py_3_9, not(Py_LIMITED_API))), crate::pyclass(
| ^^^^^^^^^^^^^^
|
= help: consider using a Cargo feature instead
= help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(Py_LIMITED_API)'] }
= help: or consider adding `println!("cargo::rustc-check-cfg=cfg(Py_LIMITED_API)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
STDERR:
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
warning: unexpected `cfg` condition name: `Py_3_9`
--> /Users/goldbaum/Documents/pyo3/tests/ui/../../src/tests/hygiene/pyclass.rs:10:16
|
10 | #[cfg_attr(any(Py_3_9, not(Py_LIMITED_API)), crate::pyclass(
| ^^^^^^
|
= help: expected names are: `docsrs`, `feature`, and `test` and 31 more
= help: consider using a Cargo feature instead
= help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(Py_3_9)'] }
= help: or consider adding `println!("cargo::rustc-check-cfg=cfg(Py_3_9)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
warning: unexpected `cfg` condition name: `Py_LIMITED_API`
--> /Users/goldbaum/Documents/pyo3/tests/ui/../../src/tests/hygiene/pyclass.rs:10:28
|
10 | #[cfg_attr(any(Py_3_9, not(Py_LIMITED_API)), crate::pyclass(
| ^^^^^^^^^^^^^^
|
= help: consider using a Cargo feature instead
= help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(Py_LIMITED_API)'] }
= help: or consider adding `println!("cargo::rustc-check-cfg=cfg(Py_LIMITED_API)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `Py_3_9`
--> /Users/goldbaum/Documents/pyo3/tests/ui/../../src/tests/hygiene/pyclass.rs:20:20
|
20 | #[cfg_attr(not(any(Py_3_9, not(Py_LIMITED_API))), crate::pyclass(
| ^^^^^^
|
= help: consider using a Cargo feature instead
= help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(Py_3_9)'] }
= help: or consider adding `println!("cargo::rustc-check-cfg=cfg(Py_3_9)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
warning: unexpected `cfg` condition name: `Py_LIMITED_API`
--> /Users/goldbaum/Documents/pyo3/tests/ui/../../src/tests/hygiene/pyclass.rs:20:32
|
20 | #[cfg_attr(not(any(Py_3_9, not(Py_LIMITED_API))), crate::pyclass(
| ^^^^^^^^^^^^^^
|
= help: consider using a Cargo feature instead
= help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(Py_LIMITED_API)'] }
= help: or consider adding `println!("cargo::rustc-check-cfg=cfg(Py_LIMITED_API)");` to the top of the `build.rs`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
test tests/ui/duplicate_pymodule_submodule.rs [should fail to compile] ... ok
test tests/ui/invalid_base_class.rs [should fail to compile] ... ok
test tests/ui/ambiguous_associated_items.rs [should pass] ... ok
test tests/ui/pyclass_probe.rs [should pass] ... ok
test tests/ui/invalid_pyfunction_warn.rs [should fail to compile] ... ok
test tests/ui/invalid_pymethods_warn.rs [should fail to compile] ... ok
test test_compile_errors ... FAILED
failures:
---- test_compile_errors stdout ----
thread 'test_compile_errors' (507293974) panicked at /Users/goldbaum/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/trybuild-1.0.116/src/run.rs:102:13:
1 of 53 tests failed
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
test_compile_errors
test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 8.82s
error: test failed, to rerun pass `--test test_compile_error`
Running cargo test --features=macros,experimental-inspect --no-default-features --test test_compile_errors doesn't trigger any errors or warnings.
It turns out that the CI doesn't do the compiler error tests without experimental-inspect enabled, so this slipped through without anyone noticing.
I can "fix" the test failure (but not the build warnings) with the following diff:
diff --git a/tests/test_compile_error.rs b/tests/test_compile_error.rs
index 423f0dd5c..95daf326c 100644
--- a/tests/test_compile_error.rs
+++ b/tests/test_compile_error.rs
@@ -10,6 +10,7 @@ fn test_compile_errors() {
t.compile_fail("tests/ui/invalid_property_args.rs");
t.compile_fail("tests/ui/invalid_proto_pymethods.rs");
#[cfg(not(all(Py_LIMITED_API, not(Py_3_10))))] // to avoid PyFunctionArgument for &str
+ #[cfg(feature = "experimental-inspect")]
t.compile_fail("tests/ui/invalid_pyclass_args.rs");
t.compile_fail("tests/ui/invalid_pyclass_doc.rs");
t.compile_fail("tests/ui/invalid_pyclass_enum.rs");
But I don't think we want to run the compiler error tests only using the experimental-inspect feature.
Ping @Tpt.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels