Skip to content

[ICE]: should have resolved vars before calling #153006

@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

//@compile-flags: -Znext-solver=globally
use std::mem::TransmuteFrom;
fn foo<const ASSUME: u8>()
where
    u8: TransmuteFrom<u8, ASSUME>,
{
}
fn main() {
    foo()
}

original:

#![feature(transmutability)]
use std::mem::TransmuteFrom;
fn foo<const ASSUME: u8>()
where
    u8: TransmuteFrom<u8, ASSUME>,
{
}
fn main() {
    foo()
}

Version information

rustc 1.95.0-nightly (1500f0f47 2026-02-22)
binary: rustc
commit-hash: 1500f0f47f5fe8ddcd6528f6c6c031b210b4eac5
commit-date: 2026-02-22
host: x86_64-unknown-linux-gnu
release: 1.95.0-nightly
LLVM version: 22.1.0

Possibly related line of code:

fn structurally_normalize_term<E: 'tcx>(
&self,
term: ty::Term<'tcx>,
fulfill_cx: &mut dyn TraitEngine<'tcx, E>,
) -> Result<ty::Term<'tcx>, Vec<E>> {
assert!(!term.is_infer(), "should have resolved vars before calling");
if self.infcx.next_trait_solver() {
if let None = term.to_alias_term() {
return Ok(term);
}

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Znext-solver=globally

Program output

error[E0658]: use of unstable library feature `transmutability`
 --> /tmp/icemaker_global_tempdir.bEz3nnIpkwl3/rustc_testrunner_tmpdir_reporting.MKlGUYiYI9Yj/mvce.rs:1:5
  |
1 | use std::mem::TransmuteFrom;
  |     ^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #99571 <https://github.com/rust-lang/rust/issues/99571> for more information
  = help: add `#![feature(transmutability)]` to the crate attributes to enable
  = note: this compiler was built on 2026-02-22; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature `transmutability`
 --> /tmp/icemaker_global_tempdir.bEz3nnIpkwl3/rustc_testrunner_tmpdir_reporting.MKlGUYiYI9Yj/mvce.rs:4:9
  |
4 |     u8: TransmuteFrom<u8, ASSUME>,
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #99571 <https://github.com/rust-lang/rust/issues/99571> for more information
  = help: add `#![feature(transmutability)]` to the crate attributes to enable
  = note: this compiler was built on 2026-02-22; consider upgrading it if it is out of date

error: the constant `ASSUME` is not of type `Assume`
  --> /tmp/icemaker_global_tempdir.bEz3nnIpkwl3/rustc_testrunner_tmpdir_reporting.MKlGUYiYI9Yj/mvce.rs:4:9
   |
 4 |     u8: TransmuteFrom<u8, ASSUME>,
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Assume`, found `u8`
   |
note: required by a const generic parameter in `TransmuteFrom`
  --> /home/matthias/.rustup/toolchains/master/lib/rustlib/src/rust/library/core/src/mem/transmutability.rs:91:37
   |
91 | pub unsafe trait TransmuteFrom<Src, const ASSUME: Assume = { Assume::NOTHING }>
   |                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this const generic parameter in `TransmuteFrom`


thread 'rustc' (483470) panicked at /rustc-dev/1500f0f47f5fe8ddcd6528f6c6c031b210b4eac5/compiler/rustc_trait_selection/src/traits/structural_normalize.rs:35:9:
should have resolved vars before calling
stack backtrace:
   0:     0x7f051c1b80eb - <<std[8fa6c4d7877d9fa6]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[8d2c922a005dfed9]::fmt::Display>::fmt
   1:     0x7f051c821648 - core[8d2c922a005dfed9]::fmt::write
   2:     0x7f051c1cf0f6 - <std[8fa6c4d7877d9fa6]::sys::stdio::unix::Stderr as std[8fa6c4d7877d9fa6]::io::Write>::write_fmt
   3:     0x7f051c18e1d8 - std[8fa6c4d7877d9fa6]::panicking::default_hook::{closure#0}
   4:     0x7f051c1ab553 - std[8fa6c4d7877d9fa6]::panicking::default_hook
   5:     0x7f051b184080 - std[8fa6c4d7877d9fa6]::panicking::update_hook::<alloc[e536beed0316d181]::boxed::Box<rustc_driver_impl[f1389595c05d78d8]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f051c1ab832 - std[8fa6c4d7877d9fa6]::panicking::panic_with_hook
   7:     0x7f051c18e2ca - std[8fa6c4d7877d9fa6]::panicking::panic_handler::{closure#0}
   8:     0x7f051c184fe9 - std[8fa6c4d7877d9fa6]::sys::backtrace::__rust_end_short_backtrace::<std[8fa6c4d7877d9fa6]::panicking::panic_handler::{closure#0}, !>
   9:     0x7f051c18fcfd - __rustc[d7af78fd024a5d6e]::rust_begin_unwind
  10:     0x7f05195ed78c - core[8d2c922a005dfed9]::panicking::panic_fmt
  11:     0x7f051bf19e86 - <rustc_infer[48338ecaa753e2f9]::infer::at::At as rustc_trait_selection[ffc7478ef7c84f11]::traits::structural_normalize::StructurallyNormalizeExt>::structurally_normalize_term::<rustc_infer[48338ecaa753e2f9]::traits::engine::ScrubbedTraitError>
  12:     0x7f051bfb67d0 - <rustc_trait_selection[ffc7478ef7c84f11]::traits::engine::ObligationCtxt>::structurally_normalize_const
  13:     0x7f051bfac868 - <rustc_trait_selection[ffc7478ef7c84f11]::error_reporting::TypeErrCtxt>::select_transmute_obligation_for_reporting
  14:     0x7f051bf89cd9 - <rustc_trait_selection[ffc7478ef7c84f11]::error_reporting::TypeErrCtxt>::report_selection_error
  15:     0x7f051aa6d7d6 - <rustc_trait_selection[ffc7478ef7c84f11]::error_reporting::TypeErrCtxt>::report_fulfillment_errors
  16:     0x7f051cc5c6f3 - <rustc_hir_typeck[aadce8c622caaa3b]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  17:     0x7f051cc6e431 - <rustc_hir_typeck[aadce8c622caaa3b]::fn_ctxt::FnCtxt>::check_expr_call
  18:     0x7f051cc59890 - <rustc_hir_typeck[aadce8c622caaa3b]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  19:     0x7f051cc53a70 - <rustc_hir_typeck[aadce8c622caaa3b]::fn_ctxt::FnCtxt>::check_expr_block
  20:     0x7f051cc59817 - <rustc_hir_typeck[aadce8c622caaa3b]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  21:     0x7f051cc28610 - rustc_hir_typeck[aadce8c622caaa3b]::check::check_fn
  22:     0x7f051d5f1332 - rustc_hir_typeck[aadce8c622caaa3b]::typeck_with_inspect::{closure#0}
  23:     0x7f051d5efd72 - rustc_query_impl[cec139e1f3385ac4]::query_impl::typeck::invoke_provider_fn::__rust_begin_short_backtrace
  24:     0x7f051cfb853e - rustc_query_impl[cec139e1f3385ac4]::execution::try_execute_query::<rustc_data_structures[1a0237db0a3cda6a]::vec_cache::VecCache<rustc_span[8a11d63785993c5a]::def_id::LocalDefId, rustc_middle[60c2cf3af82b0a08]::query::erase::ErasedData<[u8; 8usize]>, rustc_middle[60c2cf3af82b0a08]::dep_graph::graph::DepNodeIndex>, {rustc_query_impl[cec139e1f3385ac4]::QueryFlags { is_anon: false, is_depth_limit: false, is_feedable: false }}, false>
  25:     0x7f051cfb8109 - rustc_query_impl[cec139e1f3385ac4]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  26:     0x7f051cfb1b4e - <rustc_middle[60c2cf3af82b0a08]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis[a8016fad3afadedb]::check_crate::{closure#2}>::{closure#0}
  27:     0x7f051cfb156e - rustc_hir_analysis[a8016fad3afadedb]::check_crate
  28:     0x7f051cfb50ac - rustc_interface[b6ce98af9df5606d]::passes::analysis
  29:     0x7f051d9e1499 - rustc_query_impl[cec139e1f3385ac4]::execution::try_execute_query::<rustc_middle[60c2cf3af82b0a08]::query::caches::SingleCache<rustc_middle[60c2cf3af82b0a08]::query::erase::ErasedData<[u8; 0usize]>>, {rustc_query_impl[cec139e1f3385ac4]::QueryFlags { is_anon: false, is_depth_limit: false, is_feedable: false }}, false>
  30:     0x7f051d9e10c8 - rustc_query_impl[cec139e1f3385ac4]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  31:     0x7f051da2088b - rustc_interface[b6ce98af9df5606d]::interface::run_compiler::<(), rustc_driver_impl[f1389595c05d78d8]::run_compiler::{closure#0}>::{closure#1}
  32:     0x7f051d9d09fe - std[8fa6c4d7877d9fa6]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[b6ce98af9df5606d]::util::run_in_thread_with_globals<rustc_interface[b6ce98af9df5606d]::util::run_in_thread_pool_with_globals<rustc_interface[b6ce98af9df5606d]::interface::run_compiler<(), rustc_driver_impl[f1389595c05d78d8]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  33:     0x7f051d9d10e0 - <std[8fa6c4d7877d9fa6]::thread::lifecycle::spawn_unchecked<rustc_interface[b6ce98af9df5606d]::util::run_in_thread_with_globals<rustc_interface[b6ce98af9df5606d]::util::run_in_thread_pool_with_globals<rustc_interface[b6ce98af9df5606d]::interface::run_compiler<(), rustc_driver_impl[f1389595c05d78d8]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[8d2c922a005dfed9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  34:     0x7f051d9d1f6c - <std[8fa6c4d7877d9fa6]::sys::thread::unix::Thread>::new::thread_start
  35:     0x7f05174a598b - <unknown>
  36:     0x7f0517529a0c - <unknown>
  37:                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: please make sure that you have updated to the latest nightly

note: rustc 1.95.0-nightly (1500f0f47 2026-02-22) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z next-solver=globally -Z dump-mir-dir=dir

query stack during panic:
#0 [typeck] type-checking `main`
#1 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 3 previous errors

For more information about this error, try `rustc --explain E0658`.

@rustbot label +F-transmutability +WG-trait-system-refactor

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.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.WG-trait-system-refactorThe Rustc Trait System Refactor Initiative (-Znext-solver)needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions