From f35c0b96c255d209daf3b9e33362af4c5e1cdb38 Mon Sep 17 00:00:00 2001 From: Markus Westerlind Date: Mon, 5 Aug 2019 12:58:15 +0200 Subject: [PATCH] fix(vm): Accept trailing comma in record macros Fixes #770 --- examples/marshalling.rs | 4 ++-- vm/src/api/mac.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/marshalling.rs b/examples/marshalling.rs index 491c31ab06..2222fa5d92 100644 --- a/examples/marshalling.rs +++ b/examples/marshalling.rs @@ -84,9 +84,9 @@ fn marshal_enum() -> Result<()> { "#; type SourceType<'thread> = record_type! { unwrap_b => api::FunctionRef<'thread, fn (Enum) -> i32>, - value => Enum + value => Enum, }; - let (record_p! { mut unwrap_b, value }, _) = + let (record_p! { mut unwrap_b, value, }, _) = Compiler::new().run_expr::(&thread, "example", source)?; match value { Enum::C(ref a, ref b) => { diff --git a/vm/src/api/mac.rs b/vm/src/api/mac.rs index 3ae544b3a1..c155e28a33 100644 --- a/vm/src/api/mac.rs +++ b/vm/src/api/mac.rs @@ -403,7 +403,7 @@ macro_rules! row_type { /// ``` #[macro_export(local_inner_macros)] macro_rules! record_type { - ($($field: ident => $value: ty),*) => { + ($($field: ident => $value: ty),* $(,)?) => { $crate::api::Record< $crate::frunk_core::hlist::HNil, record_type_inner!($($field => $value),*) @@ -438,7 +438,7 @@ macro_rules! record_p_impl { /// ``` #[macro_export(local_inner_macros)] macro_rules! record_p { - ($($field: pat),*) => { + ($($field: pat),* $(,)?) => { $crate::api::Record { fields: record_p_impl!($($field),*), type_fields: _