-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #84024 - estebank:unclosed-brace-use, r=jackh726
Avoid `;` -> `,` recovery and unclosed `}` recovery from being too verbose Those two recovery attempts have a very bad interaction that causes too unnecessary output. Add a simple gate to avoid interpreting a `;` as a `,` when there are unclosed braces. Fix #83498.
- Loading branch information
Showing
4 changed files
with
45 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// error-pattern: expected one of `,`, `::`, `as`, or `}`, found `;` | ||
// error-pattern: this file contains an unclosed delimiter | ||
// error-pattern: expected item, found `}` | ||
use foo::{bar, baz; | ||
|
||
use std::fmt::Display; | ||
|
||
mod bar { } | ||
|
||
mod baz { } | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
error: this file contains an unclosed delimiter | ||
--> $DIR/use-unclosed-brace.rs:12:14 | ||
| | ||
LL | use foo::{bar, baz; | ||
| - unclosed delimiter | ||
... | ||
LL | fn main() {} | ||
| ^ | ||
|
||
error: expected one of `,`, `::`, `as`, or `}`, found `;` | ||
--> $DIR/use-unclosed-brace.rs:4:19 | ||
| | ||
LL | use foo::{bar, baz; | ||
| - ^ | ||
| | | | ||
| | expected one of `,`, `::`, `as`, or `}` | ||
| | help: `}` may belong here | ||
| unclosed delimiter | ||
|
||
error: expected item, found `}` | ||
--> $DIR/use-unclosed-brace.rs:12:14 | ||
| | ||
LL | fn main() {} | ||
| ^ expected item | ||
|
||
error: aborting due to 3 previous errors | ||
|