database: use Infallible for non-dup secondary keys (#60)

This commit is contained in:
hinto-janai 2024-02-13 15:57:29 -05:00 committed by GitHub
parent 331d4d3e7f
commit ce3c8c5870
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -69,7 +69,12 @@ macro_rules! impl_key {
impl Key for $t { impl Key for $t {
const DUPLICATE: bool = false; const DUPLICATE: bool = false;
type Primary = $t; type Primary = $t;
type Secondary = $t; // This 0 variant enum is unconstructable,
// and "has the same role as the ! “never” type":
// <https://doc.rust-lang.org/std/convert/enum.Infallible.html#future-compatibility>.
//
// FIXME: Use the `!` type when stable.
type Secondary = std::convert::Infallible;
#[inline(always)] #[inline(always)]
fn primary(self) -> Self::Primary { fn primary(self) -> Self::Primary {