-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
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
Spurious macro errors during development #327
Comments
Guess it has to do with this:
https://davidcole1340.github.io/ext-php-rs/macros/index.html Have the same error, but only sometimes. A little luck is involved getting stuff to execute in the correct order (or thats my guess at least). |
While the magic is nice when it works, for me my editor is full of errors basically most of the time, unless I restart rust analyzer. Do you use rust analyzer? I looked into the API to see where there's a "no magic" way to do this, but I don't see yet how to register things by hand. I think it would be helpful to have a "less magic" mode where there's a high level way to register classes and functions. |
I am using rust analyzer as well. Both fixing the magic and a no magic way would be great. |
Besides analyzer errors I am now also getting errors like this:
I'm not sure whether it's related. Yesterday when I got it I thought I fixed it by moving the SequenceIterator registration above the Sequence definition, but today with additional changes, I'm getting this error more consistently. If I can't fix this reliably and this is indeed due to auto-registration order issues then this is a bigger problem than just the analyzer being flaky. I'm going to do some digging. [edit] Changing the order of the Rust code wildly some more and recompiling again fixed it. For now. So I think this is due to the order of registration somehow. But obviously this isn't great. [edit 2] Now spun off into #328 |
An interesting note from the docs:
It's odd then that we are getting these interactions. |
During development in VS Code with Rust analyzer, even if the build succeeds, I still get a lot of spurious errors in my editor:
"The
#[php_module]macro must be called last to ensure functions and classes are registered.
Impls must be declared before you declare your startup function and module function
These go away once I restart Rust analyzer, but appear again as soon as I make any edits. This makes for an uncomfortable development experience, especially given that the build options ext-php-rs requires also seem to make cargo recompile a lot more than usual.
Does anyone else see these errors? Is there a way to fix this? I assume something is going wrong with the order in which macros are executed, and that somehow the
#[php_module]
macro is executed too early under some conditions.The text was updated successfully, but these errors were encountered: