Decode macro variable name clashes
Closed this issue · 1 comments
nberrington-cloudian commented
I have a struct with a field name called tag
that caused a compile error in the musli::Decode
macro.
This is because the generated code also uses a variable called tag
to decode field tags, shadowing the tag
variable used to hold the decoded field contents.
I suggest the mutable field variables should have something like a field_
prefix to disambiguate them from the variables used by the decode function.
Happy to submit a PR if you're in agreement.
udoprog commented
Yeah, I agree. The variable names should probably go through the ident
method which exists exactly for this reason.
Feel free to make a PR!