Skip to content

ICE: assertion failure: Size(0 bytes / 8 bytes) rustc_const_eval/src/interpret/place.rs #112623

Description

@matthiaskrgr

Code

#![feature(const_trait_impl)]

#[const_trait]
trait Func<T> {
    type Output;

    fn call_once(self, arg: T) -> Self::Output;
}

struct Closure;

impl const Func<&usize> for Closure {
    type Output = usize;

    fn call_once(&'static self, arg: &usize) -> Self::Output {
        *arg
    }
}

enum Bug<T = [(); Closure.call_once(&0)]> {
    V(T),
}

Meta

rustc --version --verbose:

rustc 1.72.0-nightly (371994e0d 2023-06-13)
binary: rustc
commit-hash: 371994e0d8380600ddda78ca1be937c7fb179b49
commit-date: 2023-06-13
host: x86_64-unknown-linux-gnu
release: 1.72.0-nightly
LLVM version: 16.0.5

Error output

-
Backtrace

thread 'rustc' panicked at 'assertion failed: `(left == right)`
  left: `Size(0 bytes)`,
 right: `Size(8 bytes)`', compiler/rustc_const_eval/src/interpret/place.rs:667:17
stack backtrace:
   0:     0x7ff7291a2c41 - std::backtrace_rs::backtrace::libunwind::trace::h4e5cd7155e2ebaac
                               at /rustc/371994e0d8380600ddda78ca1be937c7fb179b49/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7ff7291a2c41 - std::backtrace_rs::backtrace::trace_unsynchronized::hb4d504f8def07b70
                               at /rustc/371994e0d8380600ddda78ca1be937c7fb179b49/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7ff7291a2c41 - std::sys_common::backtrace::_print_fmt::h270ee65403a6a640
                               at /rustc/371994e0d8380600ddda78ca1be937c7fb179b49/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7ff7291a2c41 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hfa127bbe4d370ae8
                               at /rustc/371994e0d8380600ddda78ca1be937c7fb179b49/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7ff7292035ff - core::fmt::rt::Argument::fmt::h975c0825ea1bb836
                               at /rustc/371994e0d8380600ddda78ca1be937c7fb179b49/library/core/src/fmt/rt.rs:138:9
   5:     0x7ff7292035ff - core::fmt::write::hb200bbda235147d0
                               at /rustc/371994e0d8380600ddda78ca1be937c7fb179b49/library/core/src/fmt/mod.rs:1094:21
   6:     0x7ff729195ee1 - std::io::Write::write_fmt::hf4eeaa80392fd692
                               at /rustc/371994e0d8380600ddda78ca1be937c7fb179b49/library/std/src/io/mod.rs:1713:15
   7:     0x7ff7291a2a55 - std::sys_common::backtrace::_print::h2427e2e0721aca68
                               at /rustc/371994e0d8380600ddda78ca1be937c7fb179b49/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7ff7291a2a55 - std::sys_common::backtrace::print::h8c074174f5a65b94
                               at /rustc/371994e0d8380600ddda78ca1be937c7fb179b49/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7ff7291a5737 - std::panicking::default_hook::{{closure}}::habdecd03f278805d
  10:     0x7ff7291a5524 - std::panicking::default_hook::hfeee4c9ec6e7984a
                               at /rustc/371994e0d8380600ddda78ca1be937c7fb179b49/library/std/src/panicking.rs:288:9
  11:     0x7ff727fef46b - rustc_driver_impl[82ed5c687fa14bc7]::install_ice_hook::{closure#0}
  12:     0x7ff7291a5e7d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h75ee17e40156a9b1
                               at /rustc/371994e0d8380600ddda78ca1be937c7fb179b49/library/alloc/src/boxed.rs:1999:9
  13:     0x7ff7291a5e7d - std::panicking::rust_panic_with_hook::h50748255142a0809
                               at /rustc/371994e0d8380600ddda78ca1be937c7fb179b49/library/std/src/panicking.rs:709:13
  14:     0x7ff7291a5c17 - std::panicking::begin_panic_handler::{{closure}}::h1532befb1017034b
                               at /rustc/371994e0d8380600ddda78ca1be937c7fb179b49/library/std/src/panicking.rs:597:13
  15:     0x7ff7291a3076 - std::sys_common::backtrace::__rust_end_short_backtrace::h36f919598d3260ac
                               at /rustc/371994e0d8380600ddda78ca1be937c7fb179b49/library/std/src/sys_common/backtrace.rs:151:18
  16:     0x7ff7291a5962 - rust_begin_unwind
                               at /rustc/371994e0d8380600ddda78ca1be937c7fb179b49/library/std/src/panicking.rs:593:5
  17:     0x7ff7291ff883 - core::panicking::panic_fmt::h637089c9b9878b43
                               at /rustc/371994e0d8380600ddda78ca1be937c7fb179b49/library/core/src/panicking.rs:67:14
  18:     0x7ff7291ffd2b - core::panicking::assert_failed_inner::h19f040ba3a8153bc
  19:     0x7ff727f3c00c - core[c5a351271e0d68a3]::panicking::assert_failed::<rustc_abi[dfec205f4ad3b685]::Size, rustc_abi[dfec205f4ad3b685]::Size>
  20:     0x7ff726481aa8 - <rustc_const_eval[31d57a31448f4b0]::interpret::eval_context::InterpCx<rustc_const_eval[31d57a31448f4b0]::const_eval::machine::CompileTimeInterpreter>>::pass_argument::<core[c5a351271e0d68a3]::iter::adapters::filter::Filter<core[c5a351271e0d68a3]::iter::adapters::zip::Zip<core[c5a351271e0d68a3]::slice::iter::Iter<rustc_const_eval[31d57a31448f4b0]::interpret::operand::OpTy>, core[c5a351271e0d68a3]::slice::iter::Iter<rustc_target[97a646c7007a6648]::abi::call::ArgAbi<rustc_middle[cf9791794388bff2]::ty::Ty>>>, <rustc_const_eval[31d57a31448f4b0]::interpret::eval_context::InterpCx<rustc_const_eval[31d57a31448f4b0]::const_eval::machine::CompileTimeInterpreter>>::eval_fn_call::{closure#2}>>
  21:     0x7ff726460066 - <rustc_const_eval[31d57a31448f4b0]::interpret::eval_context::InterpCx<rustc_const_eval[31d57a31448f4b0]::const_eval::machine::CompileTimeInterpreter>>::eval_fn_call
  22:     0x7ff726450a61 - <rustc_const_eval[31d57a31448f4b0]::interpret::eval_context::InterpCx<rustc_const_eval[31d57a31448f4b0]::const_eval::machine::CompileTimeInterpreter>>::terminator
  23:     0x7ff7263c5068 - rustc_const_eval[31d57a31448f4b0]::const_eval::eval_queries::eval_to_allocation_raw_provider
  24:     0x7ff726077537 - rustc_query_impl[eec84043af3db326]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[eec84043af3db326]::query_impl::eval_to_allocation_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[cf9791794388bff2]::query::erase::Erased<[u8; 16usize]>>
  25:     0x7ff726c7eb4c - rustc_query_system[558b060458ea38]::query::plumbing::try_execute_query::<rustc_query_impl[eec84043af3db326]::DynamicConfig<rustc_query_system[558b060458ea38]::query::caches::DefaultCache<rustc_middle[cf9791794388bff2]::ty::ParamEnvAnd<rustc_middle[cf9791794388bff2]::mir::interpret::GlobalId>, rustc_middle[cf9791794388bff2]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[eec84043af3db326]::plumbing::QueryCtxt, false>
  26:     0x7ff726c7e80d - rustc_query_impl[eec84043af3db326]::query_impl::eval_to_allocation_raw::get_query_non_incr::__rust_end_short_backtrace
  27:     0x7ff7263c3fe2 - rustc_const_eval[31d57a31448f4b0]::const_eval::eval_queries::eval_to_allocation_raw_provider
  28:     0x7ff726077537 - rustc_query_impl[eec84043af3db326]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[eec84043af3db326]::query_impl::eval_to_allocation_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[cf9791794388bff2]::query::erase::Erased<[u8; 16usize]>>
  29:     0x7ff726c7eb4c - rustc_query_system[558b060458ea38]::query::plumbing::try_execute_query::<rustc_query_impl[eec84043af3db326]::DynamicConfig<rustc_query_system[558b060458ea38]::query::caches::DefaultCache<rustc_middle[cf9791794388bff2]::ty::ParamEnvAnd<rustc_middle[cf9791794388bff2]::mir::interpret::GlobalId>, rustc_middle[cf9791794388bff2]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[eec84043af3db326]::plumbing::QueryCtxt, false>
  30:     0x7ff726c7e80d - rustc_query_impl[eec84043af3db326]::query_impl::eval_to_allocation_raw::get_query_non_incr::__rust_end_short_backtrace
  31:     0x7ff727732518 - rustc_const_eval[31d57a31448f4b0]::const_eval::eval_to_valtree
  32:     0x7ff727732370 - <rustc_const_eval[31d57a31448f4b0]::provide::{closure#0} as core[c5a351271e0d68a3]::ops::function::FnOnce<(rustc_middle[cf9791794388bff2]::ty::context::TyCtxt, rustc_middle[cf9791794388bff2]::ty::ParamEnvAnd<rustc_middle[cf9791794388bff2]::mir::interpret::GlobalId>)>>::call_once
  33:     0x7ff72740efa9 - rustc_query_impl[eec84043af3db326]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[eec84043af3db326]::query_impl::eval_to_valtree::dynamic_query::{closure#2}::{closure#0}, rustc_middle[cf9791794388bff2]::query::erase::Erased<[u8; 24usize]>>
  34:     0x7ff72740ef58 - <rustc_query_impl[eec84043af3db326]::query_impl::eval_to_valtree::dynamic_query::{closure#2} as core[c5a351271e0d68a3]::ops::function::FnOnce<(rustc_middle[cf9791794388bff2]::ty::context::TyCtxt, rustc_middle[cf9791794388bff2]::ty::ParamEnvAnd<rustc_middle[cf9791794388bff2]::mir::interpret::GlobalId>)>>::call_once
  35:     0x7ff7275ca408 - rustc_query_system[558b060458ea38]::query::plumbing::try_execute_query::<rustc_query_impl[eec84043af3db326]::DynamicConfig<rustc_query_system[558b060458ea38]::query::caches::DefaultCache<rustc_middle[cf9791794388bff2]::ty::ParamEnvAnd<rustc_middle[cf9791794388bff2]::mir::interpret::GlobalId>, rustc_middle[cf9791794388bff2]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[eec84043af3db326]::plumbing::QueryCtxt, false>
  36:     0x7ff7275ca0ed - rustc_query_impl[eec84043af3db326]::query_impl::eval_to_valtree::get_query_non_incr::__rust_end_short_backtrace
  37:     0x7ff7266f72fc - rustc_middle[cf9791794388bff2]::query::plumbing::query_get_at::<rustc_query_system[558b060458ea38]::query::caches::DefaultCache<rustc_middle[cf9791794388bff2]::ty::ParamEnvAnd<rustc_middle[cf9791794388bff2]::mir::interpret::GlobalId>, rustc_middle[cf9791794388bff2]::query::erase::Erased<[u8; 24usize]>>>
  38:     0x7ff7266f7003 - <rustc_middle[cf9791794388bff2]::ty::context::TyCtxt>::const_eval_global_id_for_typeck
  39:     0x7ff7266f6bbc - <rustc_middle[cf9791794388bff2]::ty::context::TyCtxt>::const_eval_resolve_for_typeck
  40:     0x7ff7266f389f - <rustc_middle[cf9791794388bff2]::ty::consts::Const>::eval
  41:     0x7ff7266f2bd4 - <rustc_trait_selection[289a0623b6a0d732]::traits::project::AssocTypeNormalizer as rustc_type_ir[5f458fb36e5c0deb]::fold::TypeFolder<rustc_middle[cf9791794388bff2]::ty::context::TyCtxt>>::fold_const
  42:     0x7ff7266d26c2 - <rustc_trait_selection[289a0623b6a0d732]::traits::project::AssocTypeNormalizer as rustc_type_ir[5f458fb36e5c0deb]::fold::TypeFolder<rustc_middle[cf9791794388bff2]::ty::context::TyCtxt>>::fold_ty
  43:     0x7ff726e1c559 - <&rustc_middle[cf9791794388bff2]::ty::list::List<rustc_middle[cf9791794388bff2]::ty::subst::GenericArg> as rustc_type_ir[5f458fb36e5c0deb]::fold::TypeFoldable<rustc_middle[cf9791794388bff2]::ty::context::TyCtxt>>::try_fold_with::<rustc_trait_selection[289a0623b6a0d732]::traits::project::AssocTypeNormalizer>
  44:     0x7ff726e1c256 - <rustc_trait_selection[289a0623b6a0d732]::traits::project::AssocTypeNormalizer as rustc_type_ir[5f458fb36e5c0deb]::fold::FallibleTypeFolder<rustc_middle[cf9791794388bff2]::ty::context::TyCtxt>>::try_fold_binder::<rustc_middle[cf9791794388bff2]::ty::PredicateKind>
  45:     0x7ff726e1bf1c - <rustc_trait_selection[289a0623b6a0d732]::traits::project::AssocTypeNormalizer as rustc_type_ir[5f458fb36e5c0deb]::fold::FallibleTypeFolder<rustc_middle[cf9791794388bff2]::ty::context::TyCtxt>>::try_fold_predicate
  46:     0x7ff726e1b9cb - <rustc_infer[91049bb12f28370c]::infer::at::At as rustc_trait_selection[289a0623b6a0d732]::traits::project::NormalizeExt>::normalize::<rustc_middle[cf9791794388bff2]::ty::Predicate>
  47:     0x7ff726e1b5bd - <rustc_trait_selection[289a0623b6a0d732]::traits::engine::ObligationCtxt>::normalize::<rustc_middle[cf9791794388bff2]::ty::Predicate>
  48:     0x7ff726b5926d - <&mut rustc_hir_analysis[e462668682978bb5]::check::wfcheck::check_where_clauses::{closure#3} as core[c5a351271e0d68a3]::ops::function::FnOnce<((rustc_middle[cf9791794388bff2]::ty::Predicate, rustc_span[5b25b58355c0a00e]::span_encoding::Span),)>>::call_once
  49:     0x7ff726b4c8c4 - <alloc[a8c9cd47032004ef]::vec::Vec<rustc_infer[91049bb12f28370c]::traits::Obligation<rustc_middle[cf9791794388bff2]::ty::Predicate>> as alloc[a8c9cd47032004ef]::vec::spec_from_iter::SpecFromIter<rustc_infer[91049bb12f28370c]::traits::Obligation<rustc_middle[cf9791794388bff2]::ty::Predicate>, core[c5a351271e0d68a3]::iter::adapters::chain::Chain<core[c5a351271e0d68a3]::iter::adapters::flatten::FlatMap<core[c5a351271e0d68a3]::iter::adapters::zip::Zip<alloc[a8c9cd47032004ef]::vec::into_iter::IntoIter<rustc_middle[cf9791794388bff2]::ty::Predicate>, alloc[a8c9cd47032004ef]::vec::into_iter::IntoIter<rustc_span[5b25b58355c0a00e]::span_encoding::Span>>, alloc[a8c9cd47032004ef]::vec::Vec<rustc_infer[91049bb12f28370c]::traits::Obligation<rustc_middle[cf9791794388bff2]::ty::Predicate>>, rustc_hir_analysis[e462668682978bb5]::check::wfcheck::check_where_clauses::{closure#4}>, core[c5a351271e0d68a3]::iter::adapters::map::Map<core[c5a351271e0d68a3]::iter::adapters::flatten::FlatMap<core[c5a351271e0d68a3]::slice::iter::Iter<(rustc_middle[cf9791794388bff2]::ty::Predicate, rustc_span[5b25b58355c0a00e]::span_encoding::Span)>, core[c5a351271e0d68a3]::option::Option<(rustc_middle[cf9791794388bff2]::ty::Predicate, rustc_span[5b25b58355c0a00e]::span_encoding::Span)>, rustc_hir_analysis[e462668682978bb5]::check::wfcheck::check_where_clauses::{closure#2}>, rustc_hir_analysis[e462668682978bb5]::check::wfcheck::check_where_clauses::{closure#3}>>>>::from_iter
  50:     0x7ff726b49b1c - rustc_hir_analysis[e462668682978bb5]::check::wfcheck::check_where_clauses
  51:     0x7ff726b578b5 - rustc_hir_analysis[e462668682978bb5]::check::wfcheck::check_type_defn
  52:     0x7ff726b35c2f - rustc_hir_analysis[e462668682978bb5]::check::wfcheck::check_well_formed
  53:     0x7ff725febd8c - rustc_query_impl[eec84043af3db326]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[eec84043af3db326]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[cf9791794388bff2]::query::erase::Erased<[u8; 0usize]>>
  54:     0x7ff726851006 - rustc_query_system[558b060458ea38]::query::plumbing::try_execute_query::<rustc_query_impl[eec84043af3db326]::DynamicConfig<rustc_query_system[558b060458ea38]::query::caches::VecCache<rustc_hir[93dddeb8c6b4db45]::hir_id::OwnerId, rustc_middle[cf9791794388bff2]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[eec84043af3db326]::plumbing::QueryCtxt, false>
  55:     0x7ff726850d54 - rustc_query_impl[eec84043af3db326]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  56:     0x7ff7273bb96c - rustc_data_structures[77d4adee0611d83c]::sync::par_for_each_in::<&[rustc_hir[93dddeb8c6b4db45]::hir::ItemId], <rustc_middle[cf9791794388bff2]::hir::ModuleItems>::par_items<rustc_hir_analysis[e462668682978bb5]::check::wfcheck::check_mod_type_wf::{closure#0}>::{closure#0}>
  57:     0x7ff7273bb81a - rustc_hir_analysis[e462668682978bb5]::check::wfcheck::check_mod_type_wf
  58:     0x7ff726cc91ac - rustc_query_impl[eec84043af3db326]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[eec84043af3db326]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[cf9791794388bff2]::query::erase::Erased<[u8; 0usize]>>
  59:     0x7ff726cc918e - <rustc_query_impl[eec84043af3db326]::query_impl::check_mod_type_wf::dynamic_query::{closure#2} as core[c5a351271e0d68a3]::ops::function::FnOnce<(rustc_middle[cf9791794388bff2]::ty::context::TyCtxt, rustc_span[5b25b58355c0a00e]::def_id::LocalDefId)>>::call_once
  60:     0x7ff72673417f - rustc_query_system[558b060458ea38]::query::plumbing::try_execute_query::<rustc_query_impl[eec84043af3db326]::DynamicConfig<rustc_query_system[558b060458ea38]::query::caches::VecCache<rustc_span[5b25b58355c0a00e]::def_id::LocalDefId, rustc_middle[cf9791794388bff2]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[eec84043af3db326]::plumbing::QueryCtxt, false>
  61:     0x7ff7279744c4 - rustc_query_impl[eec84043af3db326]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  62:     0x7ff7274894a7 - rustc_data_structures[77d4adee0611d83c]::sync::par_for_each_in::<&[rustc_hir[93dddeb8c6b4db45]::hir_id::OwnerId], <rustc_middle[cf9791794388bff2]::hir::map::Map>::par_for_each_module<rustc_hir_analysis[e462668682978bb5]::check_crate::{closure#5}::{closure#0}::{closure#0}>::{closure#0}>
  63:     0x7ff727489277 - <rustc_session[c89a0e04955a4434]::session::Session>::track_errors::<rustc_hir_analysis[e462668682978bb5]::check_crate::{closure#5}, ()>
  64:     0x7ff7274867bf - rustc_hir_analysis[e462668682978bb5]::check_crate
  65:     0x7ff727480edd - rustc_interface[5fbdb9547dedf44d]::passes::analysis
  66:     0x7ff72750732a - rustc_query_impl[eec84043af3db326]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[eec84043af3db326]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[cf9791794388bff2]::query::erase::Erased<[u8; 1usize]>>
  67:     0x7ff727507319 - <rustc_query_impl[eec84043af3db326]::query_impl::analysis::dynamic_query::{closure#2} as core[c5a351271e0d68a3]::ops::function::FnOnce<(rustc_middle[cf9791794388bff2]::ty::context::TyCtxt, ())>>::call_once
  68:     0x7ff727689938 - rustc_query_system[558b060458ea38]::query::plumbing::try_execute_query::<rustc_query_impl[eec84043af3db326]::DynamicConfig<rustc_query_system[558b060458ea38]::query::caches::SingleCache<rustc_middle[cf9791794388bff2]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[eec84043af3db326]::plumbing::QueryCtxt, false>
  69:     0x7ff727689709 - rustc_query_impl[eec84043af3db326]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  70:     0x7ff727660255 - <rustc_middle[cf9791794388bff2]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[82ed5c687fa14bc7]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[c5a351271e0d68a3]::result::Result<(), rustc_span[5b25b58355c0a00e]::ErrorGuaranteed>>
  71:     0x7ff7272bffdf - <rustc_interface[5fbdb9547dedf44d]::interface::Compiler>::enter::<rustc_driver_impl[82ed5c687fa14bc7]::run_compiler::{closure#1}::{closure#2}, core[c5a351271e0d68a3]::result::Result<core[c5a351271e0d68a3]::option::Option<rustc_interface[5fbdb9547dedf44d]::queries::Linker>, rustc_span[5b25b58355c0a00e]::ErrorGuaranteed>>
  72:     0x7ff7272bdb79 - <scoped_tls[c0707037e0f60a9b]::ScopedKey<rustc_span[5b25b58355c0a00e]::SessionGlobals>>::set::<rustc_interface[5fbdb9547dedf44d]::interface::run_compiler<core[c5a351271e0d68a3]::result::Result<(), rustc_span[5b25b58355c0a00e]::ErrorGuaranteed>, rustc_driver_impl[82ed5c687fa14bc7]::run_compiler::{closure#1}>::{closure#0}, core[c5a351271e0d68a3]::result::Result<(), rustc_span[5b25b58355c0a00e]::ErrorGuaranteed>>
  73:     0x7ff7272bcfe6 - std[cd097dad4f2506ec]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[5fbdb9547dedf44d]::util::run_in_thread_pool_with_globals<rustc_interface[5fbdb9547dedf44d]::interface::run_compiler<core[c5a351271e0d68a3]::result::Result<(), rustc_span[5b25b58355c0a00e]::ErrorGuaranteed>, rustc_driver_impl[82ed5c687fa14bc7]::run_compiler::{closure#1}>::{closure#0}, core[c5a351271e0d68a3]::result::Result<(), rustc_span[5b25b58355c0a00e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[c5a351271e0d68a3]::result::Result<(), rustc_span[5b25b58355c0a00e]::ErrorGuaranteed>>
  74:     0x7ff7272bcd95 - <<std[cd097dad4f2506ec]::thread::Builder>::spawn_unchecked_<rustc_interface[5fbdb9547dedf44d]::util::run_in_thread_pool_with_globals<rustc_interface[5fbdb9547dedf44d]::interface::run_compiler<core[c5a351271e0d68a3]::result::Result<(), rustc_span[5b25b58355c0a00e]::ErrorGuaranteed>, rustc_driver_impl[82ed5c687fa14bc7]::run_compiler::{closure#1}>::{closure#0}, core[c5a351271e0d68a3]::result::Result<(), rustc_span[5b25b58355c0a00e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[c5a351271e0d68a3]::result::Result<(), rustc_span[5b25b58355c0a00e]::ErrorGuaranteed>>::{closure#1} as core[c5a351271e0d68a3]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  75:     0x7ff7291b03a5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hae3241ec192e9c95
                               at /rustc/371994e0d8380600ddda78ca1be937c7fb179b49/library/alloc/src/boxed.rs:1985:9
  76:     0x7ff7291b03a5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h75f69d4e89077470
                               at /rustc/371994e0d8380600ddda78ca1be937c7fb179b49/library/alloc/src/boxed.rs:1985:9
  77:     0x7ff7291b03a5 - std::sys::unix::thread::Thread::new::thread_start::heddaad8550613863
                               at /rustc/371994e0d8380600ddda78ca1be937c7fb179b49/library/std/src/sys/unix/thread.rs:108:17
  78:     0x7ff724c9b44b - <unknown>
  79:     0x7ff724d1ee40 - <unknown>
  80:                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.72.0-nightly (371994e0d 2023-06-13) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib

query stack during panic:
#0 [eval_to_allocation_raw] const-evaluating + checking `Bug::{constant#0}`
#1 [eval_to_allocation_raw] const-evaluating + checking `Bug::{constant#0}`
#2 [eval_to_valtree] evaluating type-level constant
#3 [check_well_formed] checking that `Bug` is well-formed
#4 [check_mod_type_wf] checking that types are well-formed in top-level module
#5 [analysis] running analysis passes on this crate
end of query stack

Activity

  1. added
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    C-bugCategory: This is a bug.
    requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.
    on Jun 14, 2023
  2. matthiaskrgr commented on Jun 14, 2023

    @matthiaskrgr
    MemberAuthor

    Regression in nightly-2022-05-28

      commit[0] 2022-05-26: Auto merge of #97434 - matthiaskrgr:rollup-7j3y16l, r=matthiaskrgr
      commit[1] 2022-05-26: Auto merge of #97386 - nnethercote:optimize-pos-adjustments, r=bjorn3
      commit[2] 2022-05-27: Auto merge of #96298 - petrochenkov:fromgen, r=estebank
      commit[3] 2022-05-27: Auto merge of #97444 - compiler-errors:rollup-2gvdav6, r=compiler-errors
      commit[4] 2022-05-27: Auto merge of #97004 - nnethercote:proc-macro-tweaks, r=eddyb
      commit[5] 2022-05-27: Auto merge of #97442 - hafeoz:master, r=GuillaumeGomez
      commit[6] 2022-05-27: Auto merge of #96046 - oli-obk:const_typeck, r=cjgillot
      commit[7] 2022-05-27: Auto merge of #96790 - lqd:update_jemalloc, r=Mark-Simulacrum
      
    
  3. clubby789 commented on Jun 14, 2023

    @clubby789
    Contributor

    The issue seems to be that const_trait doesn't check that the impl function signature matches the trait function signature (until after const eval, at least), so it allows us to pass &T to an ABI expecting a T. e.g.

    #![feature(const_trait_impl)]
    
    #[const_trait]
    trait Func {
        fn trigger(self) -> usize;
    }
    
    struct Cls;
    
    impl const Func for Cls {
        fn trigger(&self, a: usize) -> usize {
            0
        }
    }
    
    enum Bug<T = [(); Cls.trigger()]> {
        V(T),
    }

    This ICEs with a mismatch in the number of args

    wf_checking, which evaluates Cls.trigger() runs after item_types_checking which does report the mismatch

  4. JohnTitor commented on Oct 15, 2023

    @JohnTitor
    Member

    Fixed on the latest nightly, marking as E-needs-test (or, feel free to close if we have a sufficient regression test)
    @rustbot labels: +E-needs-test

  5. added
    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.
    on Oct 15, 2023
  6. matthiaskrgr commented on Feb 13, 2024

    @matthiaskrgr
    MemberAuthor

    auto-reduced (treereduce-rust):

    #![feature(const_trait_impl, effects)]
    
    #[const_trait]
    trait Value {
        fn value() -> u32;
    }
    
    const fn get_value<T: ~const Value>() -> u32 {
        T::value()
    }
    
    struct FortyTwo;
    
    impl const Value for FortyTwo {
        fn value() -> i64 {
            42
        }
    }
    
    const FORTY_TWO: u32 = get_value::<FortyTwo>();
    
    fn main() {
        assert_eq!(FORTY_TWO, 42);
    }
    

    original:

    // Tests that a const default trait impl can be specialized by another const
    // trait impl and that the specializing impl will be used during const-eval.
    
    // run-pass
    
    #![feature(const_trait_impl, effects)]
    #![feature(min_specialization)]
    
    #[const_trait]
    trait Value {
        fn value() -> u32;
    }
    
    const fn get_value<T: ~const Value>() -> u32 {
        T::value()
    }
    
    impl<T> const Value for T {
        default fn value() -> u32 {
            0
        }
    }
    
    struct FortyTwo;
    
    impl const Value for FortyTwo {
        fn value() -> i64 {
            42
        }
    }
    
    const ZERO: u32 = get_value::<()>();
    
    const FORTY_TWO: u32 = get_value::<FortyTwo>();
    
    fn main() {
        assert_eq!(ZERO, 0);
        assert_eq!(FORTY_TWO, 42);
    }

    Version information

    rustc 1.78.0-nightly (b381d3ab2 2024-02-12)
    binary: rustc
    commit-hash: b381d3ab27f788f990551100c4425bb782d26d76
    commit-date: 2024-02-12
    host: x86_64-unknown-linux-gnu
    release: 1.78.0-nightly
    LLVM version: 17.0.6
    
    

    Command:
    /home/matthias/.rustup/toolchains/master/bin/rustc

    Program output

    error[E0053]: method `value` has an incompatible type for trait
      --> /tmp/icemaker_global_tempdir.r53dfo7rqFNJ/rustc_testrunner_tmpdir_reporting.fKjNRjvMAypS/mvce.rs:15:19
       |
    15 |     fn value() -> i64 {
       |                   ^^^
       |                   |
       |                   expected `u32`, found `i64`
       |                   help: change the output type to match the trait: `u32`
       |
    note: type in trait
      --> /tmp/icemaker_global_tempdir.r53dfo7rqFNJ/rustc_testrunner_tmpdir_reporting.fKjNRjvMAypS/mvce.rs:5:19
       |
    5  |     fn value() -> u32;
       |                   ^^^
       = note: expected signature `fn() -> u32`
                  found signature `fn() -> i64`
    
    thread 'rustc' panicked at compiler/rustc_const_eval/src/interpret/place.rs:817:17:
    assertion `left == right` failed
      left: Size(8 bytes)
     right: Size(4 bytes)
    stack backtrace:
       0:     0x7f12ebba2476 - std::backtrace_rs::backtrace::libunwind::trace::h3f288a3148e8bb15
                                   at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
       1:     0x7f12ebba2476 - std::backtrace_rs::backtrace::trace_unsynchronized::h7277353061928bc0
                                   at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
       2:     0x7f12ebba2476 - std::sys_common::backtrace::_print_fmt::hbf79f06a8c92ca0e
                                   at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/sys_common/backtrace.rs:68:5
       3:     0x7f12ebba2476 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0afd1ff8e38a8a84
                                   at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/sys_common/backtrace.rs:44:22
       4:     0x7f12ebbf5030 - core::fmt::rt::Argument::fmt::h7f26a9b6a6522b09
                                   at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/core/src/fmt/rt.rs:142:9
       5:     0x7f12ebbf5030 - core::fmt::write::he7de9de816f98016
                                   at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/core/src/fmt/mod.rs:1120:17
       6:     0x7f12ebb95c6f - std::io::Write::write_fmt::h38e65bf4265dc66c
                                   at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/io/mod.rs:1854:15
       7:     0x7f12ebba2254 - std::sys_common::backtrace::_print::hf1424a842a74edeb
                                   at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/sys_common/backtrace.rs:47:5
       8:     0x7f12ebba2254 - std::sys_common::backtrace::print::hbb43acdb160822bd
                                   at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/sys_common/backtrace.rs:34:9
       9:     0x7f12ebba5047 - std::panicking::default_hook::{{closure}}::h9c602a562527e529
      10:     0x7f12ebba4da9 - std::panicking::default_hook::h9cb3bf5f6c73326f
                                   at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/panicking.rs:292:9
      11:     0x7f12e895cfdc - std[73253c920228642]::panicking::update_hook::<alloc[940273873142bb35]::boxed::Box<rustc_driver_impl[f037f419b039420a]::install_ice_hook::{closure#0}>>::{closure#0}
      12:     0x7f12ebba5796 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h1e0fe9ec90d27cc3
                                   at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/alloc/src/boxed.rs:2030:9
      13:     0x7f12ebba5796 - std::panicking::rust_panic_with_hook::hb5ad56797fd964c4
                                   at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/panicking.rs:785:13
      14:     0x7f12ebba54e2 - std::panicking::begin_panic_handler::{{closure}}::hd364aeee29433213
                                   at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/panicking.rs:659:13
      15:     0x7f12ebba2976 - std::sys_common::backtrace::__rust_end_short_backtrace::ha10bb1568b9ec73d
                                   at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/sys_common/backtrace.rs:171:18
      16:     0x7f12ebba5234 - rust_begin_unwind
                                   at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/panicking.rs:647:5
      17:     0x7f12ebbf1785 - core::panicking::panic_fmt::h91fa7152f33c7717
                                   at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/core/src/panicking.rs:72:14
      18:     0x7f12ebbf1ccb - core::panicking::assert_failed_inner::h57b72360e97f09d3
                                   at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/core/src/panicking.rs:342:17
      19:     0x7f12e88da0d3 - core[ed182bbac36ed604]::panicking::assert_failed::<rustc_abi[24af6b384a0c51d]::Size, rustc_abi[24af6b384a0c51d]::Size>
      20:     0x7f12ea29d97d - <rustc_const_eval[7bd60fb11925ea71]::interpret::eval_context::InterpCx<rustc_const_eval[7bd60fb11925ea71]::const_eval::machine::CompileTimeInterpreter>>::pop_stack_frame
      21:     0x7f12ea9a49ef - rustc_const_eval[7bd60fb11925ea71]::const_eval::eval_queries::eval_body_using_ecx::{closure#0}
      22:     0x7f12ea33cb30 - rustc_const_eval[7bd60fb11925ea71]::const_eval::eval_queries::eval_in_interpreter
      23:     0x7f12ea33280c - rustc_const_eval[7bd60fb11925ea71]::const_eval::eval_queries::eval_to_allocation_raw_provider
      24:     0x7f12ea33264c - rustc_query_impl[b78e7f0549dc02d3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b78e7f0549dc02d3]::query_impl::eval_to_allocation_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 24usize]>>
      25:     0x7f12ea3772eb - rustc_query_system[74854bfa6cddafab]::query::plumbing::try_execute_query::<rustc_query_impl[b78e7f0549dc02d3]::DynamicConfig<rustc_query_system[74854bfa6cddafab]::query::caches::DefaultCache<rustc_middle[dbb6cff8550fbced]::ty::ParamEnvAnd<rustc_middle[dbb6cff8550fbced]::mir::interpret::GlobalId>, rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[b78e7f0549dc02d3]::plumbing::QueryCtxt, false>
      26:     0x7f12ea376eb0 - rustc_query_impl[b78e7f0549dc02d3]::query_impl::eval_to_allocation_raw::get_query_non_incr::__rust_end_short_backtrace
      27:     0x7f12ea3785c2 - rustc_const_eval[7bd60fb11925ea71]::const_eval::eval_queries::eval_to_const_value_raw_provider
      28:     0x7f12ea3783f6 - rustc_query_impl[b78e7f0549dc02d3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b78e7f0549dc02d3]::query_impl::eval_to_const_value_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 24usize]>>
      29:     0x7f12ea37729d - rustc_query_system[74854bfa6cddafab]::query::plumbing::try_execute_query::<rustc_query_impl[b78e7f0549dc02d3]::DynamicConfig<rustc_query_system[74854bfa6cddafab]::query::caches::DefaultCache<rustc_middle[dbb6cff8550fbced]::ty::ParamEnvAnd<rustc_middle[dbb6cff8550fbced]::mir::interpret::GlobalId>, rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[b78e7f0549dc02d3]::plumbing::QueryCtxt, false>
      30:     0x7f12ea376db0 - rustc_query_impl[b78e7f0549dc02d3]::query_impl::eval_to_const_value_raw::get_query_non_incr::__rust_end_short_backtrace
      31:     0x7f12e7d289b2 - <rustc_middle[dbb6cff8550fbced]::ty::context::TyCtxt>::const_eval_resolve
      32:     0x7f12ea99bfa3 - rustc_const_eval[7bd60fb11925ea71]::const_eval::eval_queries::eval_body_using_ecx::{closure#0}
      33:     0x7f12ea33cb30 - rustc_const_eval[7bd60fb11925ea71]::const_eval::eval_queries::eval_in_interpreter
      34:     0x7f12ea33280c - rustc_const_eval[7bd60fb11925ea71]::const_eval::eval_queries::eval_to_allocation_raw_provider
      35:     0x7f12ea33264c - rustc_query_impl[b78e7f0549dc02d3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b78e7f0549dc02d3]::query_impl::eval_to_allocation_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 24usize]>>
      36:     0x7f12ea3772eb - rustc_query_system[74854bfa6cddafab]::query::plumbing::try_execute_query::<rustc_query_impl[b78e7f0549dc02d3]::DynamicConfig<rustc_query_system[74854bfa6cddafab]::query::caches::DefaultCache<rustc_middle[dbb6cff8550fbced]::ty::ParamEnvAnd<rustc_middle[dbb6cff8550fbced]::mir::interpret::GlobalId>, rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[b78e7f0549dc02d3]::plumbing::QueryCtxt, false>
      37:     0x7f12ea376eb0 - rustc_query_impl[b78e7f0549dc02d3]::query_impl::eval_to_allocation_raw::get_query_non_incr::__rust_end_short_backtrace
      38:     0x7f12ea3785c2 - rustc_const_eval[7bd60fb11925ea71]::const_eval::eval_queries::eval_to_const_value_raw_provider
      39:     0x7f12ea3783f6 - rustc_query_impl[b78e7f0549dc02d3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b78e7f0549dc02d3]::query_impl::eval_to_const_value_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 24usize]>>
      40:     0x7f12ea37729d - rustc_query_system[74854bfa6cddafab]::query::plumbing::try_execute_query::<rustc_query_impl[b78e7f0549dc02d3]::DynamicConfig<rustc_query_system[74854bfa6cddafab]::query::caches::DefaultCache<rustc_middle[dbb6cff8550fbced]::ty::ParamEnvAnd<rustc_middle[dbb6cff8550fbced]::mir::interpret::GlobalId>, rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[b78e7f0549dc02d3]::plumbing::QueryCtxt, false>
      41:     0x7f12ea376db0 - rustc_query_impl[b78e7f0549dc02d3]::query_impl::eval_to_const_value_raw::get_query_non_incr::__rust_end_short_backtrace
      42:     0x7f12e7d289b2 - <rustc_middle[dbb6cff8550fbced]::ty::context::TyCtxt>::const_eval_resolve
      43:     0x7f12e74633ca - <rustc_mir_transform[21d810ff238a01d7]::const_prop_lint::ConstPropagator as rustc_middle[dbb6cff8550fbced]::mir::visit::Visitor>::visit_operand
      44:     0x7f12e7464768 - <rustc_mir_transform[21d810ff238a01d7]::const_prop_lint::ConstPropagator as rustc_middle[dbb6cff8550fbced]::mir::visit::Visitor>::visit_assign
      45:     0x7f12ea2086c7 - <rustc_mir_transform[21d810ff238a01d7]::const_prop_lint::ConstPropagator as rustc_middle[dbb6cff8550fbced]::mir::visit::Visitor>::visit_body
      46:     0x7f12e74609ea - <rustc_mir_transform[21d810ff238a01d7]::const_prop_lint::ConstPropLint as rustc_mir_transform[21d810ff238a01d7]::pass_manager::MirLint>::run_lint
      47:     0x7f12e9c10b29 - rustc_mir_transform[21d810ff238a01d7]::pass_manager::run_passes_inner
      48:     0x7f12e7096df3 - rustc_mir_transform[21d810ff238a01d7]::mir_drops_elaborated_and_const_checked
      49:     0x7f12e9d70975 - rustc_query_impl[b78e7f0549dc02d3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b78e7f0549dc02d3]::query_impl::mir_drops_elaborated_and_const_checked::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 8usize]>>
      50:     0x7f12e9d70bfa - rustc_query_system[74854bfa6cddafab]::query::plumbing::try_execute_query::<rustc_query_impl[b78e7f0549dc02d3]::DynamicConfig<rustc_query_system[74854bfa6cddafab]::query::caches::VecCache<rustc_span[a4806a91d128f927]::def_id::LocalDefId, rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[b78e7f0549dc02d3]::plumbing::QueryCtxt, false>
      51:     0x7f12e9d704d4 - rustc_query_impl[b78e7f0549dc02d3]::query_impl::mir_drops_elaborated_and_const_checked::get_query_non_incr::__rust_end_short_backtrace
      52:     0x7f12ea5e0988 - rustc_interface[ceb207a8fb5539d]::passes::analysis
      53:     0x7f12ea5e005f - rustc_query_impl[b78e7f0549dc02d3]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b78e7f0549dc02d3]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 1usize]>>
      54:     0x7f12eaac6064 - rustc_query_system[74854bfa6cddafab]::query::plumbing::try_execute_query::<rustc_query_impl[b78e7f0549dc02d3]::DynamicConfig<rustc_query_system[74854bfa6cddafab]::query::caches::SingleCache<rustc_middle[dbb6cff8550fbced]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[b78e7f0549dc02d3]::plumbing::QueryCtxt, false>
      55:     0x7f12eaac5dc7 - rustc_query_impl[b78e7f0549dc02d3]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
      56:     0x7f12ea9409fb - rustc_interface[ceb207a8fb5539d]::interface::run_compiler::<core[ed182bbac36ed604]::result::Result<(), rustc_span[a4806a91d128f927]::ErrorGuaranteed>, rustc_driver_impl[f037f419b039420a]::run_compiler::{closure#0}>::{closure#0}
      57:     0x7f12eab6ef12 - std[73253c920228642]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[ceb207a8fb5539d]::util::run_in_thread_with_globals<rustc_interface[ceb207a8fb5539d]::util::run_in_thread_pool_with_globals<rustc_interface[ceb207a8fb5539d]::interface::run_compiler<core[ed182bbac36ed604]::result::Result<(), rustc_span[a4806a91d128f927]::ErrorGuaranteed>, rustc_driver_impl[f037f419b039420a]::run_compiler::{closure#0}>::{closure#0}, core[ed182bbac36ed604]::result::Result<(), rustc_span[a4806a91d128f927]::ErrorGuaranteed>>::{closure#0}, core[ed182bbac36ed604]::result::Result<(), rustc_span[a4806a91d128f927]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ed182bbac36ed604]::result::Result<(), rustc_span[a4806a91d128f927]::ErrorGuaranteed>>
      58:     0x7f12eab6ed3e - <<std[73253c920228642]::thread::Builder>::spawn_unchecked_<rustc_interface[ceb207a8fb5539d]::util::run_in_thread_with_globals<rustc_interface[ceb207a8fb5539d]::util::run_in_thread_pool_with_globals<rustc_interface[ceb207a8fb5539d]::interface::run_compiler<core[ed182bbac36ed604]::result::Result<(), rustc_span[a4806a91d128f927]::ErrorGuaranteed>, rustc_driver_impl[f037f419b039420a]::run_compiler::{closure#0}>::{closure#0}, core[ed182bbac36ed604]::result::Result<(), rustc_span[a4806a91d128f927]::ErrorGuaranteed>>::{closure#0}, core[ed182bbac36ed604]::result::Result<(), rustc_span[a4806a91d128f927]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ed182bbac36ed604]::result::Result<(), rustc_span[a4806a91d128f927]::ErrorGuaranteed>>::{closure#1} as core[ed182bbac36ed604]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
      59:     0x7f12ebbae985 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h37d86e7af57ec8cf
                                   at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/alloc/src/boxed.rs:2016:9
      60:     0x7f12ebbae985 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h99a2218ed45ac1ce
                                   at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/alloc/src/boxed.rs:2016:9
      61:     0x7f12ebbae985 - std::sys::pal::unix::thread::Thread::new::thread_start::h6344e9d30547345d
                                   at /rustc/b381d3ab27f788f990551100c4425bb782d26d76/library/std/src/sys/pal/unix/thread.rs:108:17
      62:     0x7f12e5aa09eb - <unknown>
      63:     0x7f12e5b247cc - <unknown>
      64:                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.78.0-nightly (b381d3ab2 2024-02-12) running on x86_64-unknown-linux-gnu
    
    query stack during panic:
    #0 [eval_to_allocation_raw] const-evaluating + checking `FORTY_TWO`
    #1 [eval_to_const_value_raw] simplifying constant for the type system `FORTY_TWO`
    #2 [eval_to_allocation_raw] const-evaluating + checking `main::promoted[1]`
    #3 [eval_to_const_value_raw] simplifying constant for the type system `main::promoted[1]`  |  = note: this failure-note originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
    
    #4 [mir_drops_elaborated_and_const_checked] elaborating drops for `main`
    #5 [analysis] running analysis passes on this crate
    end of query stack
    error: aborting due to 1 previous error
    
    For more information about this error, try `rustc --explain E0053`.
    
    

  7. removed
    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.
    glacierICE tracked in rust-lang/glacier.
    on Feb 13, 2024
  8. matthiaskrgr commented on Feb 13, 2024

    @matthiaskrgr
    MemberAuthor

    regressed again in #120550 lol cc @oli-obk

  9. added
    S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.
    on Apr 19, 2024
  10. removed
    requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.
    on Dec 13, 2025
  11. jakubadamw commented on Apr 3, 2026

    @jakubadamw
    Contributor
    #![feature(const_trait_impl)]
    
    const trait Value {
        fn value() -> u32;
    }
    
    const fn get_value<T: ~const Value>() -> u32 {
        T::value()
    }
    
    struct FortyTwo;
    
    impl const Value for FortyTwo {
        fn value() -> i64 {
            42
        }
    }
    
    const FORTY_TWO: u32 = get_value::<FortyTwo>();
    
    fn main() {
        assert_eq!(FORTY_TWO, 42);
    }

    doesn’t ICE any more.

    @rustbot label: +E-needs-test.

  12. added
    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.
    on Apr 3, 2026
  13. added 2 commits that reference this issue on Apr 9, 2026
    5c3ac13
    b683446
  14. added a commit that references this issue on Apr 10, 2026
    d788fbf
  15. added a commit that references this issue on Apr 10, 2026
    5ed070b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.F-const_trait_impl`#![feature(const_trait_impl)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions