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
At the moment our proc-macros are implemented such that they return on the first error they encounter.
I think in some cases it should be possible to collect multiple errors together so that all of these could be reported to the user. For example, the following code:
use pyo3::prelude::*;#[pyclass]structExample{#[pyo3(foo)]x:i32,#[pyo3(blah)]y:i32,}
will at time of writing report compilation errors like the following:
error: expected one of: `get`, `set`, `name`
--> src/lib.rs:5:12
|
5 | #[pyo3(foo)]
| ^^^
error: cannot find attribute `pyo3` in this scope
--> src/lib.rs:7:7
|
7 | #[pyo3(blah)]
| ^^^^
|
= note: `pyo3` is in scope, but it is a crate, not an attribute
This is because as soon as the error on "foo" occurs, the macro stops parsing and so the #[pyo3(blah)] attribute is never consumed.
A better pair of error messages could be the following:
I think I'm unlikely to work on this any time soon myself, but it would be a nice UX improvement if anyone is interested in getting dirty with our proc-macros 😄
The text was updated successfully, but these errors were encountered:
At the moment our proc-macros are implemented such that they return on the first error they encounter.
I think in some cases it should be possible to collect multiple errors together so that all of these could be reported to the user. For example, the following code:
will at time of writing report compilation errors like the following:
This is because as soon as the error on "foo" occurs, the macro stops parsing and so the
#[pyo3(blah)]
attribute is never consumed.A better pair of error messages could be the following:
I think I'm unlikely to work on this any time soon myself, but it would be a nice UX improvement if anyone is interested in getting dirty with our proc-macros 😄
The text was updated successfully, but these errors were encountered: