Skip to content

Fixes #41: Don’t panic on invalid comparisons. #42

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

Merged
merged 2 commits into from
Jun 7, 2024

Conversation

chirino
Copy link
Contributor

@chirino chirino commented Jun 6, 2024

No description provided.

@chirino
Copy link
Contributor Author

chirino commented Jun 6, 2024

This should fix #41

@chirino chirino force-pushed the no-panic-compare branch from 2ada1c3 to 0cf3d6b Compare June 6, 2024 11:15
@clarkmcc
Copy link
Owner

clarkmcc commented Jun 6, 2024

The PartialEq implementation looks good, but I'm thinking that we actually want to return a None on the PartialOrd implementation. I need to check the spec again and see. By using the type ids, we'd be following an ordering scheme that's not strictly defined in the spec, so I'd prefer to return None which triggers a comparison error.

As a note, there are currently a few other places where we have panics, which you can see by searching for unreachable!.

Agreed that nothing should panic.

@chirino
Copy link
Contributor Author

chirino commented Jun 7, 2024

None it is.

Co-authored-by: Clark McCauley <[email protected]>
Signed-off-by: Hiram Chirino <[email protected]>
@chirino chirino force-pushed the no-panic-compare branch from 25f478d to 27f25c7 Compare June 7, 2024 19:31
@clarkmcc clarkmcc merged commit a6a4dcc into clarkmcc:master Jun 7, 2024
1 check passed
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.

2 participants