-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Can't unit test procedural macros #110247
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
Labels
Comments
Procedural macros are essentially compiler plugins, and need to be compiled before they're used. As the error says, it can't us used within the crate it's defined in. You can instead define your tests in |
I get it now. I would have thought that the devs would put effort into making code easier for this. |
I've opend a PR to note a suggestion for tests |
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Apr 23, 2023
…jackh726 Suggest using integration tests for test crate using own proc-macro cc rust-lang#110247
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Apr 24, 2023
…jackh726 Suggest using integration tests for test crate using own proc-macro cc rust-lang#110247
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Apr 24, 2023
…jackh726 Suggest using integration tests for test crate using own proc-macro cc rust-lang#110247
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
I have this test:
The
str2code
macro is a procedural macro that I made.It gives this error:
Why does the compiler not let me test my macros and why does this exist?
The text was updated successfully, but these errors were encountered: