-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.E-hardCall for participation: Hard difficulty. Experience needed to fix: A lot.Call for participation: Hard difficulty. Experience needed to fix: A lot.P-lowLow priorityLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
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
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTArea: The lexing & parsing of Rust source code to an ASTA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.E-hardCall for participation: Hard difficulty. Experience needed to fix: A lot.Call for participation: Hard difficulty. Experience needed to fix: A lot.P-lowLow priorityLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.