From 2cef4367013586eb0133f7ce7f37293711096bd0 Mon Sep 17 00:00:00 2001 From: "Leon Yang (Containers)" Date: Wed, 1 Jun 2022 18:11:08 -0700 Subject: [PATCH] Fix Queriable for empty enum Summary: Turns out that reference to empty enum is consider inhabited: https://github.com/rust-lang/rust/pull/80651 Fix by adding a unreachable clause. Differential Revision: D36850027 fbshipit-source-id: cc338becc4ebd57c33441c2d8575b07c3052229e --- below/below_derive/src/qenum.rs | 1 + below/below_derive/src/queriable.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/below/below_derive/src/qenum.rs b/below/below_derive/src/qenum.rs index 4f428809..ae302016 100644 --- a/below/below_derive/src/qenum.rs +++ b/below/below_derive/src/qenum.rs @@ -77,6 +77,7 @@ pub fn enum_to_string_derive_impl(ast: &DeriveInput) -> syn::Result fn to_string(&self) -> ::std::string::String { match self { #(#variant_to_string_arms)* + _ => unreachable!(), } } } diff --git a/below/below_derive/src/queriable.rs b/below/below_derive/src/queriable.rs index 99a6cf41..b18bbb62 100644 --- a/below/below_derive/src/queriable.rs +++ b/below/below_derive/src/queriable.rs @@ -266,6 +266,7 @@ pub fn queriable_derive_impl(ast: &DeriveInput) -> syn::Result { fn query(&self, field_id: &Self::FieldId) -> ::std::option::Option { match field_id { #(#queriable_match_arms)* + _ => unreachable!(), } } }