Skip to content

Calling slice method on newtype wrapper that implements Deref<Target=[_; 1]> causes ICE #92637

Closed
@compiler-errors

Description

@compiler-errors

Found this in when debugging #92626.

Code

struct Test<T>([T; 1]);

impl<T> std::ops::Deref for Test<T> {
    type Target = [T; 1];
    
    fn deref(&self) -> &[T; 1] {
        &self.0
    }
}

fn test() {
    let mut out = Test(todo!());
    let blah = out.len();
}

Meta

rustc --version --verbose:

rustc 1.57.0 (f1edd0429 2021-11-29)
binary: rustc
commit-hash: f1edd0429582dd29cccacaf50fd134b05593bd9c
commit-date: 2021-11-29
host: x86_64-unknown-linux-gnu
release: 1.57.0
LLVM version: 13.0.0

According to godbolt, it's been failing since 1.32.

Error output

thread 'rustc' panicked at 'index out of bounds: the len is 9 but the index is 9', /home/michael/.cargo/registry/src/github.com-1ecc6299db9ec823/ena-0.14.0/src/snapshot_vec.rs:199:10 
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.59.0-dev running on x86_64-unknown-linux-gnu                                                                                                                                                                                                         

query stack during panic:                                                                                                      
#0 [typeck] type-checking `test`                                                                                               
#1 [typeck_item_bodies] type-checking all item bodies                                                                          
Backtrace

thread 'rustc' panicked at 'index out of bounds: the len is 9 but the index is 9', /home/michael/.cargo/registry/src/github.com-1ecc6299db9ec823/ena-0.14.0/src/snapshot_vec.rs:199:10
stack backtrace:
   0: rust_begin_unwind
             at ./library/std/src/panicking.rs:498:5
   1: core::panicking::panic_fmt
             at ./library/core/src/panicking.rs:107:14
   2: core::panicking::panic_bounds_check
             at ./library/core/src/panicking.rs:75:5
   3: <ena::snapshot_vec::SnapshotVec<ena::unify::backing_vec::Delegate<rustc_infer::infer::type_variable::TyVidEqKey>, &mut alloc::vec::Vec<ena::unify::VarValue<rustc_infer::infer::type_variable::TyVidEqKey>>, &mut rustc_infer::infer::undo_log::InferCtxtUndoLogs>>::get
             at /home/michael/.cargo/registry/src/github.com-1ecc6299db9ec823/ena-0.14.0/src/snapshot_vec.rs:199:10
   4: <ena::snapshot_vec::SnapshotVec<ena::unify::backing_vec::Delegate<rustc_infer::infer::type_variable::TyVidEqKey>, &mut alloc::vec::Vec<ena::unify::VarValue<rustc_infer::infer::type_variable::TyVidEqKey>>, &mut rustc_infer::infer::undo_log::InferCtxtUndoLogs> as core::ops::index::Index<usize>>::index
             at /home/michael/.cargo/registry/src/github.com-1ecc6299db9ec823/ena-0.14.0/src/snapshot_vec.rs:319:9
   5: <ena::unify::backing_vec::InPlace<rustc_infer::infer::type_variable::TyVidEqKey, &mut alloc::vec::Vec<ena::unify::VarValue<rustc_infer::infer::type_variable::TyVidEqKey>>, &mut rustc_infer::infer::undo_log::InferCtxtUndoLogs> as core::ops::index::Index<usize>>::index
             at /home/michael/.cargo/registry/src/github.com-1ecc6299db9ec823/ena-0.14.0/src/unify/backing_vec.rs:152:10
   6: <ena::unify::UnificationTable<ena::unify::backing_vec::InPlace<rustc_infer::infer::type_variable::TyVidEqKey, &mut alloc::vec::Vec<ena::unify::VarValue<rustc_infer::infer::type_variable::TyVidEqKey>>, &mut rustc_infer::infer::undo_log::InferCtxtUndoLogs>>>::value
             at /home/michael/.cargo/registry/src/github.com-1ecc6299db9ec823/ena-0.14.0/src/unify/mod.rs:347:10
   7: <ena::unify::UnificationTable<ena::unify::backing_vec::InPlace<rustc_infer::infer::type_variable::TyVidEqKey, &mut alloc::vec::Vec<ena::unify::VarValue<rustc_infer::infer::type_variable::TyVidEqKey>>, &mut rustc_infer::infer::undo_log::InferCtxtUndoLogs>>>::inlined_get_root_key
             at /home/michael/.cargo/registry/src/github.com-1ecc6299db9ec823/ena-0.14.0/src/unify/mod.rs:362:19
   8: <ena::unify::UnificationTable<ena::unify::backing_vec::InPlace<rustc_infer::infer::type_variable::TyVidEqKey, &mut alloc::vec::Vec<ena::unify::VarValue<rustc_infer::infer::type_variable::TyVidEqKey>>, &mut rustc_infer::infer::undo_log::InferCtxtUndoLogs>>>::inlined_probe_value::<rustc_type_ir::TyVid>
             at /home/michael/.cargo/registry/src/github.com-1ecc6299db9ec823/ena-0.14.0/src/unify/mod.rs:566:18
   9: <rustc_infer::infer::type_variable::TypeVariableTable>::inlined_probe
             at ./compiler/rustc_infer/src/infer/type_variable.rs:307:9
  10: <rustc_infer::infer::type_variable::TypeVariableTable>::probe
             at ./compiler/rustc_infer/src/infer/type_variable.rs:301:9
  11: <rustc_infer::infer::type_variable::TypeVariableTable>::replace_if_possible
             at ./compiler/rustc_infer/src/infer/type_variable.rs:315:46
  12: <rustc_infer::infer::sub::Sub as rustc_middle::ty::relate::TypeRelation>::tys
             at ./compiler/rustc_infer/src/infer/sub.rs:85:17
  13: <&rustc_middle::ty::TyS as rustc_middle::ty::relate::Relate>::relate::<rustc_infer::infer::sub::Sub>
             at ./compiler/rustc_middle/src/ty/relate.rs:366:9
  14: <rustc_infer::infer::sub::Sub as rustc_middle::ty::relate::TypeRelation>::relate::<&rustc_middle::ty::TyS>
             at ./compiler/rustc_middle/src/ty/relate.rs:45:9
  15: rustc_middle::ty::relate::super_relate_tys::<rustc_infer::infer::sub::Sub>
             at ./compiler/rustc_middle/src/ty/relate.rs:498:21
  16: <rustc_infer::infer::InferCtxt>::super_combine_tys::<rustc_infer::infer::sub::Sub>
             at ./compiler/rustc_infer/src/infer/combine.rs:119:18
  17: <rustc_infer::infer::sub::Sub as rustc_middle::ty::relate::TypeRelation>::tys
             at ./compiler/rustc_infer/src/infer/sub.rs:125:17
  18: <&rustc_middle::ty::TyS as rustc_middle::ty::relate::Relate>::relate::<rustc_infer::infer::sub::Sub>
             at ./compiler/rustc_middle/src/ty/relate.rs:366:9
  19: <rustc_infer::infer::sub::Sub as rustc_middle::ty::relate::TypeRelation>::relate::<&rustc_middle::ty::TyS>
             at ./compiler/rustc_middle/src/ty/relate.rs:45:9
  20: <rustc_infer::infer::sub::Sub as rustc_middle::ty::relate::TypeRelation>::relate_with_variance::<&rustc_middle::ty::TyS>
             at ./compiler/rustc_infer/src/infer/sub.rs:71:30
  21: rustc_middle::ty::relate::relate_type_and_mut::<rustc_infer::infer::sub::Sub>
             at ./compiler/rustc_middle/src/ty/relate.rs:133:18
  22: rustc_middle::ty::relate::super_relate_tys::<rustc_infer::infer::sub::Sub>
             at ./compiler/rustc_middle/src/ty/relate.rs:469:22
  23: <rustc_infer::infer::InferCtxt>::super_combine_tys::<rustc_infer::infer::sub::Sub>
             at ./compiler/rustc_infer/src/infer/combine.rs:119:18
  24: <rustc_infer::infer::sub::Sub as rustc_middle::ty::relate::TypeRelation>::tys
             at ./compiler/rustc_infer/src/infer/sub.rs:125:17
  25: <&rustc_middle::ty::TyS as rustc_middle::ty::relate::Relate>::relate::<rustc_infer::infer::sub::Sub>
             at ./compiler/rustc_middle/src/ty/relate.rs:366:9
  26: <rustc_infer::infer::sub::Sub as rustc_middle::ty::relate::TypeRelation>::relate::<&rustc_middle::ty::TyS>
             at ./compiler/rustc_middle/src/ty/relate.rs:45:9
  27: <rustc_infer::infer::at::Trace>::sub::<&rustc_middle::ty::TyS>::{closure#0}
             at ./compiler/rustc_infer/src/infer/at.rs:198:13
  28: <rustc_infer::infer::InferCtxt>::commit_if_ok::<rustc_infer::infer::InferOk<()>, rustc_middle::ty::error::TypeError, <rustc_infer::infer::at::Trace>::sub<&rustc_middle::ty::TyS>::{closure#0}>
             at ./compiler/rustc_infer/src/infer/mod.rs:845:17
  29: <rustc_infer::infer::at::Trace>::sub::<&rustc_middle::ty::TyS>
             at ./compiler/rustc_infer/src/infer/at.rs:196:9
  30: <rustc_infer::infer::at::At>::sub_exp::<&rustc_middle::ty::TyS>
             at ./compiler/rustc_infer/src/infer/at.rs:86:9
  31: <rustc_infer::infer::at::At>::sup::<&rustc_middle::ty::TyS>
             at ./compiler/rustc_infer/src/infer/at.rs:97:9
  32: <rustc_typeck::check::method::confirm::ConfirmContext>::unify_receivers
             at ./compiler/rustc_typeck/src/check/method/confirm.rs:424:15
  33: <rustc_typeck::check::method::confirm::ConfirmContext>::confirm
             at ./compiler/rustc_typeck/src/check/method/confirm.rs:100:9
  34: <rustc_typeck::check::fn_ctxt::FnCtxt>::confirm_method
             at ./compiler/rustc_typeck/src/check/method/confirm.rs:57:9
  35: <rustc_typeck::check::fn_ctxt::FnCtxt>::lookup_method
             at ./compiler/rustc_typeck/src/check/method/mod.rs:222:13
  36: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_method_call
             at ./compiler/rustc_typeck/src/check/expr.rs:1115:28
  37: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
             at ./compiler/rustc_typeck/src/check/expr.rs:316:17
  38: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
             at ./compiler/rustc_typeck/src/check/expr.rs:214:18
  39: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
             at ./compiler/rustc_typeck/src/check/expr.rs:167:9
  40: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_hint
             at ./compiler/rustc_typeck/src/check/expr.rs:119:9
  41: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_coercable_to_type
             at ./compiler/rustc_typeck/src/check/expr.rs:109:18
  42: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_decl_initializer
             at ./compiler/rustc_typeck/src/check/fn_ctxt/checks.rs:581:13
  43: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_decl
             at ./compiler/rustc_typeck/src/check/fn_ctxt/checks.rs:592:27
  44: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_decl_local
             at ./compiler/rustc_typeck/src/check/fn_ctxt/checks.rs:611:9
  45: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_stmt
             at ./compiler/rustc_typeck/src/check/fn_ctxt/checks.rs:629:17
  46: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected::{closure#0}
             at ./compiler/rustc_typeck/src/check/fn_ctxt/checks.rs:709:17
  47: <rustc_typeck::check::fn_ctxt::FnCtxt>::with_breakable_ctxt::<<rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected::{closure#0}, ()>
             at ./compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs:1519:22
  48: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
             at ./compiler/rustc_typeck/src/check/fn_ctxt/checks.rs:707:26
  49: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
             at ./compiler/rustc_typeck/src/check/expr.rs:313:41
  50: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
             at ./compiler/rustc_typeck/src/check/expr.rs:214:18
  51: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
             at ./compiler/rustc_typeck/src/check/expr.rs:167:9
  52: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_hint
             at ./compiler/rustc_typeck/src/check/expr.rs:119:9
  53: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr
             at ./compiler/rustc_typeck/src/check/expr.rs:815:30
  54: rustc_typeck::check::check::check_fn
             at ./compiler/rustc_typeck/src/check/check.rs:215:9
  55: rustc_typeck::check::typeck_with_fallback::<rustc_typeck::check::typeck::{closure#0}>::{closure#1}
             at ./compiler/rustc_typeck/src/check/mod.rs:402:23
  56: <rustc_typeck::check::inherited::InheritedBuilder>::enter::<rustc_typeck::check::typeck_with_fallback<rustc_typeck::check::typeck::{closure#0}>::{closure#1}, &rustc_middle::ty::context::TypeckResults>::{closure#0}
             at ./compiler/rustc_typeck/src/check/inherited.rs:96:34
  57: <rustc_infer::infer::InferCtxtBuilder>::enter::<&rustc_middle::ty::context::TypeckResults, <rustc_typeck::check::inherited::InheritedBuilder>::enter<rustc_typeck::check::typeck_with_fallback<rustc_typeck::check::typeck::{closure#0}>::{closure#1}, &rustc_middle::ty::context::TypeckResults>::{closure#0}>
             at ./compiler/rustc_infer/src/infer/mod.rs:613:9
  58: <rustc_typeck::check::inherited::InheritedBuilder>::enter::<rustc_typeck::check::typeck_with_fallback<rustc_typeck::check::typeck::{closure#0}>::{closure#1}, &rustc_middle::ty::context::TypeckResults>
             at ./compiler/rustc_typeck/src/check/inherited.rs:96:9
  59: rustc_typeck::check::typeck_with_fallback::<rustc_typeck::check::typeck::{closure#0}>
             at ./compiler/rustc_typeck/src/check/mod.rs:365:26
  60: rustc_typeck::check::typeck
             at ./compiler/rustc_typeck/src/check/mod.rs:330:9
  61: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query::<&rustc_middle::ty::context::TypeckResults, rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>::{closure#0}>::{closure#0}::{closure#0}
             at ./compiler/rustc_query_impl/src/plumbing.rs:103:17
  62: rustc_middle::ty::context::tls::enter_context::<<rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query<&rustc_middle::ty::context::TypeckResults, rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>::{closure#0}>::{closure#0}::{closure#0}, &rustc_middle::ty::context::TypeckResults>::{closure#0}
             at ./compiler/rustc_middle/src/ty/context.rs:1759:50
  63: rustc_middle::ty::context::tls::set_tlv::<rustc_middle::ty::context::tls::enter_context<<rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query<&rustc_middle::ty::context::TypeckResults, rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>::{closure#0}>::{closure#0}::{closure#0}, &rustc_middle::ty::context::TypeckResults>::{closure#0}, &rustc_middle::ty::context::TypeckResults>
             at ./compiler/rustc_middle/src/ty/context.rs:1743:9
  64: rustc_middle::ty::context::tls::enter_context::<<rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query<&rustc_middle::ty::context::TypeckResults, rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>::{closure#0}>::{closure#0}::{closure#0}, &rustc_middle::ty::context::TypeckResults>
             at ./compiler/rustc_middle/src/ty/context.rs:1759:9
  65: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query::<&rustc_middle::ty::context::TypeckResults, rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>::{closure#0}>::{closure#0}
             at ./compiler/rustc_query_impl/src/plumbing.rs:102:13
  66: rustc_middle::ty::context::tls::with_related_context::<<rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query<&rustc_middle::ty::context::TypeckResults, rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>::{closure#0}>::{closure#0}, &rustc_middle::ty::context::TypeckResults>::{closure#0}
             at ./compiler/rustc_middle/src/ty/context.rs:1803:13
  67: rustc_middle::ty::context::tls::with_context::<rustc_middle::ty::context::tls::with_related_context<<rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query<&rustc_middle::ty::context::TypeckResults, rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>::{closure#0}>::{closure#0}, &rustc_middle::ty::context::TypeckResults>::{closure#0}, &rustc_middle::ty::context::TypeckResults>::{closure#0}
             at ./compiler/rustc_middle/src/ty/context.rs:1787:40
  68: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_context<rustc_middle::ty::context::tls::with_related_context<<rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query<&rustc_middle::ty::context::TypeckResults, rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>::{closure#0}>::{closure#0}, &rustc_middle::ty::context::TypeckResults>::{closure#0}, &rustc_middle::ty::context::TypeckResults>::{closure#0}, &rustc_middle::ty::context::TypeckResults>
             at ./compiler/rustc_middle/src/ty/context.rs:1776:22
  69: rustc_middle::ty::context::tls::with_context::<rustc_middle::ty::context::tls::with_related_context<<rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query<&rustc_middle::ty::context::TypeckResults, rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>::{closure#0}>::{closure#0}, &rustc_middle::ty::context::TypeckResults>::{closure#0}, &rustc_middle::ty::context::TypeckResults>
             at ./compiler/rustc_middle/src/ty/context.rs:1787:9
  70: rustc_middle::ty::context::tls::with_related_context::<<rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query<&rustc_middle::ty::context::TypeckResults, rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>::{closure#0}>::{closure#0}, &rustc_middle::ty::context::TypeckResults>
             at ./compiler/rustc_middle/src/ty/context.rs:1800:9
  71: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query::<&rustc_middle::ty::context::TypeckResults, rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>::{closure#0}>
             at ./compiler/rustc_query_impl/src/plumbing.rs:91:9
  72: rustc_query_system::query::plumbing::execute_job::<rustc_query_impl::plumbing::QueryCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>
             at ./compiler/rustc_query_system/src/query/plumbing.rs:443:22
  73: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>>
             at ./compiler/rustc_query_system/src/query/plumbing.rs:401:44
  74: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::typeck, rustc_query_impl::plumbing::QueryCtxt>
             at ./compiler/rustc_query_system/src/query/plumbing.rs:760:36
  75: <rustc_middle::ty::query::TyCtxtEnsure>::typeck
             at ./compiler/rustc_middle/src/ty/query.rs:224:17
  76: rustc_typeck::check::typeck_item_bodies::{closure#0}
             at ./compiler/rustc_typeck/src/check/mod.rs:919:51
  77: <rustc_middle::hir::map::Map>::par_body_owners::<rustc_typeck::check::typeck_item_bodies::{closure#0}>::{closure#0}::{closure#0}
             at ./compiler/rustc_middle/src/hir/map/mod.rs:527:21
  78: <core::slice::iter::Iter<(rustc_hir::hir_id::ItemLocalId, &rustc_hir::hir::Body)> as core::iter::traits::iterator::Iterator>::for_each::<<rustc_middle::hir::map::Map>::par_body_owners<rustc_typeck::check::typeck_item_bodies::{closure#0}>::{closure#0}::{closure#0}>
             at ./library/core/src/slice/iter/macros.rs:211:21
  79: <rustc_middle::hir::map::Map>::par_body_owners::<rustc_typeck::check::typeck_item_bodies::{closure#0}>::{closure#0}
             at ./compiler/rustc_middle/src/hir/map/mod.rs:524:17
  80: core::iter::traits::iterator::Iterator::for_each::call::<(usize, &core::option::Option<rustc_hir::hir::OwnerInfo>), <rustc_middle::hir::map::Map>::par_body_owners<rustc_typeck::check::typeck_item_bodies::{closure#0}>::{closure#0}>::{closure#0}
             at ./library/core/src/iter/traits/iterator.rs:733:29
  81: <core::iter::adapters::enumerate::Enumerate<_> as core::iter::traits::iterator::Iterator>::fold::enumerate::<&core::option::Option<rustc_hir::hir::OwnerInfo>, (), core::iter::traits::iterator::Iterator::for_each::call<(usize, &core::option::Option<rustc_hir::hir::OwnerInfo>), <rustc_middle::hir::map::Map>::par_body_owners<rustc_typeck::check::typeck_item_bodies::{closure#0}>::{closure#0}>::{closure#0}>::{closure#0}
             at ./library/core/src/iter/adapters/enumerate.rs:106:27
  82: <core::slice::iter::Iter<core::option::Option<rustc_hir::hir::OwnerInfo>> as core::iter::traits::iterator::Iterator>::fold::<(), <core::iter::adapters::enumerate::Enumerate<_> as core::iter::traits::iterator::Iterator>::fold::enumerate<&core::option::Option<rustc_hir::hir::OwnerInfo>, (), core::iter::traits::iterator::Iterator::for_each::call<(usize, &core::option::Option<rustc_hir::hir::OwnerInfo>), <rustc_middle::hir::map::Map>::par_body_owners<rustc_typeck::check::typeck_item_bodies::{closure#0}>::{closure#0}>::{closure#0}>::{closure#0}>
             at ./library/core/src/iter/traits/iterator.rs:2171:21
  83: <core::iter::adapters::enumerate::Enumerate<core::slice::iter::Iter<core::option::Option<rustc_hir::hir::OwnerInfo>>> as core::iter::traits::iterator::Iterator>::fold::<(), core::iter::traits::iterator::Iterator::for_each::call<(usize, &core::option::Option<rustc_hir::hir::OwnerInfo>), <rustc_middle::hir::map::Map>::par_body_owners<rustc_typeck::check::typeck_item_bodies::{closure#0}>::{closure#0}>::{closure#0}>
             at ./library/core/src/iter/adapters/enumerate.rs:112:9
  84: <core::iter::adapters::enumerate::Enumerate<core::slice::iter::Iter<core::option::Option<rustc_hir::hir::OwnerInfo>>> as core::iter::traits::iterator::Iterator>::for_each::<<rustc_middle::hir::map::Map>::par_body_owners<rustc_typeck::check::typeck_item_bodies::{closure#0}>::{closure#0}>
             at ./library/core/src/iter/traits/iterator.rs:736:9
  85: <rustc_middle::hir::map::Map>::par_body_owners::<rustc_typeck::check::typeck_item_bodies::{closure#0}>
             at ./compiler/rustc_middle/src/hir/map/mod.rs:521:9
  86: rustc_typeck::check::typeck_item_bodies
             at ./compiler/rustc_typeck/src/check/mod.rs:919:5
  87: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query::<(), rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, (), ()>::{closure#0}>::{closure#0}::{closure#0}
             at ./compiler/rustc_query_impl/src/plumbing.rs:103:17
  88: rustc_middle::ty::context::tls::enter_context::<<rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query<(), rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, (), ()>::{closure#0}>::{closure#0}::{closure#0}, ()>::{closure#0}
             at ./compiler/rustc_middle/src/ty/context.rs:1759:50
  89: rustc_middle::ty::context::tls::set_tlv::<rustc_middle::ty::context::tls::enter_context<<rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query<(), rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, (), ()>::{closure#0}>::{closure#0}::{closure#0}, ()>::{closure#0}, ()>
             at ./compiler/rustc_middle/src/ty/context.rs:1743:9
  90: rustc_middle::ty::context::tls::enter_context::<<rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query<(), rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, (), ()>::{closure#0}>::{closure#0}::{closure#0}, ()>
             at ./compiler/rustc_middle/src/ty/context.rs:1759:9
  91: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query::<(), rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, (), ()>::{closure#0}>::{closure#0}
             at ./compiler/rustc_query_impl/src/plumbing.rs:102:13
  92: rustc_middle::ty::context::tls::with_related_context::<<rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query<(), rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, (), ()>::{closure#0}>::{closure#0}, ()>::{closure#0}
             at ./compiler/rustc_middle/src/ty/context.rs:1803:13
  93: rustc_middle::ty::context::tls::with_context::<rustc_middle::ty::context::tls::with_related_context<<rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query<(), rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, (), ()>::{closure#0}>::{closure#0}, ()>::{closure#0}, ()>::{closure#0}
             at ./compiler/rustc_middle/src/ty/context.rs:1787:40
  94: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_context<rustc_middle::ty::context::tls::with_related_context<<rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query<(), rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, (), ()>::{closure#0}>::{closure#0}, ()>::{closure#0}, ()>::{closure#0}, ()>
             at ./compiler/rustc_middle/src/ty/context.rs:1776:22
  95: rustc_middle::ty::context::tls::with_context::<rustc_middle::ty::context::tls::with_related_context<<rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query<(), rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, (), ()>::{closure#0}>::{closure#0}, ()>::{closure#0}, ()>
             at ./compiler/rustc_middle/src/ty/context.rs:1787:9
  96: rustc_middle::ty::context::tls::with_related_context::<<rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query<(), rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, (), ()>::{closure#0}>::{closure#0}, ()>
             at ./compiler/rustc_middle/src/ty/context.rs:1800:9
  97: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query::<(), rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, (), ()>::{closure#0}>
             at ./compiler/rustc_query_impl/src/plumbing.rs:91:9
  98: rustc_query_system::query::plumbing::execute_job::<rustc_query_impl::plumbing::QueryCtxt, (), ()>
             at ./compiler/rustc_query_system/src/query/plumbing.rs:443:22
  99: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<(), ()>>
             at ./compiler/rustc_query_system/src/query/plumbing.rs:401:44
 100: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::typeck_item_bodies, rustc_query_impl::plumbing::QueryCtxt>
             at ./compiler/rustc_query_system/src/query/plumbing.rs:760:36
 101: <rustc_middle::ty::query::TyCtxtAt>::typeck_item_bodies
             at ./compiler/rustc_middle/src/ty/query.rs:253:17
 102: <rustc_middle::ty::context::TyCtxt>::typeck_item_bodies
             at ./compiler/rustc_middle/src/ty/query.rs:234:17
 103: rustc_typeck::check_crate::{closure#7}
             at ./compiler/rustc_typeck/src/lib.rs:532:46
 104: <rustc_data_structures::profiling::VerboseTimingGuard>::run::<(), rustc_typeck::check_crate::{closure#7}>
             at ./compiler/rustc_data_structures/src/profiling.rs:644:9
 105: <rustc_session::session::Session>::time::<(), rustc_typeck::check_crate::{closure#7}>
             at ./compiler/rustc_session/src/utils.rs:16:9
 106: rustc_typeck::check_crate
             at ./compiler/rustc_typeck/src/lib.rs:532:5
 107: rustc_interface::passes::analysis
             at ./compiler/rustc_interface/src/passes.rs:926:5
 108: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, (), core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}>::{closure#0}::{closure#0}
             at ./compiler/rustc_query_impl/src/plumbing.rs:103:17
 109: rustc_middle::ty::context::tls::enter_context::<<rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query<core::result::Result<(), rustc_errors::ErrorReported>, rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, (), core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}
             at ./compiler/rustc_middle/src/ty/context.rs:1759:50
 110: rustc_middle::ty::context::tls::set_tlv::<rustc_middle::ty::context::tls::enter_context<<rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query<core::result::Result<(), rustc_errors::ErrorReported>, rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, (), core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>
             at ./compiler/rustc_middle/src/ty/context.rs:1743:9
 111: rustc_middle::ty::context::tls::enter_context::<<rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query<core::result::Result<(), rustc_errors::ErrorReported>, rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, (), core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>
             at ./compiler/rustc_middle/src/ty/context.rs:1759:9
 112: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, (), core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}>::{closure#0}
             at ./compiler/rustc_query_impl/src/plumbing.rs:102:13
 113: rustc_middle::ty::context::tls::with_related_context::<<rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query<core::result::Result<(), rustc_errors::ErrorReported>, rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, (), core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}
             at ./compiler/rustc_middle/src/ty/context.rs:1803:13
 114: rustc_middle::ty::context::tls::with_context::<rustc_middle::ty::context::tls::with_related_context<<rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query<core::result::Result<(), rustc_errors::ErrorReported>, rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, (), core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}
             at ./compiler/rustc_middle/src/ty/context.rs:1787:40
 115: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_context<rustc_middle::ty::context::tls::with_related_context<<rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query<core::result::Result<(), rustc_errors::ErrorReported>, rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, (), core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>
             at ./compiler/rustc_middle/src/ty/context.rs:1776:22
 116: rustc_middle::ty::context::tls::with_context::<rustc_middle::ty::context::tls::with_related_context<<rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query<core::result::Result<(), rustc_errors::ErrorReported>, rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, (), core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>
             at ./compiler/rustc_middle/src/ty/context.rs:1787:9
 117: rustc_middle::ty::context::tls::with_related_context::<<rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query<core::result::Result<(), rustc_errors::ErrorReported>, rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, (), core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>
             at ./compiler/rustc_middle/src/ty/context.rs:1800:9
 118: <rustc_query_impl::plumbing::QueryCtxt as rustc_query_system::query::QueryContext>::start_query::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_query_system::query::plumbing::execute_job<rustc_query_impl::plumbing::QueryCtxt, (), core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}>
             at ./compiler/rustc_query_impl/src/plumbing.rs:91:9
 119: rustc_query_system::query::plumbing::execute_job::<rustc_query_impl::plumbing::QueryCtxt, (), core::result::Result<(), rustc_errors::ErrorReported>>
             at ./compiler/rustc_query_system/src/query/plumbing.rs:443:22
 120: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<(), core::result::Result<(), rustc_errors::ErrorReported>>>
             at ./compiler/rustc_query_system/src/query/plumbing.rs:401:44
 121: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
             at ./compiler/rustc_query_system/src/query/plumbing.rs:760:36
 122: <rustc_middle::ty::query::TyCtxtAt>::analysis
             at ./compiler/rustc_middle/src/ty/query.rs:253:17
 123: <rustc_middle::ty::context::TyCtxt>::analysis
             at ./compiler/rustc_middle/src/ty/query.rs:234:17
 124: rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}
             at ./compiler/rustc_driver/src/lib.rs:387:30
 125: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}
             at ./compiler/rustc_interface/src/passes.rs:821:42
 126: rustc_middle::ty::context::tls::enter_context::<<rustc_interface::passes::QueryContext>::enter<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}
             at ./compiler/rustc_middle/src/ty/context.rs:1759:50
 127: rustc_middle::ty::context::tls::set_tlv::<rustc_middle::ty::context::tls::enter_context<<rustc_interface::passes::QueryContext>::enter<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>
             at ./compiler/rustc_middle/src/ty/context.rs:1743:9
 128: rustc_middle::ty::context::tls::enter_context::<<rustc_interface::passes::QueryContext>::enter<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>
             at ./compiler/rustc_middle/src/ty/context.rs:1759:9
 129: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorReported>>
             at ./compiler/rustc_interface/src/passes.rs:821:9
 130: rustc_driver::run_compiler::{closure#1}::{closure#2}
             at ./compiler/rustc_driver/src/lib.rs:386:13
 131: <rustc_interface::interface::Compiler>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorReported>>
             at ./compiler/rustc_interface/src/queries.rs:393:19
 132: rustc_driver::run_compiler::{closure#1}
             at ./compiler/rustc_driver/src/lib.rs:315:22
 133: rustc_interface::interface::create_compiler_and_run::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#1}
             at ./compiler/rustc_interface/src/interface.rs:220:13
 134: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#1}>
             at ./compiler/rustc_span/src/lib.rs:1010:5
 135: rustc_interface::interface::create_compiler_and_run::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>
             at ./compiler/rustc_interface/src/interface.rs:214:5
 136: rustc_interface::interface::run_compiler::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#0}
             at ./compiler/rustc_interface/src/interface.rs:236:12
 137: rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}::{closure#0}
             at ./compiler/rustc_interface/src/util.rs:148:13
 138: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>
             at /home/michael/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137:9
 139: rustc_span::create_session_globals_then::<core::result::Result<(), rustc_errors::ErrorReported>, rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}::{closure#0}>
             at ./compiler/rustc_span/src/lib.rs:108:5
 140: rustc_interface::util::setup_callbacks_and_run_in_thread_pool_with_globals::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorReported>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorReported>>::{closure#0}
             at ./compiler/rustc_interface/src/util.rs:146:9
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.59.0-dev running on x86_64-unknown-linux-gnu

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

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

Metadata

Metadata

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