Skip to content
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

Unmatched brace in a format string crashes the compiler #91556

Closed
VorfeedCanal opened this issue Dec 5, 2021 · 1 comment · Fixed by #91575
Closed

Unmatched brace in a format string crashes the compiler #91556

VorfeedCanal opened this issue Dec 5, 2021 · 1 comment · Fixed by #91575
Assignees
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@VorfeedCanal
Copy link

VorfeedCanal commented Dec 5, 2021

Reproducer:

pub fn test(i: i32) -> String {
  format!(concat!("{0}𝖳𝖾𝗌𝗍{"), i)
}

Playground link: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=8b3a4c8413cd9d296706c9da0ac6e0c0

@VorfeedCanal VorfeedCanal added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 5, 2021
@compiler-errors
Copy link
Member

I'd love to take a look at this. Seems to be ICEing in code that displays the diagnostic to fixup the actual compiler error here.

@rustbot claim

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Dec 9, 2021
…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
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Dec 10, 2021
…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
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Dec 10, 2021
…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
@bors bors closed this as completed in 6cfe9af Dec 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants