bug.rs:4:2 | 1 ...">

'called Result::unwrap_err() on an Ok value: false', compiler/rustc_builtin_macros/src/format.rs:173:51 · Issue #88770 · rust-lang/rust (original) (raw)

I'm seeing an internal compiler error on the following input, found by fuzz-rustc:

$ rustc bug.rs
error: this file contains an unclosed delimiter
 --> bug.rs:4:2
  |
1 | fn m(){print!("",(c for&g
  |       -      -   - unclosed delimiter
  |       |      |
  |       |      unclosed delimiter
  |       unclosed delimiter
...
4 | e
  |  ^

error: missing `in` in `for` loop
 --> bug.rs:1:26
  |
1 |   fn m(){print!("",(c for&g
  |  __________________________^
2 | | u
  | |_ help: try adding `in` here

error: expected one of `!`, `)`, `,`, `.`, `::`, `?`, `{`, or an operator, found keyword `for`
 --> bug.rs:1:21
  |
1 | fn m(){print!("",(c for&g
  |                     ^^^ expected one of 8 possible tokens

error: expected `;`, found `e`
 --> bug.rs:3:2
  |
3 | e
  |  ^ help: add `;` here
4 | e
  | - unexpected token

thread 'rustc' panicked at 'called `Result::unwrap_err()` on an `Ok` value: false', compiler/rustc_builtin_macros/src/format.rs:173:51
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.57.0-nightly (fdf65053e 2021-09-07) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
error: aborting due to 4 previous errors