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: 0, compiler/rustc_middle/src/ty/sty.rs #109191

Closed
matthiaskrgr opened this issue Mar 15, 2023 · 2 comments · Fixed by #109200
Closed

ICE: index out of bounds: 0, compiler/rustc_middle/src/ty/sty.rs #109191

matthiaskrgr opened this issue Mar 15, 2023 · 2 comments · Fixed by #109200
Assignees
Labels
C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

trait Foo<T>: {
    fn bar() -> ((), );
}

impl Foo<> () {
    fn bar( s: _) -> _ {}
}

Meta

rustc --version --verbose:

rustc 1.70.0-nightly (171693274 2023-03-14)
binary: rustc
commit-hash: 1716932743a7b3705cbf0c34db0c4e070ed1930d
commit-date: 2023-03-14
host: x86_64-unknown-linux-gnu
release: 1.70.0-nightly
LLVM version: 15.0.7

Error output

<output>
Backtrace

thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 0', /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/compiler/rustc_middle/src/ty/sty.rs:1388:37
stack backtrace:
   0:     0x7f06816dc51a - std::backtrace_rs::backtrace::libunwind::trace::hb525d69e070ade81
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f06816dc51a - std::backtrace_rs::backtrace::trace_unsynchronized::hc013ba6c022c8cc0
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f06816dc51a - std::sys_common::backtrace::_print_fmt::hc99069d428720acc
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f06816dc51a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h6b2dfd5fb54878e3
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f068173fc5e - core::fmt::write::he277a08b33a83db8
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/core/src/fmt/mod.rs:1232:17
   5:     0x7f06816cf375 - std::io::Write::write_fmt::h6a5aa3320aae0280
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/std/src/io/mod.rs:1684:15
   6:     0x7f06816dc2e5 - std::sys_common::backtrace::_print::h763b5adb4e9083ff
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f06816dc2e5 - std::sys_common::backtrace::print::h5a4028b32a3df8a2
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f06816df05f - std::panicking::default_hook::{{closure}}::h0c8c81b9641f8819
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/std/src/panicking.rs:271:22
   9:     0x7f06816ded9b - std::panicking::default_hook::h5bf7cd33f355743b
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/std/src/panicking.rs:290:9
  10:     0x7f06804577f5 - rustc_driver_impl[aa1a5107c9e4d916]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f06816df89d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h31d3f61cac634989
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/alloc/src/boxed.rs:2002:9
  12:     0x7f06816df89d - std::panicking::rust_panic_with_hook::h11aed2986f5c5154
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/std/src/panicking.rs:696:13
  13:     0x7f06816df619 - std::panicking::begin_panic_handler::{{closure}}::h5030a267c334a760
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/std/src/panicking.rs:583:13
  14:     0x7f06816dc986 - std::sys_common::backtrace::__rust_end_short_backtrace::hf19b9029d2a05570
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/std/src/sys_common/backtrace.rs:150:18
  15:     0x7f06816df322 - rust_begin_unwind
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/std/src/panicking.rs:579:5
  16:     0x7f068173bfb3 - core::panicking::panic_fmt::hc179041817e007c3
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/core/src/panicking.rs:64:14
  17:     0x7f068173c1a2 - core::panicking::panic_bounds_check::hda6c0d7fc7289ef8
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/core/src/panicking.rs:159:5
  18:     0x7f06805ebc7b - <rustc_middle[91c99f5af0859808]::ty::sty::Binder<rustc_middle[91c99f5af0859808]::ty::sty::FnSig>>::map_bound_ref::<<rustc_middle[91c99f5af0859808]::ty::sty::Binder<rustc_middle[91c99f5af0859808]::ty::sty::FnSig>>::input::{closure#0}, rustc_middle[91c99f5af0859808]::ty::Ty>
  19:     0x7f06805830b9 - <dyn rustc_hir_analysis[2cd7f2356faca1ef]::astconv::AstConv>::suggest_trait_fn_ty_for_impl_fn_infer
  20:     0x7f067f3a58f5 - <dyn rustc_hir_analysis[2cd7f2356faca1ef]::astconv::AstConv>::ty_of_fn::{closure#0}
  21:     0x7f067f265945 - rustc_hir_analysis[2cd7f2356faca1ef]::collect::fn_sig
  22:     0x7f067f263d50 - rustc_query_system[d086d80e7946fec]::query::plumbing::try_execute_query::<rustc_query_impl[4365cf0f327aa4bf]::queries::fn_sig, rustc_query_impl[4365cf0f327aa4bf]::plumbing::QueryCtxt>
  23:     0x7f067f2631c1 - <rustc_query_impl[4365cf0f327aa4bf]::Queries as rustc_middle[91c99f5af0859808]::ty::query::QueryEngine>::fn_sig
  24:     0x7f067ec898b5 - <rustc_hir_analysis[2cd7f2356faca1ef]::collect::CollectItemTypesVisitor as rustc_hir[2286395576989f03]::intravisit::Visitor>::visit_impl_item
  25:     0x7f067ec83e30 - <rustc_middle[91c99f5af0859808]::hir::map::Map>::visit_item_likes_in_module::<rustc_hir_analysis[2cd7f2356faca1ef]::collect::CollectItemTypesVisitor>
  26:     0x7f067ec83c1c - rustc_hir_analysis[2cd7f2356faca1ef]::collect::collect_mod_item_types
  27:     0x7f067fa9a0de - rustc_query_system[d086d80e7946fec]::query::plumbing::try_execute_query::<rustc_query_impl[4365cf0f327aa4bf]::queries::collect_mod_item_types, rustc_query_impl[4365cf0f327aa4bf]::plumbing::QueryCtxt>
  28:     0x7f067fa99c63 - <rustc_query_impl[4365cf0f327aa4bf]::Queries as rustc_middle[91c99f5af0859808]::ty::query::QueryEngine>::collect_mod_item_types
  29:     0x7f067e81fe33 - <rustc_session[66f881e4886b517]::session::Session>::track_errors::<rustc_hir_analysis[2cd7f2356faca1ef]::check_crate::{closure#0}, ()>
  30:     0x7f067e81c7b2 - rustc_hir_analysis[2cd7f2356faca1ef]::check_crate
  31:     0x7f067e8145e2 - rustc_interface[92ae9247c658ed28]::passes::analysis
  32:     0x7f067fc7b95c - rustc_query_system[d086d80e7946fec]::query::plumbing::try_execute_query::<rustc_query_impl[4365cf0f327aa4bf]::queries::analysis, rustc_query_impl[4365cf0f327aa4bf]::plumbing::QueryCtxt>
  33:     0x7f067fc7b650 - <rustc_query_impl[4365cf0f327aa4bf]::Queries as rustc_middle[91c99f5af0859808]::ty::query::QueryEngine>::analysis
  34:     0x7f067faa3369 - <rustc_middle[91c99f5af0859808]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[aa1a5107c9e4d916]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[93f4c45d685c579b]::result::Result<(), rustc_span[3a8ff7714ec0cd56]::ErrorGuaranteed>>
  35:     0x7f067f67cfa8 - rustc_span[3a8ff7714ec0cd56]::with_source_map::<core[93f4c45d685c579b]::result::Result<(), rustc_span[3a8ff7714ec0cd56]::ErrorGuaranteed>, rustc_interface[92ae9247c658ed28]::interface::run_compiler<core[93f4c45d685c579b]::result::Result<(), rustc_span[3a8ff7714ec0cd56]::ErrorGuaranteed>, rustc_driver_impl[aa1a5107c9e4d916]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  36:     0x7f067f67420c - std[8d53a76fa3b550eb]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[92ae9247c658ed28]::util::run_in_thread_pool_with_globals<rustc_interface[92ae9247c658ed28]::interface::run_compiler<core[93f4c45d685c579b]::result::Result<(), rustc_span[3a8ff7714ec0cd56]::ErrorGuaranteed>, rustc_driver_impl[aa1a5107c9e4d916]::run_compiler::{closure#1}>::{closure#0}, core[93f4c45d685c579b]::result::Result<(), rustc_span[3a8ff7714ec0cd56]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[93f4c45d685c579b]::result::Result<(), rustc_span[3a8ff7714ec0cd56]::ErrorGuaranteed>>
  37:     0x7f067f673c3a - <<std[8d53a76fa3b550eb]::thread::Builder>::spawn_unchecked_<rustc_interface[92ae9247c658ed28]::util::run_in_thread_pool_with_globals<rustc_interface[92ae9247c658ed28]::interface::run_compiler<core[93f4c45d685c579b]::result::Result<(), rustc_span[3a8ff7714ec0cd56]::ErrorGuaranteed>, rustc_driver_impl[aa1a5107c9e4d916]::run_compiler::{closure#1}>::{closure#0}, core[93f4c45d685c579b]::result::Result<(), rustc_span[3a8ff7714ec0cd56]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[93f4c45d685c579b]::result::Result<(), rustc_span[3a8ff7714ec0cd56]::ErrorGuaranteed>>::{closure#1} as core[93f4c45d685c579b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  38:     0x7f06816e9793 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb296ec1752427222
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/alloc/src/boxed.rs:1988:9
  39:     0x7f06816e9793 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha3d23d73a848aedf
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/alloc/src/boxed.rs:1988:9
  40:     0x7f06816e9793 - std::sys::unix::thread::Thread::new::thread_start::hdf09fab72a35a799
                               at /rustc/1716932743a7b3705cbf0c34db0c4e070ed1930d/library/std/src/sys/unix/thread.rs:108:17
  41:     0x7f067d067bb5 - <unknown>
  42:     0x7f067d0e9d90 - <unknown>
  43:                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: rustc 1.70.0-nightly (171693274 2023-03-14) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [fn_sig] computing function signature of `<impl at treereduce.out:5:1: 5:14>::bar`
#1 [collect_mod_item_types] collecting item types in top-level module
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0107, E0601.
For more information about an error, try `rustc --explain E0107`.

@matthiaskrgr matthiaskrgr added 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. C-bug Category: This is a bug. labels Mar 15, 2023
@bwmf2
Copy link
Contributor

bwmf2 commented Mar 16, 2023

Minimal:

trait Foo {
    fn bar();
}

impl Foo for () {
    fn bar(s: _) {}
}

@langston-barrett
Copy link

@rustbot label +S-bug-has-mcve

@rustbot rustbot added the S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue label Mar 17, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 17, 2023
…ffleLapkin

Fix index out of bounds in `suggest_trait_fn_ty_for_impl_fn_infer`

Fixes rust-lang#109191
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 17, 2023
…ffleLapkin

Fix index out of bounds in `suggest_trait_fn_ty_for_impl_fn_infer`

Fixes rust-lang#109191
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Mar 17, 2023
…ffleLapkin

Fix index out of bounds in `suggest_trait_fn_ty_for_impl_fn_infer`

Fixes rust-lang#109191
@bors bors closed this as completed in 55d5cd5 Mar 18, 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. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue 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.

6 participants