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
When placed inside of a macro code that compiles outside of the macro no longer compiles. The bug seems to be specifically around returning an instance of another pyclass from a method on another.
error[E0425]: cannot find value `py`in this scope
--> src/lib.rs:20:23
|
20 | impl_repro!(MyClass1, MyClass2);| ^^^^^^^^ not found in this scope
error[E0425]: cannot find value `ret`in this scope
--> src/lib.rs:20:23
|
20 | impl_repro!(MyClass1, MyClass2);| ^^^^^^^^ not found in this scope
### Your operating system and version
Arch Linux (kernel version 6.9.9)
### Your Python version (`python --version`)
Python 3.12.4
### Your Rust version (`rustc --version`)
rustc 1.80.0 (051478957 2024-07-21)
### Your PyO3 version
0.20.0
### How did you install python? Did you use a virtualenv?
python is installed via pacman
maturin is installed in a venv:
python -m venv .env
source .env/bin/activate
pip install maturin
### Additional Info
The original context for this is effectively attempting to get around the no-generics for pyclasses by templating out an implementation for a set of XOF functions where each hasher has a "Shaker" which absorbs data in and a "Sponge" which produces data, and you must finalize a Shaker to get a Sponge so I want to have finalize reset the state of the Shaker and return a Sponge object.
The text was updated successfully, but these errors were encountered:
I can't reproduce that on 0.20 (or 0.21), but I do see it on 0.22. (Did you perhaps mistype the version?)
The 0.22 case that I could reproduce is a tricky one 😅. It seems like this was introduced by #4220, which improved some error messages by changing the Spans of our generated code. Together with macro_rules hygiene these now seem to get different syntax contexts attached, which makes them different from the compilers perspective in this specific context. PR fixing will follow shortly.
Bug Description
When placed inside of a macro code that compiles outside of the macro no longer compiles. The bug seems to be specifically around returning an instance of another pyclass from a method on another.
Steps to Reproduce
Backtrace
The text was updated successfully, but these errors were encountered: