Closed
Description
Code
#![feature(let_chains)]
fn main() {
if let () = ()
&& let () = () {
&& let () = ()
{
}
}
Current output
error: this file contains an unclosed delimiter
--> src/main.rs:8:2
|
2 | fn main() {
| - unclosed delimiter
3 | if let () = ()
4 | && let () = () {
| - this delimiter might not be properly closed...
...
8 | }
| -^
| |
| ...as it matches this but it has different indentation
Desired output
error: this file contains an unclosed delimiter
--> src/main.rs:8:2
|
2 | fn main() {
| - unclosed delimiter
3 | if let () = ()
4 | && let () = () {
| - this delimiter might not be properly closed...
5 | && let () = ()
| -------------- you likely meant to continue the let-chain
...
8 | }
| -^
| |
| ...as it matches this but it has different indentation
help: remove the spurious block start
|
4 - && let () = () {
4 + && let () = ()
|
Rationale and extra context
Unmatched delimiters are hard to deal with by taking consideration of surrounding code because they actually occur during lexing. Still, it'd be nice if we detected some common sources of issues like this one.
Other cases
No response
Anything else?
No response
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: The lexing & parsing of Rust source code to an ASTArea: Suggestions generated by the compiler applied by `cargo fix`Diagnostics: An error or lint that needs small tweaks.Call for participation: Hard difficulty. Experience needed to fix: A lot.Low priorityRelevant to the compiler team, which will review and decide on the PR/issue.