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: panicked at 'index out of bounds: the len is 0 but the index is 0', compiler/rustc_middle/src/ty/subst.rs #83474

Closed
chengniansun opened this issue Mar 25, 2021 · 2 comments
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. glacier ICE tracked in rust-lang/glacier. 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

@chengniansun
Copy link

Code

#[lang = "owned_box"]
struct Foo;
fn main() {
    Foo
}

Meta

rustc --version --verbose:

rustc 1.53.0-nightly (07e0e2ec2 2021-03-24)
binary: rustc
commit-hash: 07e0e2ec268c140e607e1ac7f49f145612d0f597
commit-date: 2021-03-24
host: x86_64-unknown-linux-gnu
release: 1.53.0-nightly
LLVM version: 12.0.0

Error output

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

error[E0152]: found duplicate lang item `owned_box`
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:2:1
  |
2 | struct Foo;
  | ^^^^^^^^^^^
  |
  = note: the lang item is first defined in crate `alloc` (which `std` depends on)
  = note: first definition in `alloc` loaded from /home/cnsun/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-3aeb407930ebd519.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 0 but the index is 0', compiler/rustc_middle/src/ty/subst.rs:302:43
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 (07e0e2ec2 2021-03-24) running on x86_64-unknown-linux-gnu

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

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

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

error[E0152]: found duplicate lang item `owned_box`
 --> perses_node_priority_with_dfs_delta_reduced_mutant.rs:2:1
  |
2 | struct Foo;
  | ^^^^^^^^^^^
  |
  = note: the lang item is first defined in crate `alloc` (which `std` depends on)
  = note: first definition in `alloc` loaded from /home/cnsun/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-3aeb407930ebd519.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 0 but the index is 0', compiler/rustc_middle/src/ty/subst.rs:302:43
stack backtrace:
   0: rust_begin_unwind
             at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/core/src/panicking.rs:92:14
   2: core::panicking::panic_bounds_check
             at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/core/src/panicking.rs:69:5
   3: rustc_middle::ty::sty::<impl rustc_middle::ty::TyS>::boxed_ty
   4: rustc_middle::ty::sty::<impl rustc_middle::ty::TyS>::builtin_deref
   5: <rustc_trait_selection::autoderef::Autoderef as core::iter::traits::iterator::Iterator>::next
   6: rustc_typeck::check::coercion::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::deref_steps
   7: rustc_typeck::check::demand::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_ref
   8: rustc_typeck::check::fn_ctxt::suggestions::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::suggest_deref_ref_or_into
   9: rustc_typeck::check::demand::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::emit_coerce_suggestions
  10: rustc_typeck::check::coercion::CoerceMany<E>::coerce_inner
  11: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
  12: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  13: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr
  14: rustc_typeck::check::check::check_fn
  15: rustc_infer::infer::InferCtxtBuilder::enter
  16: rustc_typeck::check::typeck
  17: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  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 (07e0e2ec2 2021-03-24) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `main`
#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 2 previous errors

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

@chengniansun chengniansun 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 Mar 25, 2021
fanninpm added a commit to fanninpm/glacier that referenced this issue Mar 26, 2021
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Mar 27, 2021
@Alexendoo Alexendoo added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Aug 29, 2021
@Alexendoo
Copy link
Member

No longer ICEs since #87875

Badel2 added a commit to Badel2/rust that referenced this issue Dec 13, 2021
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Apr 7, 2022
Add test for issue rust-lang#83474

Adds test for rust-lang#83474 - second attempt at PR rust-lang#91821 which was abandoned.
bors added a commit to rust-lang-ci/rust that referenced this issue Apr 7, 2022
Rollup of 5 pull requests

Successful merges:

 - rust-lang#95352 ([bootstrap] Print the full relative path to failed tests)
 - rust-lang#95646 (Mention `std::env::var` in `env!`)
 - rust-lang#95708 (Update documentation for `trim*` and `is_whitespace` to include newlines)
 - rust-lang#95714 (Add test for issue rust-lang#83474)
 - rust-lang#95725 (Message: Chunks cannot have a size of zero.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@JohnTitor
Copy link
Member

The test has been added by #95714, closing.

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. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. glacier ICE tracked in rust-lang/glacier. 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.

4 participants