Macro Expansion on Windows Stable Fails
inspier opened this issue · 1 comments
inspier commented
I am getting error[E0658]: procedural macros cannot be expanded to statements
and error[E0658]: procedural macros cannot be expanded to expressions
for these two macros respectively only on Windows Stable. Not sure if this is a known limitation, but was just curious.
#[macro_export]
macro_rules! set {
($self:ident, $field:ident, $value:expr) => {
paste::item! {
$self.[<set_ $field:snake>]($value)
}
};
}
#[macro_export]
macro_rules! get {
($self:ident, $field:ident) => {
paste::item! {
$self.[<get_ $field:snake>]()
}
};
}
dtolnay commented
Hi @inspier, for an expression (which self.set_field(value)
is) you would need to use paste::expr as described in https://github.com/dtolnay/paste#pasting-identifiers.