rust-lang / rust-lang/rustfmt

[ICE]: `Request to format inverted span`

Open
#7,033 8 comments 0 reactions 1 assignee View on GitHub

@aerooneqq is already working on this.

Since Aug 19, 2026.

C-bug I-ICE needs-triage
Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
2d 13h
Merged PRs (30d)
24

Description

Code

mod non_delegatable_items {    reuse impl Trait for S {}
}

Configuration

rustfmt cli options used (if applicable):

$ <rustfmt_options>

rustfmt configuration file (e.g. rustfmt.toml, if applicable):

<configuration_file>

Reproduction Steps

  1. rustfmt --check file.rs

Meta

rustfmt --version:

rustfmt 1.10.0-nightly (8fa1c96cfd 2026-08-17)

Error output

<output>
Backtrace

thread 'main' (3005755) panicked at src/tools/rustfmt/src/missed_spans.rs:95:9:
Request to format inverted span: /home/matthias/vcs/github/CRED/code.rs:1:32: 1:56
stack backtrace:
   0:     0x7fcb3b0bf7d6 - <<std[5c30386837263582]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[a0a1658e72bc1214]::fmt::Display>::fmt
   1:     0x7fcb3b80e18f - core[a0a1658e72bc1214]::fmt::write
   2:     0x7fcb3b0d4dfc - <std[5c30386837263582]::sys::stdio::unix::Stderr as core[a0a1658e72bc1214]::io::write::Write>::write_fmt
   3:     0x7fcb3b092a6a - std[5c30386837263582]::panicking::default_hook::{closure#0}
   4:     0x7fcb3b0b3a83 - std[5c30386837263582]::panicking::default_hook
   5:     0x7fcb3a03782a - std[5c30386837263582]::panicking::update_hook::<alloc[4a2b879cc634dc41]::boxed::Box<rustc_driver_impl[291a57e7636f8807]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7fcb3b0b3f22 - std[5c30386837263582]::panicking::panic_with_hook
   7:     0x7fcb3b092b22 - std[5c30386837263582]::panicking::panic_handler::{closure#0}
   8:     0x7fcb3b08b9e9 - std[5c30386837263582]::sys::backtrace::__rust_end_short_backtrace::<std[5c30386837263582]::panicking::panic_handler::{closure#0}, !>
   9:     0x7fcb3b09452d - __rustc[8ce9b7f39dcd8887]::rust_begin_unwind
  10:     0x7fcb37d5430c - core[a0a1658e72bc1214]::panicking::panic_fmt
  11:     0x559fc712e63f - <rustfmt_nightly[15a900bfe66b42a0]::visitor::FmtVisitor>::format_missing_indent
  12:     0x559fc70f370c - <rustfmt_nightly[15a900bfe66b42a0]::visitor::FmtVisitor>::visit_assoc_item
  13:     0x559fc70fa182 - <rustfmt_nightly[15a900bfe66b42a0]::visitor::FmtVisitor>::visit_impl_items
  14:     0x559fc7083d7a - <rustfmt_nightly[15a900bfe66b42a0]::visitor::FmtVisitor>::with_context::<core[a0a1658e72bc1214]::result::Result<alloc[4a2b879cc634dc41]::string::String, rustfmt_nightly[15a900bfe66b42a0]::rewrite::RewriteError>, <rustfmt_nightly[15a900bfe66b42a0]::visitor::FmtVisitor>::visit_item::{closure#0}>
  15:     0x559fc70ee09c - <rustfmt_nightly[15a900bfe66b42a0]::visitor::FmtVisitor>::visit_item
  16:     0x559fc7136ec6 - <rustfmt_nightly[15a900bfe66b42a0]::visitor::FmtVisitor>::visit_items_with_reordering
  17:     0x559fc70f3070 - <rustfmt_nightly[15a900bfe66b42a0]::visitor::FmtVisitor>::walk_mod_items
  18:     0x559fc70edd01 - <rustfmt_nightly[15a900bfe66b42a0]::visitor::FmtVisitor>::visit_item
  19:     0x559fc7136ec6 - <rustfmt_nightly[15a900bfe66b42a0]::visitor::FmtVisitor>::visit_items_with_reordering
  20:     0x559fc70f3070 - <rustfmt_nightly[15a900bfe66b42a0]::visitor::FmtVisitor>::walk_mod_items
  21:     0x559fc70674fa - <scoped_tls[67b73826a82c6420]::ScopedKey<rustc_span[66c93350f36606f3]::SessionGlobals>>::with::<<rustfmt_nightly[15a900bfe66b42a0]::Session<std[5c30386837263582]::io::stdio::Stdout>>::format_input_inner::{closure#0}, core[a0a1658e72bc1214]::result::Result<rustfmt_nightly[15a900bfe66b42a0]::FormatReport, rustfmt_nightly[15a900bfe66b42a0]::ErrorKind>>
  22:     0x559fc706167f - rustfmt[917e195e023d768e]::format_and_emit_report::<std[5c30386837263582]::io::stdio::Stdout>
  23:     0x559fc7076c9e - rustfmt[917e195e023d768e]::execute
  24:     0x559fc707203a - rustfmt[917e195e023d768e]::main
  25:     0x559fc70702eb - std[5c30386837263582]::sys::backtrace::__rust_begin_short_backtrace::<fn(), ()>
  26:     0x559fc7070ae9 - std[5c30386837263582]::rt::lang_start::<()>::{closure#0}
  27:     0x7fcb3cad8bd4 - std[5c30386837263582]::rt::lang_start_internal
  28:     0x559fc7081138 - main
  29:     0x7fcb35e27741 - <unknown>
  30:     0x7fcb35e27879 - __libc_start_main
  31:     0x559fc6f5e5c9 - <unknown>
  32:                0x0 - <unknown>

error: the compiler unexpectedly panicked. This is a bug

note: we would appreciate a bug report: https://github.com/rust-lang/rustfmt/issues/new?labels=bug

note: please make sure that you have updated to the latest nightly

note: please attach the file at `/home/matthias/vcs/github/CRED/rustc-ice-2026-08-18T18_29_00-3005755.txt` to your bug report

note: rustc 1.100.0-nightly (8fa1c96cf 2026-08-17) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.