Skip to content

[ICE]: Inconsistent rustc_transmute::is_transmutable(...) result, got Yes #151462

@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

//@compile-flags: -Znext-solver=globally
#![feature(lazy_type_alias)]
mod assert {
    use std::mem::{Assume, TransmuteFrom};

    pub fn is_maybe_transmutable<Src, Dst>()
    where
        Src: TransmuteFrom<
            Src,
            {
                Assume {
                    alignment: true,
                    lifetimes: true,
                    safety: true,
                    validity: true,
                }
            },
        >,
    {
    }
}

fn test() {
    type JustUnit = ();
    assert::is_maybe_transmutable::<JustUnit, ()>();
}

original:

#![crate_type = "lib"]
#![feature(transmutability)]
#![allow(dead_code)]

mod assert {
    use std::mem::{Assume, TransmuteFrom};

    pub fn is_maybe_transmutable<Src, Dst>()
    where
        Src: TransmuteFrom<
            Src,
            { Assume { alignment: true, lifetimes: true, safety: true, validity: true } },
        >,
    {
    }
}

fn test() {
    type NaughtyLenArray = [u32; 3.14159]; //~ ERROR mismatched types
    type JustUnit = ();
    assert::is_maybe_transmutable::<JustUnit, NaughtyLenArray>();
}

Version information

rustc 1.95.0-nightly (625b63f9e 2026-01-21)
binary: rustc
commit-hash: 625b63f9e148d511e187c71e5f70643ee62c77fb
commit-date: 2026-01-21
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 -Zcrate-attr=feature(lazy_type_alias) -Znext-solver=globally

Program output

warning: the feature `lazy_type_alias` is incomplete and may not be safe to use and/or cause compiler crashes
 --> <crate attribute>:1:12
  |
1 | #![feature(lazy_type_alias)]
  |            ^^^^^^^^^^^^^^^
  |
  = note: see issue #112792 <https://github.com/rust-lang/rust/issues/112792> for more information
  = note: `#[warn(incomplete_features)]` on by default

error[E0601]: `main` function not found in crate `mvce`
  --> /tmp/icemaker_global_tempdir.gg9Pr5Yja9Sx/rustc_testrunner_tmpdir_reporting.Oy5LenqijqTQ/mvce.rs:24:2
   |
24 | }
   |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.gg9Pr5Yja9Sx/rustc_testrunner_tmpdir_reporting.Oy5LenqijqTQ/mvce.rs`

error[E0658]: use of unstable library feature `transmutability`
 --> /tmp/icemaker_global_tempdir.gg9Pr5Yja9Sx/rustc_testrunner_tmpdir_reporting.Oy5LenqijqTQ/mvce.rs:2:20
  |
2 |     use std::mem::{Assume, 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-21; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature `transmutability`
 --> /tmp/icemaker_global_tempdir.gg9Pr5Yja9Sx/rustc_testrunner_tmpdir_reporting.Oy5LenqijqTQ/mvce.rs:2:28
  |
2 |     use std::mem::{Assume, 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-21; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature `transmutability`
  --> /tmp/icemaker_global_tempdir.gg9Pr5Yja9Sx/rustc_testrunner_tmpdir_reporting.Oy5LenqijqTQ/mvce.rs:6:14
   |
 6 |           Src: TransmuteFrom<
   |  ______________^
 7 | |             Src,
 8 | |             {
 9 | |                 Assume {
...  |
15 | |             },
16 | |         >,
   | |_________^
   |
   = 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-21; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature `transmutability`
 --> /tmp/icemaker_global_tempdir.gg9Pr5Yja9Sx/rustc_testrunner_tmpdir_reporting.Oy5LenqijqTQ/mvce.rs:9:17
  |
9 |                 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-01-21; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature `transmutability`
  --> /tmp/icemaker_global_tempdir.gg9Pr5Yja9Sx/rustc_testrunner_tmpdir_reporting.Oy5LenqijqTQ/mvce.rs:10:21
   |
10 |                     alignment: true,
   |                     ^^^^^^^^^^^^^^^
   |
   = 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-21; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature `transmutability`
  --> /tmp/icemaker_global_tempdir.gg9Pr5Yja9Sx/rustc_testrunner_tmpdir_reporting.Oy5LenqijqTQ/mvce.rs:11:21
   |
11 |                     lifetimes: true,
   |                     ^^^^^^^^^^^^^^^
   |
   = 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-21; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature `transmutability`
  --> /tmp/icemaker_global_tempdir.gg9Pr5Yja9Sx/rustc_testrunner_tmpdir_reporting.Oy5LenqijqTQ/mvce.rs:12:21
   |
12 |                     safety: true,
   |                     ^^^^^^^^^^^^
   |
   = 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-21; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature `transmutability`
  --> /tmp/icemaker_global_tempdir.gg9Pr5Yja9Sx/rustc_testrunner_tmpdir_reporting.Oy5LenqijqTQ/mvce.rs:13:21
   |
13 |                     validity: true,
   |                     ^^^^^^^^^^^^^^
   |
   = 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-21; consider upgrading it if it is out of date

error[E0658]: use of unstable library feature `transmutability`
  --> /tmp/icemaker_global_tempdir.gg9Pr5Yja9Sx/rustc_testrunner_tmpdir_reporting.Oy5LenqijqTQ/mvce.rs:6:14
   |
 6 |           Src: TransmuteFrom<
   |  ______________^
 7 | |             Src,
 8 | |             {
 9 | |                 Assume {
...  |
15 | |             },
16 | |         >,
   | |_________^
   |
   = help: add `#![feature(transmutability)]` to the crate attributes to enable
   = note: this compiler was built on 2026-01-21; 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/625b63f9e148d511e187c71e5f70643ee62c77fb/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:2917:32: Inconsistent rustc_transmute::is_transmutable(...) result, got Yes
  --> /tmp/icemaker_global_tempdir.gg9Pr5Yja9Sx/rustc_testrunner_tmpdir_reporting.Oy5LenqijqTQ/mvce.rs:23:37
   |
23 |     assert::is_maybe_transmutable::<JustUnit, ()>();
   |                                     ^^^^^^^^


thread 'rustc' (207340) panicked at /rustc-dev/625b63f9e148d511e187c71e5f70643ee62c77fb/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:2917:32:
Box<dyn Any>
stack backtrace:
   0:     0x7f1a9fa10cf3 - <<std[fb3d5c90ac5b7f63]::sys::backtrace::BacktraceLock>::print::DisplayBacktrace as core[f6b43ac8430f38c9]::fmt::Display>::fmt
   1:     0x7f1aa0009756 - core[f6b43ac8430f38c9]::fmt::write
   2:     0x7f1a9fa276e6 - <std[fb3d5c90ac5b7f63]::sys::stdio::unix::Stderr as std[fb3d5c90ac5b7f63]::io::Write>::write_fmt
   3:     0x7f1a9f9e6d28 - std[fb3d5c90ac5b7f63]::panicking::default_hook::{closure#0}
   4:     0x7f1a9fa04423 - std[fb3d5c90ac5b7f63]::panicking::default_hook
   5:     0x7f1a9e9e607a - std[fb3d5c90ac5b7f63]::panicking::update_hook::<alloc[f2f1d3597b721dce]::boxed::Box<rustc_driver_impl[e2906432e8e0cdf6]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7f1a9fa04702 - std[fb3d5c90ac5b7f63]::panicking::panic_with_hook
   7:     0x7f1a9ea24371 - std[fb3d5c90ac5b7f63]::panicking::begin_panic::<rustc_errors[a7fc3a61ce6b7a9f]::ExplicitBug>::{closure#0}
   8:     0x7f1a9ea14a26 - std[fb3d5c90ac5b7f63]::sys::backtrace::__rust_end_short_backtrace::<std[fb3d5c90ac5b7f63]::panicking::begin_panic<rustc_errors[a7fc3a61ce6b7a9f]::ExplicitBug>::{closure#0}, !>
   9:     0x7f1a9ea1478f - std[fb3d5c90ac5b7f63]::panicking::begin_panic::<rustc_errors[a7fc3a61ce6b7a9f]::ExplicitBug>
  10:     0x7f1a9ea42171 - <rustc_errors[a7fc3a61ce6b7a9f]::diagnostic::BugAbort as rustc_errors[a7fc3a61ce6b7a9f]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  11:     0x7f1a9efc406c - <rustc_errors[a7fc3a61ce6b7a9f]::DiagCtxtHandle>::span_bug::<rustc_span[c096204aa74ff282]::span_encoding::Span, alloc[f2f1d3597b721dce]::string::String>
  12:     0x7f1a9efe6786 - rustc_middle[7c1e44e38e5ae512]::util::bug::opt_span_bug_fmt::<rustc_span[c096204aa74ff282]::span_encoding::Span>::{closure#0}
  13:     0x7f1a9efe6932 - rustc_middle[7c1e44e38e5ae512]::ty::context::tls::with_opt::<rustc_middle[7c1e44e38e5ae512]::util::bug::opt_span_bug_fmt<rustc_span[c096204aa74ff282]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x7f1a9efd7b7b - rustc_middle[7c1e44e38e5ae512]::ty::context::tls::with_context_opt::<rustc_middle[7c1e44e38e5ae512]::ty::context::tls::with_opt<rustc_middle[7c1e44e38e5ae512]::util::bug::opt_span_bug_fmt<rustc_span[c096204aa74ff282]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x7f1a9c983588 - rustc_middle[7c1e44e38e5ae512]::util::bug::span_bug_fmt::<rustc_span[c096204aa74ff282]::span_encoding::Span>
  16:     0x7f1a9f8014c4 - <rustc_trait_selection[b2a773cbaa62fcc]::error_reporting::TypeErrCtxt>::get_safe_transmute_error_and_reason
  17:     0x7f1a9f7e047c - <rustc_trait_selection[b2a773cbaa62fcc]::error_reporting::TypeErrCtxt>::report_selection_error
  18:     0x7f1a9e300e7d - <rustc_trait_selection[b2a773cbaa62fcc]::error_reporting::TypeErrCtxt>::report_fulfillment_errors
  19:     0x7f1aa04fd25e - <rustc_hir_typeck[ab0658cefcf568dd]::fn_ctxt::FnCtxt>::check_expr_call
  20:     0x7f1aa05176eb - <rustc_hir_typeck[ab0658cefcf568dd]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  21:     0x7f1aa04b0563 - <rustc_hir_typeck[ab0658cefcf568dd]::fn_ctxt::FnCtxt>::check_expr_block
  22:     0x7f1aa05178c5 - <rustc_hir_typeck[ab0658cefcf568dd]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  23:     0x7f1aa04ab99f - rustc_hir_typeck[ab0658cefcf568dd]::check::check_fn
  24:     0x7f1aa0d9e2cb - rustc_hir_typeck[ab0658cefcf568dd]::typeck_with_inspect::{closure#0}
  25:     0x7f1aa0d9ccf0 - rustc_query_impl[b1dbb5ee6e859e63]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b1dbb5ee6e859e63]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[7c1e44e38e5ae512]::query::erase::Erased<[u8; 8usize]>>
  26:     0x7f1aa01e5dea - rustc_query_system[662316397b943afb]::query::plumbing::try_execute_query::<rustc_query_impl[b1dbb5ee6e859e63]::DynamicConfig<rustc_data_structures[147b1c54dfb69980]::vec_cache::VecCache<rustc_span[c096204aa74ff282]::def_id::LocalDefId, rustc_middle[7c1e44e38e5ae512]::query::erase::Erased<[u8; 8usize]>, rustc_query_system[662316397b943afb]::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl[b1dbb5ee6e859e63]::plumbing::QueryCtxt, false>
  27:     0x7f1aa01e56c9 - rustc_query_impl[b1dbb5ee6e859e63]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7f1aa0ca732d - <rustc_middle[7c1e44e38e5ae512]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_hir_analysis[bccf3aa92971e1a2]::check_crate::{closure#2}>::{closure#0}
  29:     0x7f1aa0ca6d42 - rustc_hir_analysis[bccf3aa92971e1a2]::check_crate
  30:     0x7f1aa01df95b - rustc_interface[c96bb79ace64ec0a]::passes::analysis
  31:     0x7f1aa01df5a7 - rustc_query_impl[b1dbb5ee6e859e63]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b1dbb5ee6e859e63]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[7c1e44e38e5ae512]::query::erase::Erased<[u8; 0usize]>>
  32:     0x7f1aa12418e3 - rustc_query_system[662316397b943afb]::query::plumbing::try_execute_query::<rustc_query_impl[b1dbb5ee6e859e63]::DynamicConfig<rustc_query_system[662316397b943afb]::query::caches::SingleCache<rustc_middle[7c1e44e38e5ae512]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[b1dbb5ee6e859e63]::plumbing::QueryCtxt, false>
  33:     0x7f1aa12416ce - rustc_query_impl[b1dbb5ee6e859e63]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  34:     0x7f1aa136d8d1 - <rustc_interface[c96bb79ace64ec0a]::passes::create_and_enter_global_ctxt<core[f6b43ac8430f38c9]::option::Option<rustc_interface[c96bb79ace64ec0a]::queries::Linker>, rustc_driver_impl[e2906432e8e0cdf6]::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core[f6b43ac8430f38c9]::ops::function::FnOnce<(&rustc_session[ded86e37f409d2a]::session::Session, rustc_middle[7c1e44e38e5ae512]::ty::context::CurrentGcx, alloc[f2f1d3597b721dce]::sync::Arc<rustc_data_structures[147b1c54dfb69980]::jobserver::Proxy>, &std[fb3d5c90ac5b7f63]::sync::once_lock::OnceLock<rustc_middle[7c1e44e38e5ae512]::ty::context::GlobalCtxt>, &rustc_data_structures[147b1c54dfb69980]::sync::worker_local::WorkerLocal<rustc_middle[7c1e44e38e5ae512]::arena::Arena>, &rustc_data_structures[147b1c54dfb69980]::sync::worker_local::WorkerLocal<rustc_hir[586ee495a70320e8]::Arena>, rustc_driver_impl[e2906432e8e0cdf6]::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
  35:     0x7f1aa11af82a - rustc_interface[c96bb79ace64ec0a]::interface::run_compiler::<(), rustc_driver_impl[e2906432e8e0cdf6]::run_compiler::{closure#0}>::{closure#1}
  36:     0x7f1aa11dfb7e - std[fb3d5c90ac5b7f63]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[c96bb79ace64ec0a]::util::run_in_thread_with_globals<rustc_interface[c96bb79ace64ec0a]::util::run_in_thread_pool_with_globals<rustc_interface[c96bb79ace64ec0a]::interface::run_compiler<(), rustc_driver_impl[e2906432e8e0cdf6]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  37:     0x7f1aa11e00a0 - <std[fb3d5c90ac5b7f63]::thread::lifecycle::spawn_unchecked<rustc_interface[c96bb79ace64ec0a]::util::run_in_thread_with_globals<rustc_interface[c96bb79ace64ec0a]::util::run_in_thread_pool_with_globals<rustc_interface[c96bb79ace64ec0a]::interface::run_compiler<(), rustc_driver_impl[e2906432e8e0cdf6]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[f6b43ac8430f38c9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  38:     0x7f1aa11e0f68 - <std[fb3d5c90ac5b7f63]::sys::thread::unix::Thread>::new::thread_start
  39:     0x7f1a9aa9698b - <unknown>
  40:     0x7f1a9ab1a9cc - <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 (625b63f9e 2026-01-21) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z crate-attr=feature(lazy_type_alias) -Z next-solver=globally -Z dump-mir-dir=dir

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

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

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

Metadata

Metadata

Assignees

Labels

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