Code
fn main() {
let x = (let y = 6);
}
Current output
warning: unnecessary parentheses around assigned value
--> src/main.rs:2:13
|
2 | let x = (let y = 6);
| ^ ^
|
= note: `#[warn(unused_parens)]` (part of `#[warn(unused)]`) on by default
help: remove these parentheses
|
2 - let x = (let y = 6);
2 + let x = let y = 6 ;
|
Desired output
warning: unnecessary parentheses around assigned value
--> src/main.rs:2:13
|
2 | let x = (let y = 6);
| ^ ^
|
= note: `#[warn(unused_parens)]` (part of `#[warn(unused)]`) on by default
help: remove these parentheses
|
2 - let x = (let y = 6);
2 + let x = let y = 6;
|
Rationale and extra context
This is like the teeniest tiniest bug, but it's a relatively recent regression and looks weird, so here I am!
TRPL shows error messages to illustrate various concepts. When I update the version of Rust that the book is using, I regenerate and check in all the error messages for the listings.
When I upgraded the book from 1.91.1 to 1.92.0, this warning's help suggestion changed from suggesting that removing the parentheses should produce:
to suggesting that it should produce:
Note that the right parenthesis was replaced by a space, rather than being removed.
Please ignore that there is also an error in addition to this warning and that neither the original code nor the suggestion are valid Rust. I don't think that's relevant, it's just how I found the issue.
The issue can also be reproduced with this valid Rust:
fn main() {
let x = (3 + 6);
}
which also shows the space between the 6 and semicolon that I don't think should be there:
= note: `#[warn(unused_parens)]` (part of `#[warn(unused)]`) on by default
help: remove these parentheses
|
2 - let x = (3 + 6);
2 + let x = 3 + 6 ;
|
Rust Version
$ rustc --version --verbose
rustc 1.96.0 (ac68faa20 2026-05-25)
binary: rustc
commit-hash: ac68faa20c58cbccd01ee7208bf3b6e93a7d7f96
commit-date: 2026-05-25
host: aarch64-apple-darwin
release: 1.96.0
LLVM version: 22.1.2
Anything else?
This first started appearing in stable 1.92.0, continues to reproduce through stable 1.96.0, and also reproduces with 1.98.0-nightly (2026-06-28 df6ee90).
Code
Current output
Desired output
Rationale and extra context
This is like the teeniest tiniest bug, but it's a relatively recent regression and looks weird, so here I am!
TRPL shows error messages to illustrate various concepts. When I update the version of Rust that the book is using, I regenerate and check in all the error messages for the listings.
When I upgraded the book from 1.91.1 to 1.92.0, this warning's help suggestion changed from suggesting that removing the parentheses should produce:
to suggesting that it should produce:
Note that the right parenthesis was replaced by a space, rather than being removed.
Please ignore that there is also an error in addition to this warning and that neither the original code nor the suggestion are valid Rust. I don't think that's relevant, it's just how I found the issue.
The issue can also be reproduced with this valid Rust:
which also shows the space between the
6and semicolon that I don't think should be there:Rust Version
Anything else?
This first started appearing in stable 1.92.0, continues to reproduce through stable 1.96.0, and also reproduces with 1.98.0-nightly (2026-06-28 df6ee90).