ICE on long where clause: called `Option::unwrap()` on a `None` value
Open
Nobody has claimed this yet.
needs-triage
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 24
Description
enum A where for<'trivial> < <dir_structure::FmtWrapper as ::dir_structure::A>::Wr as ::dir_structure::WriteToAsync >::Future: F {}
thread 'main' panicked at src/tools/rustfmt/src/items.rs:567:10:
called `Option::unwrap()` on a `None` value
stack backtrace:
0: 0x11c6b35e7 - std::backtrace::Backtrace::create::hb33e5bccf1c8a42c
1: 0x11c6b3535 - std::backtrace::Backtrace::force_capture::h6817b64990f269a6
2: 0x11a0b7087 - rustc_driver_impl[5f54b1231065e765]::install_ice_hook::{closure#1}
3: 0x11c6b45d1 - std::panicking::panic_with_hook::h5baaace6059c0027
4: 0x11c6b4265 - std::panicking::panic_handler::{{closure}}::hbb5e20960cdb020d
5: 0x11c6ad2f9 - std::sys::backtrace::__rust_end_short_backtrace::h39dfa0cbf126ab68
6: 0x11c68e504 - __rustc[6009a88cdb7ad064]::rust_begin_unwind
7: 0x11faeca2f - core::panicking::panic_fmt::h0e052a9623d88f7f
8: 0x11faeca04 - core::panicking::panic::hf5f4fff998303e67
9: 0x11faebf28 - core::option::unwrap_failed::h6a56d2efcf7efc38
10: 0x10cf9e5b2 - <rustfmt_nightly[2796b9045b543bcf]::visitor::FmtVisitor>::visit_enum
11: 0x10cf92cc3 - <rustfmt_nightly[2796b9045b543bcf]::visitor::FmtVisitor>::visit_item
12: 0x10cfdfe55 - <rustfmt_nightly[2796b9045b543bcf]::visitor::FmtVisitor>::visit_items_with_reordering
13: 0x10cf97a22 - <rustfmt_nightly[2796b9045b543bcf]::visitor::FmtVisitor>::walk_mod_items
14: 0x10cf984b0 - <rustfmt_nightly[2796b9045b543bcf]::visitor::FmtVisitor>::format_separate_mod
15: 0x10cf139cb - <rustfmt_nightly[2796b9045b543bcf]::Session<std[13294c1bc5dae938]::io::stdio::Stdout>>::format_input_inner::{closure#0}
16: 0x10cf05169 - rustfmt[5c633625723718c7]::format_and_emit_report::<std[13294c1bc5dae938]::io::stdio::Stdout>
17: 0x10cf19c91 - rustfmt[5c633625723718c7]::execute
18: 0x10cf15a8c - rustfmt[5c633625723718c7]::main
19: 0x10cf10886 - std[13294c1bc5dae938]::sys::backtrace::__rust_begin_short_backtrace::<fn(), ()>
20: 0x10cf10cfc - std[13294c1bc5dae938]::rt::lang_start::<()>::{closure#0}
21: 0x11c69d875 - std::rt::lang_start_internal::hee0eb4f99fe324f2
22: 0x10cf254ef - _main
23: 0x7ff808285418 - <unknown>
rustc version: 1.91.0-nightly (46c219bd2 2025-08-22)
platform: x86_64-apple-darwin
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the ICE by formatting the Rust snippet with rustfmt, then inspect src/tools/rustfmt/src/items.rs at line 567 and the visit_enum path shown in the backtrace. Done means the input no longer panics and is formatted or reported without an internal compiler error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100