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.

Reviewed By: brianc118

Differential Revision: D36850027

fbshipit-source-id: 83814b331d51bc843629885ed070d527792e9736
  • Loading branch information
Leon Yang (Containers) authored and facebook-github-bot committed Jun 3, 2022
1 parent 0dfd7c1 commit 9b137f3
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 9b137f3

Please sign in to comment.