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: range end index 1 out of range for slice of length 0 #121613

Closed
matthiaskrgr opened this issue Feb 25, 2024 · 3 comments · Fixed by #128337
Closed

ICE: range end index 1 out of range for slice of length 0 #121613

matthiaskrgr opened this issue Feb 25, 2024 · 3 comments · Fixed by #128337
Labels
A-HIR Area: The high-level intermediate representation (HIR) C-bug Category: This is a bug. F-more_qualified_paths `#![feature(more_qualified_paths)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. 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

auto-reduced (treereduce-rust):

fn main() {
    let _ = <Foo as A>::Assoc { br: 2 };

    let <E>::V(..) = E::V(|a, b| a.cmp(b));
}

struct StructStruct {
    br: i8,
}

struct Foo;

trait A {
    type Assoc;
}

impl A for Foo {
    type Assoc = StructStruct;
}

enum E {
    V(u8),
}

original:

fn main() {
    // destructure through a qualified path
    let <Foo as A>::Assoc { br } = StructStruct { br: 2 };
    //~^ ERROR usage of qualified paths in this context is experimental
    let _ = <Foo as A>::Assoc { br: 2 };
    //~^ ERROR usage of qualified paths in this context is experimental
    let <E>::V(..) = E::V(|a, b| a.cmp(b));
    //~^ ERROR usage of qualified paths in this context is experimental
}

struct StructStruct {
    br: i8,
}

struct Foo;

trait A {
    type Assoc;
}

impl A for Foo {
    type Assoc = StructStruct;
}

enum E {
    V(u8)
}

Version information

rustc 1.78.0-nightly (26cd5d862 2024-02-25)
binary: rustc
commit-hash: 26cd5d862e22c013ecb3396b177d3af80e95c836
commit-date: 2024-02-25
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error[E0658]: usage of qualified paths in this context is experimental
 --> /tmp/icemaker_global_tempdir.9QGrWn4SuYqB/rustc_testrunner_tmpdir_reporting.JmIv37zbqU87/mvce.rs:2:13
  |
2 |     let _ = <Foo as A>::Assoc { br: 2 };
  |             ^^^^^^^^^^^^^^^^^
  |
  = note: see issue #86935 <https://github.com/rust-lang/rust/issues/86935> for more information
  = help: add `#![feature(more_qualified_paths)]` to the crate attributes to enable
  = note: this compiler was built on 2024-02-25; consider upgrading it if it is out of date

error[E0658]: usage of qualified paths in this context is experimental
 --> /tmp/icemaker_global_tempdir.9QGrWn4SuYqB/rustc_testrunner_tmpdir_reporting.JmIv37zbqU87/mvce.rs:4:9
  |
4 |     let <E>::V(..) = E::V(|a, b| a.cmp(b));
  |         ^^^^^^
  |
  = note: see issue #86935 <https://github.com/rust-lang/rust/issues/86935> for more information
  = help: add `#![feature(more_qualified_paths)]` to the crate attributes to enable
  = note: this compiler was built on 2024-02-25; consider upgrading it if it is out of date

thread 'rustc' panicked at compiler/rustc_middle/src/ty/generics.rs:360:45:
range end index 1 out of range for slice of length 0
stack backtrace:
   0:     0x7f8c39a78a06 - std::backtrace_rs::backtrace::libunwind::trace::h2b754d54d1bde505
                               at /rustc/26cd5d862e22c013ecb3396b177d3af80e95c836/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f8c39a78a06 - std::backtrace_rs::backtrace::trace_unsynchronized::h543e1ca101948fd5
                               at /rustc/26cd5d862e22c013ecb3396b177d3af80e95c836/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f8c39a78a06 - std::sys_common::backtrace::_print_fmt::h530a113cbf476cc2
                               at /rustc/26cd5d862e22c013ecb3396b177d3af80e95c836/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f8c39a78a06 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hdaaebae0c7e457dd
                               at /rustc/26cd5d862e22c013ecb3396b177d3af80e95c836/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f8c39ac998c - core::fmt::rt::Argument::fmt::h986a5c541218a991
                               at /rustc/26cd5d862e22c013ecb3396b177d3af80e95c836/library/core/src/fmt/rt.rs:142:9
   5:     0x7f8c39ac998c - core::fmt::write::h0480b093981ac277
                               at /rustc/26cd5d862e22c013ecb3396b177d3af80e95c836/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f8c39a6d3cf - std::io::Write::write_fmt::he3dd140cfd4aef89
                               at /rustc/26cd5d862e22c013ecb3396b177d3af80e95c836/library/std/src/io/mod.rs:1846:15
   7:     0x7f8c39a787b4 - std::sys_common::backtrace::_print::hdac374456098a97e
                               at /rustc/26cd5d862e22c013ecb3396b177d3af80e95c836/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f8c39a787b4 - std::sys_common::backtrace::print::ha7f20ab884506926
                               at /rustc/26cd5d862e22c013ecb3396b177d3af80e95c836/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f8c39a7b4fb - std::panicking::default_hook::{{closure}}::h300a405277525f5d
  10:     0x7f8c39a7b249 - std::panicking::default_hook::hde1c193b2da6a81c
                               at /rustc/26cd5d862e22c013ecb3396b177d3af80e95c836/library/std/src/panicking.rs:292:9
  11:     0x7f8c3668892c - std[555420183d371a7f]::panicking::update_hook::<alloc[b9bf11d30073d6dd]::boxed::Box<rustc_driver_impl[633500a3532990b7]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f8c39a7bc60 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h68a9e4d741c266fd
                               at /rustc/26cd5d862e22c013ecb3396b177d3af80e95c836/library/alloc/src/boxed.rs:2030:9
  13:     0x7f8c39a7bc60 - std::panicking::rust_panic_with_hook::h8ba518db0741b55a
                               at /rustc/26cd5d862e22c013ecb3396b177d3af80e95c836/library/std/src/panicking.rs:783:13
  14:     0x7f8c39a7b9a2 - std::panicking::begin_panic_handler::{{closure}}::ha55fc9dde68cbcf7
                               at /rustc/26cd5d862e22c013ecb3396b177d3af80e95c836/library/std/src/panicking.rs:657:13
  15:     0x7f8c39a78ee6 - std::sys_common::backtrace::__rust_end_short_backtrace::h6838138199d9ac3e
                               at /rustc/26cd5d862e22c013ecb3396b177d3af80e95c836/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7f8c39a7b6d4 - rust_begin_unwind
                               at /rustc/26cd5d862e22c013ecb3396b177d3af80e95c836/library/std/src/panicking.rs:645:5
  17:     0x7f8c39ac5ea5 - core::panicking::panic_fmt::hb9e36ea683b16cf8
                               at /rustc/26cd5d862e22c013ecb3396b177d3af80e95c836/library/core/src/panicking.rs:72:14
  18:     0x7f8c39acc242 - core::slice::index::slice_end_index_len_fail_rt::hfe2571e0ca7c6ab9
                               at /rustc/26cd5d862e22c013ecb3396b177d3af80e95c836/library/core/src/slice/index.rs:76:5
  19:     0x7f8c39acc1c6 - core::slice::index::slice_end_index_len_fail::h6cb8a54cb476e1bd
                               at /rustc/26cd5d862e22c013ecb3396b177d3af80e95c836/library/core/src/slice/index.rs:68:9
  20:     0x7f8c36b2f0d3 - <rustc_middle[73325823477bd615]::ty::generics::Generics>::own_args
  21:     0x7f8c36974d0f - <rustc_infer[1ff49fd47709a2df]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[1ae7fbfe8e64f62d]::intravisit::Visitor>::visit_expr
  22:     0x7f8c36940535 - <rustc_infer[1ff49fd47709a2df]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[1ae7fbfe8e64f62d]::intravisit::Visitor>::visit_local
  23:     0x7f8c3692cdf2 - <rustc_infer[1ff49fd47709a2df]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[1ae7fbfe8e64f62d]::intravisit::Visitor>::visit_block
  24:     0x7f8c36975467 - <rustc_infer[1ff49fd47709a2df]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[1ae7fbfe8e64f62d]::intravisit::Visitor>::visit_expr
  25:     0x7f8c369727d2 - <rustc_infer[1ff49fd47709a2df]::infer::error_reporting::TypeErrCtxt>::emit_inference_failure_err
  26:     0x7f8c3849e5ed - <rustc_hir_typeck[2ba3259e05449eae]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  27:     0x7f8c382f8a08 - rustc_hir_typeck[2ba3259e05449eae]::check::check_fn
  28:     0x7f8c384095e2 - <rustc_hir_typeck[2ba3259e05449eae]::fn_ctxt::FnCtxt>::check_expr_closure
  29:     0x7f8c3849711d - <rustc_hir_typeck[2ba3259e05449eae]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  30:     0x7f8c3853db52 - <rustc_hir_typeck[2ba3259e05449eae]::fn_ctxt::FnCtxt>::check_argument_types
  31:     0x7f8c382c6947 - <rustc_hir_typeck[2ba3259e05449eae]::fn_ctxt::FnCtxt>::check_call
  32:     0x7f8c384944e3 - <rustc_hir_typeck[2ba3259e05449eae]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  33:     0x7f8c37ed896a - <rustc_hir_typeck[2ba3259e05449eae]::fn_ctxt::FnCtxt>::check_decl
  34:     0x7f8c37fa774d - <rustc_hir_typeck[2ba3259e05449eae]::fn_ctxt::FnCtxt>::check_block_with_expected
  35:     0x7f8c384949c6 - <rustc_hir_typeck[2ba3259e05449eae]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  36:     0x7f8c382f8a08 - rustc_hir_typeck[2ba3259e05449eae]::check::check_fn
  37:     0x7f8c37b406ad - rustc_hir_typeck[2ba3259e05449eae]::typeck
  38:     0x7f8c37b3f98b - rustc_query_impl[2c9e1b0525c9d953]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[2c9e1b0525c9d953]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[73325823477bd615]::query::erase::Erased<[u8; 8usize]>>
  39:     0x7f8c37d0e570 - rustc_query_system[dfd6c8aac03f3724]::query::plumbing::try_execute_query::<rustc_query_impl[2c9e1b0525c9d953]::DynamicConfig<rustc_query_system[dfd6c8aac03f3724]::query::caches::VecCache<rustc_span[dc6b5ece0d38defd]::def_id::LocalDefId, rustc_middle[73325823477bd615]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[2c9e1b0525c9d953]::plumbing::QueryCtxt, false>
  40:     0x7f8c37d0e08c - rustc_query_impl[2c9e1b0525c9d953]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  41:     0x7f8c383cd4d2 - <rustc_middle[73325823477bd615]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[7c1425229e6d6e04]::check_crate::{closure#6}>::{closure#0}
  42:     0x7f8c383cbd9d - rustc_hir_analysis[7c1425229e6d6e04]::check_crate
  43:     0x7f8c386059af - rustc_interface[27abfdff6e6b27c2]::passes::analysis
  44:     0x7f8c38605619 - rustc_query_impl[2c9e1b0525c9d953]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[2c9e1b0525c9d953]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[73325823477bd615]::query::erase::Erased<[u8; 1usize]>>
  45:     0x7f8c3871f8e5 - rustc_query_system[dfd6c8aac03f3724]::query::plumbing::try_execute_query::<rustc_query_impl[2c9e1b0525c9d953]::DynamicConfig<rustc_query_system[dfd6c8aac03f3724]::query::caches::SingleCache<rustc_middle[73325823477bd615]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[2c9e1b0525c9d953]::plumbing::QueryCtxt, false>
  46:     0x7f8c3871f649 - rustc_query_impl[2c9e1b0525c9d953]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  47:     0x7f8c3872eb16 - rustc_interface[27abfdff6e6b27c2]::interface::run_compiler::<core[421030ac42e8f54b]::result::Result<(), rustc_span[dc6b5ece0d38defd]::ErrorGuaranteed>, rustc_driver_impl[633500a3532990b7]::run_compiler::{closure#0}>::{closure#0}
  48:     0x7f8c389c8cc5 - std[555420183d371a7f]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[27abfdff6e6b27c2]::util::run_in_thread_with_globals<rustc_interface[27abfdff6e6b27c2]::util::run_in_thread_pool_with_globals<rustc_interface[27abfdff6e6b27c2]::interface::run_compiler<core[421030ac42e8f54b]::result::Result<(), rustc_span[dc6b5ece0d38defd]::ErrorGuaranteed>, rustc_driver_impl[633500a3532990b7]::run_compiler::{closure#0}>::{closure#0}, core[421030ac42e8f54b]::result::Result<(), rustc_span[dc6b5ece0d38defd]::ErrorGuaranteed>>::{closure#0}, core[421030ac42e8f54b]::result::Result<(), rustc_span[dc6b5ece0d38defd]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[421030ac42e8f54b]::result::Result<(), rustc_span[dc6b5ece0d38defd]::ErrorGuaranteed>>
  49:     0x7f8c389c8af2 - <<std[555420183d371a7f]::thread::Builder>::spawn_unchecked_<rustc_interface[27abfdff6e6b27c2]::util::run_in_thread_with_globals<rustc_interface[27abfdff6e6b27c2]::util::run_in_thread_pool_with_globals<rustc_interface[27abfdff6e6b27c2]::interface::run_compiler<core[421030ac42e8f54b]::result::Result<(), rustc_span[dc6b5ece0d38defd]::ErrorGuaranteed>, rustc_driver_impl[633500a3532990b7]::run_compiler::{closure#0}>::{closure#0}, core[421030ac42e8f54b]::result::Result<(), rustc_span[dc6b5ece0d38defd]::ErrorGuaranteed>>::{closure#0}, core[421030ac42e8f54b]::result::Result<(), rustc_span[dc6b5ece0d38defd]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[421030ac42e8f54b]::result::Result<(), rustc_span[dc6b5ece0d38defd]::ErrorGuaranteed>>::{closure#1} as core[421030ac42e8f54b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  50:     0x7f8c39a85635 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h176656733d324092
                               at /rustc/26cd5d862e22c013ecb3396b177d3af80e95c836/library/alloc/src/boxed.rs:2016:9
  51:     0x7f8c39a85635 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h2cb067df8c4b40c7
                               at /rustc/26cd5d862e22c013ecb3396b177d3af80e95c836/library/alloc/src/boxed.rs:2016:9
  52:     0x7f8c39a85635 - std::sys::pal::unix::thread::Thread::new::thread_start::h9c4fa792b58c770f
                               at /rustc/26cd5d862e22c013ecb3396b177d3af80e95c836/library/std/src/sys/pal/unix/thread.rs:108:17
  53:     0x7f8c336a955a - <unknown>
  54:     0x7f8c33726a3c - <unknown>
  55:                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.78.0-nightly (26cd5d862 2024-02-25) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `main`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0658`.

@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. F-more_qualified_paths `#![feature(more_qualified_paths)]` labels Feb 25, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 25, 2024
@matthiaskrgr
Copy link
Member Author

Regression in nightly-2022-06-04

commit[0] 2022-06-02: Auto merge of #97575 - nnethercote:lazify-SourceFile-lines, r=Mark-Simulacrum
commit[1] 2022-06-02: Auto merge of #97598 - spastorino:simplify-universal-impl-trait-lowering, r=cjgillot
commit[2] 2022-06-03: Auto merge of #97667 - matthiaskrgr:rollup-5cfxc85, r=matthiaskrgr
commit[3] 2022-06-03: Auto merge of #97497 - c410-f3r:z-errors, r=petrochenkov
commit[4] 2022-06-03: Auto merge of #96296 - cjgillot:remove-label-lt-shadow, r=petrochenkov
commit[5] 2022-06-03: Auto merge of #97679 - Dylan-DPC:rollup-nswmgmx, r=Dylan-DPC
commit[6] 2022-06-03: Auto merge of #89862 - lcnr:path-generics-diagnostics, r=estebank
commit[7] 2022-06-03: Auto merge of #97694 - Dylan-DPC:rollup-2yxo7ce, r=Dylan-DPC
commit[8] 2022-06-03: Auto merge of #85993 - bjorn3:serde_json, r=wesleywiser
commit[9] 2022-06-03: Auto merge of #95833 - notriddle:notriddle/human-readable-signals, r=yaahc
ERROR: no CI builds available between e714405 and a6b8c69 within last 167 days

@jieyouxu jieyouxu added E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc A-HIR Area: The high-level intermediate representation (HIR) S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc labels Feb 26, 2024
@jieyouxu jieyouxu removed the E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc label Apr 9, 2024
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Apr 15, 2024
@Qix-
Copy link

Qix- commented Jul 29, 2024

It appears I'm hitting this one as well. Tacking this on for good measure.

thread 'rustc' panicked at compiler/rustc_middle/src/ty/generics.rs:332:45:
range end index 1 out of range for slice of length 0
stack backtrace:
   0:     0x7f4ba2f747d5 - std::backtrace_rs::backtrace::libunwind::trace::h7d42dda8f80cfb99
                               at /rustc/fcc325f1bc477975e2ce5ba534fe4c77ff8a8536/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x7f4ba2f747d5 - std::backtrace_rs::backtrace::trace_unsynchronized::h26e9e07219e59ad1
                               at /rustc/fcc325f1bc477975e2ce5ba534fe4c77ff8a8536/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f4ba2f747d5 - std::backtrace::Backtrace::create::hcbfa4cf4e4a41c38
                               at /rustc/fcc325f1bc477975e2ce5ba534fe4c77ff8a8536/library/std/src/backtrace.rs:331:13
   3:     0x7f4ba2f74725 - std::backtrace::Backtrace::force_capture::h42929cf817126c78
                               at /rustc/fcc325f1bc477975e2ce5ba534fe4c77ff8a8536/library/std/src/backtrace.rs:312:9
   4:     0x7f4ba63f62ac - std[a568119b01f6acf9]::panicking::update_hook::<alloc[bb4b795e710d07dc]::boxed::Box<rustc_driver_impl[8e1afaf50ebeb9ae]::install_ice_hook::{closure#0}>>::{closure#0}
   5:     0x7f4ba2f8f59f - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h28c95c685643affe
                               at /rustc/fcc325f1bc477975e2ce5ba534fe4c77ff8a8536/library/alloc/src/boxed.rs:2084:9
   6:     0x7f4ba2f8f59f - std::panicking::rust_panic_with_hook::h4bf66cb658082ab2
                               at /rustc/fcc325f1bc477975e2ce5ba534fe4c77ff8a8536/library/std/src/panicking.rs:808:13
   7:     0x7f4ba2f8f1c7 - std::panicking::begin_panic_handler::{{closure}}::h7a19fc32e0e387d7
                               at /rustc/fcc325f1bc477975e2ce5ba534fe4c77ff8a8536/library/std/src/panicking.rs:674:13
   8:     0x7f4ba2f8c8a9 - std::sys::backtrace::__rust_end_short_backtrace::h6117389318248cc0
                               at /rustc/fcc325f1bc477975e2ce5ba534fe4c77ff8a8536/library/std/src/sys/backtrace.rs:168:18
   9:     0x7f4ba2f8ee54 - rust_begin_unwind
                               at /rustc/fcc325f1bc477975e2ce5ba534fe4c77ff8a8536/library/std/src/panicking.rs:665:5
  10:     0x7f4ba2fd83f3 - core::panicking::panic_fmt::h1817a57f977b857c
                               at /rustc/fcc325f1bc477975e2ce5ba534fe4c77ff8a8536/library/core/src/panicking.rs:74:14
  11:     0x7f4ba2fde597 - core::slice::index::slice_end_index_len_fail_rt::h4c4d19d8542059af
                               at /rustc/fcc325f1bc477975e2ce5ba534fe4c77ff8a8536/library/core/src/slice/index.rs:65:5
  12:     0x7f4ba2fde597 - core::slice::index::slice_end_index_len_fail::hdf2622b4f1a4ee12
                               at /rustc/fcc325f1bc477975e2ce5ba534fe4c77ff8a8536/library/core/src/slice/index.rs:58:5
  13:     0x7f4ba6a3a5e3 - <rustc_middle[755ee31b8896a314]::ty::generics::Generics>::own_args
  14:     0x7f4ba6820a43 - <rustc_infer[b7b1c2eb88f3f152]::infer::need_type_info::FindInferSourceVisitor as rustc_hir[db9985a00111c11c]::intravisit::Visitor>::visit_expr
  15:     0x7f4ba68058b6 - <rustc_infer[b7b1c2eb88f3f152]::infer::need_type_info::FindInferSourceVisitor as rustc_hir[db9985a00111c11c]::intravisit::Visitor>::visit_local
  16:     0x7f4ba67cc962 - <rustc_infer[b7b1c2eb88f3f152]::infer::need_type_info::FindInferSourceVisitor as rustc_hir[db9985a00111c11c]::intravisit::Visitor>::visit_block
  17:     0x7f4ba6821246 - <rustc_infer[b7b1c2eb88f3f152]::infer::need_type_info::FindInferSourceVisitor as rustc_hir[db9985a00111c11c]::intravisit::Visitor>::visit_expr
  18:     0x7f4ba682131e - <rustc_infer[b7b1c2eb88f3f152]::infer::need_type_info::FindInferSourceVisitor as rustc_hir[db9985a00111c11c]::intravisit::Visitor>::visit_expr
  19:     0x7f4ba68058b6 - <rustc_infer[b7b1c2eb88f3f152]::infer::need_type_info::FindInferSourceVisitor as rustc_hir[db9985a00111c11c]::intravisit::Visitor>::visit_local
  20:     0x7f4ba67cc962 - <rustc_infer[b7b1c2eb88f3f152]::infer::need_type_info::FindInferSourceVisitor as rustc_hir[db9985a00111c11c]::intravisit::Visitor>::visit_block
  21:     0x7f4ba6821246 - <rustc_infer[b7b1c2eb88f3f152]::infer::need_type_info::FindInferSourceVisitor as rustc_hir[db9985a00111c11c]::intravisit::Visitor>::visit_expr
  22:     0x7f4ba681dc3b - <rustc_infer[b7b1c2eb88f3f152]::error_reporting::infer::TypeErrCtxt>::emit_inference_failure_err
  23:     0x7f4ba70d6577 - <rustc_infer[b7b1c2eb88f3f152]::error_reporting::infer::TypeErrCtxt as rustc_trait_selection[abd73c4855619381]::error_reporting::traits::ambiguity::TypeErrCtxtAmbiguityExt>::maybe_report_ambiguity
  24:     0x7f4ba711ace4 - <rustc_infer[b7b1c2eb88f3f152]::error_reporting::infer::TypeErrCtxt as rustc_trait_selection[abd73c4855619381]::error_reporting::traits::TypeErrCtxtExt>::report_fulfillment_error
  25:     0x7f4ba711942a - <rustc_infer[b7b1c2eb88f3f152]::error_reporting::infer::TypeErrCtxt as rustc_trait_selection[abd73c4855619381]::error_reporting::traits::TypeErrCtxtExt>::report_fulfillment_errors
  26:     0x7f4ba823cd63 - rustc_hir_typeck[b400399f077f89a5]::typeck
  27:     0x7f4ba82394a9 - rustc_query_impl[3b609057f07f1dcd]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[3b609057f07f1dcd]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[755ee31b8896a314]::query::erase::Erased<[u8; 8usize]>>
  28:     0x7f4ba7ce876d - rustc_query_system[f2631fe58e40596f]::query::plumbing::try_execute_query::<rustc_query_impl[3b609057f07f1dcd]::DynamicConfig<rustc_query_system[f2631fe58e40596f]::query::caches::VecCache<rustc_span[38ccacee260ae995]::def_id::LocalDefId, rustc_middle[755ee31b8896a314]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[3b609057f07f1dcd]::plumbing::QueryCtxt, true>
  29:     0x7f4ba7e8fb54 - rustc_query_impl[3b609057f07f1dcd]::query_impl::typeck::get_query_incr::__rust_end_short_backtrace
  30:     0x7f4ba7ce4544 - <rustc_middle[755ee31b8896a314]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[9e65fee665e0e0ab]::check_crate::{closure#4}>::{closure#0}
  31:     0x7f4ba7ce237c - rustc_hir_analysis[9e65fee665e0e0ab]::check_crate
  32:     0x7f4ba7e78f55 - rustc_interface[a03dee3aea9b1fd5]::passes::analysis
  33:     0x7f4ba7e78b07 - rustc_query_impl[3b609057f07f1dcd]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[3b609057f07f1dcd]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[755ee31b8896a314]::query::erase::Erased<[u8; 1usize]>>
  34:     0x7f4ba8bae2b8 - rustc_query_system[f2631fe58e40596f]::query::plumbing::try_execute_query::<rustc_query_impl[3b609057f07f1dcd]::DynamicConfig<rustc_query_system[f2631fe58e40596f]::query::caches::SingleCache<rustc_middle[755ee31b8896a314]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[3b609057f07f1dcd]::plumbing::QueryCtxt, true>
  35:     0x7f4ba8badf7a - rustc_query_impl[3b609057f07f1dcd]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
  36:     0x7f4ba87c1285 - rustc_interface[a03dee3aea9b1fd5]::interface::run_compiler::<core[da8eb5c0cc453d3]::result::Result<(), rustc_span[38ccacee260ae995]::ErrorGuaranteed>, rustc_driver_impl[8e1afaf50ebeb9ae]::run_compiler::{closure#0}>::{closure#1}
  37:     0x7f4ba8797b49 - std[a568119b01f6acf9]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[a03dee3aea9b1fd5]::util::run_in_thread_with_globals<rustc_interface[a03dee3aea9b1fd5]::util::run_in_thread_pool_with_globals<rustc_interface[a03dee3aea9b1fd5]::interface::run_compiler<core[da8eb5c0cc453d3]::result::Result<(), rustc_span[38ccacee260ae995]::ErrorGuaranteed>, rustc_driver_impl[8e1afaf50ebeb9ae]::run_compiler::{closure#0}>::{closure#1}, core[da8eb5c0cc453d3]::result::Result<(), rustc_span[38ccacee260ae995]::ErrorGuaranteed>>::{closure#0}, core[da8eb5c0cc453d3]::result::Result<(), rustc_span[38ccacee260ae995]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[da8eb5c0cc453d3]::result::Result<(), rustc_span[38ccacee260ae995]::ErrorGuaranteed>>
  38:     0x7f4ba87978fa - <<std[a568119b01f6acf9]::thread::Builder>::spawn_unchecked_<rustc_interface[a03dee3aea9b1fd5]::util::run_in_thread_with_globals<rustc_interface[a03dee3aea9b1fd5]::util::run_in_thread_pool_with_globals<rustc_interface[a03dee3aea9b1fd5]::interface::run_compiler<core[da8eb5c0cc453d3]::result::Result<(), rustc_span[38ccacee260ae995]::ErrorGuaranteed>, rustc_driver_impl[8e1afaf50ebeb9ae]::run_compiler::{closure#0}>::{closure#1}, core[da8eb5c0cc453d3]::result::Result<(), rustc_span[38ccacee260ae995]::ErrorGuaranteed>>::{closure#0}, core[da8eb5c0cc453d3]::result::Result<(), rustc_span[38ccacee260ae995]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[da8eb5c0cc453d3]::result::Result<(), rustc_span[38ccacee260ae995]::ErrorGuaranteed>>::{closure#2} as core[da8eb5c0cc453d3]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  39:     0x7f4ba2f995fb - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hcba9444f62f4d2cf
                               at /rustc/fcc325f1bc477975e2ce5ba534fe4c77ff8a8536/library/alloc/src/boxed.rs:2070:9
  40:     0x7f4ba2f995fb - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h370ba06625738899
                               at /rustc/fcc325f1bc477975e2ce5ba534fe4c77ff8a8536/library/alloc/src/boxed.rs:2070:9
  41:     0x7f4ba2f995fb - std::sys::pal::unix::thread::Thread::new::thread_start::he74bac229ff12ca4
                               at /rustc/fcc325f1bc477975e2ce5ba534fe4c77ff8a8536/library/std/src/sys/pal/unix/thread.rs:108:17
  42:     0x7f4ba2d34b43 - start_thread
                               at ./nptl/pthread_create.c:442:8
  43:     0x7f4ba2dc5bb4 - clone
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:100
  44:                0x0 - <unknown>


rustc version: 1.81.0-nightly (fcc325f1b 2024-07-17)
platform: x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `init::boot_to_kernel`
#1 [analysis] running analysis passes on this crate
end of query stack

@Qix-
Copy link

Qix- commented Jul 29, 2024

Looks like it was originally introduced here in this commit by @lcnr (and was renamed later to own_args without any change in functionality).

I'd PR a fix but I'm not entirely sure how it's supposed to work. Is this masking a deeper bug or can one simply do something like:

-let own = &substs[self.parent_count..][..self.params.len()];
+let own = &substs[self.parent_count..];
+let own = &own[..self.params.len().min(own.len())];

Derp, missed there was a PR. #128337 indeed fixes this on my end. Thanks @bvanjoi for the quick fix on this!

@bors bors closed this as completed in 5de94b6 Jul 29, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jul 29, 2024
Rollup merge of rust-lang#128337 - bvanjoi:issue-121613, r=compiler-errors

skip assoc type during infer source visitor

Fixes rust-lang#121613

Due to the generic arguments being lost during normalization, the associated type cannot retrieve the correct generics information, so this PR follows this [comment](https://github.com/rust-lang/rust/blob/master/compiler/rustc_trait_selection/src/error_reporting/infer/need_type_info.rs#L937-L942) and skips `DefKind::AssocTy`

r? `@lcnr`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-HIR Area: The high-level intermediate representation (HIR) C-bug Category: This is a bug. F-more_qualified_paths `#![feature(more_qualified_paths)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. 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.

4 participants