Fix span for unicode escape suggestion.
This commit is contained in:
parent
f317a93d4d
commit
35192ff574
3 changed files with 6 additions and 9 deletions
|
@ -181,10 +181,9 @@ pub(crate) fn emit_unescape_error(
|
||||||
|
|
||||||
if suggestion_len > 0 {
|
if suggestion_len > 0 {
|
||||||
suggestion.push('}');
|
suggestion.push('}');
|
||||||
let lo = char_span.lo();
|
let hi = char_span.lo() + BytePos(suggestion_len as u32);
|
||||||
let hi = lo + BytePos(suggestion_len as u32);
|
|
||||||
diag.span_suggestion(
|
diag.span_suggestion(
|
||||||
span.with_lo(lo).with_hi(hi),
|
span.with_hi(hi),
|
||||||
"format of unicode escape sequences uses braces",
|
"format of unicode escape sequences uses braces",
|
||||||
suggestion,
|
suggestion,
|
||||||
Applicability::MaybeIncorrect,
|
Applicability::MaybeIncorrect,
|
||||||
|
|
|
@ -2,9 +2,7 @@ error: incorrect unicode escape sequence
|
||||||
--> $DIR/format-string-error-2.rs:77:20
|
--> $DIR/format-string-error-2.rs:77:20
|
||||||
|
|
|
|
||||||
LL | println!("\x7B}\u8 {", 1);
|
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'`
|
error: invalid format string: expected `'}'`, found `'a'`
|
||||||
--> $DIR/format-string-error-2.rs:5:5
|
--> $DIR/format-string-error-2.rs:5:5
|
||||||
|
|
|
@ -80,7 +80,7 @@ error: incorrect unicode escape sequence
|
||||||
--> $DIR/issue-23620-invalid-escapes.rs:32:14
|
--> $DIR/issue-23620-invalid-escapes.rs:32:14
|
||||||
|
|
|
|
||||||
LL | let _ = "\u8f";
|
LL | let _ = "\u8f";
|
||||||
| ^^--
|
| ^^^-
|
||||||
| |
|
| |
|
||||||
| help: format of unicode escape sequences uses braces: `\u{8f}`
|
| help: format of unicode escape sequences uses braces: `\u{8f}`
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue