Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: index out of bounds: the len is 2 but the index is 2 #117209

Closed
hw0lff opened this issue Oct 26, 2023 · 1 comment · Fixed by #117246
Closed

ICE: index out of bounds: the len is 2 but the index is 2 #117209

hw0lff opened this issue Oct 26, 2023 · 1 comment · Fixed by #117246
Assignees
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@hw0lff
Copy link

hw0lff commented Oct 26, 2023

Code

use std::collections::HashMap;
use std::hash::Hash;

trait LowT: Identify {}

trait Identify {
    type Id: Clone + Hash + PartialEq + Eq;
    fn identify(&self) -> Self::Id;
}

struct MapStore<L, I>
where
    L: LowT + Identify<Id = I>,
{
    lows: HashMap<I, L>,
}

impl<L, I> MapStore<L, I>
where
    L: LowT + Identify<Id = I>,
    I: Clone + Hash + PartialEq + Eq,
{
    fn remove_low(&mut self, low: &impl LowT) {
        let _low = self.lows.remove(low.identify()).unwrap();
    }
}

Executed command

rustc +nightly-2023-10-24-x86_64-unknown-linux-gnu --crate-type lib mve.rs

Meta

rustc --version --verbose:

rustc 1.75.0-nightly (cd674d617 2023-10-24)
binary: rustc
commit-hash: cd674d61790607dfb6faa9d754bd3adfa13aea7c
commit-date: 2023-10-24
host: x86_64-unknown-linux-gnu
release: 1.75.0-nightly
LLVM version: 17.0.3

Error output

thread 'rustc' panicked at compiler/rustc_middle/src/ty/generics.rs:233:25:
index out of bounds: the len is 2 but the index is 2
stack backtrace:
   0:     0x7f44e816917c - std::backtrace_rs::backtrace::libunwind::trace::h7bce2d1c017b407e
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f44e816917c - std::backtrace_rs::backtrace::trace_unsynchronized::h55ba654239184904
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f44e816917c - std::sys_common::backtrace::_print_fmt::h3ea3555f96c73e0c
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7f44e816917c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h146a50ffccbc77e1
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f44e81cb400 - core::fmt::rt::Argument::fmt::haa20c5eab981f919
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/core/src/fmt/rt.rs:142:9
   5:     0x7f44e81cb400 - core::fmt::write::h09f4c19b93ee31d0
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/core/src/fmt/mod.rs:1117:17
   6:     0x7f44e815d09f - std::io::Write::write_fmt::h3ed8d223e2f5f8c7
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/io/mod.rs:1762:15
   7:     0x7f44e8168f64 - std::sys_common::backtrace::_print::hbce9214e75b3c008
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f44e8168f64 - std::sys_common::backtrace::print::ha135181f946a9965
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f44e816bbf7 - std::panicking::default_hook::{{closure}}::h848bb1d6992f4e40
  10:     0x7f44e816b95f - std::panicking::default_hook::h32ba10667577a9f0
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/panicking.rs:292:9
  11:     0x7f44eacbe770 - std[3e12a1aaf923ebba]::panicking::update_hook::<alloc[24e94c6c997ff992]::boxed::Box<rustc_driver_impl[e640377bb3e0eec1]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f44e816c338 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h02c0533e694d267b
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/alloc/src/boxed.rs:2021:9
  13:     0x7f44e816c338 - std::panicking::rust_panic_with_hook::hcba6804c3ef73408
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/panicking.rs:735:13
  14:     0x7f44e816c08e - std::panicking::begin_panic_handler::{{closure}}::hc6a5671dd9cedf35
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/panicking.rs:609:13
  15:     0x7f44e8169646 - std::sys_common::backtrace::__rust_end_short_backtrace::hb1f91cd088c3276f
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/sys_common/backtrace.rs:170:18
  16:     0x7f44e816bdf2 - rust_begin_unwind
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/panicking.rs:597:5
  17:     0x7f44e81c7b25 - core::panicking::panic_fmt::h72d86cf16822315b
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/core/src/panicking.rs:72:14
  18:     0x7f44e81c7d42 - core::panicking::panic_bounds_check::h479c4c4d8bdf8a87
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/core/src/panicking.rs:190:5
  19:     0x7f44ed134b10 - <rustc_middle[1315509b21ac545f]::ty::generics::Generics>::type_param.cold.0
  20:     0x7f44eaf1745e - <rustc_infer[350baa5682eb376b]::infer::error_reporting::TypeErrCtxt>::suggest_constraint::<&<rustc_infer[350baa5682eb376b]::infer::error_reporting::TypeErrCtxt>::note_and_explain_type_err::{closure#6}>
  21:     0x7f44eaf17b77 - <rustc_infer[350baa5682eb376b]::infer::error_reporting::TypeErrCtxt>::suggest_constraint::<&<rustc_infer[350baa5682eb376b]::infer::error_reporting::TypeErrCtxt>::note_and_explain_type_err::{closure#6}>
  22:     0x7f44eaf15724 - <rustc_infer[350baa5682eb376b]::infer::error_reporting::TypeErrCtxt>::note_and_explain_type_err
  23:     0x7f44eaf5bed1 - <rustc_infer[350baa5682eb376b]::infer::error_reporting::TypeErrCtxt>::note_type_err
  24:     0x7f44eaf31ea8 - <rustc_infer[350baa5682eb376b]::infer::error_reporting::TypeErrCtxt>::report_and_explain_type_error
  25:     0x7f44eae656d5 - <rustc_hir_typeck[37b671e90ff2c382]::fn_ctxt::FnCtxt>::report_arg_errors
  26:     0x7f44ec7bab35 - <rustc_hir_typeck[37b671e90ff2c382]::fn_ctxt::FnCtxt>::check_argument_types
  27:     0x7f44ec89287c - <rustc_hir_typeck[37b671e90ff2c382]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  28:     0x7f44ec8922a5 - <rustc_hir_typeck[37b671e90ff2c382]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  29:     0x7f44ec3721f1 - <rustc_hir_typeck[37b671e90ff2c382]::fn_ctxt::FnCtxt>::check_decl
  30:     0x7f44ec36fc1a - <rustc_hir_typeck[37b671e90ff2c382]::fn_ctxt::FnCtxt>::check_block_with_expected
  31:     0x7f44ec892263 - <rustc_hir_typeck[37b671e90ff2c382]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  32:     0x7f44ec6329d2 - rustc_hir_typeck[37b671e90ff2c382]::check::check_fn
  33:     0x7f44ec0e9de6 - rustc_hir_typeck[37b671e90ff2c382]::typeck
  34:     0x7f44ec0e927d - rustc_query_impl[908b9bd8c7a24ee6]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[908b9bd8c7a24ee6]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[1315509b21ac545f]::query::erase::Erased<[u8; 8usize]>>
  35:     0x7f44ebf4582c - rustc_query_system[86e76f7375bc9374]::query::plumbing::try_execute_query::<rustc_query_impl[908b9bd8c7a24ee6]::DynamicConfig<rustc_query_system[86e76f7375bc9374]::query::caches::VecCache<rustc_span[644891a9fc144be9]::def_id::LocalDefId, rustc_middle[1315509b21ac545f]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[908b9bd8c7a24ee6]::plumbing::QueryCtxt, false>
  36:     0x7f44ebf45510 - rustc_query_impl[908b9bd8c7a24ee6]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  37:     0x7f44ec2091f2 - rustc_hir_analysis[a2e6bea767eb7f54]::check_crate
  38:     0x7f44ec44c29f - rustc_interface[3ed30a2b320926ec]::passes::analysis
  39:     0x7f44ec44bca1 - rustc_query_impl[908b9bd8c7a24ee6]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[908b9bd8c7a24ee6]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[1315509b21ac545f]::query::erase::Erased<[u8; 1usize]>>
  40:     0x7f44ec914726 - rustc_query_system[86e76f7375bc9374]::query::plumbing::try_execute_query::<rustc_query_impl[908b9bd8c7a24ee6]::DynamicConfig<rustc_query_system[86e76f7375bc9374]::query::caches::SingleCache<rustc_middle[1315509b21ac545f]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[908b9bd8c7a24ee6]::plumbing::QueryCtxt, false>
  41:     0x7f44ec914555 - rustc_query_impl[908b9bd8c7a24ee6]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  42:     0x7f44ecb0f00d - std[3e12a1aaf923ebba]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[3ed30a2b320926ec]::util::run_in_thread_with_globals<rustc_interface[3ed30a2b320926ec]::interface::run_compiler<core[1f7dd8185696d514]::result::Result<(), rustc_span[644891a9fc144be9]::ErrorGuaranteed>, rustc_driver_impl[e640377bb3e0eec1]::run_compiler::{closure#1}>::{closure#0}, core[1f7dd8185696d514]::result::Result<(), rustc_span[644891a9fc144be9]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[1f7dd8185696d514]::result::Result<(), rustc_span[644891a9fc144be9]::ErrorGuaranteed>>
  43:     0x7f44ecb0e2f3 - <<std[3e12a1aaf923ebba]::thread::Builder>::spawn_unchecked_<rustc_interface[3ed30a2b320926ec]::util::run_in_thread_with_globals<rustc_interface[3ed30a2b320926ec]::interface::run_compiler<core[1f7dd8185696d514]::result::Result<(), rustc_span[644891a9fc144be9]::ErrorGuaranteed>, rustc_driver_impl[e640377bb3e0eec1]::run_compiler::{closure#1}>::{closure#0}, core[1f7dd8185696d514]::result::Result<(), rustc_span[644891a9fc144be9]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[1f7dd8185696d514]::result::Result<(), rustc_span[644891a9fc144be9]::ErrorGuaranteed>>::{closure#1} as core[1f7dd8185696d514]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  44:     0x7f44e8177105 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h97fb79c1bb86e864
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/alloc/src/boxed.rs:2007:9
  45:     0x7f44e8177105 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc948a15aaf1aa99f
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/alloc/src/boxed.rs:2007:9
  46:     0x7f44e8177105 - std::sys::unix::thread::Thread::new::thread_start::h346c5d92e5cdd54a
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/sys/unix/thread.rs:108:17
  47:     0x7f44e7f409eb - <unknown>
  48:     0x7f44e7fc47cc - <unknown>
  49:                0x0 - <unknown>

error: the compiler unexpectedly panicked. this is a bug.

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 attach the file at `/home/hendrik/code/rust/rust-ice/rustc-ice-2023-10-26T08_50_02-149603.txt` to your bug report

note: compiler flags: --crate-type lib

query stack during panic:
#0 [typeck] type-checking `<impl at mve.rs:18:1: 21:38>::remove_low`
#1 [analysis] running analysis passes on this crate
end of query stack
error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: no errors reported for args
  --> mve.rs:24:30
   |
24 |         let _low = self.lows.remove(low.identify()).unwrap();
   |                              ^^^^^^
   |
note: delayed at compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs:525:22
         0: <rustc_errors::HandlerInner>::emit_diagnostic
         1: <rustc_session::session::Session>::delay_span_bug::<rustc_span::span_encoding::Span, &str>
         2: <rustc_hir_typeck::fn_ctxt::FnCtxt>::report_arg_errors
         3: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
         4: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
         5: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
         6: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_decl
         7: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
         8: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
         9: rustc_hir_typeck::check::check_fn
        10: rustc_hir_typeck::typeck
        11: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
        12: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        13: rustc_query_impl::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
        14: rustc_hir_analysis::check_crate
        15: rustc_interface::passes::analysis
        16: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
        17: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
        18: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
        19: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
        20: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        21: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/alloc/src/boxed.rs:2007:9
        22: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                   at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/alloc/src/boxed.rs:2007:9
        23: std::sys::unix::thread::Thread::new::thread_start
                   at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/sys/unix/thread.rs:108:17
        24: <unknown>
        25: <unknown>
  --> mve.rs:24:30
   |
24 |         let _low = self.lows.remove(low.identify()).unwrap();
   |                              ^^^^^^

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 attach the file at `/home/hendrik/code/rust/rust-ice/rustc-ice-2023-10-26T08_50_02-149603.txt` to your bug report

note: compiler flags: --crate-type lib

query stack during panic:
end of query stack
thread 'rustc' panicked at library/core/src/panicking.rs:144:5:
panic in a destructor during cleanup

error: the compiler unexpectedly panicked. this is a bug.

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 attach the file at `/home/hendrik/code/rust/rust-ice/rustc-ice-2023-10-26T08_50_02-149603.txt` to your bug report

note: compiler flags: --crate-type lib

query stack during panic:
end of query stack
thread caused non-unwinding panic. aborting.
[1]    149603 IOT instruction (core dumped)  rustc +nightly-2023-10-24-x86_64-unknown-linux-gnu --crate-type lib mve.rs
Backtrace

thread 'rustc' panicked at compiler/rustc_middle/src/ty/generics.rs:233:25:
index out of bounds: the len is 2 but the index is 2
stack backtrace:
   0:     0x7f44e81511d1 - std::backtrace_rs::backtrace::libunwind::trace::h7bce2d1c017b407e
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f44e81511d1 - std::backtrace_rs::backtrace::trace_unsynchronized::h3269cc4358dc457e
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f44e81511d1 - std::backtrace::Backtrace::create::h382850bf22e6288e
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/backtrace.rs:331:13
   3:     0x7f44e8151120 - std::backtrace::Backtrace::force_capture::he4ef61a5971363bd
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/backtrace.rs:313:9
   4:     0x7f44eacbe8ac - std[3e12a1aaf923ebba]::panicking::update_hook::<alloc[24e94c6c997ff992]::boxed::Box<rustc_driver_impl[e640377bb3e0eec1]::install_ice_hook::{closure#0}>>::{closure#0}
   5:     0x7f44e816c338 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h02c0533e694d267b
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/alloc/src/boxed.rs:2021:9
   6:     0x7f44e816c338 - std::panicking::rust_panic_with_hook::hcba6804c3ef73408
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/panicking.rs:735:13
   7:     0x7f44e816c08e - std::panicking::begin_panic_handler::{{closure}}::hc6a5671dd9cedf35
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/panicking.rs:609:13
   8:     0x7f44e8169646 - std::sys_common::backtrace::__rust_end_short_backtrace::hb1f91cd088c3276f
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/sys_common/backtrace.rs:170:18
   9:     0x7f44e816bdf2 - rust_begin_unwind
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/panicking.rs:597:5
  10:     0x7f44e81c7b25 - core::panicking::panic_fmt::h72d86cf16822315b
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/core/src/panicking.rs:72:14
  11:     0x7f44e81c7d42 - core::panicking::panic_bounds_check::h479c4c4d8bdf8a87
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/core/src/panicking.rs:190:5
  12:     0x7f44ed134b10 - <rustc_middle[1315509b21ac545f]::ty::generics::Generics>::type_param.cold.0
  13:     0x7f44eaf1745e - <rustc_infer[350baa5682eb376b]::infer::error_reporting::TypeErrCtxt>::suggest_constraint::<&<rustc_infer[350baa5682eb376b]::infer::error_reporting::TypeErrCtxt>::note_and_explain_type_err::{closure#6}>
  14:     0x7f44eaf17b77 - <rustc_infer[350baa5682eb376b]::infer::error_reporting::TypeErrCtxt>::suggest_constraint::<&<rustc_infer[350baa5682eb376b]::infer::error_reporting::TypeErrCtxt>::note_and_explain_type_err::{closure#6}>
  15:     0x7f44eaf15724 - <rustc_infer[350baa5682eb376b]::infer::error_reporting::TypeErrCtxt>::note_and_explain_type_err
  16:     0x7f44eaf5bed1 - <rustc_infer[350baa5682eb376b]::infer::error_reporting::TypeErrCtxt>::note_type_err
  17:     0x7f44eaf31ea8 - <rustc_infer[350baa5682eb376b]::infer::error_reporting::TypeErrCtxt>::report_and_explain_type_error
  18:     0x7f44eae656d5 - <rustc_hir_typeck[37b671e90ff2c382]::fn_ctxt::FnCtxt>::report_arg_errors
  19:     0x7f44ec7bab35 - <rustc_hir_typeck[37b671e90ff2c382]::fn_ctxt::FnCtxt>::check_argument_types
  20:     0x7f44ec89287c - <rustc_hir_typeck[37b671e90ff2c382]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  21:     0x7f44ec8922a5 - <rustc_hir_typeck[37b671e90ff2c382]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  22:     0x7f44ec3721f1 - <rustc_hir_typeck[37b671e90ff2c382]::fn_ctxt::FnCtxt>::check_decl
  23:     0x7f44ec36fc1a - <rustc_hir_typeck[37b671e90ff2c382]::fn_ctxt::FnCtxt>::check_block_with_expected
  24:     0x7f44ec892263 - <rustc_hir_typeck[37b671e90ff2c382]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  25:     0x7f44ec6329d2 - rustc_hir_typeck[37b671e90ff2c382]::check::check_fn
  26:     0x7f44ec0e9de6 - rustc_hir_typeck[37b671e90ff2c382]::typeck
  27:     0x7f44ec0e927d - rustc_query_impl[908b9bd8c7a24ee6]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[908b9bd8c7a24ee6]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[1315509b21ac545f]::query::erase::Erased<[u8; 8usize]>>
  28:     0x7f44ebf4582c - rustc_query_system[86e76f7375bc9374]::query::plumbing::try_execute_query::<rustc_query_impl[908b9bd8c7a24ee6]::DynamicConfig<rustc_query_system[86e76f7375bc9374]::query::caches::VecCache<rustc_span[644891a9fc144be9]::def_id::LocalDefId, rustc_middle[1315509b21ac545f]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[908b9bd8c7a24ee6]::plumbing::QueryCtxt, false>
  29:     0x7f44ebf45510 - rustc_query_impl[908b9bd8c7a24ee6]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  30:     0x7f44ec2091f2 - rustc_hir_analysis[a2e6bea767eb7f54]::check_crate
  31:     0x7f44ec44c29f - rustc_interface[3ed30a2b320926ec]::passes::analysis
  32:     0x7f44ec44bca1 - rustc_query_impl[908b9bd8c7a24ee6]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[908b9bd8c7a24ee6]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[1315509b21ac545f]::query::erase::Erased<[u8; 1usize]>>
  33:     0x7f44ec914726 - rustc_query_system[86e76f7375bc9374]::query::plumbing::try_execute_query::<rustc_query_impl[908b9bd8c7a24ee6]::DynamicConfig<rustc_query_system[86e76f7375bc9374]::query::caches::SingleCache<rustc_middle[1315509b21ac545f]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[908b9bd8c7a24ee6]::plumbing::QueryCtxt, false>
  34:     0x7f44ec914555 - rustc_query_impl[908b9bd8c7a24ee6]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  35:     0x7f44ecb0f00d - std[3e12a1aaf923ebba]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[3ed30a2b320926ec]::util::run_in_thread_with_globals<rustc_interface[3ed30a2b320926ec]::interface::run_compiler<core[1f7dd8185696d514]::result::Result<(), rustc_span[644891a9fc144be9]::ErrorGuaranteed>, rustc_driver_impl[e640377bb3e0eec1]::run_compiler::{closure#1}>::{closure#0}, core[1f7dd8185696d514]::result::Result<(), rustc_span[644891a9fc144be9]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[1f7dd8185696d514]::result::Result<(), rustc_span[644891a9fc144be9]::ErrorGuaranteed>>
  36:     0x7f44ecb0e2f3 - <<std[3e12a1aaf923ebba]::thread::Builder>::spawn_unchecked_<rustc_interface[3ed30a2b320926ec]::util::run_in_thread_with_globals<rustc_interface[3ed30a2b320926ec]::interface::run_compiler<core[1f7dd8185696d514]::result::Result<(), rustc_span[644891a9fc144be9]::ErrorGuaranteed>, rustc_driver_impl[e640377bb3e0eec1]::run_compiler::{closure#1}>::{closure#0}, core[1f7dd8185696d514]::result::Result<(), rustc_span[644891a9fc144be9]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[1f7dd8185696d514]::result::Result<(), rustc_span[644891a9fc144be9]::ErrorGuaranteed>>::{closure#1} as core[1f7dd8185696d514]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  37:     0x7f44e8177105 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h97fb79c1bb86e864
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/alloc/src/boxed.rs:2007:9
  38:     0x7f44e8177105 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc948a15aaf1aa99f
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/alloc/src/boxed.rs:2007:9
  39:     0x7f44e8177105 - std::sys::unix::thread::Thread::new::thread_start::h346c5d92e5cdd54a
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/sys/unix/thread.rs:108:17
  40:     0x7f44e7f409eb - <unknown>
  41:     0x7f44e7fc47cc - <unknown>
  42:                0x0 - <unknown>


rustc version: 1.75.0-nightly (cd674d617 2023-10-24)
platform: x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `<impl at mve.rs:18:1: 21:38>::remove_low`
#1 [analysis] running analysis passes on this crate
end of query stack
delayed span bug: no errors reported for args
   0: <rustc_errors::HandlerInner>::emit_diagnostic
   1: <rustc_session::session::Session>::delay_span_bug::<rustc_span::span_encoding::Span, &str>
   2: <rustc_hir_typeck::fn_ctxt::FnCtxt>::report_arg_errors
   3: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
   4: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
   5: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
   6: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_decl
   7: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
   8: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
   9: rustc_hir_typeck::check::check_fn
  10: rustc_hir_typeck::typeck
  11: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
  12: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
  13: rustc_query_impl::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  14: rustc_hir_analysis::check_crate
  15: rustc_interface::passes::analysis
  16: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 1]>>
  17: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 1]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
  18: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  19: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
  20: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  21: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/alloc/src/boxed.rs:2007:9
  22: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/alloc/src/boxed.rs:2007:9
  23: std::sys::unix::thread::Thread::new::thread_start
             at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/sys/unix/thread.rs:108:17
  24: <unknown>
  25: <unknown>

thread 'rustc' panicked at library/core/src/panicking.rs:144:5:
panic in a destructor during cleanup
stack backtrace:
   0:     0x7f44e81511d1 - std::backtrace_rs::backtrace::libunwind::trace::h7bce2d1c017b407e
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f44e81511d1 - std::backtrace_rs::backtrace::trace_unsynchronized::h3269cc4358dc457e
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f44e81511d1 - std::backtrace::Backtrace::create::h382850bf22e6288e
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/backtrace.rs:331:13
   3:     0x7f44e8151120 - std::backtrace::Backtrace::force_capture::he4ef61a5971363bd
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/backtrace.rs:313:9
   4:     0x7f44eacbe8ac - std[3e12a1aaf923ebba]::panicking::update_hook::<alloc[24e94c6c997ff992]::boxed::Box<rustc_driver_impl[e640377bb3e0eec1]::install_ice_hook::{closure#0}>>::{closure#0}
   5:     0x7f44e816c338 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h02c0533e694d267b
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/alloc/src/boxed.rs:2021:9
   6:     0x7f44e816c338 - std::panicking::rust_panic_with_hook::hcba6804c3ef73408
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/panicking.rs:735:13
   7:     0x7f44e816c059 - std::panicking::begin_panic_handler::{{closure}}::hc6a5671dd9cedf35
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/panicking.rs:601:13
   8:     0x7f44e8169646 - std::sys_common::backtrace::__rust_end_short_backtrace::hb1f91cd088c3276f
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/sys_common/backtrace.rs:170:18
   9:     0x7f44e816bdf2 - rust_begin_unwind
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/panicking.rs:597:5
  10:     0x7f44e81c7b68 - core::panicking::panic_nounwind_fmt::ha053acf6fac3d2de
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/core/src/panicking.rs:106:14
  11:     0x7f44e81c7c6c - core::panicking::panic_nounwind_nobacktrace::hea69e5a3f0569c51
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/core/src/panicking.rs:144:5
  12:     0x7f44e81c7e73 - core::panicking::panic_in_cleanup::h234e683725602ebf
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/core/src/panicking.rs:238:5
  13:     0x7f44ecb1025b - std[3e12a1aaf923ebba]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[3ed30a2b320926ec]::util::run_in_thread_with_globals<rustc_interface[3ed30a2b320926ec]::interface::run_compiler<core[1f7dd8185696d514]::result::Result<(), rustc_span[644891a9fc144be9]::ErrorGuaranteed>, rustc_driver_impl[e640377bb3e0eec1]::run_compiler::{closure#1}>::{closure#0}, core[1f7dd8185696d514]::result::Result<(), rustc_span[644891a9fc144be9]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[1f7dd8185696d514]::result::Result<(), rustc_span[644891a9fc144be9]::ErrorGuaranteed>>
  14:     0x7f44ecb0e2f3 - <<std[3e12a1aaf923ebba]::thread::Builder>::spawn_unchecked_<rustc_interface[3ed30a2b320926ec]::util::run_in_thread_with_globals<rustc_interface[3ed30a2b320926ec]::interface::run_compiler<core[1f7dd8185696d514]::result::Result<(), rustc_span[644891a9fc144be9]::ErrorGuaranteed>, rustc_driver_impl[e640377bb3e0eec1]::run_compiler::{closure#1}>::{closure#0}, core[1f7dd8185696d514]::result::Result<(), rustc_span[644891a9fc144be9]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[1f7dd8185696d514]::result::Result<(), rustc_span[644891a9fc144be9]::ErrorGuaranteed>>::{closure#1} as core[1f7dd8185696d514]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  15:     0x7f44e8177105 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h97fb79c1bb86e864
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/alloc/src/boxed.rs:2007:9
  16:     0x7f44e8177105 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc948a15aaf1aa99f
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/alloc/src/boxed.rs:2007:9
  17:     0x7f44e8177105 - std::sys::unix::thread::Thread::new::thread_start::h346c5d92e5cdd54a
                               at /rustc/cd674d61790607dfb6faa9d754bd3adfa13aea7c/library/std/src/sys/unix/thread.rs:108:17
  18:     0x7f44e7f409eb - <unknown>
  19:     0x7f44e7fc47cc - <unknown>
  20:                0x0 - <unknown>

@hw0lff hw0lff added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 26, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 26, 2023
@hw0lff hw0lff changed the title rustc panics on index out of bounds during type checking ICE: index out of bounds: the len is 2 but the index is 2 Oct 26, 2023
@lqd
Copy link
Member

lqd commented Oct 26, 2023

I believe that's caused by #116865 cc @estebank

@estebank estebank self-assigned this Oct 26, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Oct 27, 2023
Fix ICE: Restrict param constraint suggestion

When encountering an associated item with a type param that could be constrained, do not look at the parent item if the type param comes from the associated item.

Fix rust-lang#117209, fix rust-lang#89868.
@bors bors closed this as completed in 3bbc70a Oct 27, 2023
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Oct 27, 2023
Rollup merge of rust-lang#117246 - estebank:issue-117209, r=petrochenkov

Fix ICE: Restrict param constraint suggestion

When encountering an associated item with a type param that could be constrained, do not look at the parent item if the type param comes from the associated item.

Fix rust-lang#117209, fix rust-lang#89868.
@fmease fmease removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants