update attr macro to use argument names where trivial #594
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.
Closes #592
Note for reviewers: 1750 lines of diff comes from the inclusion of a new snapshot file. It's otherwise quite a small PR.
The generated struct will now use the name of an argument if the pattern of the argument is an identifier. For example, given this failing test:
We now get an error like:
There are two possible improvements (that I can think of off the top of my head right now) here:
single parameter, for example, we could capture this argument as
s:example
(a, b): (i32, i32)could correspond to a struct fieldtuple_of_a_b: (i32, i32).Of these, the second option is a lot easier to implement, though it could get nasty with nested patterns (e.g.
tuple_of_tuple_of_tuple_of...).For now I'm going to get this minimal implementation in though.