We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#[pyproto]
0.11.1
This sample code looks correct according to lifetime elision rules:
#[pyproto] impl PyIterProtocol for Foo { fn __iter__(slf: PyRef<Self>) -> PyRef<Self> { slf } }
But it doesn't compile successfully:
error[E0106]: missing lifetime specifier --> src/main.rs:26:44 | 26 | fn __iter__(slf: PyRef<Self>) -> PyRef<Self> { | ^ expected named lifetime parameter | help: consider using the `'p` lifetime | 26 | fn __iter__(slf: PyRef<Self>) -> PyRef<'p, Self> { | ^^^ error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'p` due to conflicting requirements --> src/main.rs:26:50 | 26 | fn __iter__(slf: PyRef<Self>) -> PyRef<Self> { | __________________________________________________^ 27 | | slf 28 | | } | |_____^ | note: first, the lifetime cannot outlive the lifetime `'p` as defined on the impl at 24:1... --> src/main.rs:24:1 | 24 | #[pyproto] | ^^^^^^^^^^ note: ...so that the types are compatible --> src/main.rs:26:50 | 26 | fn __iter__(slf: PyRef<Self>) -> PyRef<Self> { | __________________________________________________^ 27 | | slf 28 | | } | |_____^ = note: expected `pyo3::class::iter::PyIterIterProtocol<'p>` found `pyo3::class::iter::PyIterIterProtocol<'_>` = note: but, the lifetime must be valid for the static lifetime... note: ...so that the expression is assignable --> src/main.rs:27:9 | 27 | slf | ^^^ = note: expected `pyo3::pycell::PyRef<'static, _>` found `pyo3::pycell::PyRef<'_, _>` = note: this error originates in an attribute macro (in Nightly builds, run with - Z macro-backtrace for more info)
It might be nice to adjust the pyproto proc macro so that this works.
pyproto
The text was updated successfully, but these errors were encountered:
This got resolved in #1093
Sorry, something went wrong.
No branches or pull requests
🐛 Bug Reports
🌍 Environment
0.11.1
💥 Reproducing
This sample code looks correct according to lifetime elision rules:
But it doesn't compile successfully:
It might be nice to adjust the
pyproto
proc macro so that this works.The text was updated successfully, but these errors were encountered: