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: Attempting to cast non-castable types fn({type error}) -> Foo {Foo::Bar} and usize #112630

Open
matthiaskrgr opened this issue Jun 14, 2023 · 4 comments · May be fixed by #113125
Open

ice: Attempting to cast non-castable types fn({type error}) -> Foo {Foo::Bar} and usize #112630

matthiaskrgr opened this issue Jun 14, 2023 · 4 comments · May be fixed by #113125
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-low Low 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

@matthiaskrgr
Copy link
Member

Code

enum Foo {
    Bar(B),
}

trait Bar {}

impl Bar for [u32; Foo::Bar as usize] {}

Meta

rustc --version --verbose:

rustc 1.72.0-nightly (7b0eac438 2023-06-14)
binary: rustc
commit-hash: 7b0eac438ace0ba305b4633328b00474fbbf5120
commit-date: 2023-06-14
host: x86_64-unknown-linux-gnu
release: 1.72.0-nightly
LLVM version: 16.0.5

Error output

error[E0412]: cannot find type `B` in this scope
 --> treereduce.out:2:9
  |
2 |     Bar(B),
  |         ^ not found in this scope
  |
help: you might be missing a type parameter
  |
1 | enum Foo<B> {
  |         +++

error[E0601]: `main` function not found in crate `treereduce`
 --> treereduce.out:7:41
  |
7 | impl Bar for [u32; Foo::Bar as usize] {}
  |                                         ^ consider adding a `main` function to `treereduce.out`
Backtrace

error: internal compiler error: compiler/rustc_middle/src/ty/cast.rs:99:13: Attempting to cast non-castable types fn({type error}) -> Foo {Foo::Bar} and usize

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/7b0eac438ace0ba305b4633328b00474fbbf5120/compiler/rustc_errors/src/lib.rs:1650:9
stack backtrace:
   0:     0x7ff378d68c41 - std::backtrace_rs::backtrace::libunwind::trace::hd5b7972f789c4974
                               at /rustc/7b0eac438ace0ba305b4633328b00474fbbf5120/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7ff378d68c41 - std::backtrace_rs::backtrace::trace_unsynchronized::h938f2c39be6402c9
                               at /rustc/7b0eac438ace0ba305b4633328b00474fbbf5120/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7ff378d68c41 - std::sys_common::backtrace::_print_fmt::hf19df4df321a9f93
                               at /rustc/7b0eac438ace0ba305b4633328b00474fbbf5120/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7ff378d68c41 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd26317478e51975e
                               at /rustc/7b0eac438ace0ba305b4633328b00474fbbf5120/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7ff378dc95ff - core::fmt::rt::Argument::fmt::h16c7790b1e3f1543
                               at /rustc/7b0eac438ace0ba305b4633328b00474fbbf5120/library/core/src/fmt/rt.rs:138:9
   5:     0x7ff378dc95ff - core::fmt::write::h6ebd457ad24c415a
                               at /rustc/7b0eac438ace0ba305b4633328b00474fbbf5120/library/core/src/fmt/mod.rs:1094:21
   6:     0x7ff378d5be41 - std::io::Write::write_fmt::h0c198b050bd0b55a
                               at /rustc/7b0eac438ace0ba305b4633328b00474fbbf5120/library/std/src/io/mod.rs:1713:15
   7:     0x7ff378d68a55 - std::sys_common::backtrace::_print::h369a7cf325feecb2
                               at /rustc/7b0eac438ace0ba305b4633328b00474fbbf5120/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7ff378d68a55 - std::sys_common::backtrace::print::h8375e9dd85dcd975
                               at /rustc/7b0eac438ace0ba305b4633328b00474fbbf5120/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7ff378d6b737 - std::panicking::default_hook::{{closure}}::h0cff43e655091646
  10:     0x7ff378d6b524 - std::panicking::default_hook::h28fa1651a8383aac
                               at /rustc/7b0eac438ace0ba305b4633328b00474fbbf5120/library/std/src/panicking.rs:288:9
  11:     0x7ff37bfcd25b - <rustc_driver_impl[d1aa6109471fdd45]::install_ice_hook::{closure#0} as core[9d3b7bf065738f73]::ops::function::FnOnce<(&core[9d3b7bf065738f73]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  12:     0x7ff378d6be7d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h5e01b737276d5f55
                               at /rustc/7b0eac438ace0ba305b4633328b00474fbbf5120/library/alloc/src/boxed.rs:1999:9
  13:     0x7ff378d6be7d - std::panicking::rust_panic_with_hook::hb6b23c86320f793c
                               at /rustc/7b0eac438ace0ba305b4633328b00474fbbf5120/library/std/src/panicking.rs:709:13
  14:     0x7ff37c4e5821 - std[c901bbae7dc26da3]::panicking::begin_panic::<rustc_errors[6a86a7f75c9c57b7]::ExplicitBug>::{closure#0}
  15:     0x7ff37c4e1546 - std[c901bbae7dc26da3]::sys_common::backtrace::__rust_end_short_backtrace::<std[c901bbae7dc26da3]::panicking::begin_panic<rustc_errors[6a86a7f75c9c57b7]::ExplicitBug>::{closure#0}, !>
  16:     0x7ff37c55c3d6 - std[c901bbae7dc26da3]::panicking::begin_panic::<rustc_errors[6a86a7f75c9c57b7]::ExplicitBug>
  17:     0x7ff37c4db944 - <rustc_errors[6a86a7f75c9c57b7]::HandlerInner>::bug::<alloc[a7b65b885799e8e7]::string::String>
  18:     0x7ff37c4db6e6 - <rustc_errors[6a86a7f75c9c57b7]::Handler>::bug::<alloc[a7b65b885799e8e7]::string::String>
  19:     0x7ff37c56a0f5 - rustc_middle[c2220a5f32aee4a9]::util::bug::opt_span_bug_fmt::<rustc_span[9591d6886b6f356b]::span_encoding::Span>::{closure#0}
  20:     0x7ff37c566d0a - rustc_middle[c2220a5f32aee4a9]::ty::context::tls::with_opt::<rustc_middle[c2220a5f32aee4a9]::util::bug::opt_span_bug_fmt<rustc_span[9591d6886b6f356b]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7ff37c566cda - rustc_middle[c2220a5f32aee4a9]::ty::context::tls::with_context_opt::<rustc_middle[c2220a5f32aee4a9]::ty::context::tls::with_opt<rustc_middle[c2220a5f32aee4a9]::util::bug::opt_span_bug_fmt<rustc_span[9591d6886b6f356b]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7ff37a256f0d - rustc_middle[c2220a5f32aee4a9]::util::bug::bug_fmt
  23:     0x7ff37a340010 - rustc_middle[c2220a5f32aee4a9]::ty::cast::mir_cast_kind
  24:     0x7ff37a311846 - <rustc_mir_build[e9c88e24b8a1c27a]::build::Builder>::as_rvalue
  25:     0x7ff37a323a43 - <rustc_mir_build[e9c88e24b8a1c27a]::build::Builder>::expr_into_dest
  26:     0x7ff37a3236e9 - <rustc_mir_build[e9c88e24b8a1c27a]::build::Builder>::expr_into_dest
  27:     0x7ff37a3236e9 - <rustc_mir_build[e9c88e24b8a1c27a]::build::Builder>::expr_into_dest
  28:     0x7ff37ae23cd1 - rustc_mir_build[e9c88e24b8a1c27a]::build::mir_built
  29:     0x7ff37a0060cc - rustc_query_impl[77c04cfc11717055]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[77c04cfc11717055]::query_impl::mir_built::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c2220a5f32aee4a9]::query::erase::Erased<[u8; 8usize]>>
  30:     0x7ff37a0060ae - <rustc_query_impl[77c04cfc11717055]::query_impl::mir_built::dynamic_query::{closure#2} as core[9d3b7bf065738f73]::ops::function::FnOnce<(rustc_middle[c2220a5f32aee4a9]::ty::context::TyCtxt, rustc_span[9591d6886b6f356b]::def_id::LocalDefId)>>::call_once
  31:     0x7ff37a0efc2d - rustc_query_system[21afab51dde9dbf3]::query::plumbing::try_execute_query::<rustc_query_impl[77c04cfc11717055]::DynamicConfig<rustc_query_system[21afab51dde9dbf3]::query::caches::VecCache<rustc_span[9591d6886b6f356b]::def_id::LocalDefId, rustc_middle[c2220a5f32aee4a9]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[77c04cfc11717055]::plumbing::QueryCtxt, false>
  32:     0x7ff37b95148f - rustc_query_impl[77c04cfc11717055]::query_impl::mir_built::get_query_non_incr::__rust_end_short_backtrace
  33:     0x7ff37b05cade - rustc_mir_transform[cafb922bcd4bfee1]::check_unsafety::unsafety_check_result
  34:     0x7ff37a00610c - rustc_query_impl[77c04cfc11717055]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[77c04cfc11717055]::query_impl::unsafety_check_result::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c2220a5f32aee4a9]::query::erase::Erased<[u8; 8usize]>>
  35:     0x7ff37a0060ee - <rustc_query_impl[77c04cfc11717055]::query_impl::unsafety_check_result::dynamic_query::{closure#2} as core[9d3b7bf065738f73]::ops::function::FnOnce<(rustc_middle[c2220a5f32aee4a9]::ty::context::TyCtxt, rustc_span[9591d6886b6f356b]::def_id::LocalDefId)>>::call_once
  36:     0x7ff37a0efc2d - rustc_query_system[21afab51dde9dbf3]::query::plumbing::try_execute_query::<rustc_query_impl[77c04cfc11717055]::DynamicConfig<rustc_query_system[21afab51dde9dbf3]::query::caches::VecCache<rustc_span[9591d6886b6f356b]::def_id::LocalDefId, rustc_middle[c2220a5f32aee4a9]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[77c04cfc11717055]::plumbing::QueryCtxt, false>
  37:     0x7ff37b95312f - rustc_query_impl[77c04cfc11717055]::query_impl::unsafety_check_result::get_query_non_incr::__rust_end_short_backtrace
  38:     0x7ff37b385ff4 - rustc_mir_transform[cafb922bcd4bfee1]::mir_const
  39:     0x7ff37a0201fe - rustc_query_impl[77c04cfc11717055]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[77c04cfc11717055]::query_impl::mir_const::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c2220a5f32aee4a9]::query::erase::Erased<[u8; 8usize]>>
  40:     0x7ff37a0201ce - <rustc_query_impl[77c04cfc11717055]::query_impl::mir_const::dynamic_query::{closure#2} as core[9d3b7bf065738f73]::ops::function::FnOnce<(rustc_middle[c2220a5f32aee4a9]::ty::context::TyCtxt, rustc_span[9591d6886b6f356b]::def_id::LocalDefId)>>::call_once
  41:     0x7ff37a0efc2d - rustc_query_system[21afab51dde9dbf3]::query::plumbing::try_execute_query::<rustc_query_impl[77c04cfc11717055]::DynamicConfig<rustc_query_system[21afab51dde9dbf3]::query::caches::VecCache<rustc_span[9591d6886b6f356b]::def_id::LocalDefId, rustc_middle[c2220a5f32aee4a9]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[77c04cfc11717055]::plumbing::QueryCtxt, false>
  42:     0x7ff37b95157f - rustc_query_impl[77c04cfc11717055]::query_impl::mir_const::get_query_non_incr::__rust_end_short_backtrace
  43:     0x7ff37a28e6ec - rustc_query_impl[77c04cfc11717055]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[77c04cfc11717055]::query_impl::mir_const_qualif::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c2220a5f32aee4a9]::query::erase::Erased<[u8; 5usize]>>
  44:     0x7ff37ae1870f - rustc_query_system[21afab51dde9dbf3]::query::plumbing::try_execute_query::<rustc_query_impl[77c04cfc11717055]::DynamicConfig<rustc_query_system[21afab51dde9dbf3]::query::caches::DefaultCache<rustc_span[9591d6886b6f356b]::def_id::DefId, rustc_middle[c2220a5f32aee4a9]::query::erase::Erased<[u8; 5usize]>>, false, false, false>, rustc_query_impl[77c04cfc11717055]::plumbing::QueryCtxt, false>
  45:     0x7ff37ae18438 - rustc_query_impl[77c04cfc11717055]::query_impl::mir_const_qualif::get_query_non_incr::__rust_end_short_backtrace
  46:     0x7ff37adef3b9 - rustc_mir_transform[cafb922bcd4bfee1]::mir_promoted
  47:     0x7ff379fefcdf - rustc_query_impl[77c04cfc11717055]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[77c04cfc11717055]::query_impl::mir_promoted::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c2220a5f32aee4a9]::query::erase::Erased<[u8; 16usize]>>
  48:     0x7ff37a94987b - rustc_query_system[21afab51dde9dbf3]::query::plumbing::try_execute_query::<rustc_query_impl[77c04cfc11717055]::DynamicConfig<rustc_query_system[21afab51dde9dbf3]::query::caches::VecCache<rustc_span[9591d6886b6f356b]::def_id::LocalDefId, rustc_middle[c2220a5f32aee4a9]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[77c04cfc11717055]::plumbing::QueryCtxt, false>
  49:     0x7ff37b951975 - rustc_query_impl[77c04cfc11717055]::query_impl::mir_promoted::get_query_non_incr::__rust_end_short_backtrace
  50:     0x7ff37af80bbc - rustc_borrowck[2bd87ad0ff331ce3]::mir_borrowck
  51:     0x7ff37a02019e - rustc_query_impl[77c04cfc11717055]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[77c04cfc11717055]::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c2220a5f32aee4a9]::query::erase::Erased<[u8; 8usize]>>
  52:     0x7ff37a02016e - <rustc_query_impl[77c04cfc11717055]::query_impl::mir_borrowck::dynamic_query::{closure#2} as core[9d3b7bf065738f73]::ops::function::FnOnce<(rustc_middle[c2220a5f32aee4a9]::ty::context::TyCtxt, rustc_span[9591d6886b6f356b]::def_id::LocalDefId)>>::call_once
  53:     0x7ff37a0efc2d - rustc_query_system[21afab51dde9dbf3]::query::plumbing::try_execute_query::<rustc_query_impl[77c04cfc11717055]::DynamicConfig<rustc_query_system[21afab51dde9dbf3]::query::caches::VecCache<rustc_span[9591d6886b6f356b]::def_id::LocalDefId, rustc_middle[c2220a5f32aee4a9]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[77c04cfc11717055]::plumbing::QueryCtxt, false>
  54:     0x7ff37b9536ff - rustc_query_impl[77c04cfc11717055]::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
  55:     0x7ff37a79edf0 - rustc_mir_transform[cafb922bcd4bfee1]::mir_drops_elaborated_and_const_checked
  56:     0x7ff37a0376ee - rustc_query_impl[77c04cfc11717055]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[77c04cfc11717055]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c2220a5f32aee4a9]::query::erase::Erased<[u8; 8usize]>>
  57:     0x7ff37a0376be - <rustc_query_impl[77c04cfc11717055]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2} as core[9d3b7bf065738f73]::ops::function::FnOnce<(rustc_middle[c2220a5f32aee4a9]::ty::context::TyCtxt, rustc_span[9591d6886b6f356b]::def_id::LocalDefId)>>::call_once
  58:     0x7ff37a0efc2d - rustc_query_system[21afab51dde9dbf3]::query::plumbing::try_execute_query::<rustc_query_impl[77c04cfc11717055]::DynamicConfig<rustc_query_system[21afab51dde9dbf3]::query::caches::VecCache<rustc_span[9591d6886b6f356b]::def_id::LocalDefId, rustc_middle[c2220a5f32aee4a9]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[77c04cfc11717055]::plumbing::QueryCtxt, false>
  59:     0x7ff37b95177f - rustc_query_impl[77c04cfc11717055]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
  60:     0x7ff37abea99c - rustc_mir_transform[cafb922bcd4bfee1]::mir_for_ctfe
  61:     0x7ff37a07db56 - rustc_query_impl[77c04cfc11717055]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[77c04cfc11717055]::query_impl::mir_for_ctfe::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c2220a5f32aee4a9]::query::erase::Erased<[u8; 8usize]>>
  62:     0x7ff37a07db31 - <rustc_query_impl[77c04cfc11717055]::query_impl::mir_for_ctfe::dynamic_query::{closure#2} as core[9d3b7bf065738f73]::ops::function::FnOnce<(rustc_middle[c2220a5f32aee4a9]::ty::context::TyCtxt, rustc_span[9591d6886b6f356b]::def_id::DefId)>>::call_once
  63:     0x7ff37a01fa45 - rustc_query_system[21afab51dde9dbf3]::query::plumbing::try_execute_query::<rustc_query_impl[77c04cfc11717055]::DynamicConfig<rustc_query_system[21afab51dde9dbf3]::query::caches::DefaultCache<rustc_span[9591d6886b6f356b]::def_id::DefId, rustc_middle[c2220a5f32aee4a9]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[77c04cfc11717055]::plumbing::QueryCtxt, false>
  64:     0x7ff37b951882 - rustc_query_impl[77c04cfc11717055]::query_impl::mir_for_ctfe::get_query_non_incr::__rust_end_short_backtrace
  65:     0x7ff37a490b23 - <rustc_const_eval[e6ffc898df0b836]::interpret::eval_context::InterpCx<rustc_const_eval[e6ffc898df0b836]::const_eval::machine::CompileTimeInterpreter>>::load_mir
  66:     0x7ff37a3cc030 - rustc_const_eval[e6ffc898df0b836]::const_eval::eval_queries::eval_to_allocation_raw_provider
  67:     0x7ff37a079977 - rustc_query_impl[77c04cfc11717055]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[77c04cfc11717055]::query_impl::eval_to_allocation_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c2220a5f32aee4a9]::query::erase::Erased<[u8; 16usize]>>
  68:     0x7ff37ac1232c - rustc_query_system[21afab51dde9dbf3]::query::plumbing::try_execute_query::<rustc_query_impl[77c04cfc11717055]::DynamicConfig<rustc_query_system[21afab51dde9dbf3]::query::caches::DefaultCache<rustc_middle[c2220a5f32aee4a9]::ty::ParamEnvAnd<rustc_middle[c2220a5f32aee4a9]::mir::interpret::GlobalId>, rustc_middle[c2220a5f32aee4a9]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[77c04cfc11717055]::plumbing::QueryCtxt, false>
  69:     0x7ff37ac11ffb - rustc_query_impl[77c04cfc11717055]::query_impl::eval_to_allocation_raw::get_query_non_incr::__rust_end_short_backtrace
  70:     0x7ff37a3cc682 - rustc_const_eval[e6ffc898df0b836]::const_eval::eval_queries::eval_to_allocation_raw_provider
  71:     0x7ff37a079977 - rustc_query_impl[77c04cfc11717055]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[77c04cfc11717055]::query_impl::eval_to_allocation_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c2220a5f32aee4a9]::query::erase::Erased<[u8; 16usize]>>
  72:     0x7ff37ac1232c - rustc_query_system[21afab51dde9dbf3]::query::plumbing::try_execute_query::<rustc_query_impl[77c04cfc11717055]::DynamicConfig<rustc_query_system[21afab51dde9dbf3]::query::caches::DefaultCache<rustc_middle[c2220a5f32aee4a9]::ty::ParamEnvAnd<rustc_middle[c2220a5f32aee4a9]::mir::interpret::GlobalId>, rustc_middle[c2220a5f32aee4a9]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[77c04cfc11717055]::plumbing::QueryCtxt, false>
  73:     0x7ff37ac11ffb - rustc_query_impl[77c04cfc11717055]::query_impl::eval_to_allocation_raw::get_query_non_incr::__rust_end_short_backtrace
  74:     0x7ff37b70ca88 - rustc_const_eval[e6ffc898df0b836]::const_eval::eval_to_valtree
  75:     0x7ff37b70c8e0 - <rustc_const_eval[e6ffc898df0b836]::provide::{closure#0} as core[9d3b7bf065738f73]::ops::function::FnOnce<(rustc_middle[c2220a5f32aee4a9]::ty::context::TyCtxt, rustc_middle[c2220a5f32aee4a9]::ty::ParamEnvAnd<rustc_middle[c2220a5f32aee4a9]::mir::interpret::GlobalId>)>>::call_once
  76:     0x7ff37b3f4b79 - rustc_query_impl[77c04cfc11717055]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[77c04cfc11717055]::query_impl::eval_to_valtree::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c2220a5f32aee4a9]::query::erase::Erased<[u8; 24usize]>>
  77:     0x7ff37b3f4b28 - <rustc_query_impl[77c04cfc11717055]::query_impl::eval_to_valtree::dynamic_query::{closure#2} as core[9d3b7bf065738f73]::ops::function::FnOnce<(rustc_middle[c2220a5f32aee4a9]::ty::context::TyCtxt, rustc_middle[c2220a5f32aee4a9]::ty::ParamEnvAnd<rustc_middle[c2220a5f32aee4a9]::mir::interpret::GlobalId>)>>::call_once
  78:     0x7ff37b59c478 - rustc_query_system[21afab51dde9dbf3]::query::plumbing::try_execute_query::<rustc_query_impl[77c04cfc11717055]::DynamicConfig<rustc_query_system[21afab51dde9dbf3]::query::caches::DefaultCache<rustc_middle[c2220a5f32aee4a9]::ty::ParamEnvAnd<rustc_middle[c2220a5f32aee4a9]::mir::interpret::GlobalId>, rustc_middle[c2220a5f32aee4a9]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[77c04cfc11717055]::plumbing::QueryCtxt, false>
  79:     0x7ff37b59c16b - rustc_query_impl[77c04cfc11717055]::query_impl::eval_to_valtree::get_query_non_incr::__rust_end_short_backtrace
  80:     0x7ff37a74d2bc - rustc_middle[c2220a5f32aee4a9]::query::plumbing::query_get_at::<rustc_query_system[21afab51dde9dbf3]::query::caches::DefaultCache<rustc_middle[c2220a5f32aee4a9]::ty::ParamEnvAnd<rustc_middle[c2220a5f32aee4a9]::mir::interpret::GlobalId>, rustc_middle[c2220a5f32aee4a9]::query::erase::Erased<[u8; 24usize]>>>
  81:     0x7ff37a74cfc3 - <rustc_middle[c2220a5f32aee4a9]::ty::context::TyCtxt>::const_eval_global_id_for_typeck
  82:     0x7ff37a74cb7c - <rustc_middle[c2220a5f32aee4a9]::ty::context::TyCtxt>::const_eval_resolve_for_typeck
  83:     0x7ff37a743edf - <rustc_middle[c2220a5f32aee4a9]::ty::consts::Const>::eval
  84:     0x7ff37a71cbaf - <rustc_trait_selection[63bfde0f7f8720d]::traits::project::AssocTypeNormalizer as rustc_type_ir[eee4d87b09b8b7ec]::fold::TypeFolder<rustc_middle[c2220a5f32aee4a9]::ty::context::TyCtxt>>::fold_const
  85:     0x7ff37a6fc6f2 - <rustc_trait_selection[63bfde0f7f8720d]::traits::project::AssocTypeNormalizer as rustc_type_ir[eee4d87b09b8b7ec]::fold::TypeFolder<rustc_middle[c2220a5f32aee4a9]::ty::context::TyCtxt>>::fold_ty
  86:     0x7ff37adcc359 - <&rustc_middle[c2220a5f32aee4a9]::ty::list::List<rustc_middle[c2220a5f32aee4a9]::ty::subst::GenericArg> as rustc_type_ir[eee4d87b09b8b7ec]::fold::TypeFoldable<rustc_middle[c2220a5f32aee4a9]::ty::context::TyCtxt>>::try_fold_with::<rustc_trait_selection[63bfde0f7f8720d]::traits::project::AssocTypeNormalizer>
  87:     0x7ff37a9d9a8f - <rustc_trait_selection[63bfde0f7f8720d]::traits::project::AssocTypeNormalizer>::fold::<rustc_middle[c2220a5f32aee4a9]::ty::sty::TraitRef>
  88:     0x7ff37a9d95e7 - rustc_trait_selection[63bfde0f7f8720d]::traits::project::normalize_with_depth::<rustc_middle[c2220a5f32aee4a9]::ty::sty::TraitRef>
  89:     0x7ff37ae90281 - <rustc_trait_selection[63bfde0f7f8720d]::traits::engine::ObligationCtxt>::normalize::<rustc_middle[c2220a5f32aee4a9]::ty::sty::TraitRef>
  90:     0x7ff37ae8d936 - rustc_hir_analysis[812eaf4e0aeb5a6e]::check::wfcheck::check_well_formed
  91:     0x7ff379fe384c - rustc_query_impl[77c04cfc11717055]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[77c04cfc11717055]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c2220a5f32aee4a9]::query::erase::Erased<[u8; 0usize]>>
  92:     0x7ff37a869966 - rustc_query_system[21afab51dde9dbf3]::query::plumbing::try_execute_query::<rustc_query_impl[77c04cfc11717055]::DynamicConfig<rustc_query_system[21afab51dde9dbf3]::query::caches::VecCache<rustc_hir[417e52bdb6051adf]::hir_id::OwnerId, rustc_middle[c2220a5f32aee4a9]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[77c04cfc11717055]::plumbing::QueryCtxt, false>
  93:     0x7ff37a8696d2 - rustc_query_impl[77c04cfc11717055]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  94:     0x7ff37b3a03dc - rustc_data_structures[b715d01ec5ecbd6f]::sync::par_for_each_in::<&[rustc_hir[417e52bdb6051adf]::hir::ItemId], <rustc_middle[c2220a5f32aee4a9]::hir::ModuleItems>::par_items<rustc_hir_analysis[812eaf4e0aeb5a6e]::check::wfcheck::check_mod_type_wf::{closure#0}>::{closure#0}>
  95:     0x7ff37b3a028a - rustc_hir_analysis[812eaf4e0aeb5a6e]::check::wfcheck::check_mod_type_wf
  96:     0x7ff37ac6351c - rustc_query_impl[77c04cfc11717055]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[77c04cfc11717055]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c2220a5f32aee4a9]::query::erase::Erased<[u8; 0usize]>>
  97:     0x7ff37ac634fe - <rustc_query_impl[77c04cfc11717055]::query_impl::check_mod_type_wf::dynamic_query::{closure#2} as core[9d3b7bf065738f73]::ops::function::FnOnce<(rustc_middle[c2220a5f32aee4a9]::ty::context::TyCtxt, rustc_span[9591d6886b6f356b]::def_id::LocalDefId)>>::call_once
  98:     0x7ff37a6d906f - rustc_query_system[21afab51dde9dbf3]::query::plumbing::try_execute_query::<rustc_query_impl[77c04cfc11717055]::DynamicConfig<rustc_query_system[21afab51dde9dbf3]::query::caches::VecCache<rustc_span[9591d6886b6f356b]::def_id::LocalDefId, rustc_middle[c2220a5f32aee4a9]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[77c04cfc11717055]::plumbing::QueryCtxt, false>
  99:     0x7ff37b95b6a2 - rustc_query_impl[77c04cfc11717055]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
 100:     0x7ff37b489e57 - rustc_data_structures[b715d01ec5ecbd6f]::sync::par_for_each_in::<&[rustc_hir[417e52bdb6051adf]::hir_id::OwnerId], <rustc_middle[c2220a5f32aee4a9]::hir::map::Map>::par_for_each_module<rustc_hir_analysis[812eaf4e0aeb5a6e]::check_crate::{closure#5}::{closure#0}::{closure#0}>::{closure#0}>
 101:     0x7ff37b489c27 - <rustc_session[1ee1d215f1830d4a]::session::Session>::track_errors::<rustc_hir_analysis[812eaf4e0aeb5a6e]::check_crate::{closure#5}, ()>
 102:     0x7ff37b48716f - rustc_hir_analysis[812eaf4e0aeb5a6e]::check_crate
 103:     0x7ff37b48148a - rustc_interface[acec405c1e433d19]::passes::analysis
 104:     0x7ff37b4e3eea - rustc_query_impl[77c04cfc11717055]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[77c04cfc11717055]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[c2220a5f32aee4a9]::query::erase::Erased<[u8; 1usize]>>
 105:     0x7ff37b4e3ed9 - <rustc_query_impl[77c04cfc11717055]::query_impl::analysis::dynamic_query::{closure#2} as core[9d3b7bf065738f73]::ops::function::FnOnce<(rustc_middle[c2220a5f32aee4a9]::ty::context::TyCtxt, ())>>::call_once
 106:     0x7ff37b668e08 - rustc_query_system[21afab51dde9dbf3]::query::plumbing::try_execute_query::<rustc_query_impl[77c04cfc11717055]::DynamicConfig<rustc_query_system[21afab51dde9dbf3]::query::caches::SingleCache<rustc_middle[c2220a5f32aee4a9]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[77c04cfc11717055]::plumbing::QueryCtxt, false>
 107:     0x7ff37b668be7 - rustc_query_impl[77c04cfc11717055]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
 108:     0x7ff37b641cb5 - <rustc_middle[c2220a5f32aee4a9]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[d1aa6109471fdd45]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[9d3b7bf065738f73]::result::Result<(), rustc_span[9591d6886b6f356b]::ErrorGuaranteed>>
 109:     0x7ff37b23b41b - <rustc_interface[acec405c1e433d19]::interface::Compiler>::enter::<rustc_driver_impl[d1aa6109471fdd45]::run_compiler::{closure#1}::{closure#2}, core[9d3b7bf065738f73]::result::Result<core[9d3b7bf065738f73]::option::Option<rustc_interface[acec405c1e433d19]::queries::Linker>, rustc_span[9591d6886b6f356b]::ErrorGuaranteed>>
 110:     0x7ff37b238fb9 - <scoped_tls[eb9c878293193d5c]::ScopedKey<rustc_span[9591d6886b6f356b]::SessionGlobals>>::set::<rustc_interface[acec405c1e433d19]::interface::run_compiler<core[9d3b7bf065738f73]::result::Result<(), rustc_span[9591d6886b6f356b]::ErrorGuaranteed>, rustc_driver_impl[d1aa6109471fdd45]::run_compiler::{closure#1}>::{closure#0}, core[9d3b7bf065738f73]::result::Result<(), rustc_span[9591d6886b6f356b]::ErrorGuaranteed>>
 111:     0x7ff37b238426 - std[c901bbae7dc26da3]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[acec405c1e433d19]::util::run_in_thread_pool_with_globals<rustc_interface[acec405c1e433d19]::interface::run_compiler<core[9d3b7bf065738f73]::result::Result<(), rustc_span[9591d6886b6f356b]::ErrorGuaranteed>, rustc_driver_impl[d1aa6109471fdd45]::run_compiler::{closure#1}>::{closure#0}, core[9d3b7bf065738f73]::result::Result<(), rustc_span[9591d6886b6f356b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9d3b7bf065738f73]::result::Result<(), rustc_span[9591d6886b6f356b]::ErrorGuaranteed>>
 112:     0x7ff37b2381d5 - <<std[c901bbae7dc26da3]::thread::Builder>::spawn_unchecked_<rustc_interface[acec405c1e433d19]::util::run_in_thread_pool_with_globals<rustc_interface[acec405c1e433d19]::interface::run_compiler<core[9d3b7bf065738f73]::result::Result<(), rustc_span[9591d6886b6f356b]::ErrorGuaranteed>, rustc_driver_impl[d1aa6109471fdd45]::run_compiler::{closure#1}>::{closure#0}, core[9d3b7bf065738f73]::result::Result<(), rustc_span[9591d6886b6f356b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9d3b7bf065738f73]::result::Result<(), rustc_span[9591d6886b6f356b]::ErrorGuaranteed>>::{closure#1} as core[9d3b7bf065738f73]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
 113:     0x7ff378d763a5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf9fefea5dd71558b
                               at /rustc/7b0eac438ace0ba305b4633328b00474fbbf5120/library/alloc/src/boxed.rs:1985:9
 114:     0x7ff378d763a5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8c988cde4d28b483
                               at /rustc/7b0eac438ace0ba305b4633328b00474fbbf5120/library/alloc/src/boxed.rs:1985:9
 115:     0x7ff378d763a5 - std::sys::unix::thread::Thread::new::thread_start::hac03aed06feb4b93
                               at /rustc/7b0eac438ace0ba305b4633328b00474fbbf5120/library/std/src/sys/unix/thread.rs:108:17
 116:     0x7ff378b0f44b - <unknown>
 117:     0x7ff378b92e40 - <unknown>
 118:                0x0 - <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.72.0-nightly (7b0eac438 2023-06-14) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [mir_built] building MIR for `<impl at treereduce.out:7:1: 7:38>::{constant#0}`
#1 [unsafety_check_result] unsafety-checking `<impl at treereduce.out:7:1: 7:38>::{constant#0}`
#2 [mir_const] preparing `<impl at treereduce.out:7:1: 7:38>::{constant#0}` for borrow checking
#3 [mir_const_qualif] const checking `<impl at treereduce.out:7:1: 7:38>::{constant#0}`
#4 [mir_promoted] promoting constants in MIR for `<impl at treereduce.out:7:1: 7:38>::{constant#0}`
#5 [mir_borrowck] borrow-checking `<impl at treereduce.out:7:1: 7:38>::{constant#0}`
#6 [mir_drops_elaborated_and_const_checked] elaborating drops for `<impl at treereduce.out:7:1: 7:38>::{constant#0}`
#7 [mir_for_ctfe] caching mir of `<impl at treereduce.out:7:1: 7:38>::{constant#0}` for CTFE
#8 [eval_to_allocation_raw] const-evaluating + checking `<impl at treereduce.out:7:1: 7:38>::{constant#0}`
#9 [eval_to_allocation_raw] const-evaluating + checking `<impl at treereduce.out:7:1: 7:38>::{constant#0}`
#10 [eval_to_valtree] evaluating type-level constant
#11 [check_well_formed] checking that `<impl at treereduce.out:7:1: 7:38>` is well-formed
#12 [check_mod_type_wf] checking that types are well-formed in top-level module
#13 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors

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

@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 Jun 14, 2023
@Jules-Bertholet
Copy link
Contributor

Regressed in Rust 1.20, per Godbolt

@rustbot label regression-from-stable-to-stable

@rustbot rustbot added regression-from-stable-to-stable Performance or correctness regression from one stable version to another. I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Jun 15, 2023
@apiraino
Copy link
Contributor

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-low

@rustbot rustbot added P-low Low priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Jun 15, 2023
@jieyouxu
Copy link
Member

jieyouxu commented Jun 15, 2023

Slightly smaller:

enum Foo {
    Bar(B),
}

fn main() {
    let _ = [0u32; Foo::Bar as usize];
}

@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Jun 25, 2023
@davidtwco davidtwco linked a pull request Jul 12, 2023 that will close this issue
davidtwco added a commit to davidtwco/rust that referenced this issue Jul 12, 2023
@jruderman
Copy link
Contributor

Seems like the same issue as #83056

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-low Low 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
7 participants