Skip to content

Commit 6156def

Browse files
committed
librustc_mir: use ? in impl_snapshot_for! macro
1 parent c3d2490 commit 6156def

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/librustc_mir/interpret/snapshot.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,8 @@ macro_rules! __impl_snapshot_field {
101101
// This assumes the type has two type parameters, first for the tag (set to `()`),
102102
// then for the id
103103
macro_rules! impl_snapshot_for {
104-
// FIXME(mark-i-m): Some of these should be `?` rather than `*`.
105104
(enum $enum_name:ident {
106-
$( $variant:ident $( ( $($field:ident $(-> $delegate:expr)*),* ) )* ),* $(,)*
105+
$( $variant:ident $( ( $($field:ident $(-> $delegate:expr)?),* ) )? ),* $(,)?
107106
}) => {
108107

109108
impl<'a, Ctx> self::Snapshot<'a, Ctx> for $enum_name
@@ -115,18 +114,17 @@ macro_rules! impl_snapshot_for {
115114
fn snapshot(&self, __ctx: &'a Ctx) -> Self::Item {
116115
match *self {
117116
$(
118-
$enum_name::$variant $( ( $(ref $field),* ) )* =>
117+
$enum_name::$variant $( ( $(ref $field),* ) )? =>
119118
$enum_name::$variant $(
120-
( $( __impl_snapshot_field!($field, __ctx $(, $delegate)*) ),* ),
121-
)*
119+
( $( __impl_snapshot_field!($field, __ctx $(, $delegate)?) ),* ),
120+
)?
122121
)*
123122
}
124123
}
125124
}
126125
};
127126

128-
// FIXME(mark-i-m): same here.
129-
(struct $struct_name:ident { $($field:ident $(-> $delegate:expr)*),* $(,)* }) => {
127+
(struct $struct_name:ident { $($field:ident $(-> $delegate:expr)?),* $(,)? }) => {
130128
impl<'a, Ctx> self::Snapshot<'a, Ctx> for $struct_name
131129
where Ctx: self::SnapshotContext<'a>,
132130
{
@@ -139,7 +137,7 @@ macro_rules! impl_snapshot_for {
139137
} = *self;
140138

141139
$struct_name {
142-
$( $field: __impl_snapshot_field!($field, __ctx $(, $delegate)*) ),*
140+
$( $field: __impl_snapshot_field!($field, __ctx $(, $delegate)?) ),*
143141
}
144142
}
145143
}

0 commit comments

Comments
 (0)