Skip to content

Commit

Permalink
Merge pull request #2020 from fzyzcjy/feat/12134
Browse files Browse the repository at this point in the history
Support non-exhaustive enumerations
  • Loading branch information
fzyzcjy authored Jun 3, 2024
2 parents b74a963 + cab981f commit 99dfccd
Show file tree
Hide file tree
Showing 6 changed files with 1,199 additions and 177 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ pub(crate) fn generate_enum_encode_rust_general(
})
.collect_vec();

lang.switch_expr(self_ref, &variants, None)
lang.switch_expr(
self_ref,
&variants,
Some(format!("{};", lang.throw_unimplemented(""))),
)
}

fn pattern_match_enum_variant(lang: &Lang, variant: &MirVariant) -> String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ impl<'a> WireRustCodecDcoGeneratorEncoderTrait for DelegateWireRustCodecDcoGener
let body = format!(
"match {self_ref} {{
{variants}
_ => unreachable!(),
}}"
);

Expand Down
Loading

0 comments on commit 99dfccd

Please sign in to comment.