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: const variables should not be hashed / cannot relate consts of different types #109296

Closed
matthiaskrgr opened this issue Mar 18, 2023 · 5 comments · Fixed by #109336
Closed
Labels
A-const-generics Area: const generics (parameters and arguments) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

#![crate_type = "lib"]

trait Q {
    const ASSOC: usize;
}

impl<const N: u64> Q for [u8; N] {}

pub fn q_user() -> [u8; <[u8; 13] as Q>::ASSOC] {}

Meta

rustc --version --verbose:

rustc 1.70.0-nightly (13afbdaa0 2023-03-17)
binary: rustc
commit-hash: 13afbdaa0655dda23d7129e59ac48f1ec88b2084
commit-date: 2023-03-17
host: x86_64-unknown-linux-gnu
release: 1.70.0-nightly
LLVM version: 15.0.7

Error output

rustc file.rs -Cincremental=.

-
Backtrace

thread 'rustc' panicked at 'const variables should not be hashed: Var(_#0c)', compiler/rustc_middle/src/ty/consts/kind.rs:145:35
stack backtrace:
   0:     0x7f7b06f6739a - std::backtrace_rs::backtrace::libunwind::trace::h84d2711f38e4d049
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f7b06f6739a - std::backtrace_rs::backtrace::trace_unsynchronized::h07f6ebc5344709db
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f7b06f6739a - std::sys_common::backtrace::_print_fmt::h05a29271ab24b307
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f7b06f6739a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2badcaa62266c6d2
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f7b06fca9be - core::fmt::write::h029bd029dcf67de1
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/core/src/fmt/mod.rs:1254:17
   5:     0x7f7b06f5a225 - std::io::Write::write_fmt::h80e1934b9bd451b8
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/io/mod.rs:1684:15
   6:     0x7f7b06f67165 - std::sys_common::backtrace::_print::hd15e10f9274c89b0
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f7b06f67165 - std::sys_common::backtrace::print::h170965e4e66b5ee4
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f7b06f69edf - std::panicking::default_hook::{{closure}}::h0164004bb09e0366
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/panicking.rs:271:22
   9:     0x7f7b06f69c1b - std::panicking::default_hook::h5e2940911ec5582f
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/panicking.rs:290:9
  10:     0x7f7b0a1f2415 - rustc_driver_impl[bad2ed848d64dbdc]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f7b06f6a71d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h0f3cc38fa49d6ba4
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/alloc/src/boxed.rs:2002:9
  12:     0x7f7b06f6a71d - std::panicking::rust_panic_with_hook::h591d1df500c4db69
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/panicking.rs:696:13
  13:     0x7f7b06f6a499 - std::panicking::begin_panic_handler::{{closure}}::h88c33edc8ad15aaa
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/panicking.rs:583:13
  14:     0x7f7b06f67806 - std::sys_common::backtrace::__rust_end_short_backtrace::h8c0d0dd7ca5cd1b1
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys_common/backtrace.rs:150:18
  15:     0x7f7b06f6a1a2 - rust_begin_unwind
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/panicking.rs:579:5
  16:     0x7f7b06fc6d13 - core::panicking::panic_fmt::h4294102993ea4dab
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/core/src/panicking.rs:64:14
  17:     0x7f7b093ecea4 - <rustc_middle[eaf6378de1cdbfa8]::ty::consts::kind::InferConst as rustc_data_structures[8426954b093953dd]::stable_hasher::HashStable<rustc_query_system[3b264ab6e948b942]::ich::hcx::StableHashingContext>>::hash_stable
  18:     0x7f7b084e0d83 - <&rustc_middle[eaf6378de1cdbfa8]::ty::list::List<rustc_middle[eaf6378de1cdbfa8]::ty::subst::GenericArg> as rustc_data_structures[8426954b093953dd]::stable_hasher::HashStable<rustc_query_system[3b264ab6e948b942]::ich::hcx::StableHashingContext>>::hash_stable
  19:     0x7f7b08b7c9cc - rustc_query_system[3b264ab6e948b942]::dep_graph::graph::hash_result::<core[9847d4a2e8a02df2]::result::Result<&rustc_middle[eaf6378de1cdbfa8]::traits::ImplSource<()>, rustc_middle[eaf6378de1cdbfa8]::traits::CodegenObligationError>>
  20:     0x7f7b08b7b127 - rustc_query_system[3b264ab6e948b942]::query::plumbing::try_execute_query::<rustc_query_impl[1cc93b35ef872c79]::queries::codegen_select_candidate, rustc_query_impl[1cc93b35ef872c79]::plumbing::QueryCtxt>
  21:     0x7f7b087c719f - rustc_ty_utils[5b6915958c5e5b62]::instance::inner_resolve_instance
  22:     0x7f7b089ea620 - <rustc_middle[eaf6378de1cdbfa8]::dep_graph::dep_node::DepKind as rustc_query_system[3b264ab6e948b942]::dep_graph::DepKind>::with_deps::<<rustc_query_system[3b264ab6e948b942]::dep_graph::graph::DepGraphData<rustc_middle[eaf6378de1cdbfa8]::dep_graph::dep_node::DepKind>>::with_task<(rustc_query_impl[1cc93b35ef872c79]::plumbing::QueryCtxt, rustc_query_impl[1cc93b35ef872c79]::queries::resolve_instance), rustc_middle[eaf6378de1cdbfa8]::ty::ParamEnvAnd<(rustc_span[4d522547309d7b79]::def_id::DefId, &rustc_middle[eaf6378de1cdbfa8]::ty::list::List<rustc_middle[eaf6378de1cdbfa8]::ty::subst::GenericArg>)>, core[9847d4a2e8a02df2]::result::Result<core[9847d4a2e8a02df2]::option::Option<rustc_middle[eaf6378de1cdbfa8]::ty::instance::Instance>, rustc_span[4d522547309d7b79]::ErrorGuaranteed>>::{closure#0}, core[9847d4a2e8a02df2]::result::Result<core[9847d4a2e8a02df2]::option::Option<rustc_middle[eaf6378de1cdbfa8]::ty::instance::Instance>, rustc_span[4d522547309d7b79]::ErrorGuaranteed>>
  23:     0x7f7b089e856a - rustc_query_system[3b264ab6e948b942]::query::plumbing::try_execute_query::<rustc_query_impl[1cc93b35ef872c79]::queries::resolve_instance, rustc_query_impl[1cc93b35ef872c79]::plumbing::QueryCtxt>
  24:     0x7f7b08466768 - <rustc_middle[eaf6378de1cdbfa8]::ty::instance::Instance>::resolve_opt_const_arg
  25:     0x7f7b08ac7c21 - <rustc_const_eval[6662232fc86430df]::interpret::eval_context::InterpCx<rustc_const_eval[6662232fc86430df]::const_eval::machine::CompileTimeInterpreter>>::eval_mir_constant
  26:     0x7f7b084a601f - <rustc_const_eval[6662232fc86430df]::interpret::eval_context::InterpCx<rustc_const_eval[6662232fc86430df]::const_eval::machine::CompileTimeInterpreter>>::push_stack_frame
  27:     0x7f7b083ca6cd - rustc_const_eval[6662232fc86430df]::const_eval::eval_queries::eval_to_allocation_raw_provider
  28:     0x7f7b096e0b8b - rustc_query_system[3b264ab6e948b942]::query::plumbing::try_execute_query::<rustc_query_impl[1cc93b35ef872c79]::queries::eval_to_allocation_raw, rustc_query_impl[1cc93b35ef872c79]::plumbing::QueryCtxt>
  29:     0x7f7b096e0040 - <rustc_query_impl[1cc93b35ef872c79]::Queries as rustc_middle[eaf6378de1cdbfa8]::ty::query::QueryEngine>::eval_to_allocation_raw
  30:     0x7f7b083ca7e2 - rustc_const_eval[6662232fc86430df]::const_eval::eval_queries::eval_to_allocation_raw_provider
  31:     0x7f7b096e0b8b - rustc_query_system[3b264ab6e948b942]::query::plumbing::try_execute_query::<rustc_query_impl[1cc93b35ef872c79]::queries::eval_to_allocation_raw, rustc_query_impl[1cc93b35ef872c79]::plumbing::QueryCtxt>
  32:     0x7f7b096e0040 - <rustc_query_impl[1cc93b35ef872c79]::Queries as rustc_middle[eaf6378de1cdbfa8]::ty::query::QueryEngine>::eval_to_allocation_raw
  33:     0x7f7b098c3495 - rustc_const_eval[6662232fc86430df]::const_eval::eval_to_valtree
  34:     0x7f7b098c32c0 - <rustc_const_eval[6662232fc86430df]::provide::{closure#0} as core[9847d4a2e8a02df2]::ops::function::FnOnce<(rustc_middle[eaf6378de1cdbfa8]::ty::context::TyCtxt, rustc_middle[eaf6378de1cdbfa8]::ty::ParamEnvAnd<rustc_middle[eaf6378de1cdbfa8]::mir::interpret::GlobalId>)>>::call_once
  35:     0x7f7b0988372b - rustc_query_system[3b264ab6e948b942]::query::plumbing::try_execute_query::<rustc_query_impl[1cc93b35ef872c79]::queries::eval_to_valtree, rustc_query_impl[1cc93b35ef872c79]::plumbing::QueryCtxt>
  36:     0x7f7b09882dd0 - <rustc_query_impl[1cc93b35ef872c79]::Queries as rustc_middle[eaf6378de1cdbfa8]::ty::query::QueryEngine>::eval_to_valtree
  37:     0x7f7b087be132 - <rustc_middle[eaf6378de1cdbfa8]::ty::context::TyCtxt>::const_eval_global_id_for_typeck
  38:     0x7f7b087bdc24 - <rustc_middle[eaf6378de1cdbfa8]::ty::context::TyCtxt>::const_eval_resolve_for_typeck
  39:     0x7f7b087bb045 - <rustc_middle[eaf6378de1cdbfa8]::ty::consts::Const>::eval
  40:     0x7f7b0879e8f0 - <rustc_trait_selection[4b4d59406d7aac09]::traits::project::AssocTypeNormalizer as rustc_type_ir[ebb4b6c2800c0907]::fold::TypeFolder<rustc_middle[eaf6378de1cdbfa8]::ty::context::TyCtxt>>::fold_const
  41:     0x7f7b0879ca07 - <rustc_trait_selection[4b4d59406d7aac09]::traits::project::AssocTypeNormalizer as rustc_type_ir[ebb4b6c2800c0907]::fold::TypeFolder<rustc_middle[eaf6378de1cdbfa8]::ty::context::TyCtxt>>::fold_ty
  42:     0x7f7b0897d6e6 - <rustc_trait_selection[4b4d59406d7aac09]::traits::engine::ObligationCtxt>::normalize::<rustc_middle[eaf6378de1cdbfa8]::ty::Ty>
  43:     0x7f7b0897c8c7 - <&mut rustc_hir_analysis[7035f0189d3c093a]::check::wfcheck::check_fn_or_method::{closure#1} as core[9847d4a2e8a02df2]::ops::function::FnOnce<((usize, rustc_middle[eaf6378de1cdbfa8]::ty::Ty),)>>::call_once
  44:     0x7f7b0897c6ec - <rustc_middle[eaf6378de1cdbfa8]::ty::Ty as rustc_type_ir[ebb4b6c2800c0907]::CollectAndApply<rustc_middle[eaf6378de1cdbfa8]::ty::Ty, &rustc_middle[eaf6378de1cdbfa8]::ty::list::List<rustc_middle[eaf6378de1cdbfa8]::ty::Ty>>>::collect_and_apply::<core[9847d4a2e8a02df2]::iter::adapters::map::Map<core[9847d4a2e8a02df2]::iter::adapters::enumerate::Enumerate<core[9847d4a2e8a02df2]::iter::adapters::copied::Copied<core[9847d4a2e8a02df2]::slice::iter::Iter<rustc_middle[eaf6378de1cdbfa8]::ty::Ty>>>, rustc_hir_analysis[7035f0189d3c093a]::check::wfcheck::check_fn_or_method::{closure#1}>, <rustc_middle[eaf6378de1cdbfa8]::ty::context::TyCtxt>::mk_type_list_from_iter<core[9847d4a2e8a02df2]::iter::adapters::map::Map<core[9847d4a2e8a02df2]::iter::adapters::enumerate::Enumerate<core[9847d4a2e8a02df2]::iter::adapters::copied::Copied<core[9847d4a2e8a02df2]::slice::iter::Iter<rustc_middle[eaf6378de1cdbfa8]::ty::Ty>>>, rustc_hir_analysis[7035f0189d3c093a]::check::wfcheck::check_fn_or_method::{closure#1}>, rustc_middle[eaf6378de1cdbfa8]::ty::Ty>::{closure#0}>
  45:     0x7f7b0919e1ff - rustc_hir_analysis[7035f0189d3c093a]::check::wfcheck::check_fn_or_method
  46:     0x7f7b09195625 - rustc_hir_analysis[7035f0189d3c093a]::check::wfcheck::check_item_fn
  47:     0x7f7b0919210d - rustc_hir_analysis[7035f0189d3c093a]::check::wfcheck::check_well_formed
  48:     0x7f7b089145a3 - rustc_query_system[3b264ab6e948b942]::query::plumbing::try_execute_query::<rustc_query_impl[1cc93b35ef872c79]::queries::check_well_formed, rustc_query_impl[1cc93b35ef872c79]::plumbing::QueryCtxt>
  49:     0x7f7b0953ae12 - rustc_data_structures[8426954b093953dd]::sync::par_for_each_in::<&[rustc_hir[f188a593009d666f]::hir::ItemId], <rustc_middle[eaf6378de1cdbfa8]::hir::ModuleItems>::par_items<rustc_hir_analysis[7035f0189d3c093a]::check::wfcheck::check_mod_type_wf::{closure#0}>::{closure#0}>
  50:     0x7f7b0953a8e0 - rustc_hir_analysis[7035f0189d3c093a]::check::wfcheck::check_mod_type_wf
  51:     0x7f7b0985dbca - rustc_query_system[3b264ab6e948b942]::query::plumbing::try_execute_query::<rustc_query_impl[1cc93b35ef872c79]::queries::check_mod_type_wf, rustc_query_impl[1cc93b35ef872c79]::plumbing::QueryCtxt>
  52:     0x7f7b0985d533 - <rustc_query_impl[1cc93b35ef872c79]::Queries as rustc_middle[eaf6378de1cdbfa8]::ty::query::QueryEngine>::check_mod_type_wf
  53:     0x7f7b08552888 - rustc_data_structures[8426954b093953dd]::sync::par_for_each_in::<&[rustc_hir[f188a593009d666f]::hir_id::OwnerId], <rustc_middle[eaf6378de1cdbfa8]::hir::map::Map>::par_for_each_module<rustc_hir_analysis[7035f0189d3c093a]::check_crate::{closure#5}::{closure#0}::{closure#0}>::{closure#0}>
  54:     0x7f7b08552710 - <rustc_session[8656a7a78cf578e4]::session::Session>::track_errors::<rustc_hir_analysis[7035f0189d3c093a]::check_crate::{closure#5}, ()>
  55:     0x7f7b0854f8b0 - rustc_hir_analysis[7035f0189d3c093a]::check_crate
  56:     0x7f7b08546742 - rustc_interface[dde792dfc5bb5edd]::passes::analysis
  57:     0x7f7b09a11d0d - rustc_query_system[3b264ab6e948b942]::query::plumbing::try_execute_query::<rustc_query_impl[1cc93b35ef872c79]::queries::analysis, rustc_query_impl[1cc93b35ef872c79]::plumbing::QueryCtxt>
  58:     0x7f7b09a117e0 - <rustc_query_impl[1cc93b35ef872c79]::Queries as rustc_middle[eaf6378de1cdbfa8]::ty::query::QueryEngine>::analysis
  59:     0x7f7b0986e109 - <rustc_middle[eaf6378de1cdbfa8]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[bad2ed848d64dbdc]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>>
  60:     0x7f7b093f852d - <rustc_interface[dde792dfc5bb5edd]::interface::Compiler>::enter::<rustc_driver_impl[bad2ed848d64dbdc]::run_compiler::{closure#1}::{closure#2}, core[9847d4a2e8a02df2]::result::Result<core[9847d4a2e8a02df2]::option::Option<rustc_interface[dde792dfc5bb5edd]::queries::Linker>, rustc_span[4d522547309d7b79]::ErrorGuaranteed>>
  61:     0x7f7b093f6630 - rustc_span[4d522547309d7b79]::with_source_map::<core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>, rustc_interface[dde792dfc5bb5edd]::interface::run_compiler<core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>, rustc_driver_impl[bad2ed848d64dbdc]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  62:     0x7f7b093f5bd9 - std[b4247acdb72724ff]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[dde792dfc5bb5edd]::util::run_in_thread_pool_with_globals<rustc_interface[dde792dfc5bb5edd]::interface::run_compiler<core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>, rustc_driver_impl[bad2ed848d64dbdc]::run_compiler::{closure#1}>::{closure#0}, core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>>
  63:     0x7f7b09ae6afa - <<std[b4247acdb72724ff]::thread::Builder>::spawn_unchecked_<rustc_interface[dde792dfc5bb5edd]::util::run_in_thread_pool_with_globals<rustc_interface[dde792dfc5bb5edd]::interface::run_compiler<core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>, rustc_driver_impl[bad2ed848d64dbdc]::run_compiler::{closure#1}>::{closure#0}, core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>>::{closure#1} as core[9847d4a2e8a02df2]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  64:     0x7f7b06f745f3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h51bca2043facf7d3
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/alloc/src/boxed.rs:1988:9
  65:     0x7f7b06f745f3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h365da710d54db7ab
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/alloc/src/boxed.rs:1988:9
  66:     0x7f7b06f745f3 - std::sys::unix::thread::Thread::new::thread_start::hb322f3a535acf0fe
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys/unix/thread.rs:108:17
  67:     0x7f7b06d06bb5 - <unknown>
  68:     0x7f7b06d88d90 - <unknown>
  69:                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: rustc 1.70.0-nightly (13afbdaa0 2023-03-17) running on x86_64-unknown-linux-gnu

note: compiler flags: -C incremental=[REDACTED]

query stack during panic:
#0 [codegen_select_candidate] computing candidate for `<[u8; 13] as Q>`
#1 [resolve_instance] resolving instance `<[u8; 13] as Q>::ASSOC`
#2 [eval_to_allocation_raw] const-evaluating + checking `q_user::{constant#0}`
#3 [eval_to_allocation_raw] const-evaluating + checking `q_user::{constant#0}`
#4 [eval_to_valtree] evaluating type-level constant
#5 [check_well_formed] checking that `q_user` is well-formed
#6 [check_mod_type_wf] checking that types are well-formed in top-level module
#7 [analysis] running analysis passes on this crate
end of query stack
error: internal compiler error: no errors encountered even though `delay_span_bug` issued

error: internal compiler error: cannot relate consts of different types (a=Const { ty: usize, kind: Value(Leaf(0x000000000000000d)) }, b=Const { ty: u64, kind: Infer(Var(_#0c)) })
  |
  = note: delayed at    0: <rustc_errors::HandlerInner>::emit_diagnostic
             1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, &alloc::string::String>
             2: <rustc_infer::infer::InferCtxt>::super_combine_consts::<rustc_infer::infer::equate::Equate>
             3: rustc_middle::ty::relate::super_relate_tys::<rustc_infer::infer::equate::Equate>
             4: <rustc_infer::infer::equate::Equate as rustc_middle::ty::relate::TypeRelation>::tys
             5: <rustc_trait_selection::traits::select::SelectionContext>::match_impl
             6: <rustc_middle::ty::context::TyCtxt>::for_each_relevant_impl::<<rustc_trait_selection::traits::select::SelectionContext>::assemble_candidates_from_impls::{closure#0}>
             7: <rustc_trait_selection::traits::select::SelectionContext>::assemble_candidates
             8: <rustc_trait_selection::traits::select::SelectionContext>::candidate_from_obligation_no_cache
             9: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_anon_task::<rustc_middle::ty::context::TyCtxt, <rustc_trait_selection::traits::select::SelectionContext>::in_task<<rustc_trait_selection::traits::select::SelectionContext>::candidate_from_obligation::{closure#0}::{closure#0}, core::result::Result<core::option::Option<rustc_middle::traits::select::SelectionCandidate>, rustc_middle::traits::SelectionError>>::{closure#0}, core::result::Result<core::option::Option<rustc_middle::traits::select::SelectionCandidate>, rustc_middle::traits::SelectionError>>
            10: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_stack
            11: <rustc_middle::dep_graph::dep_node::DepKind as rustc_query_system::dep_graph::DepKind>::with_deps::<<rustc_trait_selection::traits::select::SelectionContext>::in_task<<rustc_trait_selection::traits::select::SelectionContext>::evaluate_trait_predicate_recursively::{closure#0}::{closure#2}, core::result::Result<rustc_middle::traits::select::EvaluationResult, rustc_middle::traits::select::OverflowError>>::{closure#0}, core::result::Result<rustc_middle::traits::select::EvaluationResult, rustc_middle::traits::select::OverflowError>>
            12: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_predicate_recursively
            13: rustc_traits::evaluate_obligation::evaluate_obligation
            14: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::evaluate_obligation, rustc_query_impl::plumbing::QueryCtxt>
            15: <rustc_trait_selection::traits::fulfill::FulfillProcessor as rustc_data_structures::obligation_forest::ObligationProcessor>::process_obligation
            16: <rustc_data_structures::obligation_forest::ObligationForest<rustc_trait_selection::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection::traits::fulfill::FulfillProcessor>
            17: <rustc_hir_typeck::fn_ctxt::FnCtxt>::type_inference_fallback
            18: rustc_hir_typeck::typeck
            19: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::typeck, rustc_query_impl::plumbing::QueryCtxt>
            20: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
            21: rustc_mir_build::thir::cx::thir_body
            22: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::thir_body, rustc_query_impl::plumbing::QueryCtxt>
            23: rustc_mir_build::build::mir_built
            24: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_built, rustc_query_impl::plumbing::QueryCtxt>
            25: rustc_mir_transform::check_unsafety::unsafety_check_result
            26: <rustc_mir_transform::check_unsafety::provide::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
            27: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::unsafety_check_result, rustc_query_impl::plumbing::QueryCtxt>
            28: rustc_mir_transform::mir_const
            29: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_const, rustc_query_impl::plumbing::QueryCtxt>
            30: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_const
            31: <rustc_mir_transform::provide::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::DefId)>>::call_once
            32: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_const_qualif, rustc_query_impl::plumbing::QueryCtxt>
            33: rustc_mir_transform::mir_promoted
            34: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_promoted, rustc_query_impl::plumbing::QueryCtxt>
            35: rustc_borrowck::mir_borrowck
            36: <rustc_borrowck::provide::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
            37: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_borrowck, rustc_query_impl::plumbing::QueryCtxt>
            38: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_borrowck
            39: rustc_mir_transform::mir_drops_elaborated_and_const_checked
            40: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_drops_elaborated_and_const_checked, rustc_query_impl::plumbing::QueryCtxt>
            41: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_drops_elaborated_and_const_checked
            42: rustc_mir_transform::inner_mir_for_ctfe
            43: rustc_mir_transform::mir_for_ctfe
            44: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_for_ctfe, rustc_query_impl::plumbing::QueryCtxt>
            45: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_for_ctfe
            46: <rustc_const_eval::interpret::eval_context::InterpCx<rustc_const_eval::const_eval::machine::CompileTimeInterpreter>>::load_mir
            47: rustc_const_eval::const_eval::eval_queries::eval_to_allocation_raw_provider
            48: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::eval_to_allocation_raw, rustc_query_impl::plumbing::QueryCtxt>
            49: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_allocation_raw
            50: rustc_const_eval::const_eval::eval_queries::eval_to_allocation_raw_provider
            51: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::eval_to_allocation_raw, rustc_query_impl::plumbing::QueryCtxt>
            52: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_allocation_raw
            53: rustc_const_eval::const_eval::eval_to_valtree
            54: <rustc_const_eval::provide::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_middle::ty::ParamEnvAnd<rustc_middle::mir::interpret::GlobalId>)>>::call_once
            55: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::eval_to_valtree, rustc_query_impl::plumbing::QueryCtxt>
            56: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_valtree
            57: <rustc_middle::ty::context::TyCtxt>::const_eval_global_id_for_typeck
            58: <rustc_middle::ty::context::TyCtxt>::const_eval_resolve_for_typeck
            59: <rustc_middle::ty::consts::Const>::eval
            60: <rustc_trait_selection::traits::project::AssocTypeNormalizer as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_const
            61: <rustc_trait_selection::traits::project::AssocTypeNormalizer as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_ty
            62: <rustc_trait_selection::traits::engine::ObligationCtxt>::normalize::<rustc_middle::ty::Ty>
            63: <&mut rustc_hir_analysis::check::wfcheck::check_fn_or_method::{closure#1} as core::ops::function::FnOnce<((usize, rustc_middle::ty::Ty),)>>::call_once
            64: <rustc_middle::ty::Ty as rustc_type_ir::CollectAndApply<rustc_middle::ty::Ty, &rustc_middle::ty::list::List<rustc_middle::ty::Ty>>>::collect_and_apply::<core::iter::adapters::map::Map<core::iter::adapters::enumerate::Enumerate<core::iter::adapters::copied::Copied<core::slice::iter::Iter<rustc_middle::ty::Ty>>>, rustc_hir_analysis::check::wfcheck::check_fn_or_method::{closure#1}>, <rustc_middle::ty::context::TyCtxt>::mk_type_list_from_iter<core::iter::adapters::map::Map<core::iter::adapters::enumerate::Enumerate<core::iter::adapters::copied::Copied<core::slice::iter::Iter<rustc_middle::ty::Ty>>>, rustc_hir_analysis::check::wfcheck::check_fn_or_method::{closure#1}>, rustc_middle::ty::Ty>::{closure#0}>
            65: rustc_hir_analysis::check::wfcheck::check_fn_or_method
            66: rustc_hir_analysis::check::wfcheck::check_item_fn
            67: rustc_hir_analysis::check::wfcheck::check_well_formed
            68: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::check_well_formed, rustc_query_impl::plumbing::QueryCtxt>
            69: rustc_data_structures::sync::par_for_each_in::<&[rustc_hir::hir::ItemId], <rustc_middle::hir::ModuleItems>::par_items<rustc_hir_analysis::check::wfcheck::check_mod_type_wf::{closure#0}>::{closure#0}>
            70: rustc_hir_analysis::check::wfcheck::check_mod_type_wf
            71: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::check_mod_type_wf, rustc_query_impl::plumbing::QueryCtxt>
            72: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::check_mod_type_wf
            73: rustc_data_structures::sync::par_for_each_in::<&[rustc_hir::hir_id::OwnerId], <rustc_middle::hir::map::Map>::par_for_each_module<rustc_hir_analysis::check_crate::{closure#5}::{closure#0}::{closure#0}>::{closure#0}>
            74: <rustc_session::session::Session>::track_errors::<rustc_hir_analysis::check_crate::{closure#5}, ()>
            75: rustc_hir_analysis::check_crate
            76: rustc_interface::passes::analysis
            77: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
            78: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
            79: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#4}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
            80: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
            81: rustc_span::with_source_map::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
            82: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
            83: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
            84: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/alloc/src/boxed.rs:1988:9
            85: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/alloc/src/boxed.rs:1988:9
            86: std::sys::unix::thread::Thread::new::thread_start
                       at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys/unix/thread.rs:108:17
            87: <unknown>
            88: <unknown>


error: internal compiler error: cannot relate consts of different types (a=Const { ty: usize, kind: Value(Leaf(0x000000000000000d)) }, b=Const { ty: u64, kind: Infer(Var(_#0c)) })
  |
  = note: delayed at    0: <rustc_errors::HandlerInner>::emit_diagnostic
             1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, &alloc::string::String>
             2: <rustc_infer::infer::InferCtxt>::super_combine_consts::<rustc_infer::infer::equate::Equate>
             3: rustc_middle::ty::relate::super_relate_tys::<rustc_infer::infer::equate::Equate>
             4: <rustc_infer::infer::equate::Equate as rustc_middle::ty::relate::TypeRelation>::tys
             5: <rustc_trait_selection::traits::select::SelectionContext>::confirm_candidate
             6: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_stack
             7: <rustc_middle::dep_graph::dep_node::DepKind as rustc_query_system::dep_graph::DepKind>::with_deps::<<rustc_trait_selection::traits::select::SelectionContext>::in_task<<rustc_trait_selection::traits::select::SelectionContext>::evaluate_trait_predicate_recursively::{closure#0}::{closure#2}, core::result::Result<rustc_middle::traits::select::EvaluationResult, rustc_middle::traits::select::OverflowError>>::{closure#0}, core::result::Result<rustc_middle::traits::select::EvaluationResult, rustc_middle::traits::select::OverflowError>>
             8: <rustc_trait_selection::traits::select::SelectionContext>::evaluate_predicate_recursively
             9: rustc_traits::evaluate_obligation::evaluate_obligation
            10: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::evaluate_obligation, rustc_query_impl::plumbing::QueryCtxt>
            11: <rustc_trait_selection::traits::fulfill::FulfillProcessor as rustc_data_structures::obligation_forest::ObligationProcessor>::process_obligation
            12: <rustc_data_structures::obligation_forest::ObligationForest<rustc_trait_selection::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection::traits::fulfill::FulfillProcessor>
            13: <rustc_hir_typeck::fn_ctxt::FnCtxt>::type_inference_fallback
            14: rustc_hir_typeck::typeck
            15: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::typeck, rustc_query_impl::plumbing::QueryCtxt>
            16: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
            17: rustc_mir_build::thir::cx::thir_body
            18: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::thir_body, rustc_query_impl::plumbing::QueryCtxt>
            19: rustc_mir_build::build::mir_built
            20: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_built, rustc_query_impl::plumbing::QueryCtxt>
            21: rustc_mir_transform::check_unsafety::unsafety_check_result
            22: <rustc_mir_transform::check_unsafety::provide::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
            23: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::unsafety_check_result, rustc_query_impl::plumbing::QueryCtxt>
            24: rustc_mir_transform::mir_const
            25: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_const, rustc_query_impl::plumbing::QueryCtxt>
            26: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_const
            27: <rustc_mir_transform::provide::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::DefId)>>::call_once
            28: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_const_qualif, rustc_query_impl::plumbing::QueryCtxt>
            29: rustc_mir_transform::mir_promoted
            30: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_promoted, rustc_query_impl::plumbing::QueryCtxt>
            31: rustc_borrowck::mir_borrowck
            32: <rustc_borrowck::provide::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
            33: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_borrowck, rustc_query_impl::plumbing::QueryCtxt>
            34: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_borrowck
            35: rustc_mir_transform::mir_drops_elaborated_and_const_checked
            36: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_drops_elaborated_and_const_checked, rustc_query_impl::plumbing::QueryCtxt>
            37: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_drops_elaborated_and_const_checked
            38: rustc_mir_transform::inner_mir_for_ctfe
            39: rustc_mir_transform::mir_for_ctfe
            40: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::mir_for_ctfe, rustc_query_impl::plumbing::QueryCtxt>
            41: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::mir_for_ctfe
            42: <rustc_const_eval::interpret::eval_context::InterpCx<rustc_const_eval::const_eval::machine::CompileTimeInterpreter>>::load_mir
            43: rustc_const_eval::const_eval::eval_queries::eval_to_allocation_raw_provider
            44: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::eval_to_allocation_raw, rustc_query_impl::plumbing::QueryCtxt>
            45: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_allocation_raw
            46: rustc_const_eval::const_eval::eval_queries::eval_to_allocation_raw_provider
            47: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::eval_to_allocation_raw, rustc_query_impl::plumbing::QueryCtxt>
            48: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_allocation_raw
            49: rustc_const_eval::const_eval::eval_to_valtree
            50: <rustc_const_eval::provide::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_middle::ty::ParamEnvAnd<rustc_middle::mir::interpret::GlobalId>)>>::call_once
            51: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::eval_to_valtree, rustc_query_impl::plumbing::QueryCtxt>
            52: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_valtree
            53: <rustc_middle::ty::context::TyCtxt>::const_eval_global_id_for_typeck
            54: <rustc_middle::ty::context::TyCtxt>::const_eval_resolve_for_typeck
            55: <rustc_middle::ty::consts::Const>::eval
            56: <rustc_trait_selection::traits::project::AssocTypeNormalizer as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_const
            57: <rustc_trait_selection::traits::project::AssocTypeNormalizer as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_ty
            58: <rustc_trait_selection::traits::engine::ObligationCtxt>::normalize::<rustc_middle::ty::Ty>
            59: <&mut rustc_hir_analysis::check::wfcheck::check_fn_or_method::{closure#1} as core::ops::function::FnOnce<((usize, rustc_middle::ty::Ty),)>>::call_once
            60: <rustc_middle::ty::Ty as rustc_type_ir::CollectAndApply<rustc_middle::ty::Ty, &rustc_middle::ty::list::List<rustc_middle::ty::Ty>>>::collect_and_apply::<core::iter::adapters::map::Map<core::iter::adapters::enumerate::Enumerate<core::iter::adapters::copied::Copied<core::slice::iter::Iter<rustc_middle::ty::Ty>>>, rustc_hir_analysis::check::wfcheck::check_fn_or_method::{closure#1}>, <rustc_middle::ty::context::TyCtxt>::mk_type_list_from_iter<core::iter::adapters::map::Map<core::iter::adapters::enumerate::Enumerate<core::iter::adapters::copied::Copied<core::slice::iter::Iter<rustc_middle::ty::Ty>>>, rustc_hir_analysis::check::wfcheck::check_fn_or_method::{closure#1}>, rustc_middle::ty::Ty>::{closure#0}>
            61: rustc_hir_analysis::check::wfcheck::check_fn_or_method
            62: rustc_hir_analysis::check::wfcheck::check_item_fn
            63: rustc_hir_analysis::check::wfcheck::check_well_formed
            64: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::check_well_formed, rustc_query_impl::plumbing::QueryCtxt>
            65: rustc_data_structures::sync::par_for_each_in::<&[rustc_hir::hir::ItemId], <rustc_middle::hir::ModuleItems>::par_items<rustc_hir_analysis::check::wfcheck::check_mod_type_wf::{closure#0}>::{closure#0}>
            66: rustc_hir_analysis::check::wfcheck::check_mod_type_wf
            67: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::check_mod_type_wf, rustc_query_impl::plumbing::QueryCtxt>
            68: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::check_mod_type_wf
            69: rustc_data_structures::sync::par_for_each_in::<&[rustc_hir::hir_id::OwnerId], <rustc_middle::hir::map::Map>::par_for_each_module<rustc_hir_analysis::check_crate::{closure#5}::{closure#0}::{closure#0}>::{closure#0}>
            70: <rustc_session::session::Session>::track_errors::<rustc_hir_analysis::check_crate::{closure#5}, ()>
            71: rustc_hir_analysis::check_crate
            72: rustc_interface::passes::analysis
            73: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
            74: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
            75: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#4}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
            76: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
            77: rustc_span::with_source_map::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
            78: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
            79: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
            80: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/alloc/src/boxed.rs:1988:9
            81: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/alloc/src/boxed.rs:1988:9
            82: std::sys::unix::thread::Thread::new::thread_start
                       at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys/unix/thread.rs:108:17
            83: <unknown>
            84: <unknown>


error: internal compiler error: cannot relate consts of different types (a=Const { ty: usize, kind: Value(Leaf(0x000000000000000d)) }, b=Const { ty: u64, kind: Infer(Var(_#0c)) })
  |
  = note: delayed at    0: <rustc_errors::HandlerInner>::emit_diagnostic
             1: <rustc_errors::Handler>::delay_span_bug::<rustc_span::span_encoding::Span, &alloc::string::String>
             2: <rustc_infer::infer::InferCtxt>::super_combine_consts::<rustc_infer::infer::equate::Equate>
             3: rustc_middle::ty::relate::super_relate_tys::<rustc_infer::infer::equate::Equate>
             4: <rustc_infer::infer::equate::Equate as rustc_middle::ty::relate::TypeRelation>::tys
             5: <rustc_trait_selection::traits::select::SelectionContext>::confirm_candidate
             6: <rustc_trait_selection::traits::select::SelectionContext>::select
             7: rustc_traits::codegen::codegen_select_candidate
             8: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::codegen_select_candidate, rustc_query_impl::plumbing::QueryCtxt>
             9: rustc_ty_utils::instance::inner_resolve_instance
            10: <rustc_middle::dep_graph::dep_node::DepKind as rustc_query_system::dep_graph::DepKind>::with_deps::<<rustc_query_system::dep_graph::graph::DepGraphData<rustc_middle::dep_graph::dep_node::DepKind>>::with_task<(rustc_query_impl::plumbing::QueryCtxt, rustc_query_impl::queries::resolve_instance), rustc_middle::ty::ParamEnvAnd<(rustc_span::def_id::DefId, &rustc_middle::ty::list::List<rustc_middle::ty::subst::GenericArg>)>, core::result::Result<core::option::Option<rustc_middle::ty::instance::Instance>, rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<core::option::Option<rustc_middle::ty::instance::Instance>, rustc_span::ErrorGuaranteed>>
            11: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::resolve_instance, rustc_query_impl::plumbing::QueryCtxt>
            12: <rustc_middle::ty::instance::Instance>::resolve_opt_const_arg
            13: <rustc_const_eval::interpret::eval_context::InterpCx<rustc_const_eval::const_eval::machine::CompileTimeInterpreter>>::eval_mir_constant
            14: <rustc_const_eval::interpret::eval_context::InterpCx<rustc_const_eval::const_eval::machine::CompileTimeInterpreter>>::push_stack_frame
            15: rustc_const_eval::const_eval::eval_queries::eval_to_allocation_raw_provider
            16: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::eval_to_allocation_raw, rustc_query_impl::plumbing::QueryCtxt>
            17: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_allocation_raw
            18: rustc_const_eval::const_eval::eval_queries::eval_to_allocation_raw_provider
            19: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::eval_to_allocation_raw, rustc_query_impl::plumbing::QueryCtxt>
            20: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_allocation_raw
            21: rustc_const_eval::const_eval::eval_to_valtree
            22: <rustc_const_eval::provide::{closure#0} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_middle::ty::ParamEnvAnd<rustc_middle::mir::interpret::GlobalId>)>>::call_once
            23: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::eval_to_valtree, rustc_query_impl::plumbing::QueryCtxt>
            24: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_valtree
            25: <rustc_middle::ty::context::TyCtxt>::const_eval_global_id_for_typeck
            26: <rustc_middle::ty::context::TyCtxt>::const_eval_resolve_for_typeck
            27: <rustc_middle::ty::consts::Const>::eval
            28: <rustc_trait_selection::traits::project::AssocTypeNormalizer as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_const
            29: <rustc_trait_selection::traits::project::AssocTypeNormalizer as rustc_type_ir::fold::TypeFolder<rustc_middle::ty::context::TyCtxt>>::fold_ty
            30: <rustc_trait_selection::traits::engine::ObligationCtxt>::normalize::<rustc_middle::ty::Ty>
            31: <&mut rustc_hir_analysis::check::wfcheck::check_fn_or_method::{closure#1} as core::ops::function::FnOnce<((usize, rustc_middle::ty::Ty),)>>::call_once
            32: <rustc_middle::ty::Ty as rustc_type_ir::CollectAndApply<rustc_middle::ty::Ty, &rustc_middle::ty::list::List<rustc_middle::ty::Ty>>>::collect_and_apply::<core::iter::adapters::map::Map<core::iter::adapters::enumerate::Enumerate<core::iter::adapters::copied::Copied<core::slice::iter::Iter<rustc_middle::ty::Ty>>>, rustc_hir_analysis::check::wfcheck::check_fn_or_method::{closure#1}>, <rustc_middle::ty::context::TyCtxt>::mk_type_list_from_iter<core::iter::adapters::map::Map<core::iter::adapters::enumerate::Enumerate<core::iter::adapters::copied::Copied<core::slice::iter::Iter<rustc_middle::ty::Ty>>>, rustc_hir_analysis::check::wfcheck::check_fn_or_method::{closure#1}>, rustc_middle::ty::Ty>::{closure#0}>
            33: rustc_hir_analysis::check::wfcheck::check_fn_or_method
            34: rustc_hir_analysis::check::wfcheck::check_item_fn
            35: rustc_hir_analysis::check::wfcheck::check_well_formed
            36: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::check_well_formed, rustc_query_impl::plumbing::QueryCtxt>
            37: rustc_data_structures::sync::par_for_each_in::<&[rustc_hir::hir::ItemId], <rustc_middle::hir::ModuleItems>::par_items<rustc_hir_analysis::check::wfcheck::check_mod_type_wf::{closure#0}>::{closure#0}>
            38: rustc_hir_analysis::check::wfcheck::check_mod_type_wf
            39: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::check_mod_type_wf, rustc_query_impl::plumbing::QueryCtxt>
            40: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::check_mod_type_wf
            41: rustc_data_structures::sync::par_for_each_in::<&[rustc_hir::hir_id::OwnerId], <rustc_middle::hir::map::Map>::par_for_each_module<rustc_hir_analysis::check_crate::{closure#5}::{closure#0}::{closure#0}>::{closure#0}>
            42: <rustc_session::session::Session>::track_errors::<rustc_hir_analysis::check_crate::{closure#5}, ()>
            43: rustc_hir_analysis::check_crate
            44: rustc_interface::passes::analysis
            45: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
            46: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
            47: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#4}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
            48: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
            49: rustc_span::with_source_map::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
            50: std::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
            51: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
            52: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/alloc/src/boxed.rs:1988:9
            53: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
                       at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/alloc/src/boxed.rs:1988:9
            54: std::sys::unix::thread::Thread::new::thread_start
                       at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys/unix/thread.rs:108:17
            55: <unknown>
            56: <unknown>


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.70.0-nightly (13afbdaa0 2023-03-17) running on x86_64-unknown-linux-gnu

note: compiler flags: -C incremental=[REDACTED]

query stack during panic:
end of query stack
thread panicked while panicking. aborting.
[1]    862430 IOT instruction  rustc treereduce.out -Cincremental=.

@matthiaskrgr matthiaskrgr added 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. C-bug Category: This is a bug. labels Mar 18, 2023
@matthiaskrgr
Copy link
Member Author

matthiaskrgr commented Mar 18, 2023

Regression in rust-lang-ci@eb23117

searched nightlies: from nightly-2023-03-10 to nightly-2023-03-18
regressed nightly: nightly-2023-03-12
searched commit range: ff4b772...8a73f50
regressed commit: 19c5376

bisected with cargo-bisect-rustc v0.6.5

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

cargo bisect-rustc --script=/home/matthias/vcs/github/rust_bisect/script.sh --test-dir=/home/matthias/vcs/github/rust_bisect/foo

@BoxyUwU
Copy link
Member

BoxyUwU commented Mar 19, 2023

@compiler-errors

@BoxyUwU BoxyUwU added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. A-const-generics Area: const generics (parameters and arguments) labels Mar 19, 2023
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Mar 19, 2023
@BoxyUwU
Copy link
Member

BoxyUwU commented Mar 19, 2023

We relate ?0: u64 with 13: usize during codegen when selecting an impl which now eagerly returns ErrorGuaranteed: usize without constraining ?0 to anything wheras previously it would have been instantiated with 13. This then results in codegen returning an impl with ?0: u64 in the substs from a query

@BoxyUwU
Copy link
Member

BoxyUwU commented Mar 19, 2023

output on beta/stable:

error: the constant `N` is not of type `u64`
 --> src/lib.rs:5:26
  |
5 | impl<const N: u64> Q for [u8; N] {}
  |                          ^^^^^^^
  |
note: required for `[u8; N]` to implement `Q`
 --> src/lib.rs:5:20
  |
5 | impl<const N: u64> Q for [u8; N] {}
  |      ------------  ^     ^^^^^^^
  |      |
  |      unsatisfied trait bound introduced here

error: the constant `13` is not of type `u64`
 --> src/lib.rs:7:25
  |
7 | pub fn q_user() -> [u8; <[u8; 13] as Q>::ASSOC] {}
  |                         ^^^^^^^^^^^^^^^^^^^^^^
  |
note: required for `[u8; 13]` to implement `Q`
 --> src/lib.rs:5:20
  |
5 | impl<const N: u64> Q for [u8; N] {}
  |      ------------  ^     ^^^^^^^
  |      |
  |      unsatisfied trait bound introduced here

@apiraino
Copy link
Contributor

WG-prioritization assigning priority (Zulip discussion).

@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 Mar 20, 2023
@bors bors closed this as completed in 081c607 Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-generics Area: const generics (parameters and arguments) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants