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

Regression from 1.61 to 1.62 #98932

Closed
0xdeafbeef opened this issue Jul 5, 2022 · 5 comments · Fixed by #99728
Closed

Regression from 1.61 to 1.62 #98932

0xdeafbeef opened this issue Jul 5, 2022 · 5 comments · Fixed by #99728
Assignees
Labels
C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@0xdeafbeef
Copy link

Code

cd $(mktemp -d) &&  git clone https://github.com/broxus/ton-indexer.git && cd ton-indexer && git checkout c17e57d00f3e881ad32c867094edb738b5e47b5a && cargo check

Meta

rustc --version --verbose:

rustc 1.62.0 (a8314ef7d 2022-06-27)
binary: rustc
commit-hash: a8314ef7d0ec7b75c336af2c9857bfaf43002bfc
commit-date: 2022-06-27
host: x86_64-unknown-linux-gnu
release: 1.62.0
LLVM version: 14.0.5

Error output

error: internal compiler error: compiler/rustc_borrowck/src/universal_regions.rs:810:36: cannot convert `ReEarlyBound(1, '_)` to a region vid
Backtrace

error: internal compiler error: compiler/rustc_borrowck/src/universal_regions.rs:810:36: cannot convert `ReEarlyBound(1, '_)` to a region vid

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/compiler/rustc_errors/src/lib.rs:1335:9
stack backtrace:
   0:     0x7fbb88e9dfed - std::backtrace_rs::backtrace::libunwind::trace::hb729d9642bb971eb
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fbb88e9dfed - std::backtrace_rs::backtrace::trace_unsynchronized::h373bb774579df5c7
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fbb88e9dfed - std::sys_common::backtrace::_print_fmt::hfbd4e92d240c89bb
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7fbb88e9dfed - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h8f618991fbf64972
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7fbb88ef9c7c - core::fmt::write::hc69b5b640d88cce8
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/core/src/fmt/mod.rs:1196:17
   5:     0x7fbb88e8f6c1 - std::io::Write::write_fmt::h3403cef06a24a303
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/io/mod.rs:1654:15
   6:     0x7fbb88ea0d05 - std::sys_common::backtrace::_print::h368f27cdedea0e52
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7fbb88ea0d05 - std::sys_common::backtrace::print::ha105c9cf5a64cd17
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7fbb88ea0d05 - std::panicking::default_hook::{{closure}}::h48ed2c3707d5e20e
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:295:22
   9:     0x7fbb88ea0979 - std::panicking::default_hook::h8744fc5cea5e3110
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:314:9
  10:     0x7fbb896e9961 - rustc_driver[cc15f272104f8c81]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7fbb78609683 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hf270ccd282d441e1
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/alloc/src/boxed.rs:1886:9
  12:     0x7fbb786371cd - proc_macro::bridge::client::<impl proc_macro::bridge::Bridge>::enter::{{closure}}::{{closure}}::h47be12298b431f57
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/proc_macro/src/bridge/client.rs:335:21
  13:     0x7fbb88ea14d6 - std::panicking::rust_panic_with_hook::hc82286af2030e925
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/panicking.rs:702:17
  14:     0x7fbb8a763e61 - std[62a6aef941a414a5]::panicking::begin_panic::<rustc_errors[7cc8b2502942d635]::ExplicitBug>::{closure#0}
  15:     0x7fbb8a75e3b6 - std[62a6aef941a414a5]::sys_common::backtrace::__rust_end_short_backtrace::<std[62a6aef941a414a5]::panicking::begin_panic<rustc_errors[7cc8b2502942d635]::ExplicitBug>::{closure#0}, !>
  16:     0x7fbb8a6f3dc6 - std[62a6aef941a414a5]::panicking::begin_panic::<rustc_errors[7cc8b2502942d635]::ExplicitBug>
  17:     0x7fbb8a6ab536 - std[62a6aef941a414a5]::panic::panic_any::<rustc_errors[7cc8b2502942d635]::ExplicitBug>
  18:     0x7fbb8a6a4c75 - <rustc_errors[7cc8b2502942d635]::HandlerInner>::bug::<&alloc[678093063b977939]::string::String>
  19:     0x7fbb8a6a4680 - <rustc_errors[7cc8b2502942d635]::Handler>::bug::<&alloc[678093063b977939]::string::String>
  20:     0x7fbb8a76c7ad - rustc_middle[2b9dbf3985a9058b]::ty::context::tls::with_opt::<rustc_middle[2b9dbf3985a9058b]::util::bug::opt_span_bug_fmt<rustc_span[aeddd698d19619f]::span_encoding::Span>::{closure#0}, ()>
  21:     0x7fbb8a76cb26 - rustc_middle[2b9dbf3985a9058b]::util::bug::opt_span_bug_fmt::<rustc_span[aeddd698d19619f]::span_encoding::Span>
  22:     0x7fbb8a76caa3 - rustc_middle[2b9dbf3985a9058b]::util::bug::bug_fmt
  23:     0x7fbb8af30451 - <rustc_borrowck[c373a10a95822b25]::type_check::constraint_conversion::ConstraintConversion>::convert_all
  24:     0x7fbb8af58e8b - <rustc_borrowck[c373a10a95822b25]::type_check::TypeChecker>::fully_perform_op::<(), rustc_middle[2b9dbf3985a9058b]::ty::ParamEnvAnd<rustc_middle[2b9dbf3985a9058b]::traits::query::type_op::AscribeUserType>>
  25:     0x7fbb8af41e6c - rustc_borrowck[c373a10a95822b25]::type_check::type_check
  26:     0x7fbb8af1deec - rustc_borrowck[c373a10a95822b25]::nll::compute_regions
  27:     0x7fbb8af8babe - rustc_borrowck[c373a10a95822b25]::do_mir_borrowck
  28:     0x7fbb8af84749 - rustc_borrowck[c373a10a95822b25]::mir_borrowck
  29:     0x7fbb8af814b0 - <rustc_borrowck[c373a10a95822b25]::provide::{closure#0} as core[6724bec812d80be0]::ops::function::FnOnce<(rustc_middle[2b9dbf3985a9058b]::ty::context::TyCtxt, rustc_span[aeddd698d19619f]::def_id::LocalDefId)>>::call_once
  30:     0x7fbb8bc16cc0 - <rustc_query_system[a16ac1cefdea5f76]::dep_graph::graph::DepGraph<rustc_middle[2b9dbf3985a9058b]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[2b9dbf3985a9058b]::ty::context::TyCtxt, rustc_span[aeddd698d19619f]::def_id::LocalDefId, &rustc_middle[2b9dbf3985a9058b]::mir::query::BorrowCheckResult>
  31:     0x7fbb8b1b3761 - rustc_query_system[a16ac1cefdea5f76]::query::plumbing::try_execute_query::<rustc_query_impl[37d320545ae1f097]::plumbing::QueryCtxt, rustc_query_system[a16ac1cefdea5f76]::query::caches::DefaultCache<rustc_span[aeddd698d19619f]::def_id::LocalDefId, &rustc_middle[2b9dbf3985a9058b]::mir::query::BorrowCheckResult>>
  32:     0x7fbb8b17e3ea - <rustc_query_impl[37d320545ae1f097]::Queries as rustc_middle[2b9dbf3985a9058b]::ty::query::QueryEngine>::mir_borrowck
  33:     0x7fbb8b61e831 - <rustc_middle[2b9dbf3985a9058b]::ty::context::TyCtxt>::mir_borrowck_opt_const_arg
  34:     0x7fbb8ab250f7 - rustc_mir_transform[34692f6d13108f5a]::mir_drops_elaborated_and_const_checked
  35:     0x7fbb8bc0b23c - <rustc_query_system[a16ac1cefdea5f76]::dep_graph::graph::DepGraph<rustc_middle[2b9dbf3985a9058b]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[2b9dbf3985a9058b]::ty::context::TyCtxt, rustc_middle[2b9dbf3985a9058b]::ty::WithOptConstParam<rustc_span[aeddd698d19619f]::def_id::LocalDefId>, &rustc_data_structures[e6d5a572b4e9612f]::steal::Steal<rustc_middle[2b9dbf3985a9058b]::mir::Body>>
  36:     0x7fbb8b1a01a6 - rustc_query_system[a16ac1cefdea5f76]::query::plumbing::try_execute_query::<rustc_query_impl[37d320545ae1f097]::plumbing::QueryCtxt, rustc_query_system[a16ac1cefdea5f76]::query::caches::DefaultCache<rustc_middle[2b9dbf3985a9058b]::ty::WithOptConstParam<rustc_span[aeddd698d19619f]::def_id::LocalDefId>, &rustc_data_structures[e6d5a572b4e9612f]::steal::Steal<rustc_middle[2b9dbf3985a9058b]::mir::Body>>>
  37:     0x7fbb8b17cf28 - <rustc_query_impl[37d320545ae1f097]::Queries as rustc_middle[2b9dbf3985a9058b]::ty::query::QueryEngine>::mir_drops_elaborated_and_const_checked
  38:     0x7fbb8b91d286 - rustc_mir_transform[34692f6d13108f5a]::inner_mir_for_ctfe
  39:     0x7fbb8b91cafc - rustc_mir_transform[34692f6d13108f5a]::mir_for_ctfe
  40:     0x7fbb8bc22e87 - <rustc_query_system[a16ac1cefdea5f76]::dep_graph::graph::DepGraph<rustc_middle[2b9dbf3985a9058b]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[2b9dbf3985a9058b]::ty::context::TyCtxt, rustc_span[aeddd698d19619f]::def_id::DefId, &rustc_middle[2b9dbf3985a9058b]::mir::Body>
  41:     0x7fbb8b1c33ec - rustc_query_system[a16ac1cefdea5f76]::query::plumbing::try_execute_query::<rustc_query_impl[37d320545ae1f097]::plumbing::QueryCtxt, rustc_query_system[a16ac1cefdea5f76]::query::caches::DefaultCache<rustc_span[aeddd698d19619f]::def_id::DefId, &rustc_middle[2b9dbf3985a9058b]::mir::Body>>
  42:     0x7fbb8bcff2bc - rustc_query_system[a16ac1cefdea5f76]::query::plumbing::get_query::<rustc_query_impl[37d320545ae1f097]::queries::mir_for_ctfe, rustc_query_impl[37d320545ae1f097]::plumbing::QueryCtxt>
  43:     0x7fbb8bb8120f - <rustc_const_eval[654e2017a2411b4b]::interpret::eval_context::InterpCx<rustc_const_eval[654e2017a2411b4b]::const_eval::machine::CompileTimeInterpreter>>::load_mir
  44:     0x7fbb8b0cbcab - rustc_const_eval[654e2017a2411b4b]::const_eval::eval_queries::eval_to_allocation_raw_provider
  45:     0x7fbb8bc09c49 - <rustc_query_system[a16ac1cefdea5f76]::dep_graph::graph::DepGraph<rustc_middle[2b9dbf3985a9058b]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[2b9dbf3985a9058b]::ty::context::TyCtxt, rustc_middle[2b9dbf3985a9058b]::ty::ParamEnvAnd<rustc_middle[2b9dbf3985a9058b]::mir::interpret::GlobalId>, core[6724bec812d80be0]::result::Result<rustc_middle[2b9dbf3985a9058b]::mir::interpret::value::ConstAlloc, rustc_middle[2b9dbf3985a9058b]::mir::interpret::error::ErrorHandled>>
  46:     0x7fbb8b19cab7 - rustc_query_system[a16ac1cefdea5f76]::query::plumbing::try_execute_query::<rustc_query_impl[37d320545ae1f097]::plumbing::QueryCtxt, rustc_query_system[a16ac1cefdea5f76]::query::caches::DefaultCache<rustc_middle[2b9dbf3985a9058b]::ty::ParamEnvAnd<rustc_middle[2b9dbf3985a9058b]::mir::interpret::GlobalId>, core[6724bec812d80be0]::result::Result<rustc_middle[2b9dbf3985a9058b]::mir::interpret::value::ConstAlloc, rustc_middle[2b9dbf3985a9058b]::mir::interpret::error::ErrorHandled>>>
  47:     0x7fbb8b17e533 - <rustc_query_impl[37d320545ae1f097]::Queries as rustc_middle[2b9dbf3985a9058b]::ty::query::QueryEngine>::eval_to_allocation_raw
  48:     0x7fbb8b0caad4 - rustc_const_eval[654e2017a2411b4b]::const_eval::eval_queries::eval_to_const_value_raw_provider
  49:     0x7fbb8bc0a1f9 - <rustc_query_system[a16ac1cefdea5f76]::dep_graph::graph::DepGraph<rustc_middle[2b9dbf3985a9058b]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[2b9dbf3985a9058b]::ty::context::TyCtxt, rustc_middle[2b9dbf3985a9058b]::ty::ParamEnvAnd<rustc_middle[2b9dbf3985a9058b]::mir::interpret::GlobalId>, core[6724bec812d80be0]::result::Result<rustc_middle[2b9dbf3985a9058b]::mir::interpret::value::ConstValue, rustc_middle[2b9dbf3985a9058b]::mir::interpret::error::ErrorHandled>>
  50:     0x7fbb8b19dc4e - rustc_query_system[a16ac1cefdea5f76]::query::plumbing::try_execute_query::<rustc_query_impl[37d320545ae1f097]::plumbing::QueryCtxt, rustc_query_system[a16ac1cefdea5f76]::query::caches::DefaultCache<rustc_middle[2b9dbf3985a9058b]::ty::ParamEnvAnd<rustc_middle[2b9dbf3985a9058b]::mir::interpret::GlobalId>, core[6724bec812d80be0]::result::Result<rustc_middle[2b9dbf3985a9058b]::mir::interpret::value::ConstValue, rustc_middle[2b9dbf3985a9058b]::mir::interpret::error::ErrorHandled>>>
  51:     0x7fbb8b17e6e0 - <rustc_query_impl[37d320545ae1f097]::Queries as rustc_middle[2b9dbf3985a9058b]::ty::query::QueryEngine>::eval_to_const_value_raw
  52:     0x7fbb8b0ca842 - rustc_const_eval[654e2017a2411b4b]::const_eval::eval_queries::eval_to_const_value_raw_provider
  53:     0x7fbb8bc0a1f9 - <rustc_query_system[a16ac1cefdea5f76]::dep_graph::graph::DepGraph<rustc_middle[2b9dbf3985a9058b]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[2b9dbf3985a9058b]::ty::context::TyCtxt, rustc_middle[2b9dbf3985a9058b]::ty::ParamEnvAnd<rustc_middle[2b9dbf3985a9058b]::mir::interpret::GlobalId>, core[6724bec812d80be0]::result::Result<rustc_middle[2b9dbf3985a9058b]::mir::interpret::value::ConstValue, rustc_middle[2b9dbf3985a9058b]::mir::interpret::error::ErrorHandled>>
  54:     0x7fbb8b19dc4e - rustc_query_system[a16ac1cefdea5f76]::query::plumbing::try_execute_query::<rustc_query_impl[37d320545ae1f097]::plumbing::QueryCtxt, rustc_query_system[a16ac1cefdea5f76]::query::caches::DefaultCache<rustc_middle[2b9dbf3985a9058b]::ty::ParamEnvAnd<rustc_middle[2b9dbf3985a9058b]::mir::interpret::GlobalId>, core[6724bec812d80be0]::result::Result<rustc_middle[2b9dbf3985a9058b]::mir::interpret::value::ConstValue, rustc_middle[2b9dbf3985a9058b]::mir::interpret::error::ErrorHandled>>>
  55:     0x7fbb8b17e6e0 - <rustc_query_impl[37d320545ae1f097]::Queries as rustc_middle[2b9dbf3985a9058b]::ty::query::QueryEngine>::eval_to_const_value_raw
  56:     0x7fbb8b60d475 - <rustc_middle[2b9dbf3985a9058b]::ty::context::TyCtxt>::const_eval_global_id
  57:     0x7fbb8bf87179 - <rustc_middle[2b9dbf3985a9058b]::ty::context::TyCtxt>::const_eval_resolve
  58:     0x7fbb8a63e71a - rustc_middle[2b9dbf3985a9058b]::ty::relate::super_relate_consts::<rustc_infer[55a689d00ae6ec12]::infer::equate::Equate>
  59:     0x7fbb8a61b7c3 - <rustc_infer[55a689d00ae6ec12]::infer::InferCtxt>::super_combine_consts::<rustc_infer[55a689d00ae6ec12]::infer::equate::Equate>
  60:     0x7fbb8b545107 - rustc_middle[2b9dbf3985a9058b]::ty::relate::super_relate_tys::<rustc_infer[55a689d00ae6ec12]::infer::equate::Equate>
  61:     0x7fbb8b527127 - <rustc_infer[55a689d00ae6ec12]::infer::InferCtxt>::super_combine_tys::<rustc_infer[55a689d00ae6ec12]::infer::equate::Equate>
  62:     0x7fbb8b544e92 - rustc_middle[2b9dbf3985a9058b]::ty::relate::super_relate_tys::<rustc_infer[55a689d00ae6ec12]::infer::equate::Equate>
  63:     0x7fbb8b59fbbc - <rustc_infer[55a689d00ae6ec12]::infer::equate::Equate as rustc_middle[2b9dbf3985a9058b]::ty::relate::TypeRelation>::tys
  64:     0x7fbb8b49709e - rustc_trait_selection[5d73681df2441a7c]::traits::project::project_and_unify_type
  65:     0x7fbb8b4c594f - <rustc_trait_selection[5d73681df2441a7c]::traits::fulfill::FulfillProcessor>::process_changed_obligations
  66:     0x7fbb8b4eb787 - <rustc_data_structures[e6d5a572b4e9612f]::obligation_forest::ObligationForest<rustc_trait_selection[5d73681df2441a7c]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[5d73681df2441a7c]::traits::fulfill::FulfillProcessor, rustc_data_structures[e6d5a572b4e9612f]::obligation_forest::Outcome<rustc_trait_selection[5d73681df2441a7c]::traits::fulfill::PendingPredicateObligation, rustc_infer[55a689d00ae6ec12]::traits::FulfillmentErrorCode>>
  67:     0x7fbb8b4c2df1 - <rustc_trait_selection[5d73681df2441a7c]::traits::fulfill::FulfillmentContext as rustc_infer[55a689d00ae6ec12]::traits::engine::TraitEngine>::select_where_possible
  68:     0x7fbb8ab94129 - <rustc_typeck[9a0dbd9e1b6c9fb9]::check::fn_ctxt::FnCtxt>::type_inference_fallback
  69:     0x7fbb8ac3730d - <rustc_infer[55a689d00ae6ec12]::infer::InferCtxtBuilder>::enter::<&rustc_middle[2b9dbf3985a9058b]::ty::context::TypeckResults, <rustc_typeck[9a0dbd9e1b6c9fb9]::check::inherited::InheritedBuilder>::enter<rustc_typeck[9a0dbd9e1b6c9fb9]::check::typeck_with_fallback<rustc_typeck[9a0dbd9e1b6c9fb9]::check::typeck::{closure#0}>::{closure#1}, &rustc_middle[2b9dbf3985a9058b]::ty::context::TypeckResults>::{closure#0}>
  70:     0x7fbb8abf6fe0 - rustc_typeck[9a0dbd9e1b6c9fb9]::check::typeck
  71:     0x7fbb8bc162c0 - <rustc_query_system[a16ac1cefdea5f76]::dep_graph::graph::DepGraph<rustc_middle[2b9dbf3985a9058b]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[2b9dbf3985a9058b]::ty::context::TyCtxt, rustc_span[aeddd698d19619f]::def_id::LocalDefId, &rustc_middle[2b9dbf3985a9058b]::ty::context::TypeckResults>
  72:     0x7fbb8b1b2786 - rustc_query_system[a16ac1cefdea5f76]::query::plumbing::try_execute_query::<rustc_query_impl[37d320545ae1f097]::plumbing::QueryCtxt, rustc_query_system[a16ac1cefdea5f76]::query::caches::DefaultCache<rustc_span[aeddd698d19619f]::def_id::LocalDefId, &rustc_middle[2b9dbf3985a9058b]::ty::context::TypeckResults>>
  73:     0x7fbb8b17e178 - <rustc_query_impl[37d320545ae1f097]::Queries as rustc_middle[2b9dbf3985a9058b]::ty::query::QueryEngine>::typeck
  74:     0x7fbb8b61e2a2 - <rustc_middle[2b9dbf3985a9058b]::ty::context::TyCtxt>::typeck_opt_const_arg
  75:     0x7fbb8ae3ce7a - rustc_mir_build[47e1d63702a692cd]::build::mir_built
  76:     0x7fbb8bc0b23c - <rustc_query_system[a16ac1cefdea5f76]::dep_graph::graph::DepGraph<rustc_middle[2b9dbf3985a9058b]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[2b9dbf3985a9058b]::ty::context::TyCtxt, rustc_middle[2b9dbf3985a9058b]::ty::WithOptConstParam<rustc_span[aeddd698d19619f]::def_id::LocalDefId>, &rustc_data_structures[e6d5a572b4e9612f]::steal::Steal<rustc_middle[2b9dbf3985a9058b]::mir::Body>>
  77:     0x7fbb8b1a01a6 - rustc_query_system[a16ac1cefdea5f76]::query::plumbing::try_execute_query::<rustc_query_impl[37d320545ae1f097]::plumbing::QueryCtxt, rustc_query_system[a16ac1cefdea5f76]::query::caches::DefaultCache<rustc_middle[2b9dbf3985a9058b]::ty::WithOptConstParam<rustc_span[aeddd698d19619f]::def_id::LocalDefId>, &rustc_data_structures[e6d5a572b4e9612f]::steal::Steal<rustc_middle[2b9dbf3985a9058b]::mir::Body>>>
  78:     0x7fbb8b17cb25 - <rustc_query_impl[37d320545ae1f097]::Queries as rustc_middle[2b9dbf3985a9058b]::ty::query::QueryEngine>::mir_built
  79:     0x7fbb8ab349ce - rustc_mir_transform[34692f6d13108f5a]::check_unsafety::unsafety_check_result
  80:     0x7fbb8ab2c1b0 - <rustc_mir_transform[34692f6d13108f5a]::check_unsafety::provide::{closure#0} as core[6724bec812d80be0]::ops::function::FnOnce<(rustc_middle[2b9dbf3985a9058b]::ty::context::TyCtxt, rustc_span[aeddd698d19619f]::def_id::LocalDefId)>>::call_once
  81:     0x7fbb8bc171c0 - <rustc_query_system[a16ac1cefdea5f76]::dep_graph::graph::DepGraph<rustc_middle[2b9dbf3985a9058b]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[2b9dbf3985a9058b]::ty::context::TyCtxt, rustc_span[aeddd698d19619f]::def_id::LocalDefId, &rustc_middle[2b9dbf3985a9058b]::mir::query::UnsafetyCheckResult>
  82:     0x7fbb8b1b47a6 - rustc_query_system[a16ac1cefdea5f76]::query::plumbing::try_execute_query::<rustc_query_impl[37d320545ae1f097]::plumbing::QueryCtxt, rustc_query_system[a16ac1cefdea5f76]::query::caches::DefaultCache<rustc_span[aeddd698d19619f]::def_id::LocalDefId, &rustc_middle[2b9dbf3985a9058b]::mir::query::UnsafetyCheckResult>>
  83:     0x7fbb8b17dd7e - <rustc_query_impl[37d320545ae1f097]::Queries as rustc_middle[2b9dbf3985a9058b]::ty::query::QueryEngine>::unsafety_check_result
  84:     0x7fbb8ab22e4f - rustc_mir_transform[34692f6d13108f5a]::mir_const
  85:     0x7fbb8bc0b23c - <rustc_query_system[a16ac1cefdea5f76]::dep_graph::graph::DepGraph<rustc_middle[2b9dbf3985a9058b]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[2b9dbf3985a9058b]::ty::context::TyCtxt, rustc_middle[2b9dbf3985a9058b]::ty::WithOptConstParam<rustc_span[aeddd698d19619f]::def_id::LocalDefId>, &rustc_data_structures[e6d5a572b4e9612f]::steal::Steal<rustc_middle[2b9dbf3985a9058b]::mir::Body>>
  86:     0x7fbb8b1a01a6 - rustc_query_system[a16ac1cefdea5f76]::query::plumbing::try_execute_query::<rustc_query_impl[37d320545ae1f097]::plumbing::QueryCtxt, rustc_query_system[a16ac1cefdea5f76]::query::caches::DefaultCache<rustc_middle[2b9dbf3985a9058b]::ty::WithOptConstParam<rustc_span[aeddd698d19619f]::def_id::LocalDefId>, &rustc_data_structures[e6d5a572b4e9612f]::steal::Steal<rustc_middle[2b9dbf3985a9058b]::mir::Body>>>
  87:     0x7fbb8b17cc5c - <rustc_query_impl[37d320545ae1f097]::Queries as rustc_middle[2b9dbf3985a9058b]::ty::query::QueryEngine>::mir_const
  88:     0x7fbb8ab24985 - rustc_mir_transform[34692f6d13108f5a]::mir_promoted
  89:     0x7fbb8bc0b75b - <rustc_query_system[a16ac1cefdea5f76]::dep_graph::graph::DepGraph<rustc_middle[2b9dbf3985a9058b]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[2b9dbf3985a9058b]::ty::context::TyCtxt, rustc_middle[2b9dbf3985a9058b]::ty::WithOptConstParam<rustc_span[aeddd698d19619f]::def_id::LocalDefId>, (&rustc_data_structures[e6d5a572b4e9612f]::steal::Steal<rustc_middle[2b9dbf3985a9058b]::mir::Body>, &rustc_data_structures[e6d5a572b4e9612f]::steal::Steal<rustc_index[342f26aacc9ae82e]::vec::IndexVec<rustc_middle[2b9dbf3985a9058b]::mir::Promoted, rustc_middle[2b9dbf3985a9058b]::mir::Body>>)>
  90:     0x7fbb8b1a16ce - rustc_query_system[a16ac1cefdea5f76]::query::plumbing::try_execute_query::<rustc_query_impl[37d320545ae1f097]::plumbing::QueryCtxt, rustc_query_system[a16ac1cefdea5f76]::query::caches::DefaultCache<rustc_middle[2b9dbf3985a9058b]::ty::WithOptConstParam<rustc_span[aeddd698d19619f]::def_id::LocalDefId>, (&rustc_data_structures[e6d5a572b4e9612f]::steal::Steal<rustc_middle[2b9dbf3985a9058b]::mir::Body>, &rustc_data_structures[e6d5a572b4e9612f]::steal::Steal<rustc_index[342f26aacc9ae82e]::vec::IndexVec<rustc_middle[2b9dbf3985a9058b]::mir::Promoted, rustc_middle[2b9dbf3985a9058b]::mir::Body>>)>>
  91:     0x7fbb8b17d074 - <rustc_query_impl[37d320545ae1f097]::Queries as rustc_middle[2b9dbf3985a9058b]::ty::query::QueryEngine>::mir_promoted
  92:     0x7fbb8af843f9 - rustc_borrowck[c373a10a95822b25]::mir_borrowck
  93:     0x7fbb8af814b0 - <rustc_borrowck[c373a10a95822b25]::provide::{closure#0} as core[6724bec812d80be0]::ops::function::FnOnce<(rustc_middle[2b9dbf3985a9058b]::ty::context::TyCtxt, rustc_span[aeddd698d19619f]::def_id::LocalDefId)>>::call_once
  94:     0x7fbb8bc16cc0 - <rustc_query_system[a16ac1cefdea5f76]::dep_graph::graph::DepGraph<rustc_middle[2b9dbf3985a9058b]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[2b9dbf3985a9058b]::ty::context::TyCtxt, rustc_span[aeddd698d19619f]::def_id::LocalDefId, &rustc_middle[2b9dbf3985a9058b]::mir::query::BorrowCheckResult>
  95:     0x7fbb8b1b3761 - rustc_query_system[a16ac1cefdea5f76]::query::plumbing::try_execute_query::<rustc_query_impl[37d320545ae1f097]::plumbing::QueryCtxt, rustc_query_system[a16ac1cefdea5f76]::query::caches::DefaultCache<rustc_span[aeddd698d19619f]::def_id::LocalDefId, &rustc_middle[2b9dbf3985a9058b]::mir::query::BorrowCheckResult>>
  96:     0x7fbb8b17e3ea - <rustc_query_impl[37d320545ae1f097]::Queries as rustc_middle[2b9dbf3985a9058b]::ty::query::QueryEngine>::mir_borrowck
  97:     0x7fbb8acce506 - rustc_typeck[9a0dbd9e1b6c9fb9]::collect::type_of::type_of
  98:     0x7fbb8b14b8b7 - <rustc_query_system[a16ac1cefdea5f76]::dep_graph::graph::DepGraph<rustc_middle[2b9dbf3985a9058b]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[2b9dbf3985a9058b]::ty::context::TyCtxt, rustc_span[aeddd698d19619f]::def_id::DefId, rustc_middle[2b9dbf3985a9058b]::ty::Ty>
  99:     0x7fbb8b1f9f0a - rustc_query_system[a16ac1cefdea5f76]::query::plumbing::get_query::<rustc_query_impl[37d320545ae1f097]::queries::type_of, rustc_query_impl[37d320545ae1f097]::plumbing::QueryCtxt>
 100:     0x7fbb8acbf442 - rustc_typeck[9a0dbd9e1b6c9fb9]::check::check::check_item_type
 101:     0x7fbb8acc433b - rustc_typeck[9a0dbd9e1b6c9fb9]::check::check::check_mod_item_types
 102:     0x7fbb8bc17baf - <rustc_query_system[a16ac1cefdea5f76]::dep_graph::graph::DepGraph<rustc_middle[2b9dbf3985a9058b]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[2b9dbf3985a9058b]::ty::context::TyCtxt, rustc_span[aeddd698d19619f]::def_id::LocalDefId, ()>
 103:     0x7fbb8b1b578e - rustc_query_system[a16ac1cefdea5f76]::query::plumbing::try_execute_query::<rustc_query_impl[37d320545ae1f097]::plumbing::QueryCtxt, rustc_query_system[a16ac1cefdea5f76]::query::caches::DefaultCache<rustc_span[aeddd698d19619f]::def_id::LocalDefId, ()>>
 104:     0x7fbb8bd06f83 - rustc_query_system[a16ac1cefdea5f76]::query::plumbing::get_query::<rustc_query_impl[37d320545ae1f097]::queries::check_mod_item_types, rustc_query_impl[37d320545ae1f097]::plumbing::QueryCtxt>
 105:     0x7fbb8ba1c95d - <rustc_middle[2b9dbf3985a9058b]::hir::map::Map>::for_each_module::<rustc_typeck[9a0dbd9e1b6c9fb9]::check_crate::{closure#6}::{closure#0}>
 106:     0x7fbb8b9e8138 - <rustc_session[834eb9541c60901f]::session::Session>::time::<(), rustc_typeck[9a0dbd9e1b6c9fb9]::check_crate::{closure#6}>
 107:     0x7fbb8b9db748 - rustc_typeck[9a0dbd9e1b6c9fb9]::check_crate
 108:     0x7fbb8b7844d7 - rustc_interface[a10bc87377f6ea4]::passes::analysis
 109:     0x7fbb8bc2f3b5 - <rustc_query_system[a16ac1cefdea5f76]::dep_graph::graph::DepGraph<rustc_middle[2b9dbf3985a9058b]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[2b9dbf3985a9058b]::ty::context::TyCtxt, (), core[6724bec812d80be0]::result::Result<(), rustc_errors[7cc8b2502942d635]::ErrorGuaranteed>>
 110:     0x7fbb8bcd4ca1 - rustc_query_system[a16ac1cefdea5f76]::query::plumbing::try_execute_query::<rustc_query_impl[37d320545ae1f097]::plumbing::QueryCtxt, rustc_query_system[a16ac1cefdea5f76]::query::caches::DefaultCache<(), core[6724bec812d80be0]::result::Result<(), rustc_errors[7cc8b2502942d635]::ErrorGuaranteed>>>
 111:     0x7fbb8bd15fbe - rustc_query_system[a16ac1cefdea5f76]::query::plumbing::get_query::<rustc_query_impl[37d320545ae1f097]::queries::analysis, rustc_query_impl[37d320545ae1f097]::plumbing::QueryCtxt>
 112:     0x7fbb8b764f97 - <rustc_interface[a10bc87377f6ea4]::passes::QueryContext>::enter::<rustc_driver[cc15f272104f8c81]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[6724bec812d80be0]::result::Result<(), rustc_errors[7cc8b2502942d635]::ErrorGuaranteed>>
 113:     0x7fbb8b74ffe8 - <rustc_interface[a10bc87377f6ea4]::interface::Compiler>::enter::<rustc_driver[cc15f272104f8c81]::run_compiler::{closure#1}::{closure#2}, core[6724bec812d80be0]::result::Result<core[6724bec812d80be0]::option::Option<rustc_interface[a10bc87377f6ea4]::queries::Linker>, rustc_errors[7cc8b2502942d635]::ErrorGuaranteed>>
 114:     0x7fbb8b7786ef - rustc_span[aeddd698d19619f]::with_source_map::<core[6724bec812d80be0]::result::Result<(), rustc_errors[7cc8b2502942d635]::ErrorGuaranteed>, rustc_interface[a10bc87377f6ea4]::interface::create_compiler_and_run<core[6724bec812d80be0]::result::Result<(), rustc_errors[7cc8b2502942d635]::ErrorGuaranteed>, rustc_driver[cc15f272104f8c81]::run_compiler::{closure#1}>::{closure#1}>
 115:     0x7fbb8b764024 - rustc_interface[a10bc87377f6ea4]::interface::create_compiler_and_run::<core[6724bec812d80be0]::result::Result<(), rustc_errors[7cc8b2502942d635]::ErrorGuaranteed>, rustc_driver[cc15f272104f8c81]::run_compiler::{closure#1}>
 116:     0x7fbb8b74e4f2 - <scoped_tls[7f4edc8f5e37700f]::ScopedKey<rustc_span[aeddd698d19619f]::SessionGlobals>>::set::<rustc_interface[a10bc87377f6ea4]::interface::run_compiler<core[6724bec812d80be0]::result::Result<(), rustc_errors[7cc8b2502942d635]::ErrorGuaranteed>, rustc_driver[cc15f272104f8c81]::run_compiler::{closure#1}>::{closure#0}, core[6724bec812d80be0]::result::Result<(), rustc_errors[7cc8b2502942d635]::ErrorGuaranteed>>
 117:     0x7fbb8b76561f - std[62a6aef941a414a5]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[a10bc87377f6ea4]::util::run_in_thread_pool_with_globals<rustc_interface[a10bc87377f6ea4]::interface::run_compiler<core[6724bec812d80be0]::result::Result<(), rustc_errors[7cc8b2502942d635]::ErrorGuaranteed>, rustc_driver[cc15f272104f8c81]::run_compiler::{closure#1}>::{closure#0}, core[6724bec812d80be0]::result::Result<(), rustc_errors[7cc8b2502942d635]::ErrorGuaranteed>>::{closure#0}, core[6724bec812d80be0]::result::Result<(), rustc_errors[7cc8b2502942d635]::ErrorGuaranteed>>
 118:     0x7fbb8b765759 - <<std[62a6aef941a414a5]::thread::Builder>::spawn_unchecked_<rustc_interface[a10bc87377f6ea4]::util::run_in_thread_pool_with_globals<rustc_interface[a10bc87377f6ea4]::interface::run_compiler<core[6724bec812d80be0]::result::Result<(), rustc_errors[7cc8b2502942d635]::ErrorGuaranteed>, rustc_driver[cc15f272104f8c81]::run_compiler::{closure#1}>::{closure#0}, core[6724bec812d80be0]::result::Result<(), rustc_errors[7cc8b2502942d635]::ErrorGuaranteed>>::{closure#0}, core[6724bec812d80be0]::result::Result<(), rustc_errors[7cc8b2502942d635]::ErrorGuaranteed>>::{closure#1} as core[6724bec812d80be0]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
 119:     0x7fbb88eab3f3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hcbca3baf872b7fe4
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/alloc/src/boxed.rs:1872:9
 120:     0x7fbb88eab3f3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h18790338ce1743e2
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/alloc/src/boxed.rs:1872:9
 121:     0x7fbb88eab3f3 - std::sys::unix::thread::Thread::new::thread_start::hb1067183bad48893
                               at /rustc/a8314ef7d0ec7b75c336af2c9857bfaf43002bfc/library/std/src/sys/unix/thread.rs:108:17
 122:     0x7fbb88c8054d - <unknown>
 123:     0x7fbb88d05874 - clone
 124:                0x0 - <unknown>

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.62.0 (a8314ef7d 2022-06-27) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C incremental

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [mir_borrowck] borrow-checking `db::shard_state_storage::entries_buffer::<impl at src/db/shard_state_storage/entries_buffer.rs:3:1: 29:2>::iter_child_buffers::{opaque#0}::{constant#0}`
#1 [mir_drops_elaborated_and_const_checked] elaborating drops for `db::shard_state_storage::entries_buffer::<impl at src/db/shard_state_storage/entries_buffer.rs:3:1: 29:2>::iter_child_buffers::{opaque#0}::{constant#0}`
#2 [mir_for_ctfe] caching mir of `db::shard_state_storage::entries_buffer::<impl at src/db/shard_state_storage/entries_buffer.rs:3:1: 29:2>::iter_child_buffers::{opaque#0}::{constant#0}` for CTFE
#3 [eval_to_allocation_raw] const-evaluating + checking `db::shard_state_storage::entries_buffer::<impl at src/db/shard_state_storage/entries_buffer.rs:3:1: 29:2>::iter_child_buffers::{opaque#0}::{constant#0}`
#4 [eval_to_const_value_raw] simplifying constant for the type system `db::shard_state_storage::entries_buffer::<impl at src/db/shard_state_storage/entries_buffer.rs:3:1: 29:2>::iter_child_buffers::{opaque#0}::{constant#0}`
#5 [eval_to_const_value_raw] simplifying constant for the type system `db::shard_state_storage::entries_buffer::<impl at src/db/shard_state_storage/entries_buffer.rs:3:1: 29:2>::iter_child_buffers::{opaque#0}::{constant#0}`
#6 [typeck] type-checking `db::shard_state_storage::entries_buffer::<impl at src/db/shard_state_storage/entries_buffer.rs:3:1: 29:2>::iter_child_buffers`
#7 [mir_built] building MIR for `db::shard_state_storage::entries_buffer::<impl at src/db/shard_state_storage/entries_buffer.rs:3:1: 29:2>::iter_child_buffers`
#8 [unsafety_check_result] unsafety-checking `db::shard_state_storage::entries_buffer::<impl at src/db/shard_state_storage/entries_buffer.rs:3:1: 29:2>::iter_child_buffers`
#9 [mir_const] processing MIR for `db::shard_state_storage::entries_buffer::<impl at src/db/shard_state_storage/entries_buffer.rs:3:1: 29:2>::iter_child_buffers`
#10 [mir_promoted] processing `db::shard_state_storage::entries_buffer::<impl at src/db/shard_state_storage/entries_buffer.rs:3:1: 29:2>::iter_child_buffers`
#11 [mir_borrowck] borrow-checking `db::shard_state_storage::entries_buffer::<impl at src/db/shard_state_storage/entries_buffer.rs:3:1: 29:2>::iter_child_buffers`
#12 [type_of] computing type of `db::shard_state_storage::entries_buffer::<impl at src/db/shard_state_storage/entries_buffer.rs:3:1: 29:2>::iter_child_buffers::{opaque#0}`
#13 [check_mod_item_types] checking item types in module `db::shard_state_storage::entries_buffer`
#14 [analysis] running analysis passes on this crate
end of query stack

@0xdeafbeef 0xdeafbeef 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 Jul 5, 2022
@0xdeafbeef
Copy link
Author

Mre:

pub struct EntriesBuffer(Box<[[u8; HashesEntry::LEN]; 5]>);

impl EntriesBuffer {
    pub fn new() -> Self {
        Self(Box::new([[0; HashesEntry::LEN]; 5]))
    }

    pub fn current_entry_buffer(&mut self) -> &mut [u8; HashesEntry::LEN] {
        &mut self.0[0]
    }

    pub fn iter_child_buffers(&mut self) -> impl Iterator<Item = &mut [u8; HashesEntry::LEN]> {
        self.0.iter_mut().skip(1)
    }

    pub fn split_children<'a, 'b>(
        &'a mut self,
        references: &'b [u32],
    ) -> (HashesEntryWriter<'a>, EntriesBufferChildren<'b>)
    where
        'a: 'b,
    {
        let [first, tail @ ..] = &mut *self.0;
        (
            HashesEntryWriter(first),
            EntriesBufferChildren(references, tail),
        )
    }
}

pub struct EntriesBufferChildren<'a>(&'a [u32], &'a [[u8; HashesEntry::LEN]]);

impl EntriesBufferChildren<'_> {
    pub fn iter(&self) -> impl Iterator<Item = (&u32, HashesEntry)> {
        self.0
            .iter()
            .zip(self.1)
            .map(|(index, item)| (index, HashesEntry(item)))
    }
}

pub struct HashesEntryWriter<'a>(&'a mut [u8]);

impl HashesEntryWriter<'_> {
    pub fn as_reader(&self) -> HashesEntry {
        HashesEntry(self.0)
    }

    pub fn clear(&mut self) {
        for byte in &mut *self.0 {
            *byte = 0;
        }
    }

    pub fn set_tree_bits_count(&mut self, count: u64) {
        self.0[4..12].copy_from_slice(&count.to_le_bytes());
    }

    pub fn set_tree_cell_count(&mut self, count: u64) {
        self.0[12..20].copy_from_slice(&count.to_le_bytes());
    }

    pub fn get_tree_counters(&mut self) -> &[u8] {
        &self.0[4..20]
    }

    pub fn set_hash(&mut self, i: u8, hash: &[u8]) {
        self.get_hash_slice(i).copy_from_slice(hash);
    }

    pub fn get_hash_slice(&mut self, i: u8) -> &mut [u8] {
        let offset = HashesEntry::HASHES_OFFSET + 32 * i as usize;
        &mut self.0[offset..offset + 32]
    }

    pub fn set_depth(&mut self, i: u8, depth: u16) {
        self.get_depth_slice(i)
            .copy_from_slice(&depth.to_le_bytes());
    }

    pub fn get_depth_slice(&mut self, i: u8) -> &mut [u8] {
        let offset = HashesEntry::DEPTHS_OFFSET + 2 * i as usize;
        &mut self.0[offset..offset + 2]
    }
}

pub struct HashesEntry<'a>(&'a [u8]);

impl<'a> HashesEntry<'a> {
    // 4 bytes - info (1 byte level mask, 1 byte cell type, 2 bytes padding)
    // 8 bytes - tree bits count
    // 4 bytes - cell count
    // 32 * 4 bytes - hashes
    // 2 * 4 bytes - depths
    pub const LEN: usize = 4 + 8 + 8 + 32 * 4 + 2 * 4;
    pub const HASHES_OFFSET: usize = 4 + 8 + 8;
    pub const DEPTHS_OFFSET: usize = 4 + 8 + 8 + 32 * 4;

    pub fn tree_bits_count(&self) -> u64 {
        u64::from_le_bytes(self.0[4..12].try_into().unwrap())
    }

    pub fn tree_cell_count(&self) -> u64 {
        u64::from_le_bytes(self.0[12..20].try_into().unwrap())
    }

    pub fn hash(&self, n: u8) -> &[u8] {
        let offset = Self::HASHES_OFFSET + 32 * self.level_mask().calc_hash_index(n as usize);
        &self.0[offset..offset + 32]
    }

    pub fn depth(&self, n: u8) -> u16 {
        let offset = Self::DEPTHS_OFFSET + 2 * self.level_mask().calc_hash_index(n as usize);
        u16::from_le_bytes([self.0[offset], self.0[offset + 1]])
    }

    pub fn pruned_branch_hash<'b>(&self, n: u8, data: &'b [u8]) -> &'b [u8]
    where
        'a: 'b,
    {
        let level_mask = self.level_mask();
        let index = level_mask.calc_hash_index(n as usize);
        let level = level_mask.level() as usize;

        if index == level {
            let offset = Self::HASHES_OFFSET;
            &self.0[offset..offset + 32]
        } else {
            let offset = 1 + 1 + index * 32;
            &data[offset..offset + 32]
        }
    }

    pub fn pruned_branch_depth(&self, n: u8, data: &[u8]) -> u16 {
        let level_mask = self.level_mask();
        let index = level_mask.calc_hash_index(n as usize);
        let level = level_mask.level() as usize;

        if index == level {
            let offset = Self::DEPTHS_OFFSET;
            u16::from_le_bytes([self.0[offset], self.0[offset + 1]])
        } else {
            let offset = 1 + 1 + level * 32 + index * 2;
            u16::from_be_bytes([data[offset], data[offset + 1]])
        }
    }
}

searched nightlies: from nightly-2022-04-15 to nightly-2022-05-02
regressed nightly: nightly-2022-05-01
searched commit range: a707f40...7c4b476
regressed commit: 76d4862

bisected with cargo-bisect-rustc v0.6.3

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --test-dir=. --start=2022-04-15 --end=2022-05-02

@workingjubilee workingjubilee added the regression-from-stable-to-stable Performance or correctness regression from one stable version to another. label Jul 6, 2022
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Jul 6, 2022
@apiraino
Copy link
Contributor

apiraino commented Jul 6, 2022

WG-prioritization assigning priority (Zulip discussion). Tagging PR #95776

@rustbot label -I-prioritize +P-medium

@rustbot rustbot added P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Jul 6, 2022
@apiraino
Copy link
Contributor

apiraino commented Jul 6, 2022

Before the regression, the sample code reported a compile error:

error summary
~/tmp/issue-98932$ cargo +nightly-2022-04-15-x86_64-unknown-linux-gnu check
    Checking issue-98932 v0.1.0 (~/tmp/issue-98932)
error[E0599]: no method named `level_mask` found for reference `&HashesEntry<'a>` in the current scope
   --> src/main.rs:108:54
    |
108 |         let offset = Self::HASHES_OFFSET + 32 * self.level_mask().calc_hash_index(n as usize);
    |                                                      ^^^^^^^^^^ method not found in `&HashesEntry<'a>`

error[E0599]: no method named `level_mask` found for reference `&HashesEntry<'a>` in the current scope
   --> src/main.rs:113:53
    |
113 |         let offset = Self::DEPTHS_OFFSET + 2 * self.level_mask().calc_hash_index(n as usize);
    |                                                     ^^^^^^^^^^ method not found in `&HashesEntry<'a>`

error[E0599]: no method named `level_mask` found for reference `&HashesEntry<'a>` in the current scope
   --> src/main.rs:121:31
    |
121 |         let level_mask = self.level_mask();
    |                               ^^^^^^^^^^ method not found in `&HashesEntry<'a>`

error[E0599]: no method named `level_mask` found for reference `&HashesEntry<'a>` in the current scope
   --> src/main.rs:135:31
    |
135 |         let level_mask = self.level_mask();
    |                               ^^^^^^^^^^ method not found in `&HashesEntry<'a>`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `issue-98932` due to 4 previous errors

@lqd
Copy link
Member

lqd commented Jul 6, 2022

so the ICE is from #95776, cc PR author @cjgillot

@cjgillot cjgillot self-assigned this Jul 6, 2022
@Rexagon
Copy link

Rexagon commented Jul 6, 2022

Slightly smaller example which successfully compiles on 1.61 and failed with ICE on 1.62:

pub struct EntriesBuffer(Box<[[u8; HashesEntry::LEN]; 5]>);

impl EntriesBuffer {
    pub fn iter_child_buffers(&mut self) -> impl Iterator<Item = &mut [u8; HashesEntry::LEN]> {
        self.0.iter_mut()
    }

//     Compiles successfully if `'static` lifetime is specified:
//
//     pub fn iter_child_buffers(&mut self) -> impl Iterator<Item = &mut [u8; HashesEntry::<'static>::LEN]> {
//        self.0.iter_mut()
//    }
}

pub struct HashesEntry<'a>(&'a [u8]);

impl HashesEntry<'_> {
    pub const LEN: usize = 1;
}

matthiaskrgr added a commit to matthiaskrgr/glacier that referenced this issue Jul 7, 2022
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Jul 7, 2022
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this issue Jul 27, 2022
…r=petrochenkov

Clean up HIR-based lifetime resolution

Based on rust-lang#97313.

Fixes rust-lang#98932.

r? `@petrochenkov`
@bors bors closed this as completed in ae70e36 Jul 27, 2022
flip1995 pushed a commit to flip1995/rust that referenced this issue Jul 28, 2022
…r=petrochenkov

Clean up HIR-based lifetime resolution

Based on rust-lang#97313.

Fixes rust-lang#98932.

r? `@petrochenkov`
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. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. 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.

8 participants