-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Description
This issue tracks the release notes text for #144369.
cc @joshtriplett, @petrochenkov -- original issue/PR authors and assignees for drafting text
See the forge.rust-lang.org chapter about release notes for an overview of how the release team makes use of these tracking issues.
Release notes text
This section should be edited to specify the correct category(s) for the change, with succinct description(s) of what changed. Some things worth considering:
- Does this need an additional compat notes section?
- Was this a libs stabilization that should have additional headers to list new APIs under
Stabilized APIs
andConst Stabilized APIs
?
# Language
- [Upgrade semicolon_in_expressions_from_macros from warn to deny](https://github.com/rust-lang/rust/pull/144369)
# Compatibility Notes
- The lint `semicolon_in_expressions_from_macros`, for `macro_rules!` macros in expression position that expand to end in a semicolon (`;`), is now deny-by-default. It was already warn-by-default, and a future compatibility warning (FCW) that warned even in dependencies. This lint will become a hard error in the future.
Tip
Use the previous releases for inspiration on how to write the release notes text and which categories to pick.
Release blog section
If this change is notable enough for inclusion in the blog post then this section should be edited to contain a draft for the blog post. Otherwise leave it empty.
# Macros in expression positions that expand to include a trailing semicolon
For compatibility, `macro_rules!` macros that appear in expressions were previously allowed to expand to end in a trailing semicolon, even though expressions can't normally end in a semicolon. For instance:
```rust
macro_rules! m {
() => { println!("hello world"); }
}
fn main() {
match 42 {
42 => m!(),
_ => (),
}
}
```
This has produced a lint `semicolon_in_expressions_from_macros`, which has been warn-by-default since Rust 1.56 and a future compatibility warning (FCW) that warns even in dependencies since Rust 1.68. With this release, we're upgrading this lint to deny-by-default, working towards making this a hard error in the future. (Doing so removes complex special cases from macro handling.)
In most cases, you can fix this issue by removing the semicolon. In some cases, for macros that may sometimes expand to items and sometimes expand to expressions, you may need to invoke the macro using braces (`m! {}`).
Note
If a blog post section is required the release-blog-post
label should be added (@rustbot label +release-blog-post
) to this issue as otherwise it may be missed by the release team.