Skip to content

ICE: valtree: expected leaf, got Value #150506

@matthiaskrgr

Description

@matthiaskrgr

Code

#![feature(min_generic_const_args)]
#![feature(transmutability)]

fn main() {}

mod assert {
    use std::mem::{Assume, TransmuteFrom};
    struct Dst {}
    fn is_maybe_transmutable()
    where
        Dst: TransmuteFrom<
            (),
            {
                Assume {
                    alignment: Assume {},
                    lifetimes: const { true },
                    safety: const { true },
                    validity: const { true },
                }
            },
        >,
    {
    }
}

Meta

rustc --version --verbose:

rustc 1.94.0-nightly (56f24e00c 2025-12-29)
binary: rustc
commit-hash: 56f24e00c62ec2db9a8b407e7aef532caaf71062
commit-date: 2025-12-29
host: x86_64-unknown-linux-gnu
release: 1.94.0-nightly
LLVM version: 21.1.8

Error output

error: struct expression with missing field initialiser for `alignment`
  --> code.rs:15:32
   |
15 |                     alignment: Assume {},
   |                                ^^^^^^

error: struct expression with missing field initialiser for `lifetimes`
  --> code.rs:15:32
   |
15 |                     alignment: Assume {},
   |                                ^^^^^^

error: struct expression with missing field initialiser for `safety`
  --> code.rs:15:32
   |
15 |                     alignment: Assume {},
   |                                ^^^^^^

error: struct expression with missing field initialiser for `validity`
  --> code.rs:15:32
   |
15 |                     alignment: Assume {},
   |                                ^^^^^^
Backtrace


```error: internal compiler error: /rustc-dev/56f24e00c62ec2db9a8b407e7aef532caaf71062/compiler/rustc_middle/src/ty/consts/valtree.rs:159:40: expected leaf, got Value { ty: std::mem::Assume, valtree: Branch([{const error}, {const error}, {const error}, {const error}]) }


thread 'rustc' (3844444) panicked at /rustc-dev/56f24e00c62ec2db9a8b407e7aef532caaf71062/compiler/rustc_middle/src/ty/consts/valtree.rs:159:40:
Box<dyn Any>
stack backtrace:
   0:     0x7fae89c4dd03 - <<std[f3a57754886c7fb2]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[8a6ed22ea881a8cb]::fmt::Display>::fmt
   1:     0x7fae8a210b48 - core[8a6ed22ea881a8cb]::fmt::write
   2:     0x7fae89c64416 - <std[f3a57754886c7fb2]::sys::stdio::unix::Stderr as std[f3a57754886c7fb2]::io::Write>::write_fmt
   3:     0x7fae89c245b8 - std[f3a57754886c7fb2]::panicking::default_hook::{closure#0}
   4:     0x7fae89c41c43 - std[f3a57754886c7fb2]::panicking::default_hook
   5:     0x7fae88c21a5a - std[f3a57754886c7fb2]::panicking::update_hook::<alloc[1d6b3c33e0f4de11]::boxed::Box<rustc_driver_impl[6a7be9e1e9fa397f]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7fae89c41f22 - std[f3a57754886c7fb2]::panicking::panic_with_hook
   7:     0x7fae88c5e301 - std[f3a57754886c7fb2]::panicking::begin_panic::<rustc_errors[664c3640727ede8e]::ExplicitBug>::{closure#0}
   8:     0x7fae88c4e966 - std[f3a57754886c7fb2]::sys::backtrace::__rust_end_short_backtrace::<std[f3a57754886c7fb2]::panicking::begin_panic<rustc_errors[664c3640727ede8e]::ExplicitBug>::{closure#0}, !>
   9:     0x7fae88c4e59f - std[f3a57754886c7fb2]::panicking::begin_panic::<rustc_errors[664c3640727ede8e]::ExplicitBug>
  10:     0x7fae88c7c241 - <rustc_errors[664c3640727ede8e]::diagnostic::BugAbort as rustc_errors[664c3640727ede8e]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  11:     0x7fae8922b7a9 - rustc_middle[d64d9de6cd50ee9e]::util::bug::opt_span_bug_fmt::<rustc_span[4944cb2db7cdecd5]::span_encoding::Span>::{closure#0}
  12:     0x7fae8922b932 - rustc_middle[d64d9de6cd50ee9e]::ty::context::tls::with_opt::<rustc_middle[d64d9de6cd50ee9e]::util::bug::opt_span_bug_fmt<rustc_span[4944cb2db7cdecd5]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  13:     0x7fae8921cd3b - rustc_middle[d64d9de6cd50ee9e]::ty::context::tls::with_context_opt::<rustc_middle[d64d9de6cd50ee9e]::ty::context::tls::with_opt<rustc_middle[d64d9de6cd50ee9e]::util::bug::opt_span_bug_fmt<rustc_span[4944cb2db7cdecd5]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  14:     0x7fae8680ea64 - rustc_middle[d64d9de6cd50ee9e]::util::bug::bug_fmt
  15:     0x7fae89b6713f - <rustc_transmute[c4405421b0ac0cb5]::Assume>::from_const
  16:     0x7fae8b19ce5e - <rustc_trait_selection[dcbc30d4103d7f98]::traits::select::SelectionContext>::confirm_candidate
  17:     0x7fae8a4b4c23 - <rustc_trait_selection[dcbc30d4103d7f98]::traits::select::SelectionContext>::evaluate_trait_predicate_recursively
  18:     0x7fae8a48f11c - <rustc_trait_selection[dcbc30d4103d7f98]::traits::select::SelectionContext>::evaluate_root_obligation
  19:     0x7fae8a48d3b2 - rustc_traits[4835aa45ad1d92a1]::evaluate_obligation::evaluate_obligation
  20:     0x7fae8a48cce9 - rustc_query_impl[af29d8227245b9b8]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[af29d8227245b9b8]::query_impl::evaluate_obligation::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d64d9de6cd50ee9e]::query::erase::Erased<[u8; 2usize]>>
  21:     0x7fae8a48bea1 - rustc_query_system[38d99c914916a494]::query::plumbing::try_execute_query::<rustc_query_impl[af29d8227245b9b8]::DynamicConfig<rustc_query_system[38d99c914916a494]::query::caches::DefaultCache<rustc_type_ir[1c04adc5ce1a83a7]::canonical::CanonicalQueryInput<rustc_middle[d64d9de6cd50ee9e]::ty::context::TyCtxt, rustc_middle[d64d9de6cd50ee9e]::ty::ParamEnvAnd<rustc_middle[d64d9de6cd50ee9e]::ty::predicate::Predicate>>, rustc_middle[d64d9de6cd50ee9e]::query::erase::Erased<[u8; 2usize]>>, false, false, false>, rustc_query_impl[af29d8227245b9b8]::plumbing::QueryCtxt, false>
  22:     0x7fae8a48baf1 - rustc_query_impl[af29d8227245b9b8]::query_impl::evaluate_obligation::get_query_non_incr::__rust_end_short_backtrace
  23:     0x7fae8a8d4dc2 - <rustc_trait_selection[dcbc30d4103d7f98]::traits::fulfill::FulfillProcessor as rustc_data_structures[9ed66e451837e56]::obligation_forest::ObligationProcessor>::process_obligation
  24:     0x7fae8a2045a4 - <rustc_data_structures[9ed66e451837e56]::obligation_forest::ObligationForest<rustc_trait_selection[dcbc30d4103d7f98]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[dcbc30d4103d7f98]::traits::fulfill::FulfillProcessor>
  25:     0x7fae8aad85b2 - <rustc_trait_selection[dcbc30d4103d7f98]::traits::fulfill::FulfillmentContext<rustc_trait_selection[dcbc30d4103d7f98]::traits::FulfillmentError> as rustc_infer[d68c34913411bc97]::traits::engine::TraitEngine<rustc_trait_selection[dcbc30d4103d7f98]::traits::FulfillmentError>>::evaluate_obligations_error_on_ambiguity
  26:     0x7fae8aad08ef - rustc_hir_analysis[729b60c7a4d556f9]::check::wfcheck::check_item_fn
  27:     0x7fae8aa0a4c2 - rustc_hir_analysis[729b60c7a4d556f9]::check::check::check_item_type
  28:     0x7fae8aa06576 - rustc_hir_analysis[729b60c7a4d556f9]::check::wfcheck::check_well_formed
  29:     0x7fae8aa06557 - rustc_query_impl[af29d8227245b9b8]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[af29d8227245b9b8]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d64d9de6cd50ee9e]::query::erase::Erased<[u8; 1usize]>>
  30:     0x7fae8aa05dcd - rustc_query_system[38d99c914916a494]::query::plumbing::try_execute_query::<rustc_query_impl[af29d8227245b9b8]::DynamicConfig<rustc_data_structures[9ed66e451837e56]::vec_cache::VecCache<rustc_span[4944cb2db7cdecd5]::def_id::LocalDefId, rustc_middle[d64d9de6cd50ee9e]::query::erase::Erased<[u8; 1usize]>, rustc_query_system[38d99c914916a494]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[af29d8227245b9b8]::plumbing::QueryCtxt, false>
  31:     0x7fae8aa058d6 - rustc_query_impl[af29d8227245b9b8]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  32:     0x7fae8aa03070 - rustc_hir_analysis[729b60c7a4d556f9]::check::wfcheck::check_type_wf
  33:     0x7fae8aa02f5d - rustc_query_impl[af29d8227245b9b8]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[af29d8227245b9b8]::query_impl::check_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d64d9de6cd50ee9e]::query::erase::Erased<[u8; 1usize]>>
  34:     0x7fae8b359b88 - rustc_query_system[38d99c914916a494]::query::plumbing::try_execute_query::<rustc_query_impl[af29d8227245b9b8]::DynamicConfig<rustc_query_system[38d99c914916a494]::query::caches::SingleCache<rustc_middle[d64d9de6cd50ee9e]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[af29d8227245b9b8]::plumbing::QueryCtxt, false>
  35:     0x7fae8b35994e - rustc_query_impl[af29d8227245b9b8]::query_impl::check_type_wf::get_query_non_incr::__rust_end_short_backtrace
  36:     0x7fae8a91a334 - rustc_hir_analysis[729b60c7a4d556f9]::check_crate
  37:     0x7fae8b053e1b - rustc_interface[6e17731c7eb03393]::passes::analysis
  38:     0x7fae8b053a75 - rustc_query_impl[af29d8227245b9b8]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[af29d8227245b9b8]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d64d9de6cd50ee9e]::query::erase::Erased<[u8; 0usize]>>
  39:     0x7fae8b35b366 - rustc_query_system[38d99c914916a494]::query::plumbing::try_execute_query::<rustc_query_impl[af29d8227245b9b8]::DynamicConfig<rustc_query_system[38d99c914916a494]::query::caches::SingleCache<rustc_middle[d64d9de6cd50ee9e]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[af29d8227245b9b8]::plumbing::QueryCtxt, false>
  40:     0x7fae8b35af36 - rustc_query_impl[af29d8227245b9b8]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  41:     0x7fae8b52dcd1 - <rustc_interface[6e17731c7eb03393]::passes::create_and_enter_global_ctxt<core[8a6ed22ea881a8cb]::option::Option<rustc_interface[6e17731c7eb03393]::queries::Linker>, rustc_driver_impl[6a7be9e1e9fa397f]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[8a6ed22ea881a8cb]::ops::function::FnOnce<(&rustc_session[dc82c22dadb31e90]::session::Session, rustc_middle[d64d9de6cd50ee9e]::ty::context::CurrentGcx, alloc[1d6b3c33e0f4de11]::sync::Arc<rustc_data_structures[9ed66e451837e56]::jobserver::Proxy>, &std[f3a57754886c7fb2]::sync::once_lock::OnceLock<rustc_middle[d64d9de6cd50ee9e]::ty::context::GlobalCtxt>, &rustc_data_structures[9ed66e451837e56]::sync::worker_local::WorkerLocal<rustc_middle[d64d9de6cd50ee9e]::arena::Arena>, &rustc_data_structures[9ed66e451837e56]::sync::worker_local::WorkerLocal<rustc_hir[dd3d5f943bb98ed5]::Arena>, rustc_driver_impl[6a7be9e1e9fa397f]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
  42:     0x7fae8b3dcd98 - rustc_interface[6e17731c7eb03393]::interface::run_compiler::<(), rustc_driver_impl[6a7be9e1e9fa397f]::run_compiler::{closure#0}>::{closure#1}
  43:     0x7fae8b34928e - std[f3a57754886c7fb2]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[6e17731c7eb03393]::util::run_in_thread_with_globals<rustc_interface[6e17731c7eb03393]::util::run_in_thread_pool_with_globals<rustc_interface[6e17731c7eb03393]::interface::run_compiler<(), rustc_driver_impl[6a7be9e1e9fa397f]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  44:     0x7fae8b349060 - <std[f3a57754886c7fb2]::thread::lifecycle::spawn_unchecked<rustc_interface[6e17731c7eb03393]::util::run_in_thread_with_globals<rustc_interface[6e17731c7eb03393]::util::run_in_thread_pool_with_globals<rustc_interface[6e17731c7eb03393]::interface::run_compiler<(), rustc_driver_impl[6a7be9e1e9fa397f]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[8a6ed22ea881a8cb]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  45:     0x7fae8b347438 - <std[f3a57754886c7fb2]::sys::thread::unix::Thread>::new::thread_start
  46:     0x7fae84c9698b - <unknown>
  47:     0x7fae84d1a9cc - <unknown>
  48:                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: please make sure that you have updated to the latest nightly

note: please attach the file at `/home/matthias/vcs/github/CRED/rustc-ice-2025-12-30T10_29_43-3844426.txt` to your bug report

note: rustc 1.94.0-nightly (56f24e00c 2025-12-29) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `assert::Dst: core::mem::transmutability::TransmuteFrom<(), ValTree(Branch([ValTree(Branch([{const error}, {const error}, {const error}, {const error}]): core::mem::transmutability::Assume), ValTree(Leaf(0x01): bool), ValTree(Leaf(0x01): bool), ValTree(Leaf(0x01): bool)]): core::mem::transmutability::Assume)>`
#1 [check_well_formed] checking that `assert::is_maybe_transmutable` is well-formed
#2 [check_type_wf] checking that types are well-formed
#3 [analysis] running analysis passes on crate `code`
end of query stack
error: aborting due to 5 previous errors; 1 warning emitted

</p>
</details>


<!-- TRIAGEBOT_START -->

<!-- TRIAGEBOT_ASSIGN_START -->

<!-- TRIAGEBOT_ASSIGN_END -->
<!-- TRIAGEBOT_END -->

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.F-min_generic_const_args`#![feature(min_generic_const_args)]`F-transmutability`#![feature(transmutability)]`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.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions