Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read: improved UnexpectedEof errors #408

Merged
merged 1 commit into from
Mar 14, 2019
Merged

Conversation

philipc
Copy link
Collaborator

@philipc philipc commented Mar 13, 2019

Stores a (hopefully) unique ReaderOffsetId in the error, which can be converted back to a section+offset for display.

This can be expanded to more error variants as needed.

The ReaderOffsetId is a little hacky: for slices it is a cast of the pointer to a u64, but this is only unique if the slice is backed by its own memory allocation. I think this is good enough though? To do better I think we need to add a unique id field to every base reader (but which is preserved by clones), and I'd prefer not to do that just for this. Users can define their own reader which does this if required.

Stores a (hopefully) unique `ReaderOffsetId` in the error, which can
be converted back to a section+offset for display.
@philipc philipc requested a review from fitzgen March 13, 2019 08:28
@coveralls
Copy link

Coverage Status

Coverage increased (+0.5%) to 86.79% when pulling 736c202 on philipc:error-loc into f405ada on gimli-rs:master.

Copy link
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh nice

@philipc philipc merged commit 28f75db into gimli-rs:master Mar 14, 2019
@philipc philipc deleted the error-loc branch March 14, 2019 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants