-
Notifications
You must be signed in to change notification settings - Fork 544
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
Make ParseErrorKind public and available through ParseError::kind() #588
Conversation
ParseErrorKind has also been made #[non_exhaustive] to avoid committing to only the current set of error kinds, i.e. so that it can be expanded as needed without an SemVer-breaking change.
I find the PR good but I wonder why there is a notion of "kind" involved whereas a synonymous notion is provided by the "type" system. Can't |
Yes, |
Sorry I am still learning Rust... Given that it has been private until now, why would it break? Is it because the ABI of a |
ParseError is already public, and this change simply adds a new method to that existing type. ParseErrorKind was not previously public, which is why it was possible to make it #[non_exhaustive]. If the ParseErrorKind type was already public, that would be a breaking change.
Also, this is not really a venue meant for general Rust questions. I’d recommend checking out the Rust Discord if you’ve got more questions, it’s
a good resource:
https://discord.com/invite/rust-lang-community
|
Thanks for the contribution, I just run into an issue which solved by this PR, because I can't return ParseResult in one of my functions, because the ParseErrorKind is private and I want to return |
Thank you but I don’t think this change will actually help with that usage. This leaves the field inside the tuple struct private, so I don’t think you would be able to construct your own ParseError value. |
Maintainers, I haven’t resolved the CHANGELOG.md conflict because it isn’t clear if or when this PR will be looked at, and it seemed likely the conflict would reoccur. If you’re ignoring this because of the conflict please let me know and I’ll fix it, otherwise I would appreciate feedback one way or the other. Thanks. |
This would also be a valuable addition for us. We want to match the minimal possible values from contiguous slices of possible matches. Not having to materialize the string errors would save a lot of allocations. |
Why is this not yet merged? |
The previous maintainer left, and other changes have taken priority. Once CI passes I'm happy to review this. |
Looking at the test results, |
Yes, 1.32 is the current MSRV for the main branch and will be for the next release, so |
Is it an option to implement it like this in the meantime? https://rust-lang.github.io/rfcs/2008-non-exhaustive.html#how-we-do-this-today |
Yeah, that's probably an okay solution for now. Probably should add a comment with a |
Feel free to already review my changes sbrocket#1 |
Done, thanks @Ploppz! |
Np! I guess it's up to you to either rebase or merge from |
I’ll leave it up to the maintainer to handle the changelog conflict, since I have no idea when this might be reviewed and would otherwise need to repeatedly resolve conflicts there. |
Please just rebase this and fix the merge conflict. I don't have time to resolve conflicts for every PR -- I will review this pretty soon once it passes CI. |
Ok, rebased (once; hopefully it makes sense that expecting all authors of pending PRs to rebase their PRs every time the changelog is updated by another merged PR is not a very smooth contribution process). CI isn't going to run automatically because of the first-time contributor approval limitation. |
I hope it's not out of place with a gentle reminder. Additional question: can this be included in the next version / what's the timeline for the next version release? |
It should be in the next release. That's mainly waiting for the work in #677 and related PRs. Rest assured that this is still in my GitHub notifications queue and won't be forgotten (that is, no need to remind me again). |
ParseErrorKind has also been made #[non_exhaustive] to avoid committing
to only the current set of error kinds, i.e. so that it can be expanded
as needed without an SemVer-breaking change.
Thanks for contributing to chrono!
about adding the PR number)
we can't reintroduce it?
Fixes #319