Skip to content

Conversation

tvsfx
Copy link
Contributor

@tvsfx tvsfx commented Aug 4, 2025

uninhabited types should be dealt with at compile time, not through the runtime panic that unreachable! throws
since rust 1.82, Rust has better ergonomics for matching on uninhabited enum variants, which makes this easier for owned types (rust-lang/rust#122792)

Checklist

  • Updated guide with pertinent info (may not always apply).
  • Squash down commits to one or two logical commits which clearly describe the work you've done.
  • Unittest is a friend:)

This change is Reviewable

uninhabited types should be dealt with at compile time, not through the
runtime panic that `unreachable!` throws
since rust 1.82, Rust has better ergonomics for matching on uninhabited
enum variants, which makes this easier for owned types (rust-lang/rust#122792)
Copy link
Member

@drmingdrmer drmingdrmer left a comment

Choose a reason for hiding this comment

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

Wow cool! Thank you!

Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @drmingdrmer and @SteveLauC)


openraft/src/error.rs line 324 at r1 (raw file):

            RPCError::PayloadTooLarge(e) => RPCError::PayloadTooLarge(e),
            RPCError::Network(e) => RPCError::Network(e),
            RPCError::RemoteError(_infallible) => unreachable!(),

Oh today I learned that! It does not need to enumerate a variant that can not be constructed!

@drmingdrmer drmingdrmer self-requested a review August 4, 2025 14:32
@drmingdrmer drmingdrmer merged commit 850ea99 into databendlabs:main Aug 4, 2025
35 of 36 checks 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