-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ICE on format string of macro with secondary-label #91575
Conversation
r? @cjgillot (rust-highfive has picked a reviewer for you, use r? to override) |
let sp2 = if efmt_kind_is_lit { fmt_span.from_inner(span) } else { fmt_span }; | ||
e.span_label(sp2, label); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sp2
looks like a leftover temporary change. If so:
let sp2 = if efmt_kind_is_lit { fmt_span.from_inner(span) } else { fmt_span }; | |
e.span_label(sp2, label); | |
let sp = if efmt_kind_is_lit { fmt_span.from_inner(span) } else { fmt_span }; | |
e.span_label(sp, label); |
@@ -995,8 +995,9 @@ pub fn expand_preparsed_format_args( | |||
e.note(¬e); | |||
} | |||
if let Some((label, span)) = err.secondary_label { | |||
let sp = fmt_span.from_inner(span); | |||
e.span_label(sp, label); | |||
// FIXME(compiler-errors): Should we just suppress this secondary_label? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree we should just suppress the secondary label. Its purpose is to point to the opening brace, which can't happen if we have to replace the span with fmt_span
.
42975b8
to
99bd24e
Compare
r? @cjgillot |
@bors r+ rollup |
📌 Commit 99bd24e has been approved by |
…llot Fix ICE on format string of macro with secondary-label This generalizes the fix rust-lang#86104 to also correctly skip `Span::from_inner` for the `secondary_label` of a format macro parsing error as well. We can alternatively skip the `span_label` diagnostic call for the secondary label as well, since that label probably only makes sense when the _proper_ span is computed. Fixes rust-lang#91556
…llot Fix ICE on format string of macro with secondary-label This generalizes the fix rust-lang#86104 to also correctly skip `Span::from_inner` for the `secondary_label` of a format macro parsing error as well. We can alternatively skip the `span_label` diagnostic call for the secondary label as well, since that label probably only makes sense when the _proper_ span is computed. Fixes rust-lang#91556
…llot Fix ICE on format string of macro with secondary-label This generalizes the fix rust-lang#86104 to also correctly skip `Span::from_inner` for the `secondary_label` of a format macro parsing error as well. We can alternatively skip the `span_label` diagnostic call for the secondary label as well, since that label probably only makes sense when the _proper_ span is computed. Fixes rust-lang#91556
…askrgr Rollup of 10 pull requests Successful merges: - rust-lang#90407 (Document all public items in `rustc_incremental`) - rust-lang#90897 (Fix incorrect stability attributes) - rust-lang#91105 (Fix method name reference in stream documentation) - rust-lang#91325 (adjust const_eval_select documentation) - rust-lang#91470 (code-cov: generate dead functions with private/default linkage) - rust-lang#91482 (Update documentation to use `from()` to initialize `HashMap`s and `BTreeMap`s) - rust-lang#91524 (Fix Vec::extend_from_slice docs) - rust-lang#91575 (Fix ICE on format string of macro with secondary-label) - rust-lang#91625 (Remove redundant [..]s) - rust-lang#91646 (Fix documentation for `core::ready::Ready`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This generalizes the fix #86104 to also correctly skip
Span::from_inner
for thesecondary_label
of a format macro parsing error as well.We can alternatively skip the
span_label
diagnostic call for the secondary label as well, since that label probably only makes sense when the proper span is computed.Fixes #91556