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

Update proc macros to syn v2 #2063

Merged
merged 8 commits into from
Mar 21, 2024
Merged

Update proc macros to syn v2 #2063

merged 8 commits into from
Mar 21, 2024

Conversation

aumetra
Copy link
Member

@aumetra aumetra commented Mar 21, 2024

This PR updates all the proc-macro crates to syn v2 and improves the error messages while I was already at it!
Previously error handling was handled with simple panic!s which makes for rather ugly error messages since they don't include spans.

This update uses the manyhow crate to bring anyhow-like error handling into the proc-macros and produce pretty error messages that point to the exact source of the issue.

Before:

image

After:

image

@aumetra aumetra requested a review from uint March 21, 2024 13:18
Copy link
Contributor

@uint uint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, great. The move toward nicer error handling is a huge 👍, and I'm sure contract devs will appreciate the better messages. The refactoring and code deduplication are also good.

I'm a bit apprehensive about the added deps. Details below!

packages/schema-derive/src/query_responses.rs Outdated Show resolved Hide resolved
packages/derive/src/lib.rs Show resolved Hide resolved
packages/schema-derive/Cargo.toml Outdated Show resolved Hide resolved
@aumetra aumetra requested a review from uint March 21, 2024 15:18
Copy link
Contributor

@uint uint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@uint
Copy link
Contributor

uint commented Mar 21, 2024

output

@aumetra aumetra merged commit 1d06b23 into main Mar 21, 2024
27 checks passed
@aumetra aumetra deleted the aw/syn-v2 branch March 21, 2024 16:11
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.

2 participants