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
Macro-expanded trailing expression statement macros expand into statements, but unexpanded trailing expression statement macros expand into expressions. For example,
macro_rules! m {() => {let x = 0;}}macro_rules! n {() => {let y = 0;
m!()// Since `m!()` expands into statements, this is ok}}fnmain(){n!();let x = 0;m!()// Since `m!()` expands into an expression, this is not ok}
One way to fix this is to make all trailing expression statement macros expand into statements.
When (if?) #34706 gets fixed, this will be backwards compatible. However, today it isn't:
macro_rules! m {() => {1;}}fnf() -> i32{m!()// The trailing semicolon on `1` is ignored today, so this typechecks.// If `m!()` were expanded into statements, the trailing semicolon// would not be ignored, so this would break.}
The text was updated successfully, but these errors were encountered:
Macro-expanded trailing expression statement macros expand into statements, but unexpanded trailing expression statement macros expand into expressions. For example,
One way to fix this is to make all trailing expression statement macros expand into statements.
When (if?) #34706 gets fixed, this will be backwards compatible. However, today it isn't:
The text was updated successfully, but these errors were encountered: