Closed
Description
Started seeing this on CI today.
I think this is all just formatting changes but an expert should probably look at this before updating the answers.
goldbaum at Nathans-MBP in ~/Documents/pyo3 on pyimport_addmoduleref
± rustc --version
rustc 1.81.0 (eeb90cda1 2024-09-04)
goldbaum at Nathans-MBP in ~/Documents/pyo3 on pyimport_addmoduleref
± cargo test test_compile_errors
Finished `test` profile [unoptimized + debuginfo] target(s) in 0.14s
Running unittests src/lib.rs (target/debug/deps/pyo3-618e8c1d2994ab67)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 689 filtered out; finished in 0.00s
Running tests/test_anyhow.rs (target/debug/deps/test_anyhow-d0f9a83f868e178c)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Running tests/test_append_to_inittab.rs (target/debug/deps/test_append_to_inittab-ac8f6e7fa66ec417)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out; finished in 0.00s
Running tests/test_arithmetics.rs (target/debug/deps/test_arithmetics-c097465d598d8289)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 15 filtered out; finished in 0.00s
Running tests/test_buffer.rs (target/debug/deps/test_buffer-ff4395eb7e5b275a)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 1 filtered out; finished in 0.00s
Running tests/test_buffer_protocol.rs (target/debug/deps/test_buffer_protocol-b1edc980259aa0e6)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 3 filtered out; finished in 0.00s
Running tests/test_bytes.rs (target/debug/deps/test_bytes-7b2076bc3bdf7dc3)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 4 filtered out; finished in 0.00s
Running tests/test_class_attributes.rs (target/debug/deps/test_class_attributes-a47b46fe385db50e)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 13 filtered out; finished in 0.00s
Running tests/test_class_basics.rs (target/debug/deps/test_class_basics-54111f114d099ec8)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 23 filtered out; finished in 0.00s
Running tests/test_class_comparisons.rs (target/debug/deps/test_class_comparisons-0dbb564d6d220965)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 8 filtered out; finished in 0.00s
Running tests/test_class_conversion.rs (target/debug/deps/test_class_conversion-a4208ae8901c3392)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 6 filtered out; finished in 0.00s
Running tests/test_class_formatting.rs (target/debug/deps/test_class_formatting-4b0d6e02e69a52a7)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 7 filtered out; finished in 0.00s
Running tests/test_class_new.rs (target/debug/deps/test_class_new-5726eb39804f590e)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 11 filtered out; finished in 0.00s
Running tests/test_compile_error.rs (target/debug/deps/test_compile_error-0f14bd0c2870d5ee)
running 1 test
Locking 1 package to latest compatible version
Adding pyo3-tests v0.0.0 (/Users/goldbaum/Documents/pyo3/target/tests/trybuild/pyo3)
Compiling pyo3-tests v0.0.0 (/Users/goldbaum/Documents/pyo3/target/tests/trybuild/pyo3)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.37s
test tests/ui/invalid_property_args.rs [should fail to compile] ... mismatch
EXPECTED:
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
error: getter function can only have one argument (of type pyo3::Python)
--> tests/ui/invalid_property_args.rs:9:56
|
9 | fn getter_with_arg(&self, _py: Python<'_>, _index: u32) {}
| ^^^
error: setter function expected to have one argument
--> tests/ui/invalid_property_args.rs:18:8
|
18 | fn setter_with_no_arg(&mut self, _py: Python<'_>) {}
| ^^^^^^^^^^^^^^^^^^
error: setter function can have at most two arguments ([pyo3::Python,] and value)
--> tests/ui/invalid_property_args.rs:24:79
|
24 | fn setter_with_too_many_args(&mut self, _py: Python<'_>, _foo: u32, _bar: u32) {}
| ^^^
error: `get` and `set` with tuple struct fields require `name`
--> tests/ui/invalid_property_args.rs:28:50
|
28 | struct TupleGetterSetterNoName(#[pyo3(get, set)] i32);
| ^^^
error: `get` may only be specified once
--> tests/ui/invalid_property_args.rs:31:32
|
31 | struct MultipleGet(#[pyo3(get, get)] i32);
| ^^^
error: `set` may only be specified once
--> tests/ui/invalid_property_args.rs:34:32
|
34 | struct MultipleSet(#[pyo3(set, set)] i32);
| ^^^
error: `name` may only be specified once
--> tests/ui/invalid_property_args.rs:37:42
|
37 | struct MultipleName(#[pyo3(name = "foo", name = "bar")] i32);
| ^^^^
error: `name` is useless without `get` or `set`
--> tests/ui/invalid_property_args.rs:40:33
|
40 | struct NameWithoutGetSet(#[pyo3(name = "value")] i32);
| ^^^^^^^^^^^^^^
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 `IntoPyObject<'_>` is not implemented for `PhantomData<i32>`, which is required by `for<'py> PhantomData<i32>: PyO3GetField<'py>`
= note: implement `IntoPyObject` for `&PhantomData<i32>` or `IntoPyObject + Clone` for `PhantomData<i32>` to define the conversion
= note: required for `PhantomData<i32>` to implement `for<'py> PyO3GetField<'py>`
note: required by a bound in `PyClassGetterGenerator::<ClassT, FieldT, Offset, false, false, false, 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
...
| for<'py> FieldT: PyO3GetField<'py>,
| ^^^^^^^^^^^^^^^^^ required by this bound in `PyClassGetterGenerator::<ClassT, FieldT, Offset, false, false, false, false, false>::generate`
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
ACTUAL OUTPUT:
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
error: getter function can only have one argument (of type pyo3::Python)
--> tests/ui/invalid_property_args.rs:9:56
|
9 | fn getter_with_arg(&self, _py: Python<'_>, _index: u32) {}
| ^^^
error: setter function expected to have one argument
--> tests/ui/invalid_property_args.rs:18:8
|
18 | fn setter_with_no_arg(&mut self, _py: Python<'_>) {}
| ^^^^^^^^^^^^^^^^^^
error: setter function can have at most two arguments ([pyo3::Python,] and value)
--> tests/ui/invalid_property_args.rs:24:79
|
24 | fn setter_with_too_many_args(&mut self, _py: Python<'_>, _foo: u32, _bar: u32) {}
| ^^^
error: `get` and `set` with tuple struct fields require `name`
--> tests/ui/invalid_property_args.rs:28:50
|
28 | struct TupleGetterSetterNoName(#[pyo3(get, set)] i32);
| ^^^
error: `get` may only be specified once
--> tests/ui/invalid_property_args.rs:31:32
|
31 | struct MultipleGet(#[pyo3(get, get)] i32);
| ^^^
error: `set` may only be specified once
--> tests/ui/invalid_property_args.rs:34:32
|
34 | struct MultipleSet(#[pyo3(set, set)] i32);
| ^^^
error: `name` may only be specified once
--> tests/ui/invalid_property_args.rs:37:42
|
37 | struct MultipleName(#[pyo3(name = "foo", name = "bar")] i32);
| ^^^^
error: `name` is useless without `get` or `set`
--> tests/ui/invalid_property_args.rs:40:33
|
40 | struct NameWithoutGetSet(#[pyo3(name = "value")] i32);
| ^^^^^^^^^^^^^^
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 `IntoPyObject<'_>` is not implemented for `PhantomData<i32>`, which is required by `for<'py> PhantomData<i32>: PyO3GetField<'py>`
= note: implement `IntoPyObject` for `&PhantomData<i32>` or `IntoPyObject + Clone` for `PhantomData<i32>` to define the conversion
= help: the following other types implement trait `IntoPyObject<'py>`:
&&str
&'a BTreeMap<K, V>
&'a BTreeSet<K>
&'a Cell<T>
&'a HashMap<K, V, H>
&'a HashSet<K, H>
&'a Option<T>
&'a Py<T>
and $N others
= note: required for `PhantomData<i32>` to implement `for<'py> PyO3GetField<'py>`
note: required by a bound in `PyClassGetterGenerator::<ClassT, FieldT, Offset, false, false, false, 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
...
| for<'py> FieldT: PyO3GetField<'py>,
| ^^^^^^^^^^^^^^^^^ required by this bound in `PyClassGetterGenerator::<ClassT, FieldT, Offset, false, false, false, false, false>::generate`
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
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_proto_pymethods.rs [should fail to compile] ... ok
test tests/ui/invalid_pyclass_args.rs [should fail to compile] ... ok
test tests/ui/invalid_pyclass_enum.rs [should fail to compile] ... ok
test tests/ui/invalid_pyclass_item.rs [should fail to compile] ... ok
test tests/ui/invalid_pyfunction_signatures.rs [should fail to compile] ... ok
test tests/ui/invalid_pyfunction_definition.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/reject_generics.rs [should fail to compile] ... ok
test tests/ui/deprecations.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_argument_attributes.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] ... mismatch
EXPECTED:
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
error: Python functions cannot have generic type parameters
--> tests/ui/invalid_pyfunctions.rs:5:21
|
5 | fn generic_function<T>(_value: T) {}
| ^
error: Python functions cannot have `impl Trait` arguments
--> tests/ui/invalid_pyfunctions.rs:8:37
|
8 | fn impl_trait_function(_impl_trait: impl AsRef<PyAny>) {}
| ^^^^
error: wildcard argument names are not supported
--> tests/ui/invalid_pyfunctions.rs:11:22
|
11 | fn wildcard_argument(_: i32) {}
| ^
error: destructuring in arguments is not supported
--> tests/ui/invalid_pyfunctions.rs:14:26
|
14 | 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:17:63
|
17 | fn function_with_required_after_option(_opt: Option<i32>, _x: i32) {}
| ^^^
error: args cannot be optional
--> tests/ui/invalid_pyfunctions.rs:21:32
|
21 | fn function_with_optional_args(args: Option<Bound<'_, PyTuple>>) {
| ^^^^
error: kwargs must be Option<_>
--> tests/ui/invalid_pyfunctions.rs:27:34
|
27 | fn function_with_required_kwargs(kwargs: Bound<'_, PyDict>) {
| ^^^^^^
error: expected `&PyModule` or `Py<PyModule>` as first argument with `pass_module`
--> tests/ui/invalid_pyfunctions.rs:32:37
|
32 | fn pass_module_but_no_arguments<'py>() {}
| ^^
error[E0277]: the trait bound `&str: From<BoundRef<'_, '_, pyo3::types::PyModule>>` is not satisfied
--> tests/ui/invalid_pyfunctions.rs:36:14
|
36 | _string: &str,
| ^ the trait `From<BoundRef<'_, '_, pyo3::types::PyModule>>` is not implemented for `&str`, which is required by `BoundRef<'_, '_, pyo3::types::PyModule>: Into<_>`
|
= help: the following other types implement trait `From<T>`:
<String as From<&String>>
<String as From<&mut str>>
<String as From<&str>>
<String as From<Box<str>>>
<String as From<Cow<'a, str>>>
<String as From<char>>
= note: required for `BoundRef<'_, '_, pyo3::types::PyModule>` to implement `Into<&str>`
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
ACTUAL OUTPUT:
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
error: Python functions cannot have generic type parameters
--> tests/ui/invalid_pyfunctions.rs:5:21
|
5 | fn generic_function<T>(_value: T) {}
| ^
error: Python functions cannot have `impl Trait` arguments
--> tests/ui/invalid_pyfunctions.rs:8:37
|
8 | fn impl_trait_function(_impl_trait: impl AsRef<PyAny>) {}
| ^^^^
error: wildcard argument names are not supported
--> tests/ui/invalid_pyfunctions.rs:11:22
|
11 | fn wildcard_argument(_: i32) {}
| ^
error: destructuring in arguments is not supported
--> tests/ui/invalid_pyfunctions.rs:14:26
|
14 | 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:17:63
|
17 | fn function_with_required_after_option(_opt: Option<i32>, _x: i32) {}
| ^^^
error: args cannot be optional
--> tests/ui/invalid_pyfunctions.rs:21:32
|
21 | fn function_with_optional_args(args: Option<Bound<'_, PyTuple>>) {
| ^^^^
error: kwargs must be Option<_>
--> tests/ui/invalid_pyfunctions.rs:27:34
|
27 | fn function_with_required_kwargs(kwargs: Bound<'_, PyDict>) {
| ^^^^^^
error: expected `&PyModule` or `Py<PyModule>` as first argument with `pass_module`
--> tests/ui/invalid_pyfunctions.rs:32:37
|
32 | fn pass_module_but_no_arguments<'py>() {}
| ^^
error[E0277]: the trait bound `&str: From<BoundRef<'_, '_, pyo3::types::PyModule>>` is not satisfied
--> tests/ui/invalid_pyfunctions.rs:36:14
|
36 | _string: &str,
| ^ the trait `From<BoundRef<'_, '_, pyo3::types::PyModule>>` is not implemented for `&str`, which is required by `BoundRef<'_, '_, pyo3::types::PyModule>: Into<_>`
|
= help: the following other types implement trait `From<T>`:
`String` implements `From<&String>`
`String` implements `From<&mut str>`
`String` implements `From<&str>`
`String` implements `From<Box<str>>`
`String` implements `From<Cow<'a, str>>`
`String` implements `From<char>`
= note: required for `BoundRef<'_, '_, pyo3::types::PyModule>` to implement `Into<&str>`
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
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_pymethods.rs [should fail to compile] ... mismatch
EXPECTED:
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
error: #[classattr] can only have one argument (of type pyo3::Python)
--> tests/ui/invalid_pymethods.rs:9:35
|
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() {}
| ^^
error: unexpected receiver
--> tests/ui/invalid_pymethods.rs:26:35
|
26 | fn staticmethod_with_receiver(&self) {}
| ^
error: Expected `&Bound<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 `&Bound<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
|
66 | fn text_signature_on_call() {}
| ^^
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 = ())]
| ^^^^^^^^^
error: `signature` not allowed with `setter`
--> tests/ui/invalid_pymethods.rs:113:12
|
113 | #[pyo3(signature = ())]
| ^^^^^^^^^
error: `signature` not allowed with `classattr`
--> tests/ui/invalid_pymethods.rs:120:12
|
120 | #[pyo3(signature = ())]
| ^^^^^^^^^
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:49
|
172 | fn impl_trait_method_first_arg(_impl_trait: impl AsRef<PyAny>) {}
| ^^^^
error: Python functions cannot have `impl Trait` arguments
--> tests/ui/invalid_pymethods.rs:177:57
|
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)]
| ^^^^^^^^^^^
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<BoundRef<'_, '_, PyType>>` is not satisfied
--> tests/ui/invalid_pymethods.rs:46:45
|
46 | fn classmethod_wrong_first_argument(_x: i32) -> Self {
| ^^^ the trait `From<BoundRef<'_, '_, PyType>>` is not implemented for `i32`, which is required by `BoundRef<'_, '_, PyType>: Into<_>`
|
= help: the following other types implement trait `From<T>`:
<i32 as From<bool>>
<i32 as From<i16>>
<i32 as From<i8>>
<i32 as From<u16>>
<i32 as From<u8>>
= note: required for `BoundRef<'_, '_, PyType>` to implement `Into<i32>`
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
ACTUAL OUTPUT:
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
error: #[classattr] can only have one argument (of type pyo3::Python)
--> tests/ui/invalid_pymethods.rs:9:35
|
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() {}
| ^^
error: unexpected receiver
--> tests/ui/invalid_pymethods.rs:26:35
|
26 | fn staticmethod_with_receiver(&self) {}
| ^
error: Expected `&Bound<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 `&Bound<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
|
66 | fn text_signature_on_call() {}
| ^^
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 = ())]
| ^^^^^^^^^
error: `signature` not allowed with `setter`
--> tests/ui/invalid_pymethods.rs:113:12
|
113 | #[pyo3(signature = ())]
| ^^^^^^^^^
error: `signature` not allowed with `classattr`
--> tests/ui/invalid_pymethods.rs:120:12
|
120 | #[pyo3(signature = ())]
| ^^^^^^^^^
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:49
|
172 | fn impl_trait_method_first_arg(_impl_trait: impl AsRef<PyAny>) {}
| ^^^^
error: Python functions cannot have `impl Trait` arguments
--> tests/ui/invalid_pymethods.rs:177:57
|
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)]
| ^^^^^^^^^^^
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<BoundRef<'_, '_, PyType>>` is not satisfied
--> tests/ui/invalid_pymethods.rs:46:45
|
46 | fn classmethod_wrong_first_argument(_x: i32) -> Self {
| ^^^ the trait `From<BoundRef<'_, '_, PyType>>` is not implemented for `i32`, which is required by `BoundRef<'_, '_, PyType>: Into<_>`
|
= help: the following other types implement trait `From<T>`:
`i32` implements `From<bool>`
`i32` implements `From<i16>`
`i32` implements `From<i8>`
`i32` implements `From<u16>`
`i32` implements `From<u8>`
= note: required for `BoundRef<'_, '_, PyType>` to implement `Into<i32>`
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
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_intern_arg.rs [should fail to compile] ... mismatch
EXPECTED:
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
error[E0435]: attempt to use a non-constant value in a constant
--> tests/ui/invalid_intern_arg.rs:5:55
|
5 | Python::with_gil(|py| py.import(pyo3::intern!(py, _foo)).unwrap());
| ------------------^^^^-
| | |
| | non-constant value
| help: consider using `let` instead of `static`: `let INTERNED`
error: lifetime may not live long enough
--> tests/ui/invalid_intern_arg.rs:5:27
|
5 | Python::with_gil(|py| py.import(pyo3::intern!(py, _foo)).unwrap());
| --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2`
| | |
| | return type of closure is pyo3::Bound<'2, PyModule>
| has type `Python<'1>`
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
ACTUAL OUTPUT:
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
error[E0435]: attempt to use a non-constant value in a constant
--> tests/ui/invalid_intern_arg.rs:5:55
|
5 | Python::with_gil(|py| py.import(pyo3::intern!(py, _foo)).unwrap());
| ^^^^ non-constant value
|
help: consider using `let` instead of `static`
--> src/sync.rs
|
| let INTERNED: $crate::sync::Interned = $crate::sync::Interned::new($text);
| ~~~
error: lifetime may not live long enough
--> tests/ui/invalid_intern_arg.rs:5:27
|
5 | Python::with_gil(|py| py.import(pyo3::intern!(py, _foo)).unwrap());
| --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2`
| | |
| | return type of closure is pyo3::Bound<'2, PyModule>
| has type `Python<'1>`
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
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_frozen_pyclass_borrow.rs [should fail to compile] ... ok
test tests/ui/invalid_pymethod_receiver.rs [should fail to compile] ... mismatch
EXPECTED:
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
error[E0277]: the trait bound `i32: TryFrom<BoundRef<'_, '_, MyClass>>` is not satisfied
--> tests/ui/invalid_pymethod_receiver.rs:8:44
|
8 | fn method_with_invalid_self_type(_slf: i32, _py: Python<'_>, _index: u32) {}
| ^^^ the trait `From<BoundRef<'_, '_, MyClass>>` is not implemented for `i32`, which is required by `i32: TryFrom<BoundRef<'_, '_, MyClass>>`
|
= help: the following other types implement trait `From<T>`:
<i32 as From<bool>>
<i32 as From<i16>>
<i32 as From<i8>>
<i32 as From<u16>>
<i32 as From<u8>>
= note: required for `BoundRef<'_, '_, MyClass>` to implement `Into<i32>`
= note: required for `i32` to implement `TryFrom<BoundRef<'_, '_, MyClass>>`
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
ACTUAL OUTPUT:
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
error[E0277]: the trait bound `i32: TryFrom<BoundRef<'_, '_, MyClass>>` is not satisfied
--> tests/ui/invalid_pymethod_receiver.rs:8:44
|
8 | fn method_with_invalid_self_type(_slf: i32, _py: Python<'_>, _index: u32) {}
| ^^^ the trait `From<BoundRef<'_, '_, MyClass>>` is not implemented for `i32`, which is required by `i32: TryFrom<BoundRef<'_, '_, MyClass>>`
|
= help: the following other types implement trait `From<T>`:
`i32` implements `From<bool>`
`i32` implements `From<i16>`
`i32` implements `From<i8>`
`i32` implements `From<u16>`
`i32` implements `From<u8>`
= note: required for `BoundRef<'_, '_, MyClass>` to implement `Into<i32>`
= note: required for `i32` to implement `TryFrom<BoundRef<'_, '_, MyClass>>`
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
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/missing_intopy.rs [should fail to compile] ... ok
test tests/ui/invalid_result_conversion.rs [should fail to compile] ... mismatch
EXPECTED:
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
error[E0277]: the trait bound `PyErr: From<MyError>` is not satisfied
--> tests/ui/invalid_result_conversion.rs:22:25
|
22 | fn should_not_work() -> Result<(), MyError> {
| ^^^^^^ the trait `From<MyError>` is not implemented for `PyErr`, which is required by `MyError: Into<PyErr>`
|
= help: the following other types implement trait `From<T>`:
<PyErr as From<AddrParseError>>
<PyErr as From<DecodeUtf16Error>>
<PyErr as From<DowncastError<'_, '_>>>
<PyErr as From<DowncastIntoError<'_>>>
<PyErr as From<FromUtf16Error>>
<PyErr as From<FromUtf8Error>>
<PyErr as From<Infallible>>
<PyErr as From<IntoInnerError<W>>>
and $N others
= note: required for `MyError` to implement `Into<PyErr>`
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
ACTUAL OUTPUT:
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
error[E0277]: the trait bound `PyErr: From<MyError>` is not satisfied
--> tests/ui/invalid_result_conversion.rs:22:25
|
22 | fn should_not_work() -> Result<(), MyError> {
| ^^^^^^ the trait `From<MyError>` is not implemented for `PyErr`, which is required by `MyError: Into<PyErr>`
|
= help: the following other types implement trait `From<T>`:
`PyErr` implements `From<AddrParseError>`
`PyErr` implements `From<DecodeUtf16Error>`
`PyErr` implements `From<DowncastError<'_, '_>>`
`PyErr` implements `From<DowncastIntoError<'_>>`
`PyErr` implements `From<FromUtf16Error>`
`PyErr` implements `From<FromUtf8Error>`
`PyErr` implements `From<Infallible>`
`PyErr` implements `From<IntoInnerError<W>>`
and $N others
= note: required for `MyError` to implement `Into<PyErr>`
┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈
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/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/duplicate_pymodule_submodule.rs [should fail to compile] ... ok
test tests/ui/invalid_base_class.rs [should fail to compile] ... ok
test test_compile_errors ... FAILED
failures:
---- test_compile_errors stdout ----
thread 'test_compile_errors' panicked at /Users/goldbaum/.cargo/registry/src/index.crates.io-6f17d22bba15001f/trybuild-1.0.99/src/run.rs:101:13:
6 of 37 tests failed
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Metadata
Metadata
Assignees
Labels
No labels