about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorTaiki Endo <te316e89@gmail.com>2019-02-11 01:58:47 +0900
committerTaiki Endo <te316e89@gmail.com>2019-02-11 02:24:46 +0900
commit6156defd516aad7002fb88f3003cd549fca9f084 (patch)
treecd0f8bb837ff1ebc11131dc13f3a67b692ca15a1 /src
parentc3d2490433aa675b850d54cac3beed0977074637 (diff)
downloadrust-6156defd516aad7002fb88f3003cd549fca9f084.tar.gz
rust-6156defd516aad7002fb88f3003cd549fca9f084.zip
librustc_mir: use ? in impl_snapshot_for! macro
Diffstat (limited to 'src')
-rw-r--r--src/librustc_mir/interpret/snapshot.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/librustc_mir/interpret/snapshot.rs b/src/librustc_mir/interpret/snapshot.rs
index ee295116ba9..0168e1301fa 100644
--- a/src/librustc_mir/interpret/snapshot.rs
+++ b/src/librustc_mir/interpret/snapshot.rs
@@ -101,9 +101,8 @@ macro_rules! __impl_snapshot_field {
 // This assumes the type has two type parameters, first for the tag (set to `()`),
 // then for the id
 macro_rules! impl_snapshot_for {
-    // FIXME(mark-i-m): Some of these should be `?` rather than `*`.
     (enum $enum_name:ident {
-        $( $variant:ident $( ( $($field:ident $(-> $delegate:expr)*),* ) )* ),* $(,)*
+        $( $variant:ident $( ( $($field:ident $(-> $delegate:expr)?),* ) )? ),* $(,)?
     }) => {
 
         impl<'a, Ctx> self::Snapshot<'a, Ctx> for $enum_name
@@ -115,18 +114,17 @@ macro_rules! impl_snapshot_for {
             fn snapshot(&self, __ctx: &'a Ctx) -> Self::Item {
                 match *self {
                     $(
-                        $enum_name::$variant $( ( $(ref $field),* ) )* =>
+                        $enum_name::$variant $( ( $(ref $field),* ) )? =>
                             $enum_name::$variant $(
-                                ( $( __impl_snapshot_field!($field, __ctx $(, $delegate)*) ),* ),
-                            )*
+                                ( $( __impl_snapshot_field!($field, __ctx $(, $delegate)?) ),* ),
+                            )?
                     )*
                 }
             }
         }
     };
 
-    // FIXME(mark-i-m): same here.
-    (struct $struct_name:ident { $($field:ident $(-> $delegate:expr)*),*  $(,)* }) => {
+    (struct $struct_name:ident { $($field:ident $(-> $delegate:expr)?),*  $(,)? }) => {
         impl<'a, Ctx> self::Snapshot<'a, Ctx> for $struct_name
             where Ctx: self::SnapshotContext<'a>,
         {
@@ -139,7 +137,7 @@ macro_rules! impl_snapshot_for {
                 } = *self;
 
                 $struct_name {
-                    $( $field: __impl_snapshot_field!($field, __ctx $(, $delegate)*) ),*
+                    $( $field: __impl_snapshot_field!($field, __ctx $(, $delegate)?) ),*
                 }
             }
         }