diff options
| author | Yuki Okushi <huyuumi.dev@gmail.com> | 2020-10-06 16:26:14 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-06 16:26:14 +0900 |
| commit | cc908f3b7005eb9762f81148e3668603edd92003 (patch) | |
| tree | a86e43aed454006d920707a213e974d77bd69dcb /src | |
| parent | cdaf8c5f7164b6ea940ebdb066833895719e09f1 (diff) | |
| parent | 35192ff574c3706646e2f4be16d5c22c4f8b60b1 (diff) | |
Rollup merge of #77587 - ehuss:unicode-escape-span, r=ecstatic-morse
Fix span for unicode escape suggestion.
If a unicode escape is missing the curly braces, the suggested fix is to add the curly braces, but the span for the fix was incorrect. It was not covering the `\u`, but the suggested text includes the `\u`, causing the resulting fix to be `"\u\u{1234}"`. This changes it so that the span includes the `\u`. An alternate fix would be to remove `\u` from the suggested fix, but I think the error message reads better if the entire escape is included.
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/fmt/format-string-error-2.stderr | 4 | ||||
| -rw-r--r-- | src/test/ui/parser/issue-23620-invalid-escapes.stderr | 6 |
2 files changed, 4 insertions, 6 deletions
diff --git a/src/test/ui/fmt/format-string-error-2.stderr b/src/test/ui/fmt/format-string-error-2.stderr index d202044a2bb..c421fe49ef0 100644 --- a/src/test/ui/fmt/format-string-error-2.stderr +++ b/src/test/ui/fmt/format-string-error-2.stderr @@ -2,9 +2,7 @@ error: incorrect unicode escape sequence --> $DIR/format-string-error-2.rs:77:20 | LL | println!("\x7B}\u8 {", 1); - | ^^- - | | - | help: format of unicode escape sequences uses braces: `\u{8}` + | ^^^ help: format of unicode escape sequences uses braces: `\u{8}` error: invalid format string: expected `'}'`, found `'a'` --> $DIR/format-string-error-2.rs:5:5 diff --git a/src/test/ui/parser/issue-23620-invalid-escapes.stderr b/src/test/ui/parser/issue-23620-invalid-escapes.stderr index b391ac75bf8..8c924ad0330 100644 --- a/src/test/ui/parser/issue-23620-invalid-escapes.stderr +++ b/src/test/ui/parser/issue-23620-invalid-escapes.stderr @@ -80,9 +80,9 @@ error: incorrect unicode escape sequence --> $DIR/issue-23620-invalid-escapes.rs:32:14 | LL | let _ = "\u8f"; - | ^^-- - | | - | help: format of unicode escape sequences uses braces: `\u{8f}` + | ^^^- + | | + | help: format of unicode escape sequences uses braces: `\u{8f}` error: aborting due to 13 previous errors |
