derive: make error messages slightly more readable, add manually-driven test #133
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 a bit of #129.
Using a fully-fledged compile-error testsuite is a bit overkill, but we still want to make sure that the
derive
crate generates reasonable error messages. That's what this "example" is for. In the following, there are blocks of lines, one marked as POSITIVE and multiple lines marked as NEGATIVE. The committed version of this file should only contain POSITIVE. In order to run a test, comment out the POSITIVE line, and use a NEGATIVE line instead, and manually check whether you see a reasonable error message – ideally the error message indicated by the comment. One way to do this is:Example output with the type that I did in #129:
It's not a particularly nice error message, but it's more readable than the current
called `Option::unwrap()` on a `None` value
.