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 #132765

Open
1 of 4 tasks
wxie7 opened this issue Nov 8, 2024 · 6 comments
Open
1 of 4 tasks

[ICE]: index out of bounds #132765

wxie7 opened this issue Nov 8, 2024 · 6 comments
Labels
C-bug Category: This is a bug. 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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@wxie7
Copy link

wxie7 commented Nov 8, 2024

Code

trait LendingIterator {
    type Item<'q>: 'a;
    fn for_each(mut self, mut f: Box<dyn FnMut(Self::Item<'_>) + 'static>) {}
}
struct Query<'q> {}
impl<'static> Query<'q> {
    pub fn new() -> Self {}
}
fn data() {
    LendingIterator::for_each(Box::new(&data), Box::new);
}
pub fn main() {}

Affected release channels

  • Previous Stable
  • Current Stable
  • Current Beta
  • Current Nightly

Rust Version

rustc 1.84.0-nightly (b91a3a0 2024-11-07)
binary: rustc
commit-hash: b91a3a0
commit-date: 2024-11-07
host: x86_64-unknown-linux-gnu
release: 1.84.0-nightly
LLVM version: 19.1.3

Current error output

error[E0261]: use of undeclared lifetime name `'a`
 --> mutant.rs:2:20
  |
2 |     type Item<'q>: 'a;
  |                    ^^ undeclared lifetime
  |
help: consider introducing lifetime `'a` here
  |
2 |     type Item<'a, 'q>: 'a;
  |               +++
help: consider introducing lifetime `'a` here
  |
1 | trait LendingIterator<'a> {
  |                      ++++

error[E0262]: invalid lifetime parameter name: `'static`
 --> mutant.rs:6:6
  |
6 | impl<'static> Query<'q> {
  |      ^^^^^^^ 'static is a reserved lifetime name

error[E0261]: use of undeclared lifetime name `'q`
 --> mutant.rs:6:21
  |
6 | impl<'static> Query<'q> {
  |      -              ^^ undeclared lifetime
  |      |
  |      help: consider introducing lifetime `'q` here: `'q,`

error[E0392]: lifetime parameter `'q` is never used
 --> mutant.rs:5:14
  |
5 | struct Query<'q> {}
  |              ^^ unused lifetime parameter
  |
  = help: consider removing `'q`, referring to it in a field, or using a marker such as `PhantomData`

error[E0277]: the size for values of type `Self` cannot be known at compilation time
 --> mutant.rs:3:21
  |
3 |     fn for_each(mut self, mut f: Box<dyn FnMut(Self::Item<'_>) + 'static>) {}
  |                     ^^^^ doesn't have a size known at compile-time
  |
  = help: unsized fn params are gated as an unstable feature
help: consider further restricting `Self`
  |
3 |     fn for_each(mut self, mut f: Box<dyn FnMut(Self::Item<'_>) + 'static>) where Self: Sized {}
  |                                                                            +++++++++++++++++
help: function arguments must have a statically known size, borrowed types always have a known size
  |
3 |     fn for_each(mut &self, mut f: Box<dyn FnMut(Self::Item<'_>) + 'static>) {}
  |                     +

error[E0277]: the trait bound `Box<&fn() {data}>: LendingIterator` is not satisfied
  --> mutant.rs:10:31
   |
10 |     LendingIterator::for_each(Box::new(&data), Box::new);
   |     ------------------------- ^^^^^^^^^^^^^^^ the trait `LendingIterator` is not implemented for `Box<&fn() {data}>`
   |     |
   |     required by a bound introduced by this call
   |
help: this trait has no implementations, consider adding one
  --> mutant.rs:1:1
   |
1  | trait LendingIterator {
   | ^^^^^^^^^^^^^^^^^^^^^

thread 'rustc' panicked at /rust/deps/ena-0.14.3/src/snapshot_vec.rs:199:10:
index out of bounds: the len is 7 but the index is 7
stack backtrace:
   0:     0x7f719d25517a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hfadad24fb33e3d1a
   1:     0x7f719da040a6 - core::fmt::write::h42d25fbda60cd99f
   2:     0x7f719edc3351 - std::io::Write::write_fmt::hc2819193e80b365e
   3:     0x7f719d254fd2 - std::sys::backtrace::BacktraceLock::print::h9450230402d77664
   4:     0x7f719d2574d6 - std::panicking::default_hook::{{closure}}::h739047d4d787c596
   5:     0x7f719d257320 - std::panicking::default_hook::h203d1229480f37a5
   6:     0x7f719c2d2269 - std[56fe22ad9ea837fd]::panicking::update_hook::<alloc[b5641001d343df5f]::boxed::Box<rustc_driver_impl[945e9afaf49c7d35]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x7f719d257be8 - std::panicking::rust_panic_with_hook::h657fdcc17f7e2546
   8:     0x7f719d2579ba - std::panicking::begin_panic_handler::{{closure}}::h6c1a7592f2611ed5
   9:     0x7f719d255629 - std::sys::backtrace::__rust_end_short_backtrace::h3e1efd1ff0b15465
  10:     0x7f719d25767c - rust_begin_unwind
  11:     0x7f7199ccd320 - core::panicking::panic_fmt::h41647251c9f15c53
  12:     0x7f719b9f0b1b - core::panicking::panic_bounds_check::h66515744fb563c4b
  13:     0x7f719dacc1f6 - <rustc_middle[f0eb6ba890d0a9bb]::ty::Ty as rustc_type_ir[8408d34320f8a6fb]::fold::TypeSuperFoldable<rustc_middle[f0eb6ba890d0a9bb]::ty::context::TyCtxt>>::try_super_fold_with::<rustc_infer[21ddc8b2a5f19898]::infer::resolve::OpportunisticVarResolver>
  14:     0x7f719dac6323 - <&rustc_middle[f0eb6ba890d0a9bb]::ty::list::RawList<(), rustc_middle[f0eb6ba890d0a9bb]::ty::generic_args::GenericArg> as rustc_type_ir[8408d34320f8a6fb]::fold::TypeFoldable<rustc_middle[f0eb6ba890d0a9bb]::ty::context::TyCtxt>>::try_fold_with::<rustc_infer[21ddc8b2a5f19898]::infer::resolve::OpportunisticVarResolver>
  15:     0x7f719dac9e17 - <rustc_middle[f0eb6ba890d0a9bb]::ty::Ty as rustc_type_ir[8408d34320f8a6fb]::fold::TypeSuperFoldable<rustc_middle[f0eb6ba890d0a9bb]::ty::context::TyCtxt>>::try_super_fold_with::<rustc_infer[21ddc8b2a5f19898]::infer::resolve::OpportunisticVarResolver>
  16:     0x7f719dac8554 - <rustc_middle[f0eb6ba890d0a9bb]::ty::Ty as rustc_type_ir[8408d34320f8a6fb]::fold::TypeSuperFoldable<rustc_middle[f0eb6ba890d0a9bb]::ty::context::TyCtxt>>::try_super_fold_with::<rustc_infer[21ddc8b2a5f19898]::infer::resolve::OpportunisticVarResolver>
  17:     0x7f719d01a962 - <rustc_infer[21ddc8b2a5f19898]::infer::resolve::OpportunisticVarResolver as rustc_type_ir[8408d34320f8a6fb]::fold::FallibleTypeFolder<rustc_middle[f0eb6ba890d0a9bb]::ty::context::TyCtxt>>::try_fold_ty
  18:     0x7f719d087548 - <rustc_trait_selection[c0f45c4e16f8dab6]::error_reporting::TypeErrCtxt>::same_type_modulo_infer::<rustc_middle[f0eb6ba890d0a9bb]::ty::Ty>
  19:     0x7f719d0fcaba - <rustc_trait_selection[c0f45c4e16f8dab6]::error_reporting::TypeErrCtxt>::note_type_err
  20:     0x7f719d084350 - <rustc_trait_selection[c0f45c4e16f8dab6]::error_reporting::TypeErrCtxt>::report_and_explain_type_error
  21:     0x7f719c62446e - <rustc_hir_typeck[9dbf9add14d719fd]::fn_ctxt::FnCtxt>::report_arg_errors
  22:     0x7f719a103be3 - <rustc_hir_typeck[9dbf9add14d719fd]::fn_ctxt::FnCtxt>::confirm_builtin_call
  23:     0x7f719e6fa2bf - <rustc_hir_typeck[9dbf9add14d719fd]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  24:     0x7f719e6f4736 - <rustc_hir_typeck[9dbf9add14d719fd]::fn_ctxt::FnCtxt>::check_block_with_expected
  25:     0x7f719e6fabb4 - <rustc_hir_typeck[9dbf9add14d719fd]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  26:     0x7f719dc4df5b - rustc_hir_typeck[9dbf9add14d719fd]::check::check_fn
  27:     0x7f719dc43bac - rustc_hir_typeck[9dbf9add14d719fd]::typeck
  28:     0x7f719dc43553 - rustc_query_impl[1357963d8dd30e8b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1357963d8dd30e8b]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f0eb6ba890d0a9bb]::query::erase::Erased<[u8; 8usize]>>
  29:     0x7f719e123681 - rustc_query_system[887bb79932b1d8c1]::query::plumbing::try_execute_query::<rustc_query_impl[1357963d8dd30e8b]::DynamicConfig<rustc_query_system[887bb79932b1d8c1]::query::caches::VecCache<rustc_span[db86d96c2ae2e3a4]::def_id::LocalDefId, rustc_middle[f0eb6ba890d0a9bb]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[1357963d8dd30e8b]::plumbing::QueryCtxt, false>
  30:     0x7f719e121b4d - rustc_query_impl[1357963d8dd30e8b]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  31:     0x7f719e1217c7 - <rustc_middle[f0eb6ba890d0a9bb]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[af6e6fecb0b5810e]::check_crate::{closure#4}>::{closure#0}
  32:     0x7f719e11f799 - rustc_hir_analysis[af6e6fecb0b5810e]::check_crate
  33:     0x7f719e268aca - rustc_interface[5fea8bf9cd0b71b5]::passes::run_required_analyses
  34:     0x7f719e80861e - rustc_interface[5fea8bf9cd0b71b5]::passes::analysis
  35:     0x7f719e8085ef - rustc_query_impl[1357963d8dd30e8b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1357963d8dd30e8b]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f0eb6ba890d0a9bb]::query::erase::Erased<[u8; 1usize]>>
  36:     0x7f719e992cee - rustc_query_system[887bb79932b1d8c1]::query::plumbing::try_execute_query::<rustc_query_impl[1357963d8dd30e8b]::DynamicConfig<rustc_query_system[887bb79932b1d8c1]::query::caches::SingleCache<rustc_middle[f0eb6ba890d0a9bb]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[1357963d8dd30e8b]::plumbing::QueryCtxt, false>
  37:     0x7f719e9929ce - rustc_query_impl[1357963d8dd30e8b]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  38:     0x7f719e88707a - rustc_interface[5fea8bf9cd0b71b5]::interface::run_compiler::<core[5ba82ee3405aa490]::result::Result<(), rustc_span[db86d96c2ae2e3a4]::ErrorGuaranteed>, rustc_driver_impl[945e9afaf49c7d35]::run_compiler::{closure#0}>::{closure#1}
  39:     0x7f719e8cd5d0 - std[56fe22ad9ea837fd]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[5fea8bf9cd0b71b5]::util::run_in_thread_with_globals<rustc_interface[5fea8bf9cd0b71b5]::util::run_in_thread_pool_with_globals<rustc_interface[5fea8bf9cd0b71b5]::interface::run_compiler<core[5ba82ee3405aa490]::result::Result<(), rustc_span[db86d96c2ae2e3a4]::ErrorGuaranteed>, rustc_driver_impl[945e9afaf49c7d35]::run_compiler::{closure#0}>::{closure#1}, core[5ba82ee3405aa490]::result::Result<(), rustc_span[db86d96c2ae2e3a4]::ErrorGuaranteed>>::{closure#0}, core[5ba82ee3405aa490]::result::Result<(), rustc_span[db86d96c2ae2e3a4]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5ba82ee3405aa490]::result::Result<(), rustc_span[db86d96c2ae2e3a4]::ErrorGuaranteed>>
  40:     0x7f719e8cd9eb - <<std[56fe22ad9ea837fd]::thread::Builder>::spawn_unchecked_<rustc_interface[5fea8bf9cd0b71b5]::util::run_in_thread_with_globals<rustc_interface[5fea8bf9cd0b71b5]::util::run_in_thread_pool_with_globals<rustc_interface[5fea8bf9cd0b71b5]::interface::run_compiler<core[5ba82ee3405aa490]::result::Result<(), rustc_span[db86d96c2ae2e3a4]::ErrorGuaranteed>, rustc_driver_impl[945e9afaf49c7d35]::run_compiler::{closure#0}>::{closure#1}, core[5ba82ee3405aa490]::result::Result<(), rustc_span[db86d96c2ae2e3a4]::ErrorGuaranteed>>::{closure#0}, core[5ba82ee3405aa490]::result::Result<(), rustc_span[db86d96c2ae2e3a4]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5ba82ee3405aa490]::result::Result<(), rustc_span[db86d96c2ae2e3a4]::ErrorGuaranteed>>::{closure#1} as core[5ba82ee3405aa490]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  41:     0x7f719e8ce4b9 - std::sys::pal::unix::thread::Thread::new::thread_start::hb3d6392adeea417c
  42:     0x7f7198a6bac3 - start_thread
                               at ./nptl/pthread_create.c:442:8
  43:     0x7f7198afd850 - __GI___clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
  44:                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 make sure that you have updated to the latest nightly


note: compiler flags: --crate-type staticlib -C link-dead-code -C debuginfo=2 -C opt-level=3 -Z mir-opt-level=3

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

Some errors have detailed explanations: E0261, E0262, E0277, E0392.
For more information about an error, try `rustc --explain E0261`.

Backtrace

thread 'rustc' panicked at /rust/deps/ena-0.14.3/src/snapshot_vec.rs:199:10:
index out of bounds: the len is 7 but the index is 7
stack backtrace:
   0:     0x7f719d25517a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hfadad24fb33e3d1a
   1:     0x7f719da040a6 - core::fmt::write::h42d25fbda60cd99f
   2:     0x7f719edc3351 - std::io::Write::write_fmt::hc2819193e80b365e
   3:     0x7f719d254fd2 - std::sys::backtrace::BacktraceLock::print::h9450230402d77664
   4:     0x7f719d2574d6 - std::panicking::default_hook::{{closure}}::h739047d4d787c596
   5:     0x7f719d257320 - std::panicking::default_hook::h203d1229480f37a5
   6:     0x7f719c2d2269 - std[56fe22ad9ea837fd]::panicking::update_hook::<alloc[b5641001d343df5f]::boxed::Box<rustc_driver_impl[945e9afaf49c7d35]::install_ice_hook::{closure#0}>>::{clos
   7:     0x7f719d257be8 - std::panicking::rust_panic_with_hook::h657fdcc17f7e2546
   8:     0x7f719d2579ba - std::panicking::begin_panic_handler::{{closure}}::h6c1a7592f2611ed5
   9:     0x7f719d255629 - std::sys::backtrace::__rust_end_short_backtrace::h3e1efd1ff0b15465
  10:     0x7f719d25767c - rust_begin_unwind
  11:     0x7f7199ccd320 - core::panicking::panic_fmt::h41647251c9f15c53
  12:     0x7f719b9f0b1b - core::panicking::panic_bounds_check::h66515744fb563c4b
  13:     0x7f719dacc1f6 - <rustc_middle[f0eb6ba890d0a9bb]::ty::Ty as rustc_type_ir[8408d34320f8a6fb]::fold::TypeSuperFoldable<rustc_middle[f0eb6ba890d0a9bb]::ty::context::TyCtxt>>::try_
  14:     0x7f719dac6323 - <&rustc_middle[f0eb6ba890d0a9bb]::ty::list::RawList<(), rustc_middle[f0eb6ba890d0a9bb]::ty::generic_args::GenericArg> as rustc_type_ir[8408d34320f8a6fb]::fold:
  15:     0x7f719dac9e17 - <rustc_middle[f0eb6ba890d0a9bb]::ty::Ty as rustc_type_ir[8408d34320f8a6fb]::fold::TypeSuperFoldable<rustc_middle[f0eb6ba890d0a9bb]::ty::context::TyCtxt>>::try_
  16:     0x7f719dac8554 - <rustc_middle[f0eb6ba890d0a9bb]::ty::Ty as rustc_type_ir[8408d34320f8a6fb]::fold::TypeSuperFoldable<rustc_middle[f0eb6ba890d0a9bb]::ty::context::TyCtxt>>::try_
  17:     0x7f719d01a962 - <rustc_infer[21ddc8b2a5f19898]::infer::resolve::OpportunisticVarResolver as rustc_type_ir[8408d34320f8a6fb]::fold::FallibleTypeFolder<rustc_middle[f0eb6ba890d0
  18:     0x7f719d087548 - <rustc_trait_selection[c0f45c4e16f8dab6]::error_reporting::TypeErrCtxt>::same_type_modulo_infer::<rustc_middle[f0eb6ba890d0a9bb]::ty::Ty>
  19:     0x7f719d0fcaba - <rustc_trait_selection[c0f45c4e16f8dab6]::error_reporting::TypeErrCtxt>::note_type_err
  20:     0x7f719d084350 - <rustc_trait_selection[c0f45c4e16f8dab6]::error_reporting::TypeErrCtxt>::report_and_explain_type_error
  21:     0x7f719c62446e - <rustc_hir_typeck[9dbf9add14d719fd]::fn_ctxt::FnCtxt>::report_arg_errors
  22:     0x7f719a103be3 - <rustc_hir_typeck[9dbf9add14d719fd]::fn_ctxt::FnCtxt>::confirm_builtin_call
  23:     0x7f719e6fa2bf - <rustc_hir_typeck[9dbf9add14d719fd]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  24:     0x7f719e6f4736 - <rustc_hir_typeck[9dbf9add14d719fd]::fn_ctxt::FnCtxt>::check_block_with_expected
  25:     0x7f719e6fabb4 - <rustc_hir_typeck[9dbf9add14d719fd]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  26:     0x7f719dc4df5b - rustc_hir_typeck[9dbf9add14d719fd]::check::check_fn
  27:     0x7f719dc43bac - rustc_hir_typeck[9dbf9add14d719fd]::typeck
  28:     0x7f719dc43553 - rustc_query_impl[1357963d8dd30e8b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1357963d8dd30e8b]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f0eb6ba890d0a9bb]::query::erase::Erased<[u8; 8usize]>>
  29:     0x7f719e123681 - rustc_query_system[887bb79932b1d8c1]::query::plumbing::try_execute_query::<rustc_query_impl[1357963d8dd30e8b]::DynamicConfig<rustc_query_system[887bb79932b1d8c1]::query::caches::VecCache<rustc_span[db86d96c2ae2e3a4]::def_id::LocalDefId, rustc_middle[f0eb6ba890d0a9bb]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[1357963d8dd30e8b]::plumbing::QueryCtxt, false>
  30:     0x7f719e121b4d - rustc_query_impl[1357963d8dd30e8b]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  31:     0x7f719e1217c7 - <rustc_middle[f0eb6ba890d0a9bb]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[af6e6fecb0b5810e]::check_crate::{closure#4}>::{closure#0}
  32:     0x7f719e11f799 - rustc_hir_analysis[af6e6fecb0b5810e]::check_crate
  33:     0x7f719e268aca - rustc_interface[5fea8bf9cd0b71b5]::passes::run_required_analyses
  34:     0x7f719e80861e - rustc_interface[5fea8bf9cd0b71b5]::passes::analysis
  35:     0x7f719e8085ef - rustc_query_impl[1357963d8dd30e8b]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1357963d8dd30e8b]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f0eb6ba890d0a9bb]::query::erase::Erased<[u8; 1usize]>>
  36:     0x7f719e992cee - rustc_query_system[887bb79932b1d8c1]::query::plumbing::try_execute_query::<rustc_query_impl[1357963d8dd30e8b]::DynamicConfig<rustc_query_system[887bb79932b1d8c1]::query::caches::SingleCache<rustc_middle[f0eb6ba890d0a9bb]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[1357963d8dd30e8b]::plumbing::QueryCtxt, false>
  37:     0x7f719e9929ce - rustc_query_impl[1357963d8dd30e8b]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  38:     0x7f719e88707a - rustc_interface[5fea8bf9cd0b71b5]::interface::run_compiler::<core[5ba82ee3405aa490]::result::Result<(), rustc_span[db86d96c2ae2e3a4]::ErrorGuaranteed>, rustc_driver_impl[945e9afaf49c7d35]::run_compiler::{closure#0}>::{closure#1}
  39:     0x7f719e8cd5d0 - std[56fe22ad9ea837fd]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[5fea8bf9cd0b71b5]::util::run_in_thread_with_globals<rustc_interface[5fea8bf9cd0b71b5]::util::run_in_thread_pool_with_globals<rustc_interface[5fea8bf9cd0b71b5]::interface::run_compiler<core[5ba82ee3405aa490]::result::Result<(), rustc_span[db86d96c2ae2e3a4]::ErrorGuaranteed>, rustc_driver_impl[945e9afaf49c7d35]::run_compiler::{closure#0}>::{closure#1}, core[5ba82ee3405aa490]::result::Result<(), rustc_span[db86d96c2ae2e3a4]::ErrorGuaranteed>>::{closure#0}, core[5ba82ee3405aa490]::result::Result<(), rustc_span[db86d96c2ae2e3a4]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5ba82ee3405aa490]::result::Result<(), rustc_span[db86d96c2ae2e3a4]::ErrorGuaranteed>>
  40:     0x7f719e8cd9eb - <<std[56fe22ad9ea837fd]::thread::Builder>::spawn_unchecked_<rustc_interface[5fea8bf9cd0b71b5]::util::run_in_thread_with_globals<rustc_interface[5fea8bf9cd0b71b5]::util::run_in_thread_pool_with_globals<rustc_interface[5fea8bf9cd0b71b5]::interface::run_compiler<core[5ba82ee3405aa490]::result::Result<(), rustc_span[db86d96c2ae2e3a4]::ErrorGuaranteed>, rustc_driver_impl[945e9afaf49c7d35]::run_compiler::{closure#0}>::{closure#1}, core[5ba82ee3405aa490]::result::Result<(), rustc_span[db86d96c2ae2e3a4]::ErrorGuaranteed>>::{closure#0}, core[5ba82ee3405aa490]::result::Result<(), rustc_span[db86d96c2ae2e3a4]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5ba82ee3405aa490]::result::Result<(), rustc_span[db86d96c2ae2e3a4]::ErrorGuaranteed>>::{closure#1} as core[5ba82ee3405aa490]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  41:     0x7f719e8ce4b9 - std::sys::pal::unix::thread::Thread::new::thread_start::hb3d6392adeea417c
  42:     0x7f7198a6bac3 - start_thread
                               at ./nptl/pthread_create.c:442:8
  43:     0x7f7198afd850 - __GI___clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
  44:                0x0 - <unknown>

Anything else?

This issue is similar to #122098; however, #122098 does not report an ICE on the current nightly version. The difference is the addition of a main function.

@wxie7 wxie7 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 Nov 8, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 8, 2024
@Noratrieb
Copy link
Member

@wxie7 it would be nice if you could minimize your examples to have as few errors as possible. when confronted with an example that has many errors, it is very confusing to try to figure out what's going on. I suspect only one or two of the errors are actually necessary.

@lqd
Copy link
Member

lqd commented Nov 8, 2024

also helpful:

  • removing the compilation flags that are unrelated to the issue
  • making these important flags, if any, more apparent in the report than within the error output
  • making sure the "affected releases" section is accurate (since this will affect people trying to do bisections). Here the ICE seems to reproduce on more than the current nightly (and from a quick look, starting in 1.75)
  • putting long text, duplicated text, backtraces, etc in <details> blocks so they are collapsed by default

@cyrgani
Copy link
Contributor

cyrgani commented Nov 8, 2024

Reduced:

trait LendingIterator {
    type Item<'q>;
    fn for_each(&self, _f: Box<fn(Self::Item<'_>)>) {}
}

fn f(_: ()) {}

fn main() {
    LendingIterator::for_each(&(), f);
}

Also ICEs in 1.70.0.

@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 8, 2024
@ranger-ross
Copy link
Contributor

Bisects to nightly-2022-07-23

get_commits_between returning commits, len: 8
  commit[0] 2022-07-21: Auto merge of #99501 - lcnr:check-regions-infcx, r=oli-obk
  commit[1] 2022-07-21: Auto merge of #99530 - RalfJung:miri, r=oli-obk
  commit[2] 2022-07-22: Auto merge of #99420 - RalfJung:vtable, r=oli-obk
  commit[3] 2022-07-22: Auto merge of #99592 - Dylan-DPC:rollup-xlw4wax, r=Dylan-DPC
  commit[4] 2022-07-22: Auto merge of #99491 - workingjubilee:sync-psimd, r=workingjubilee
  commit[5] 2022-07-22: Auto merge of #99521 - fee1-dead-contrib:const_fix_hax, r=oli-obk
  commit[6] 2022-07-22: Auto merge of #99598 - GuillaumeGomez:clean-trait-fields-on-demand, r=notriddle
  commit[7] 2022-07-22: Auto merge of #98017 - RalfJung:dereferenceable, r=nikic

@kadenlnelson
Copy link
Contributor

thread 'rustc' panicked at /rust/deps/ena-0.14.3/src/snapshot_vec.rs:199:10

reference

@kadenlnelson
Copy link
Contributor

Dig some more digging, the suggestion seems valid, at least in the sense that it doesn't like that the user hasn't fully defined a parameter that the f parameter is expecting in the trait's function.

$ RUSTC_LOG=debug rustc 132765.rs
...
              18ms DEBUG rustc_trait_selection::error_reporting::infer::suggest suggest_accessing_field_where_appropriate(cause=ObligationCause { span: 132765.rs:10:48: 10:56 (#0), body_id: DefId(0:12 ~ 132765[0e75]::data), code: Misc }, exp_found=ExpectedFound { expected: std::boxed::Box<dyn [Binder { value: Trait(std::ops::FnMut<(_,)>), bound_vars: [Region(BrNamed(DefId(0:14 ~ 132765[0e75]::LendingIterator::for_each::'_), '_))] }, Binder { value: Projection(Output = ()), bound_vars: [Region(BrNamed(DefId(0:14 ~ 132765[0e75]::LendingIterator::for_each::'_), '_))] }] + 'static, std::alloc::Global>, found: FnDef(DefId(5:571 ~ alloc[bf7f]::boxed::{impl#0}::new), [?6t]) })
thread 'rustc' panicked at /Users/kaden/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ena-0.14.3/src/snapshot_vec.rs:199:10:

@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Dec 13, 2024
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) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

9 participants