Skip to content
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

Catalog and catch the main proc macro usage error #212

Merged
merged 3 commits into from
Jan 12, 2025

Conversation

AS1100K
Copy link
Contributor

@AS1100K AS1100K commented Jan 10, 2025

Fixes #154

This PR also makes error with RON files much helpful as it not shows, where the error. The following is the error message generated with mistake in RON file

error: proc macro panicked
 --> examples/cu_caterpillar/src/logreader.rs:4:1
  |
4 | gen_cumsgs!("copperconfig.ron");
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = help: message: Syntax Error in config: Expected string at position 4:17

@gbin
Copy link
Collaborator

gbin commented Jan 10, 2025

Oh yes way better!

Can you add some unit tests so we can see what types of errors it catches?

Thanks

@AS1100K AS1100K changed the title Catalog and catch the main proc macro usage error WIP Catalog and catch the main proc macro usage error Jan 11, 2025
@AS1100K
Copy link
Contributor Author

AS1100K commented Jan 11, 2025

I have added catalog of error which came to my mind and added them in tests/compile_fail directory.

Also, currently the error in the RON file is shown with line and column position only when it is an syntax error and in order to identify that a certain type exists in the RON file and in the crate would be much difficult but is possible by validating RON file in build.rs, atm I am thinking of using rustdoc-json could address this. But I believe this would be too much.

@gbin What are you thoughts on this PR?

@AS1100K AS1100K changed the title WIP Catalog and catch the main proc macro usage error Catalog and catch the main proc macro usage error Jan 11, 2025
@gbin
Copy link
Collaborator

gbin commented Jan 12, 2025

@AS1100K this is awesome! We will see if the users encounter new cases but this is a really good start.

@gbin gbin merged commit 29f3b9c into copper-project:master Jan 12, 2025
1 of 3 checks passed
@AS1100K AS1100K deleted the issue-154 branch January 12, 2025 03:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Catalog and catch the main proc macro usage error before it blows up in the compilation of the macro
2 participants