You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While working on the str implementation for pyclass, I found that eq for pyclass for structs had a hygiene issue. I created a test in the pyclass hygiene tests to cover this scenario and it passes. I noticed that complex and tuple enums do not have any tests for hygiene, so I added them, but am struggling to get them to fully pass.
Steps to Reproduce
Add the following test cases to src/tests/hygiene/pyclass.rs:
Errors were of the type:
error: cannot find macro `unreachable`in this scope
--> src/tests/hygiene/pyclass.rs:79:1
|
79 |#[crate::pyclass()]| ^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the attribute macro `crate::pyclass` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider importing one of these items
|
1 + use core::unreachable;|
1 + use std::unreachable;|
error[E0423]: expected value, found enum `std::result::Result`
--> src/tests/hygiene/pyclass.rs:79:1
|
79 |#[crate::pyclass()]| ^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the attribute macro `crate::pyclass` (in Nightly builds, run with -Z macro-backtrace for more info)
help: the following enum variants are available
|
79 | (std::result::Result::Err(/* fields */))
|
79 | (std::result::Result::Ok(/* fields */))
I am now encountering the following errors for my enum test cases that I'm not quite sure how to resolve:
error[E0599]: no function or associated item named `from` found for struct `pyclass_init::PyClassInitializer` in the current scope
--> src/tests/hygiene/pyclass.rs:87:1
|
87 | #[crate::pyclass(eq, ord)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `PyClassInitializer<_>`
|
::: src/pyclass_init.rs:136:1
|
136 | pub struct PyClassInitializer<T: PyClass>(PyClassInitializerImpl<T>);
| ----------------------------------------- function or associated item `from` not found for this struct
|
note: if you're trying to build a new `pyclass_init::PyClassInitializer<_>`, consider using `pyclass_init::PyClassInitializer::<T>::new` which returns `pyclass_init::PyClassInitializer<_>`
--> src/pyclass_init.rs:150:5
|
150 | pub fn new(init: T, super_init: <T::BaseType as PyClassBaseType>::Initializer) -> Self {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: items from traits can only be used if the trait is in scope
= note: this error originates in the attribute macro `crate::pyclass` (in Nightly builds, run with -Z macro-backtrace for more info)
help: trait `From` which provides `from` is implemented but not in scope; perhaps you want to import it
|
1 + use std::convert::From;
|
help: there is an associated function `try_from` with a similar name
|
87 | try_from
|
error[E0599]: no method named `clone` found for reference `&u32` in the current scope
--> src/tests/hygiene/pyclass.rs:87:1
|
87 | #[crate::pyclass(eq, ord)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: items from traits can only be used if the trait is in scope
help: there is a method `clone_from` with a similar name, but with different arguments
--> /var/home/zyell/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/clone.rs:169:5
|
169 | fn clone_from(&mut self, source: &Self) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the attribute macro `crate::pyclass` (in Nightly builds, run with -Z macro-backtrace for more info)
help: trait `Clone` which provides `clone` is implemented but not in scope; perhaps you want to import it
|
1 + use std::clone::Clone;
|
### Your operating system and version
Bluefin fedora 40
### Your Python version (`python --version`)
3.12.4
### Your Rust version (`rustc --version`)
1.79.0
### Your PyO3 version
main
### How did you install python? Did you use a virtualenv?
virtualenv
### Additional Info
_No response_
The text was updated successfully, but these errors were encountered:
Bug Description
While working on the
str
implementation for pyclass, I found thateq
for pyclass for structs had a hygiene issue. I created a test in the pyclass hygiene tests to cover this scenario and it passes. I noticed that complex and tuple enums do not have any tests for hygiene, so I added them, but am struggling to get them to fully pass.Steps to Reproduce
Backtrace
I am now encountering the following errors for my enum test cases that I'm not quite sure how to resolve:
The text was updated successfully, but these errors were encountered: