Skip to content

ICE: Inconsistent rustc_transmute::is_transmutable(...) result, got Yes #151300

@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

//@compile-flags: -Znext-solver=globally
use std::mem::TransmuteFrom;

pub fn is_maybe_transmutable<Src, Dst>()
where
    Dst: TransmuteFrom<Src>,
{
}

fn function_with_generic<T>() {
    is_maybe_transmutable::<(), ()>();
}

original:

//@ check-pass
#![crate_type = "lib"]
#![feature(transmutability)]
use std::mem::TransmuteFrom;

pub fn is_maybe_transmutable<Src, Dst>()
where
    Dst: TransmuteFrom<Src>,
{
}

// The `T` here should not have any effect on checking
// if transmutability is allowed or not.
fn function_with_generic<T>() {
    is_maybe_transmutable::<(), ()>();
}

Version information

rustc 1.95.0-nightly (621d76794 2026-01-18)
binary: rustc
commit-hash: 621d76794c76fc21c0a6151fbc090120e0230a91
commit-date: 2026-01-18
host: x86_64-unknown-linux-gnu
release: 1.95.0-nightly
LLVM version: 21.1.8

Possibly related line of code:

GetSafeTransmuteErrorAndReason::Error {
err_msg,
safe_transmute_explanation: Some(safe_transmute_explanation),
}
}
// Should never get a Yes at this point! We already ran it before, and did not get a Yes.
Answer::Yes => span_bug!(
span,
"Inconsistent rustc_transmute::is_transmutable(...) result, got Yes",
),
// Reached when a different obligation (namely `Freeze`) causes the
// transmutability analysis to fail. In this case, silence the
// transmutability error message in favor of that more specific

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

Program output

error[E0601]: `main` function not found in crate `mvce`
  --> /tmp/icemaker_global_tempdir.7EzZ1PoWdaSk/rustc_testrunner_tmpdir_reporting.1DgCHdjrCYC2/mvce.rs:11:2
   |
11 | }
   |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.7EzZ1PoWdaSk/rustc_testrunner_tmpdir_reporting.1DgCHdjrCYC2/mvce.rs`

error[E0658]: use of unstable library feature `transmutability`
 --> /tmp/icemaker_global_tempdir.7EzZ1PoWdaSk/rustc_testrunner_tmpdir_reporting.1DgCHdjrCYC2/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-01-18; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature `transmutability`
 --> /tmp/icemaker_global_tempdir.7EzZ1PoWdaSk/rustc_testrunner_tmpdir_reporting.1DgCHdjrCYC2/mvce.rs:5:10
  |
5 |     Dst: TransmuteFrom<Src>,
  |          ^^^^^^^^^^^^^^^^^^
  |
  = 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-01-18; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature `transmutability`
  --> /tmp/icemaker_global_tempdir.7EzZ1PoWdaSk/rustc_testrunner_tmpdir_reporting.1DgCHdjrCYC2/mvce.rs:5:10
   |
 5 |     Dst: TransmuteFrom<Src>,
   |          ^^^^^^^^^^^^^^^^^^
   |
   = help: add `#![feature(transmutability)]` to the crate attributes to enable
   = note: this compiler was built on 2026-01-18; consider upgrading it if it is out of date
note: required by a bound in `TransmuteFrom`
  --> /home/matthias/.rustup/toolchains/master/lib/rustlib/src/rust/library/core/src/mem/transmutability.rs:86:1
   |
86 | #[unstable_feature_bound(transmutability)]
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `TransmuteFrom`
...
91 | pub unsafe trait TransmuteFrom<Src, const ASSUME: Assume = { Assume::NOTHING }>
   |                  ------------- required by a bound in this trait

error: internal compiler error: /rustc-dev/621d76794c76fc21c0a6151fbc090120e0230a91/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:2886:32: Inconsistent rustc_transmute::is_transmutable(...) result, got Yes
  --> /tmp/icemaker_global_tempdir.7EzZ1PoWdaSk/rustc_testrunner_tmpdir_reporting.1DgCHdjrCYC2/mvce.rs:10:33
   |
10 |     is_maybe_transmutable::<(), ()>();
   |                                 ^^


thread 'rustc' (1001615) panicked at /rustc-dev/621d76794c76fc21c0a6151fbc090120e0230a91/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:2886:32:
Box<dyn Any>
stack backtrace:
   0:     0x7fd962e33fd3 - <<std[287527946f71f0bc]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[7477a31a1a34cc49]::fmt::Display>::fmt
   1:     0x7fd96340e2c8 - core[7477a31a1a34cc49]::fmt::write
   2:     0x7fd962e4a9c6 - <std[287527946f71f0bc]::sys::stdio::unix::Stderr as std[287527946f71f0bc]::io::Write>::write_fmt
   3:     0x7fd962e0a048 - std[287527946f71f0bc]::panicking::default_hook::{closure#0}
   4:     0x7fd962e27703 - std[287527946f71f0bc]::panicking::default_hook
   5:     0x7fd961dfbb8a - std[287527946f71f0bc]::panicking::update_hook::<alloc[979041e9952e771b]::boxed::Box<rustc_driver_impl[517260a07841a630]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7fd962e279e2 - std[287527946f71f0bc]::panicking::panic_with_hook
   7:     0x7fd961e38bc1 - std[287527946f71f0bc]::panicking::begin_panic::<rustc_errors[26c9ea40265c581b]::ExplicitBug>::{closure#0}
   8:     0x7fd961e28fe6 - std[287527946f71f0bc]::sys::backtrace::__rust_end_short_backtrace::<std[287527946f71f0bc]::panicking::begin_panic<rustc_errors[26c9ea40265c581b]::ExplicitBug>::{closure#0}, !>
   9:     0x7fd961e264b9 - std[287527946f71f0bc]::panicking::begin_panic::<rustc_errors[26c9ea40265c581b]::ExplicitBug>
  10:     0x7fd961e56901 - <rustc_errors[26c9ea40265c581b]::diagnostic::BugAbort as rustc_errors[26c9ea40265c581b]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  11:     0x7fd9623e492c - <rustc_errors[26c9ea40265c581b]::DiagCtxtHandle>::span_bug::<rustc_span[851f35e07e3c2dd4]::span_encoding::Span, alloc[979041e9952e771b]::string::String>
  12:     0x7fd9624074d6 - rustc_middle[725063e074f29df]::util::bug::opt_span_bug_fmt::<rustc_span[851f35e07e3c2dd4]::span_encoding::Span>::{closure#0}
  13:     0x7fd962407682 - rustc_middle[725063e074f29df]::ty::context::tls::with_opt::<rustc_middle[725063e074f29df]::util::bug::opt_span_bug_fmt<rustc_span[851f35e07e3c2dd4]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x7fd9623f8cab - rustc_middle[725063e074f29df]::ty::context::tls::with_context_opt::<rustc_middle[725063e074f29df]::ty::context::tls::with_opt<rustc_middle[725063e074f29df]::util::bug::opt_span_bug_fmt<rustc_span[851f35e07e3c2dd4]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x7fd95fcafa68 - rustc_middle[725063e074f29df]::util::bug::span_bug_fmt::<rustc_span[851f35e07e3c2dd4]::span_encoding::Span>
  16:     0x7fd962c1e874 - <rustc_trait_selection[9fee51d8a10a777c]::error_reporting::TypeErrCtxt>::get_safe_transmute_error_and_reason
  17:     0x7fd962bfd5dc - <rustc_trait_selection[9fee51d8a10a777c]::error_reporting::TypeErrCtxt>::report_selection_error
  18:     0x7fd961725777 - <rustc_trait_selection[9fee51d8a10a777c]::error_reporting::TypeErrCtxt>::report_fulfillment_errors
  19:     0x7fd963843835 - <rustc_hir_typeck[ed5453188701a25b]::fn_ctxt::FnCtxt>::check_expr_call
  20:     0x7fd9638199b0 - <rustc_hir_typeck[ed5453188701a25b]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  21:     0x7fd963814ac2 - <rustc_hir_typeck[ed5453188701a25b]::fn_ctxt::FnCtxt>::check_expr_block
  22:     0x7fd96381998b - <rustc_hir_typeck[ed5453188701a25b]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  23:     0x7fd9637fa1a6 - rustc_hir_typeck[ed5453188701a25b]::check::check_fn
  24:     0x7fd9641b3d33 - rustc_hir_typeck[ed5453188701a25b]::typeck_with_inspect::{closure#0}
  25:     0x7fd9641b26b4 - rustc_query_impl[f20b8284200e680a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f20b8284200e680a]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[725063e074f29df]::query::erase::Erased<[u8; 8usize]>>
  26:     0x7fd96355522a - rustc_query_system[b7e73caa2c2ad9a]::query::plumbing::try_execute_query::<rustc_query_impl[f20b8284200e680a]::DynamicConfig<rustc_data_structures[e0d8483206daafa2]::vec_cache::VecCache<rustc_span[851f35e07e3c2dd4]::def_id::LocalDefId, rustc_middle[725063e074f29df]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[b7e73caa2c2ad9a]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[f20b8284200e680a]::plumbing::QueryCtxt, false>
  27:     0x7fd963554b09 - rustc_query_impl[f20b8284200e680a]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7fd963f3fdb5 - <rustc_middle[725063e074f29df]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis[1a80394817eddfdd]::check_crate::{closure#2}>::{closure#0}
  29:     0x7fd963f3f7c4 - rustc_hir_analysis[1a80394817eddfdd]::check_crate
  30:     0x7fd9635493db - rustc_interface[5c48368f5debe80d]::passes::analysis
  31:     0x7fd963549035 - rustc_query_impl[f20b8284200e680a]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[f20b8284200e680a]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[725063e074f29df]::query::erase::Erased<[u8; 0usize]>>
  32:     0x7fd9645a4be3 - rustc_query_system[b7e73caa2c2ad9a]::query::plumbing::try_execute_query::<rustc_query_impl[f20b8284200e680a]::DynamicConfig<rustc_query_system[b7e73caa2c2ad9a]::query::caches::SingleCache<rustc_middle[725063e074f29df]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[f20b8284200e680a]::plumbing::QueryCtxt, false>
  33:     0x7fd9645a49ce - rustc_query_impl[f20b8284200e680a]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  34:     0x7fd964782c11 - <rustc_interface[5c48368f5debe80d]::passes::create_and_enter_global_ctxt<core[7477a31a1a34cc49]::option::Option<rustc_interface[5c48368f5debe80d]::queries::Linker>, rustc_driver_impl[517260a07841a630]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[7477a31a1a34cc49]::ops::function::FnOnce<(&rustc_session[eb79e6d3104f29ae]::session::Session, rustc_middle[725063e074f29df]::ty::context::CurrentGcx, alloc[979041e9952e771b]::sync::Arc<rustc_data_structures[e0d8483206daafa2]::jobserver::Proxy>, &std[287527946f71f0bc]::sync::once_lock::OnceLock<rustc_middle[725063e074f29df]::ty::context::GlobalCtxt>, &rustc_data_structures[e0d8483206daafa2]::sync::worker_local::WorkerLocal<rustc_middle[725063e074f29df]::arena::Arena>, &rustc_data_structures[e0d8483206daafa2]::sync::worker_local::WorkerLocal<rustc_hir[7eac7792dedc1861]::Arena>, rustc_driver_impl[517260a07841a630]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
  35:     0x7fd9645f5d34 - rustc_interface[5c48368f5debe80d]::interface::run_compiler::<(), rustc_driver_impl[517260a07841a630]::run_compiler::{closure#0}>::{closure#1}
  36:     0x7fd96455aa3a - std[287527946f71f0bc]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[5c48368f5debe80d]::util::run_in_thread_with_globals<rustc_interface[5c48368f5debe80d]::util::run_in_thread_pool_with_globals<rustc_interface[5c48368f5debe80d]::interface::run_compiler<(), rustc_driver_impl[517260a07841a630]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  37:     0x7fd96455a7fe - <std[287527946f71f0bc]::thread::lifecycle::spawn_unchecked<rustc_interface[5c48368f5debe80d]::util::run_in_thread_with_globals<rustc_interface[5c48368f5debe80d]::util::run_in_thread_pool_with_globals<rustc_interface[5c48368f5debe80d]::interface::run_compiler<(), rustc_driver_impl[517260a07841a630]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[7477a31a1a34cc49]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  38:     0x7fd96455c5c4 - <std[287527946f71f0bc]::sys::thread::unix::Thread>::new::thread_start
  39:     0x7fd95de9698b - <unknown>
  40:     0x7fd95df1a9cc - <unknown>
  41:                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: rustc 1.95.0-nightly (621d76794 2026-01-18) 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 `function_with_generic`
#1 [analysis] running analysis passes on crate `mvce`
end of query stack
error: aborting due to 5 previous errors

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

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

Metadata

Metadata

Assignees

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)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions