Skip to content

Commit

Permalink
Fix Queriable for empty enum
Browse files Browse the repository at this point in the history
Summary:
Turns out that reference to empty enum is consider inhabited: rust-lang/rust#80651

Fix by adding a unreachable clause.

Differential Revision: D36850027

fbshipit-source-id: cc338becc4ebd57c33441c2d8575b07c3052229e
  • Loading branch information
Leon Yang (Containers) authored and facebook-github-bot committed Jun 2, 2022
1 parent bcbb7cb commit 2cef436
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions below/below_derive/src/qenum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ pub fn enum_to_string_derive_impl(ast: &DeriveInput) -> syn::Result<TokenStream>
fn to_string(&self) -> ::std::string::String {
match self {
#(#variant_to_string_arms)*
_ => unreachable!(),
}
}
}
Expand Down
1 change: 1 addition & 0 deletions below/below_derive/src/queriable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ pub fn queriable_derive_impl(ast: &DeriveInput) -> syn::Result<TokenStream> {
fn query(&self, field_id: &Self::FieldId) -> ::std::option::Option<Field> {
match field_id {
#(#queriable_match_arms)*
_ => unreachable!(),
}
}
}
Expand Down

0 comments on commit 2cef436

Please sign in to comment.