Skip to content

1.100 beta regression: panicked at compiler/rustc_hir_typeck/src/method/confirm.rs:762:54: index out of bounds: the len is 0 but the index is 0 #163804

Closed

Description

@mejrs

Code

https://crater-reports.s3.amazonaws.com/beta-1.100/1.100.0-beta.1/reg/ftc-0.1.5/log.txt

Possibly related:

let import_span = self.tcx.hir_span_if_local(pick.import_ids[0].to_def_id()).unwrap();

Version it worked on

It most recently worked on: current stable 1.99

Version with regression

rustc --version --verbose:

1.100-beta

Backtrace

Backtrace

thread 'rustc' (1094) panicked at /rustc-dev/e3feeb59cd1bdd011a2bfcc0747b55125d9b8527/compiler/rustc_hir_typeck/src/method/confirm.rs:762:54:
[INFO] [stderr] index out of bounds: the len is 0 but the index is 0
[INFO] [stderr] stack backtrace:
[INFO] [stderr]    0:     0x7cc8e5d8a9d6 - <<std[617be2ca0a6fd877]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[a373ad73a504971]::fmt::Display>::fmt
[INFO] [stderr]    1:     0x7cc8e640d08f - core[a373ad73a504971]::fmt::write
[INFO] [stderr]    2:     0x7cc8e7a8356c - <std[617be2ca0a6fd877]::sys::stdio::unix::Stderr as core[a373ad73a504971]::io::write::Write>::write_fmt
[INFO] [stderr]    3:     0x7cc8e5d5d60a - std[617be2ca0a6fd877]::panicking::default_hook::{closure#0}
[INFO] [stderr]    4:     0x7cc8e5d7f103 - std[617be2ca0a6fd877]::panicking::default_hook
[INFO] [stderr]    5:     0x7cc8e4a92665 - std[617be2ca0a6fd877]::panicking::update_hook::<alloc[2e1b2a31b91974c5]::boxed::Box<rustc_driver_impl[fec14241f8975cfd]::install_ice_hook::{closure#1}>>::{closure#0}
[INFO] [stderr]    6:     0x7cc8e5d7f5a2 - std[617be2ca0a6fd877]::panicking::panic_with_hook
[INFO] [stderr]    7:     0x7cc8e5d5d6c2 - std[617be2ca0a6fd877]::panicking::panic_handler::{closure#0}
[INFO] [stderr]    8:     0x7cc8e5d55279 - std[617be2ca0a6fd877]::sys::backtrace::__rust_end_short_backtrace::<std[617be2ca0a6fd877]::panicking::panic_handler::{closure#0}, !>
[INFO] [stderr]    9:     0x7cc8e5d5f29d - __rustc[ea4f61d10b84890b]::rust_begin_unwind
[INFO] [stderr]   10:     0x7cc8e279807c - core[a373ad73a504971]::panicking::panic_fmt
[INFO] [stderr]   11:     0x7cc8e3277f05 - core[a373ad73a504971]::panicking::panic_bounds_check
[INFO] [stderr]   12:     0x7cc8e77accc0 - <rustc_hir_typeck[8942a51420d77344]::method::confirm::ConfirmContext>::confirm
[INFO] [stderr]   13:     0x7cc8e669b1b4 - <rustc_hir_typeck[8942a51420d77344]::fn_ctxt::FnCtxt>::check_expr_method_call
[INFO] [stderr]   14:     0x7cc8e668d63f - <rustc_hir_typeck[8942a51420d77344]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
[INFO] [stderr]   15:     0x7cc8e6688e32 - <rustc_hir_typeck[8942a51420d77344]::fn_ctxt::FnCtxt>::check_expr_if
[INFO] [stderr]   16:     0x7cc8e668f5ac - <rustc_hir_typeck[8942a51420d77344]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
[INFO] [stderr]   17:     0x7cc8e6625e47 - <rustc_hir_typeck[8942a51420d77344]::fn_ctxt::FnCtxt>::check_expr_block
[INFO] [stderr]   18:     0x7cc8e668d613 - <rustc_hir_typeck[8942a51420d77344]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
[INFO] [stderr]   19:     0x7cc8e662c365 - rustc_hir_typeck[8942a51420d77344]::check::check_fn
[INFO] [stderr]   20:     0x7cc8e7770187 - rustc_hir_typeck[8942a51420d77344]::typeck_with_inspect::{closure#0}
[INFO] [stderr]   21:     0x7cc8e776e58e - rustc_query_impl[dd2043a667895b0]::query_vtables::typeck_root::invoke_provider_fn::__rust_begin_short_backtrace
[INFO] [stderr]   22:     0x7cc8e6abc5fa - rustc_query_impl[dd2043a667895b0]::execution::try_execute_query::<rustc_data_structures[16bfc8b56cfc6142]::vec_cache::VecCache<rustc_span[4b7b5a53591785e6]::def_id::LocalDefId, rustc_middle[264df97201bda3a9]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[264df97201bda3a9]::dep_graph::graph::DepNodeIndex>, false>
[INFO] [stderr]   23:     0x7cc8e6abc22d - rustc_query_impl[dd2043a667895b0]::query_vtables::typeck_root::execute_query_non_incr::__rust_end_short_backtrace
[INFO] [stderr]   24:     0x7cc8e67e731c - <rustc_middle[264df97201bda3a9]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis[7da984f530155d80]::check_crate::{closure#1}>::{closure#0}
[INFO] [stderr]   25:     0x7cc8e67e69cb - rustc_hir_analysis[7da984f530155d80]::check_crate
[INFO] [stderr]   26:     0x7cc8e6ab8fca - rustc_interface[f286839d7ce16120]::passes::analysis
[INFO] [stderr]   27:     0x7cc8e745b547 - rustc_query_impl[dd2043a667895b0]::execution::try_execute_query::<rustc_middle[264df97201bda3a9]::query::caches::SingleCache<rustc_middle[264df97201bda3a9]::query::erase::ErasedData<[u8; 0usize]>>, false>
[INFO] [stderr]   28:     0x7cc8e745b32b - rustc_query_impl[dd2043a667895b0]::query_vtables::analysis::execute_query_non_incr::__rust_end_short_backtrace
[INFO] [stderr]   29:     0x7cc8e75a87c9 - rustc_interface[f286839d7ce16120]::interface::run_compiler::<(), rustc_driver_impl[fec14241f8975cfd]::run_compiler::{closure#0}>::{closure#2}
[INFO] [stderr]   30:     0x7cc8e761f7e4 - std[617be2ca0a6fd877]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[f286839d7ce16120]::util::run_in_thread_with_globals<rustc_interface[f286839d7ce16120]::util::run_in_thread_pool_with_globals<rustc_interface[f286839d7ce16120]::interface::run_compiler<(), rustc_driver_impl[fec14241f8975cfd]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
[INFO] [stderr]   31:     0x7cc8e761f57d - <std[617be2ca0a6fd877]::thread::lifecycle::spawn_unchecked<rustc_interface[f286839d7ce16120]::util::run_in_thread_with_globals<rustc_interface[f286839d7ce16120]::util::run_in_thread_pool_with_globals<rustc_interface[f286839d7ce16120]::interface::run_compiler<(), rustc_driver_impl[fec14241f8975cfd]::run_compiler::{closure#0}>::{closure#2}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[a373ad73a504971]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
[INFO] [stderr]   32:     0x7cc8e762a3ad - <std[617be2ca0a6fd877]::sys::thread::unix::Thread>::new::thread_start
[INFO] [stderr]   33:     0x7cc8e0882dfa - <unknown>
[INFO] [stderr]   34:     0x7cc8e09163d4 - clone
[INFO] [stderr]   35:                0x0 - <unknown>
[INFO] [stderr] 
[INFO] [stderr] error: the compiler unexpectedly panicked. This is a bug
[INFO] [stderr] 
[INFO] [stderr] 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
[INFO] [stderr] 
[INFO] [stderr] note: rustc 1.100.0-beta.1 (e3feeb59c 2026-09-27) running on x86_64-unknown-linux-gnu
[INFO] [stderr] 
[INFO] [stderr] note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2
[INFO] [stderr] 
[INFO] [stderr] note: some of the compiler flags provided by cargo are hidden

Activity

  1. added
    C-bugCategory: This is a bug.
    regression-untriagedUntriaged performance or correctness regression.
    on Oct 5, 2026
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Oct 5, 2026
  3. mejrs commented on Oct 5, 2026

    @mejrs
    MemberAuthor
  4. added
    E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc
    E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example
    on Oct 5, 2026
  5. LorrensP-2158466 commented on Oct 5, 2026

    @LorrensP-2158466
    Contributor

    @mejrs, I could fix this, but i can't seem to reproduce this locally? is there something else i need to to since its on beta? (never done this)

  6. mejrs commented on Oct 7, 2026

    @mejrs
    MemberAuthor

    I don't know, maybe you are on an outdated beta/nightly?

  7. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Oct 8, 2026
  8. LorrensP-2158466 commented on Oct 8, 2026

    @LorrensP-2158466
    Contributor

    alright, so it fails with latest beta but not with latest nightly or the main branch. I would say its fixed? Or i am definitely doing something wrong:

    nightly is commit: 1d81eb4

    > cargo clone ftc@0.1.5
    > cd ftc
    > cargo +nightly build
    error[E0422]: cannot find struct, variant or union type `LineColumn` in crate `proc_macro`
       --> /Users/lorrens/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/proc-macro2-1.0.51/src/wrapper.rs:475:33
        |
    475 |                 let proc_macro::LineColumn { line, column } = s.start();
        |                                 ^^^^^^^^^^ not found in `proc_macro`
        |
    help: consider importing this struct through its public re-export
        |
      1 + use crate::LineColumn;
        |
    help: if you import `LineColumn`, refer to it directly
        |
    475 -                 let proc_macro::LineColumn { line, column } = s.start();
    475 +                 let LineColumn { line, column } = s.start();
        |
    ...
    

    and beta: a2eb609

    > cargo clone ftc@0.1.5
    > cd ftc
    > cargo +beta build
    thread 'rustc' (16193993) panicked at /rustc-dev/a2eb6097d22d908142aa4a067bc2cb70860a95b7/compiler/rustc_hir_typeck/src/method/confirm.rs:762:54:
    index out of bounds: the len is 0 but the index is 0
    stack backtrace:
    

    so i believe its already fixed on nightly?

  9. mejrs commented on Oct 8, 2026

    @mejrs
    MemberAuthor

    It's possible it's been fixed accidentally, if so a regression test should be added.

    In any case, it would be nice to do a beta backport of the fix.

  10. mejrs commented on Oct 8, 2026

    @mejrs
    MemberAuthor

    Oh, I think this might be #162857, can you confirm?

  11. LorrensP-2158466 commented on Oct 8, 2026

    @LorrensP-2158466
    Contributor

    You know, I thought I was going crazy because I know that issue/pr 😅. Glad I am not

  12. LorrensP-2158466 commented on Oct 8, 2026

    @LorrensP-2158466
    Contributor

    can you confirm?

    Had to double check, but yeah the issue references the exact location the ICE happens as this issue.

  13. theemathas commented on Oct 10, 2026

    @theemathas
    Contributor
  14. darkraider01 commented on Oct 10, 2026

    @darkraider01
    Contributor

    I was looking through this and #162904, and the fix there does seem to explain the ICE, since the ambiguity flag and import_ids could end up coming from different candidates.

    One thing I noticed though: the nightly build of ftc fails earlier in proc-macro2, so that run doesn't really confirm whether the ICE is gone.

    Since #162904 is already accepted for beta backport, might be worth checking both ftc and spacer before and after the fix? Mainly to confirm that both reproduce the same ICE without it, and that applying #162904 gets rid of the panic in both cases, rather than just hitting an unrelated compilation error earlier.

  15. theemathas commented on Oct 14, 2026

    @theemathas
    Contributor

    I have verified locally that rustc 1.100.0-beta.5 (8ea38001b 2026-10-13) fixes both ICEs.

  16. removed
    I-prioritizeIssue needs a team member to assess the impact. Will be replaced by P-{low,medium,high,critical}
    on Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcE-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions