Fix span calculation on secondary_label as well
This commit is contained in:
parent
e2116acae5
commit
99bd24e9a3
3 changed files with 22 additions and 2 deletions
|
@ -995,8 +995,9 @@ pub fn expand_preparsed_format_args(
|
||||||
e.note(¬e);
|
e.note(¬e);
|
||||||
}
|
}
|
||||||
if let Some((label, span)) = err.secondary_label {
|
if let Some((label, span)) = err.secondary_label {
|
||||||
let sp = fmt_span.from_inner(span);
|
if efmt_kind_is_lit {
|
||||||
e.span_label(sp, label);
|
e.span_label(fmt_span.from_inner(span), label);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
e.emit();
|
e.emit();
|
||||||
return DummyResult::raw_expr(sp, true);
|
return DummyResult::raw_expr(sp, true);
|
||||||
|
|
8
src/test/ui/fmt/issue-91556.rs
Normal file
8
src/test/ui/fmt/issue-91556.rs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
fn main() {
|
||||||
|
let _ = format!(concat!("{0}𝖳𝖾𝗌𝗍{"), i);
|
||||||
|
//~^ ERROR: invalid format string: expected `'}'` but string was terminated
|
||||||
|
//~| NOTE: if you intended to print `{`, you can escape it using `{{`
|
||||||
|
//~| NOTE: in this expansion of concat!
|
||||||
|
//~| NOTE: in this expansion of concat!
|
||||||
|
//~| NOTE: expected `'}'` in format string
|
||||||
|
}
|
11
src/test/ui/fmt/issue-91556.stderr
Normal file
11
src/test/ui/fmt/issue-91556.stderr
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
error: invalid format string: expected `'}'` but string was terminated
|
||||||
|
--> $DIR/issue-91556.rs:2:19
|
||||||
|
|
|
||||||
|
LL | let _ = format!(concat!("{0}𝖳𝖾𝗌𝗍{"), i);
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^ expected `'}'` in format string
|
||||||
|
|
|
||||||
|
= note: if you intended to print `{`, you can escape it using `{{`
|
||||||
|
= note: this error originates in the macro `concat` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue