-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #113774 - compiler-errors:fill-expr-bracket, r=eholk
Improve error message when closing bracket interpreted as formatting fill character Fixes #112732 by explaining why it's erroring in the way it is.
- Loading branch information
Showing
8 changed files
with
97 additions
and
75 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,8 @@ | ||
// issue: 112732 | ||
|
||
// `}` is typoed since it is interpreted as a fill character rather than a closing bracket | ||
|
||
fn main() { | ||
println!("Hello, world! {0:}<3", 2); | ||
//~^ ERROR invalid format string: expected `'}'` but string was terminated | ||
} |
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: invalid format string: expected `'}'` but string was terminated | ||
--> $DIR/closing-brace-as-fill.rs:6:35 | ||
| | ||
LL | println!("Hello, world! {0:}<3", 2); | ||
| - ^ expected `'}'` in format string | ||
| | | ||
| this is not interpreted as a formatting closing brace | ||
| | ||
= note: the character `'}'` is interpreted as a fill character because of the `:` that precedes it | ||
|
||
error: aborting due to previous error | ||
|
Oops, something went wrong.