Repository navigation
Fix hygiene of macro-generated local variable accesses in serde(with) wrappers - #2845
Merged
Merged
Conversation
error[E0424]: expected value, found module `self`
--> test_suite/tests/regression/issue2844.rs:13:19
|
5 | #[derive(Serialize, Deserialize)]
| --------- this function has a `self` parameter, but a macro invocation can only access identifiers it receives from parameters
...
13 | declare_in_macro!("with");
| ^^^^^^ `self` value is a keyword only available in methods with a `self` parameter
error[E0425]: cannot find value `__s` in this scope
--> test_suite/tests/regression/issue2844.rs:13:19
|
13 | declare_in_macro!("with");
| ^^^^^^ not found in this scope
error[E0425]: cannot find value `__deserializer` in this scope
--> test_suite/tests/regression/issue2844.rs:13:19
|
13 | declare_in_macro!("with");
| ^^^^^^ not found in this scope
Mingun
reviewed
Oct 22, 2024
| let (de_impl_generics, de_ty_generics, ty_generics, where_clause) = | ||
| split_with_de_lifetime(params); | ||
| let delife = params.borrowed.de_lifetime(); | ||
| let deserializer_var = quote!(__deserializer); |
Contributor
There was a problem hiding this comment.
I think, it would be useful to explain why this line (and in other similar places) placed in it's own TokenStream so this part was not accidentally optimized (yes, new tests will catch that, but this can create unnecessary friction for developers whos not aware of that problem). Even reference to GitHub issue with very short comment will be enougth
This file contains hidden or 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
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.
Fixes #2844.