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
If you're a crate author who's been linked here, this issue tracks emitting a hard error when a trailing semicolon occurs in a macro used in expression position. See rust-lang/lang-team#70 for some background about the issue.
In the above code snippet, foo!() is invoked in expression position (in this case, a macro arm). However, foo!() expands to the token stream true;, which is not a valid expression due to the presence of a trailing semicolon.
To make the behavior of macro expansion more consistent, we plan to turn this into a hard error at some point in the future.
Fixing issues in your crate is usually as simple as removing the trailing semicolon from the macro definition.
Currently, the associated lint (semicolon_in_expressions_from_macros) is set to allow-by-default. As time goes on, we may increase this to warn-by-default.
About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
This is a tracking issue for MCP rust-lang/lang-team#70
What is this issue?
If you're a crate author who's been linked here, this issue tracks emitting a hard error when a trailing semicolon occurs in a macro used in expression position. See rust-lang/lang-team#70 for some background about the issue.
In the future, code like this may stop compiling:
In the above code snippet,
foo!()is invoked in expression position (in this case, a macro arm). However,foo!()expands to the token streamtrue;, which is not a valid expression due to the presence of a trailing semicolon.To make the behavior of macro expansion more consistent, we plan to turn this into a hard error at some point in the future.
Fixing issues in your crate is usually as simple as removing the trailing semicolon from the macro definition.
Currently, the associated lint (
semicolon_in_expressions_from_macros) is set to allow-by-default. As time goes on, we may increase this to warn-by-default.About tracking issues
Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.
Steps
SEMICOLON_IN_EXPRESSIONS_FROM_MACROSlint #79819lint_node_idso that we can apply#[allow]close to a macro call site (Compute a betterlint_node_idduring expansion #87146)macro_rules!arm body rustfmt#4507 makes it way into a stable release, make the lint warn-by-defaultSEMICOLON_IN_EXPRESSIONS_FROM_MACROSto future-incompat report #103418)Unresolved Questions
Implementation history
SEMICOLON_IN_EXPRESSIONS_FROM_MACROSlint #79819SEMICOLON_IN_EXPRESSIONS_FROM_MACROSwarn by default #87385SEMICOLON_IN_EXPRESSIONS_FROM_MACROSto future-incompat report #103418