Skip to content

ICE: panicked at 'index out of bounds: the len is 1 but the index is 1', compiler/rustc_typeck/src/check/method/mod.rs:318:32 #83893

Closed

Description

Code

#[lang = "add"]
trait Add<'a, T> {}
fn ice() {
    r + a
}

Meta

rustc --version --verbose:

rustc 1.53.0-nightly (c755ee4ce 2021-04-04)
binary: rustc
commit-hash: c755ee4ce8cae6ea977d65a0288480940db721d9
commit-date: 2021-04-04
host: x86_64-unknown-linux-gnu
release: 1.53.0-nightly
LLVM version: 12.0.0

Error output

error[E0425]: cannot find value `r` in this scope
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:4:5
  |
4 |     r + a
  |     ^ not found in this scope

error[E0425]: cannot find value `a` in this scope
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:4:9
  |
4 |     r + a
  |         ^ not found in this scope

error[E0658]: language items are subject to change
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:1
  |
1 | #[lang = "add"]
  | ^^^^^^^^^^^^^^^
  |
  = help: add `#![feature(lang_items)]` to the crate attributes to enable

error[E0601]: `main` function not found in crate `perses_node_priority_with_dfs_delta_reduced_mutant`
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:1
  |
1 | / #[lang = "add"]
2 | | trait Add<'a, T> {}
3 | | fn ice() {
4 | |     r + a
5 | | }
  | |_^ consider adding a `main` function to `perses_node_priority_with_dfs_delta_reduced_mutant.rs`

error[E0152]: found duplicate lang item `add`
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:2:1
  |
2 | trait Add<'a, T> {}
  | ^^^^^^^^^^^^^^^^^^^
  |
  = note: the lang item is first defined in crate `core` (which `std` depends on)
  = note: first definition in `core` loaded from /home/cnsun/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-166dae07beec0398.rlib
  = note: second definition in the local crate (`perses_node_priority_with_dfs_delta_reduced_mutant`)

thread 'rustc' panicked at 'index out of bounds: the len is 1 but the index is 1', compiler/rustc_typeck/src/check/method/mod.rs:318:32
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: 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.53.0-nightly (c755ee4ce 2021-04-04) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `ice`
#1 [typeck_item_bodies] type-checking all item bodies
end of query stack
error: aborting due to 5 previous errors

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

error[E0425]: cannot find value `r` in this scope
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:4:5
  |
4 |     r + a
  |     ^ not found in this scope

error[E0425]: cannot find value `a` in this scope
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:4:9
  |
4 |     r + a
  |         ^ not found in this scope

error[E0658]: language items are subject to change
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:1
  |
1 | #[lang = "add"]
  | ^^^^^^^^^^^^^^^
  |
  = help: add `#![feature(lang_items)]` to the crate attributes to enable

error[E0601]: `main` function not found in crate `perses_node_priority_with_dfs_delta_reduced_mutant`
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:1:1
  |
1 | / #[lang = "add"]
2 | | trait Add<'a, T> {}
3 | | fn ice() {
4 | |     r + a
5 | | }
  | |_^ consider adding a `main` function to `perses_node_priority_with_dfs_delta_reduced_mutant.rs`

error[E0152]: found duplicate lang item `add`
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:2:1
  |
2 | trait Add<'a, T> {}
  | ^^^^^^^^^^^^^^^^^^^
  |
  = note: the lang item is first defined in crate `core` (which `std` depends on)
  = note: first definition in `core` loaded from /home/cnsun/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-166dae07beec0398.rlib
  = note: second definition in the local crate (`perses_node_priority_with_dfs_delta_reduced_mutant`)

thread 'rustc' panicked at 'index out of bounds: the len is 1 but the index is 1', compiler/rustc_typeck/src/check/method/mod.rs:318:32
stack backtrace:
   0: rust_begin_unwind
             at /rustc/c755ee4ce8cae6ea977d65a0288480940db721d9/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/c755ee4ce8cae6ea977d65a0288480940db721d9/library/core/src/panicking.rs:92:14
   2: core::panicking::panic_bounds_check
             at /rustc/c755ee4ce8cae6ea977d65a0288480940db721d9/library/core/src/panicking.rs:69:5
   3: rustc_middle::ty::subst::<impl rustc_middle::ty::list::List<rustc_middle::ty::subst::GenericArg>>::fill_item
   4: rustc_middle::ty::subst::<impl rustc_middle::ty::list::List<rustc_middle::ty::subst::GenericArg>>::for_item
   5: rustc_typeck::check::method::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::lookup_method_in_trait
   6: rustc_typeck::check::op::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::lookup_op_method
   7: rustc_typeck::check::op::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_overloaded_binop
   8: rustc_typeck::check::op::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_binop
   9: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  10: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
  11: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  12: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr
  13: rustc_typeck::check::check::check_fn
  14: rustc_infer::infer::InferCtxtBuilder::enter
  15: rustc_typeck::check::typeck
  16: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  17: rustc_data_structures::stack::ensure_sufficient_stack
  18: rustc_query_system::query::plumbing::force_query_with_job
  19: rustc_query_system::query::plumbing::get_query_impl
  20: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
  21: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::par_body_owners
  22: rustc_typeck::check::typeck_item_bodies
  23: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  24: rustc_data_structures::stack::ensure_sufficient_stack
  25: rustc_query_system::query::plumbing::force_query_with_job
  26: rustc_query_system::query::plumbing::get_query_impl
  27: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies
  28: rustc_session::utils::<impl rustc_session::session::Session>::time
  29: rustc_typeck::check_crate
  30: rustc_interface::passes::analysis
  31: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  32: rustc_data_structures::stack::ensure_sufficient_stack
  33: rustc_query_system::query::plumbing::force_query_with_job
  34: rustc_query_system::query::plumbing::get_query_impl
  35: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  36: rustc_interface::passes::QueryContext::enter
  37: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  38: rustc_span::with_source_map
  39: rustc_interface::interface::create_compiler_and_run
  40: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

note: 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.53.0-nightly (c755ee4ce 2021-04-04) running on x86_64-unknown-linux-gnu

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

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

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

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions