You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Macros in statement positions might produce expressions or statements. This causes issues if the macro produces an item, because items need to be indexed before macros using them in case they use the item produced.
As an example, println! can use a constant value as the first argument, but this would currently cause issues:
pubfnmain(){println!(FORMAT, "World");declare_format!();// produces: `const FORMAT = "Hello {}";}
This could be solved in following ways:
Identify with metadata that a macro needs to use constant evaluation, in which case it is not permitted to expand to an item.
Not allowing constant evaluation in macros, which would be a shame.
Live with the fact that combining const values and macros have an inherent evaluation order.
Macros in statement positions might produce expressions or statements. This causes issues if the macro produces an item, because items need to be indexed before macros using them in case they use the item produced.
As an example,
println!
can use a constant value as the first argument, but this would currently cause issues:This could be solved in following ways:
const
values and macros have an inherent evaluation order.Related: #153
The text was updated successfully, but these errors were encountered: