rust-lang / rust-lang/rust

ICE: `Performed HIR wfcheck without an existing error!` in rustc_hir_analysis/src/hir_wf_check.rs

Open
#157,800 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug fixed-by-next-solver I-ICE needs-triage T-compiler
Dominant language
Rust
Stars
119k
Forks
16.2k
PR merge metrics
PR metrics pending

Description

I tried this code:

trait Dbg {}

struct Foo<I, E> {
    input: I,
    errors: E,
}

trait Bar: Offset<<Self as Bar>::Checkpoint> {
    type Checkpoint;
}

impl<I: Bar, E: Dbg> Bar for Foo<I, E> {
    type Checkpoint = I::Checkpoint;
}

trait Offset<Start = Self> {}

impl<I: Bar, E: Dbg> Offset<<Foo<I, E> as Bar>::Checkpoint> for Foo<I, E> {}

impl<I: Bar, E> Foo<I, E> {
    fn record_err(self, _: <Self as Bar>::Checkpoint) {}
}

fn main() {}

ICE:

error: internal compiler error: Performed HIR wfcheck without an existing error!
  --> ./min.rs:21:5
   |
21 |     fn record_err(self, _: <Self as Bar>::Checkpoint) {}
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: delayed at /rustc-dev/23a3312d92a1c4ba0373f1e25277be20ba8bb28c/compiler/rustc_hir_analysis/src/hir_wf_check.rs:28:10 - disabled backtrace
  --> ./min.rs:21:5
   |
21 |     fn record_err(self, _: <Self as Bar>::Checkpoint) {}
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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: please make sure that you have updated to the latest nightly

note: please attach the file at `/home/fuzz/WorkSpace/fusion-fuzz/output/bugs/rust/RustPanic__rust_deps_ena-0.14.3_src_snapshot_vec.rs_199_10_index_out_of_bounds__the_len_is_2_but_the/rustc-ice-2026-06-12T08_49_56-1380130.txt` to your bug report

note: rustc 1.98.0-nightly (23a3312d9 2026-05-23) 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.

Research direction

Reproduce the ICE with the minimized Rust program in the issue using the reported nightly compiler, then start at rustc_hir_analysis/src/hir_wf_check.rs:28. Trace why HIR well-formedness checking is reached without an existing error; done means the example no longer triggers an internal compiler error and produces an appropriate compiler result.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.