-
Notifications
You must be signed in to change notification settings - Fork 202
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
Migrate out from proc macro error #920
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
juhaku
force-pushed
the
chore-migrate-off-proc-macro-error
branch
4 times, most recently
from
May 13, 2024 19:40
e222c59
to
ae687f4
Compare
juhaku
changed the title
Wip migrate out from proc macro error
Migrate out from proc macro error
May 13, 2024
juhaku
force-pushed
the
chore-migrate-off-proc-macro-error
branch
from
May 14, 2024 14:07
ae687f4
to
b4702a1
Compare
juhaku
force-pushed
the
chore-migrate-off-proc-macro-error
branch
2 times, most recently
from
May 14, 2024 14:11
595e078
to
df9ad98
Compare
Implement `Result<T, E>` based proc macro error handling instead of out of fashion `proc_macro_error` that still is in _syn_ `1.0`. This allows us to remove the need for `proc_macro_error` crate and makes our dependency tree leaner. The error handling is implemented with custom `ToTokensDiagnostics` trait that is used instead of the `ToTokens` when there is a possibility for error. Error is passed up in the call stack via `Diagnostics` struct that converts to compile error token stream at root of the macro call. The result based approach is the recommended way of handling compile errors in proc macros. Resolves #854
juhaku
force-pushed
the
chore-migrate-off-proc-macro-error
branch
from
May 14, 2024 15:06
df9ad98
to
733fb18
Compare
juhaku
added a commit
that referenced
this pull request
May 16, 2024
Fix compile error propagation via comprehensive use of `ToTokensDiagnostics` trait. `ToTokensDiagnostics` was introduced in PR #920 to allow error propagation up in the call stack for error reporting. However this initial implementation was too limited which resulted invalid compile errors in case of error. This implementation aims to fix the shortcomings of the initial implementation.
juhaku
added a commit
that referenced
this pull request
May 16, 2024
Fix compile error propagation via comprehensive use of `ToTokensDiagnostics` trait. `ToTokensDiagnostics` was introduced in PR #920 to allow error propagation up in the call stack for error reporting. However this initial implementation was too limited which resulted invalid compile errors in case of error. This implementation aims to fix the shortcomings of the initial implementation.
juhaku
added a commit
that referenced
this pull request
May 16, 2024
Fix compile error propagation via comprehensive use of `ToTokensDiagnostics` trait. `ToTokensDiagnostics` was introduced in PR #920 to allow error propagation up in the call stack for error reporting. However this initial implementation was too limited which resulted invalid compile errors in case of error. This implementation aims to fix the shortcomings of the initial implementation.
juhaku
added a commit
that referenced
this pull request
May 16, 2024
Fix compile error propagation via comprehensive use of `ToTokensDiagnostics` trait. `ToTokensDiagnostics` was introduced in PR #920 to allow error propagation up in the call stack for error reporting. However this initial implementation was too limited which resulted invalid compile errors in case of error. This implementation aims to fix the shortcomings of the initial implementation.
juhaku
added a commit
that referenced
this pull request
May 16, 2024
Fix compile error propagation via comprehensive use of `ToTokensDiagnostics` trait. `ToTokensDiagnostics` was introduced in PR #920 to allow error propagation up in the call stack for error reporting. However this initial implementation was too limited which resulted invalid compile errors in case of error. This implementation aims to fix the shortcomings of the initial implementation. Fixes #927
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implement
Result<T, E>
based proc macro error handling instead of outof fashion
proc_macro_error
that still is in syn1.0
. This allowsus to remove the need for
proc_macro_error
crate and makes ourdependency tree leaner.
The error handling is implemented with custom
ToTokensDiagnostics
traitthat is used instead of the
ToTokens
when there is a possibility forerror. Error is passed up in the call stack via
Diagnostics
structthat converts to compile error token stream at root of the macro call.
The result based approach is the recommended way of handling compile
errors in proc macros.
Resolves #854