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.
Instead of using bitflags, this reimplements the status code struct by hand. Using bitflags has some unfortunate side effects in that it makes the debug implementation completely wrong. Instead of logging the name of the status code, bitflags usually produces a weird mix of other status codes, probably because the different status codes overlap. This is very inconvenient when debugging, as you will often just
unwrap
errors.Instead of using a JS script for codegen, this generates the status code implementation from the CSV inline. While putting the CSV in rust code is slightly inconvenient, it does mean that the code is more self-contained. Implementation wise it is a pair of not-actually-that-hairy macros (no recursion, which is what tends to make these macros hard to work with).
I tried to do this without too many breaking changes, and the effect on the rest of the codebase is minimal. The implementation is now all in a single file, which is manageable because the generated code isn't committed. There are some changes to note:
|
operator is no longer supported, since we're not using bitflags. Instead use the variousset_
methods to set parts of the status code.