shared: switch to structured error handling#454
Merged
BurntSushi merged 6 commits intomasterfrom Dec 20, 2025
Merged
Conversation
c582184 to
ed682ab
Compare
For this one, I defined the error type inline with it. This just felt right and it does stay reasonably encapsulated. I'll probably swing back and do the same for the time range error type?
ed682ab to
0baf046
Compare
I guess parsing a POSIX time zone doesn't actually require `alloc` any more. That's cool.
I believe this reduces code size.
This follows the pattern I used for TZif and POSIX time zone parsing.
0baf046 to
70e2160
Compare
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.
This completes the work started in #453 by switching everything in
jiff::sharedto structured error handling. This module is somewhatspecial in that it is "shared" with
jiff-static.As a result,
jiff::sharedhad its own special bare bones errortype that didn't build a dynamic chain internally (which is what
jiff::Errordoes, similar toanyhow::Error). It has now beenreplaced with structured errors entirely and no dynamic chains. I did
this because I didn't feel like rebuilding the chaining functionality
(or moving it into
shared), and because it didn't seem that onerousof a task.
But doing it this way did make it clear to me that the chaining in
jiff::Erroris letting us avoid a lot of tedium. Without the dynamicchaining, you wind up needing to define many more error types in order
to preserve decent contextualized error messages. It's quite annoying,
but doable at a small scale.
This does shrink LLVM lines in my Biff benchmark even more. Before this
PR, we were at 756,177 lines. After this PR, we are at 753,960. Nice!
In terms of compile times, it seems there isn't much of a change. Before
this PR:
And after:
Which is somewhat disappointing.