Skip to content

[ICE]: index out of bounds: the len is 0 but the index is 0 #162857

Description

@424ever

rustc-ice-2026-09-16T16_21_37-29763.txt
Playground

Code

#![allow(dead_code)]
mod vis1 {
    pub struct B;
    pub struct C(pub B);

    pub trait Visitor {
        fn visit_b(&mut self, b: &B);
        fn visit_c(&mut self, c: &C);
    }
}

mod vis2 {
    pub struct A;

    pub trait Visitor {
        fn visit_a(&mut self, a: &A);
    }
}

mod imp {
    use crate::{
        vis1::{self, *},
        vis2::{self, *},
    };

    pub struct Impl;

    impl vis1::Visitor for Impl {
        fn visit_b(&mut self, b: &B) {
            todo!()
        }

        fn visit_c(&mut self, c: &C) {
            self.visit_b(&c.0)
        }
    }
    impl vis2::Visitor for Impl {
        fn visit_a(&mut self, a: &A) {
            todo!()
        }
    }
}

Meta

Nightly only, stable and beta don't panic.

rustc --version --verbose:

rustc 1.100.0-nightly (215a8af4b 2026-09-15)
binary: rustc
commit-hash: 215a8af4bb4c106cccf6d6535f84eaae91818265
commit-date: 2026-09-15
host: x86_64-unknown-linux-gnu
release: 1.100.0-nightly
LLVM version: 23.1.1

Bisect

searched nightlies: from nightly-2026-08-20 to nightly-2026-09-16
regressed nightly: nightly-2026-08-29
searched commit range: e457a7b...17fd5b8
regressed commit: 344f790

bisected with cargo-bisect-rustc v0.6.11

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --start 2026-08-20 
full bisect output
fetching https://static.rust-lang.org/dist/channel-rust-nightly-date.txt
nightly date: 10 B / 10 B [=================================================================] 100.00 % 871.85 KB/s determined the latest nightly is 2026-09-16
checking the start range to find a passing nightly
installing nightly-2026-08-20
rust-std-nightly-x86_64-unknown-linux-gnu: 30.14 MB / 30.14 MB [==============================] 100.00 % 3.72 MB/s testing...
RESULT: nightly-2026-08-20, ===> Successfully compiled
uninstalling nightly-2026-08-20

checking the end range to verify it does not pass
installing nightly-2026-09-16
rust-std-nightly-x86_64-unknown-linux-gnu: 30.24 MB / 30.24 MB [=========================================================================================================================================================================] 100.00 % 3.71 MB/s testing...
RESULT: nightly-2026-09-16, ===> Compile error
uninstalling nightly-2026-09-16

14 versions remaining to test after this (roughly 4 steps)
installing nightly-2026-09-02
rust-std-nightly-x86_64-unknown-linux-gnu: 30.24 MB / 30.24 MB [=========================================================================================================================================================================] 100.00 % 3.77 MB/s testing...
RESULT: nightly-2026-09-02, ===> Compile error
uninstalling nightly-2026-09-02

7 versions remaining to test after this (roughly 3 steps)
installing nightly-2026-08-26
rust-std-nightly-x86_64-unknown-linux-gnu: 30.18 MB / 30.18 MB [=========================================================================================================================================================================] 100.00 % 3.59 MB/s testing...
RESULT: nightly-2026-08-26, ===> Successfully compiled
uninstalling nightly-2026-08-26

4 versions remaining to test after this (roughly 3 steps)
installing nightly-2026-08-29
rust-std-nightly-x86_64-unknown-linux-gnu: 30.16 MB / 30.16 MB [=========================================================================================================================================================================] 100.00 % 2.78 MB/s testing...
RESULT: nightly-2026-08-29, ===> Compile error
uninstalling nightly-2026-08-29

2 versions remaining to test after this (roughly 2 steps)
installing nightly-2026-08-27
rust-std-nightly-x86_64-unknown-linux-gnu: 30.14 MB / 30.14 MB [=========================================================================================================================================================================] 100.00 % 3.07 MB/s testing...
RESULT: nightly-2026-08-27, ===> Successfully compiled
uninstalling nightly-2026-08-27

1 versions remaining to test after this (roughly 1 steps)
installing nightly-2026-08-28
rust-std-nightly-x86_64-unknown-linux-gnu: 30.17 MB / 30.17 MB [=========================================================================================================================================================================] 100.00 % 3.76 MB/s testing...
RESULT: nightly-2026-08-28, ===> Successfully compiled
uninstalling nightly-2026-08-28

searched toolchains nightly-2026-08-20 through nightly-2026-09-16


********************************************************************************
Regression in nightly-2026-08-29
********************************************************************************

fetching https://static.rust-lang.org/dist/2026-08-28/channel-rust-nightly-git-commit-hash.txt
nightly manifest 2026-08-28: 40 B / 40 B [===============================================================================================================================================================================================] 100.00 % 1.07 MB/s converted 2026-08-28 to e457a7b0d326d67b4322ef0d11bd715cfaeda48f
fetching https://static.rust-lang.org/dist/2026-08-29/channel-rust-nightly-git-commit-hash.txt
nightly manifest 2026-08-29: 40 B / 40 B [===============================================================================================================================================================================================] 100.00 % 1.20 MB/s converted 2026-08-29 to 17fd5b8a37b6667b6cc137f3cc35f09759768a3b
looking for regression commit between 2026-08-28 and 2026-08-29
fetching (via remote github) commits from max(e457a7b0d326d67b4322ef0d11bd715cfaeda48f, 2026-08-26) to 17fd5b8a37b6667b6cc137f3cc35f09759768a3b
ending github query because we found starting sha: e457a7b0d326d67b4322ef0d11bd715cfaeda48f
get_commits_between returning commits, len: 5
  commit[0] 2026-08-27: Auto merge of #161849 - jhpratt:rollup-QMTkuLl, r=jhpratt
  commit[1] 2026-08-28: Auto merge of #161398 - bjorn3:rename_unadjusted_abi, r=tgross35
  commit[2] 2026-08-28: Auto merge of #161571 - mu001999-contrib:dead-code-refactor, r=chenyukang
  commit[3] 2026-08-28: Auto merge of #161906 - JonathanBrouwer:rollup-obMe707, r=JonathanBrouwer
  commit[4] 2026-08-28: Auto merge of #161853 - Kobzol:bootstrap-llvm-env, r=jieyouxu
validated commits found, specifying toolchains

checking the start range to verify it passes
installing e457a7b0d326d67b4322ef0d11bd715cfaeda48f
rust-std-nightly-x86_64-unknown-linux-gnu: 31.39 MB / 31.39 MB [=========================================================================================================================================================================] 100.00 % 3.51 MB/s testing...
RESULT: e457a7b0d326d67b4322ef0d11bd715cfaeda48f, ===> Successfully compiled
uninstalling e457a7b0d326d67b4322ef0d11bd715cfaeda48f

checking the end range to verify it does not pass
installing 17fd5b8a37b6667b6cc137f3cc35f09759768a3b
rust-std-nightly-x86_64-unknown-linux-gnu: 31.42 MB / 31.42 MB [=========================================================================================================================================================================] 100.00 % 3.53 MB/s testing...
RESULT: 17fd5b8a37b6667b6cc137f3cc35f09759768a3b, ===> Compile error
uninstalling 17fd5b8a37b6667b6cc137f3cc35f09759768a3b

2 versions remaining to test after this (roughly 2 steps)
installing c42ac5fd59628ea7e2f52af5944c2aaac3f0e7f6
rust-std-nightly-x86_64-unknown-linux-gnu: 31.39 MB / 31.39 MB [=========================================================================================================================================================================] 100.00 % 3.51 MB/s testing...
RESULT: c42ac5fd59628ea7e2f52af5944c2aaac3f0e7f6, ===> Successfully compiled
uninstalling c42ac5fd59628ea7e2f52af5944c2aaac3f0e7f6

1 versions remaining to test after this (roughly 1 steps)
installing 344f7902949345394fa40a5d7dda31f012ccbc0d
rust-std-nightly-x86_64-unknown-linux-gnu: 31.40 MB / 31.40 MB [=========================================================================================================================================================================] 100.00 % 3.51 MB/s testing...
RESULT: 344f7902949345394fa40a5d7dda31f012ccbc0d, ===> Compile error
uninstalling 344f7902949345394fa40a5d7dda31f012ccbc0d

searched toolchains e457a7b0d326d67b4322ef0d11bd715cfaeda48f through 17fd5b8a37b6667b6cc137f3cc35f09759768a3b


********************************************************************************
Regression in 344f7902949345394fa40a5d7dda31f012ccbc0d
********************************************************************************

Attempting to search unrolled perf builds
ERROR: couldn't find perf build comment
==================================================================================
= Please file this regression report on the rust-lang/rust GitHub repository     =
=        New issue: https://github.com/rust-lang/rust/issues/new                 =
=     Known issues: https://github.com/rust-lang/rust/issues                     =
= Copy and paste the text below into the issue report thread.  Thanks!           =
==================================================================================

Error output

thread 'rustc' (32468) panicked at /rustc-dev/215a8af4bb4c106cccf6d6535f84eaae91818265/compiler/rustc_hir_typeck/src/method/confirm.rs:763:54:
index out of bounds: the len is 0 but the index is 0
Backtrace

stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic_bounds_check
   3: <rustc_hir_typeck::method::confirm::ConfirmContext>::confirm
   4: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_method_call
   5: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
   6: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_block
   7: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
   8: rustc_hir_typeck::check::check_fn
   9: rustc_hir_typeck::typeck_with_inspect::{closure#0}
      [... omitted 1 frame ...]
  10: <rustc_middle::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis::check_crate::{closure#1}>::{closure#0}
  11: rustc_hir_analysis::check_crate
  12: rustc_interface::passes::analysis
  13: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 0]>>, true>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}S-has-bisectionStatus: A bisection has been found for this issueS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-nightlyPerformance or correctness regression from stable to nightly.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions