Skip to content

Panic on missing type on static item #130478

@rakita

Description

@rakita

Code

    pub fn get(&self) -> &KzgSettings {
        match self {
            Self::Default => {
                cfg_if::cfg_if! {
                    if #[cfg(feature = "c-kzg")] {
                        c_kzg::ethereum_kzg_settings()
                    } else if #[cfg(feature = "kzg-rs")] {
                        static DEFAULT = once_cell::race::OnceBox::<KzgSettings>::new();
                        DEFAULT.get_or_init(|| {
                            KzgSettings::load_trusted_setup_file()
                                .expect("failed to load default trusted setup")
                        })
                    } else {
                        unimplemented!()
                    }
                }
            }
            Self::Custom(settings) => settings,
        }
    }

Meta

rustc --version --verbose:

rustc 1.81.0 (eeb90cda1 2024-09-04)
binary: rustc
commit-hash: eeb90cda1969383f56a2637cbd3037bdf598841c
commit-date: 2024-09-04
host: aarch64-apple-darwin
release: 1.81.0
LLVM version: 18.1.7

Error output

Panic on `cargo check  --no-default-features --features=kzg-rs`. Backtrace included
Backtrace

<backtrace>
error: missing type for `static` item
  --> crates/wiring/src/kzg.rs:31:39
   |
31 |                         static DEFAULT = once_cell::race::OnceBox::<KzgSettings>::new();
   |                                       ^ help: provide a type for the static variable: `: OnceBox<KzgSettings>`

thread 'rustc' panicked at compiler/rustc_const_eval/src/interpret/validity.rs:741:21:
assertion `left == right` failed
  left: Mut
 right: Not
stack backtrace:
   0:        0x101dc373c - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h243268f17d714c7f
   1:        0x101e06688 - core::fmt::write::hb3cfb8a30e72d7ff
   2:        0x101db9720 - std::io::Write::write_fmt::hfb2314975de9ecf1
   3:        0x101dc5c4c - std::panicking::default_hook::{{closure}}::h14c7718ccf39d316
   4:        0x101dc5870 - std::panicking::default_hook::hc62e60da3be2f352
   5:        0x10b9bc5b8 - <alloc[47bc6d386d7ae45f]::boxed::Box<rustc_driver_impl[54c40c94c6cfc0b2]::install_ice_hook::{closure#0}> as core[f827f14b5e761a5d]::ops::function::Fn<(&dyn for<'a, 'b> core[f827f14b5e761a5d]::ops::function::Fn<(&'a std[4f7d7c3ef984657a]::panic::PanicHookInfo<'b>,), Output = ()> + core[f827f14b5e761a5d]::marker::Sync + core[f827f14b5e761a5d]::marker::Send, &std[4f7d7c3ef984657a]::panic::PanicHookInfo)>>::call
   6:        0x101dc6868 - std::panicking::rust_panic_with_hook::h09e8a656f11e82b2
   7:        0x101dc6178 - std::panicking::begin_panic_handler::{{closure}}::h1230eb3cc91b241c
   8:        0x101dc3bc8 - std::sys::backtrace::__rust_end_short_backtrace::hc3491307aceda2c2
   9:        0x101dc5e40 - _rust_begin_unwind
  10:        0x101e20ad8 - core::panicking::panic_fmt::ha4b80a05b9fff47a
  11:        0x101e20e98 - core::panicking::assert_failed_inner::h57b35cd882aa8c8a
  12:        0x10fd230e4 - core[f827f14b5e761a5d]::panicking::assert_failed::<rustc_ast_ir[f3187cbcb70e5154]::Mutability, rustc_ast_ir[f3187cbcb70e5154]::Mutability>
  13:        0x10b8be9fc - rustc_const_eval[21ec315fa1b71203]::interpret::validity::mutability::<rustc_const_eval[21ec315fa1b71203]::const_eval::machine::CompileTimeMachine>
  14:        0x10b8bec7c - <rustc_const_eval[21ec315fa1b71203]::interpret::validity::ValidityVisitor<rustc_const_eval[21ec315fa1b71203]::const_eval::machine::CompileTimeMachine> as rustc_const_eval[21ec315fa1b71203]::interpret::visitor::ValueVisitor<rustc_const_eval[21ec315fa1b71203]::const_eval::machine::CompileTimeMachine>>::visit_value
  15:        0x10b8bfae0 - <rustc_const_eval[21ec315fa1b71203]::interpret::validity::ValidityVisitor<rustc_const_eval[21ec315fa1b71203]::const_eval::machine::CompileTimeMachine> as rustc_const_eval[21ec315fa1b71203]::interpret::visitor::ValueVisitor<rustc_const_eval[21ec315fa1b71203]::const_eval::machine::CompileTimeMachine>>::walk_value
  16:        0x10b8bee70 - <rustc_const_eval[21ec315fa1b71203]::interpret::validity::ValidityVisitor<rustc_const_eval[21ec315fa1b71203]::const_eval::machine::CompileTimeMachine> as rustc_const_eval[21ec315fa1b71203]::interpret::visitor::ValueVisitor<rustc_const_eval[21ec315fa1b71203]::const_eval::machine::CompileTimeMachine>>::visit_value
  17:        0x10b8bfae0 - <rustc_const_eval[21ec315fa1b71203]::interpret::validity::ValidityVisitor<rustc_const_eval[21ec315fa1b71203]::const_eval::machine::CompileTimeMachine> as rustc_const_eval[21ec315fa1b71203]::interpret::visitor::ValueVisitor<rustc_const_eval[21ec315fa1b71203]::const_eval::machine::CompileTimeMachine>>::walk_value
  18:        0x10b86dcbc - <rustc_const_eval[21ec315fa1b71203]::interpret::eval_context::InterpCx<rustc_const_eval[21ec315fa1b71203]::const_eval::machine::CompileTimeMachine>>::validate_operand_internal
  19:        0x10b8db56c - rustc_const_eval[21ec315fa1b71203]::const_eval::eval_queries::eval_static_initializer_provider
  20:        0x10ce28988 - rustc_query_impl[5e7782f17777a7c9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5e7782f17777a7c9]::query_impl::eval_static_initializer::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5a798f9924bfd2e0]::query::erase::Erased<[u8; 16usize]>>
  21:        0x10ce71414 - <rustc_query_impl[5e7782f17777a7c9]::query_impl::eval_static_initializer::dynamic_query::{closure#2} as core[f827f14b5e761a5d]::ops::function::FnOnce<(rustc_middle[5a798f9924bfd2e0]::ty::context::TyCtxt, rustc_span[ab16d476329f5d04]::def_id::DefId)>>::call_once
  22:        0x10cd80fd4 - rustc_query_system[5f1672c0485b57da]::query::plumbing::try_execute_query::<rustc_query_impl[5e7782f17777a7c9]::DynamicConfig<rustc_query_system[5f1672c0485b57da]::query::caches::DefIdCache<rustc_middle[5a798f9924bfd2e0]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[5e7782f17777a7c9]::plumbing::QueryCtxt, true>
  23:        0x10ceb2408 - rustc_query_impl[5e7782f17777a7c9]::query_impl::eval_static_initializer::get_query_incr::__rust_end_short_backtrace
  24:        0x10bc38214 - <rustc_data_structures[5fa37262921da6b8]::sync::parallel::ParallelGuard>::run::<(), rustc_data_structures[5fa37262921da6b8]::sync::parallel::disabled::par_for_each_in<&[rustc_span[ab16d476329f5d04]::def_id::LocalDefId], <rustc_middle[5a798f9924bfd2e0]::hir::map::Map>::par_body_owners<rustc_hir_analysis[b55295e9540087c6]::check_crate::{closure#3}>::{closure#0}>::{closure#0}::{closure#0}::{closure#0}>
  25:        0x10bd5ee80 - rustc_hir_analysis[b55295e9540087c6]::check_crate
  26:        0x10c252dc0 - rustc_interface[1340bb505392beac]::passes::analysis
  27:        0x10ce2adf8 - rustc_query_impl[5e7782f17777a7c9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5e7782f17777a7c9]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[5a798f9924bfd2e0]::query::erase::Erased<[u8; 1usize]>>
  28:        0x10ce798ac - <rustc_query_impl[5e7782f17777a7c9]::query_impl::analysis::dynamic_query::{closure#2} as core[f827f14b5e761a5d]::ops::function::FnOnce<(rustc_middle[5a798f9924bfd2e0]::ty::context::TyCtxt, ())>>::call_once
  29:        0x10cd90b4c - rustc_query_system[5f1672c0485b57da]::query::plumbing::try_execute_query::<rustc_query_impl[5e7782f17777a7c9]::DynamicConfig<rustc_query_system[5f1672c0485b57da]::query::caches::SingleCache<rustc_middle[5a798f9924bfd2e0]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[5e7782f17777a7c9]::plumbing::QueryCtxt, true>
  30:        0x10cea28a4 - rustc_query_impl[5e7782f17777a7c9]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
  31:        0x10b9a70b4 - <rustc_interface[1340bb505392beac]::queries::QueryResult<&rustc_middle[5a798f9924bfd2e0]::ty::context::GlobalCtxt>>::enter::<core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>, rustc_driver_impl[54c40c94c6cfc0b2]::run_compiler::{closure#0}::{closure#1}::{closure#5}>
  32:        0x10b9be1a0 - <rustc_interface[1340bb505392beac]::interface::Compiler>::enter::<rustc_driver_impl[54c40c94c6cfc0b2]::run_compiler::{closure#0}::{closure#1}, core[f827f14b5e761a5d]::result::Result<core[f827f14b5e761a5d]::option::Option<rustc_interface[1340bb505392beac]::queries::Linker>, rustc_span[ab16d476329f5d04]::ErrorGuaranteed>>
  33:        0x10b9b298c - <scoped_tls[df49f867320abf2e]::ScopedKey<rustc_span[ab16d476329f5d04]::SessionGlobals>>::set::<rustc_interface[1340bb505392beac]::util::run_in_thread_with_globals<rustc_interface[1340bb505392beac]::interface::run_compiler<core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>, rustc_driver_impl[54c40c94c6cfc0b2]::run_compiler::{closure#0}>::{closure#1}, core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}, core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>>
  34:        0x10b9bdb34 - rustc_span[ab16d476329f5d04]::create_session_globals_then::<core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>, rustc_interface[1340bb505392beac]::util::run_in_thread_with_globals<rustc_interface[1340bb505392beac]::interface::run_compiler<core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>, rustc_driver_impl[54c40c94c6cfc0b2]::run_compiler::{closure#0}>::{closure#1}, core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}>
  35:        0x10b9db8fc - std[4f7d7c3ef984657a]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[1340bb505392beac]::util::run_in_thread_with_globals<rustc_interface[1340bb505392beac]::interface::run_compiler<core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>, rustc_driver_impl[54c40c94c6cfc0b2]::run_compiler::{closure#0}>::{closure#1}, core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>>
  36:        0x10b9bb7dc - <<std[4f7d7c3ef984657a]::thread::Builder>::spawn_unchecked_<rustc_interface[1340bb505392beac]::util::run_in_thread_with_globals<rustc_interface[1340bb505392beac]::interface::run_compiler<core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>, rustc_driver_impl[54c40c94c6cfc0b2]::run_compiler::{closure#0}>::{closure#1}, core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[f827f14b5e761a5d]::result::Result<(), rustc_span[ab16d476329f5d04]::ErrorGuaranteed>>::{closure#1} as core[f827f14b5e761a5d]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  37:        0x101dcefa4 - std::sys::pal::unix::thread::Thread::new::thread_start::h1bd1b9c95010bf71
  38:        0x18b536034 - __pthread_joiner_wake

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.81.0 (eeb90cda1 2024-09-04) running on aarch64-apple-darwin

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C split-debuginfo=unpacked -C incremental=[REDACTED]

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

query stack during panic:
#0 [eval_static_initializer] evaluating initializer of static `kzg::<impl at crates/wiring/src/kzg.rs:20:1: 20:20>::get::DEFAULT`
#1 [analysis] running analysis passes on this crate
end of query stack

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-needs-reproStatus: This issue has no reproduction and needs a reproduction to make progress.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions