-
-
Notifications
You must be signed in to change notification settings - Fork 123
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
Zero length span #356
Open
Nahor
wants to merge
6
commits into
zkat:main
Choose a base branch
from
Nahor:zero_length_no_context
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Zero length span #356
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6f8fbf8
refactor(get_lines): Simplify `get_lines`
Nahor a37328a
refactor(span): Simplify checks how a span applies on a line
Nahor f7fa50d
fix(SourceCode): Fix and improve default `SourceCode` implementation
Nahor d63b2bb
fix(zero length, no context): Add Option to distinguish between "curr…
Nahor d0c1143
fix(miri): remove or mark as dead_code unused internal structs
Nahor c7cbb07
fix(zero length): Improve rendering for zero-length error spans
Nahor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wasn't all this here for a reason? I'm nervous about this change cause it touches the code that was taken from anyhow, which I honestly don't fully understand, and does some Weird Things with pointers and types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know either but I couldn't find any mention of
DisplayError
in the whole Miette history except for adding the struct and its impl. It is not public outside of the crate either (and thus the Miri error), unlike the one inanyhow
. So I don't know how/where it could be useful and figured deleting it was the best option.If you don't agree, I can easily change that to
dead_code
instead.(and if so, does your comment apply to
NoneError
as well? I couldn't find it inanyhow
's code, so I'm not sure if it does)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional info: if I understand correctly,
DisplayError
in Anyhow (and Eyre, which also has aDisplayError
but private to the crate, like Miette and unlike Anyhow, where its public) is used to convert anOption<T>
to aResult<T>
. Miette does not have such a feature.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 more points, in Eyre:
DisplayError
seems to only be used for compatibility with Anyhow (viaContextCompat
). For the pure Eyre (ok_or_eyre
), theOption
->Result
usesMessageError
instead (which is also not available in Miette).NoneError
, it is in Eyre and used along sideDisplayError
, for the same Option-to-Result in thatContextCompat
.DisplayError
/NoneError
if I removeContextCompat
there (and does not complain otherwise of course)So at this point, I'm 99% sure that it's safe to remove. And I believe I can remove an extra line of code related to that Option conversion.