rust-lang / rust-lang/rust

[ICE]: `Unable to construct rustc_transmute::Assume where it was previously possible`

Open
#156,099 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug F-generic_const_exprs F-transmutability I-ICE needs-triage T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

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

Meta

rustc --version --verbose:

rustc 1.97.0-nightly (a3e96d8cb 2026-05-02)
binary: rustc
commit-hash: a3e96d8cb8a420022828d0a595277ad3671928a7
commit-date: 2026-05-02
host: x86_64-unknown-linux-gnu
release: 1.97.0-nightly
LLVM version: 22.1.4
Error output
<output>
Backtrace

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

warning: function `foo` is never used
 --> code.rs:3:4
  |
3 | fn foo()
  |    ^^^
  |
  = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default

warning: 2 warnings emitted

note: no errors encountered even though delayed bugs were created

note: those delayed bugs will now be shown as internal compiler errors

error: internal compiler error: Unable to construct rustc_transmute::Assume where it was previously possible
 --> code.rs:5:5
  |
5 |     u8: TransmuteFrom<Option<String>>,
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
note: delayed at /rustc-dev/a3e96d8cb8a420022828d0a595277ad3671928a7/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:2918:28
         0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
         2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
         3: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, &str>
         4: <rustc_trait_selection::error_reporting::TypeErrCtxt>::get_safe_transmute_error_and_reason
         5: <rustc_trait_selection::error_reporting::TypeErrCtxt>::report_selection_error
         6: <rustc_trait_selection::error_reporting::TypeErrCtxt>::report_fulfillment_errors
         7: rustc_hir_analysis::check::wfcheck::check_item_fn
         8: rustc_hir_analysis::check::check::check_item_type
         9: rustc_hir_analysis::check::wfcheck::check_well_formed
        10: rustc_query_impl::query_impl::check_well_formed::invoke_provider_fn::__rust_begin_short_backtrace
        11: rustc_query_impl::execution::try_execute_query::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::ErasedData<[u8; 1]>, rustc_middle::dep_graph::graph::DepNodeIndex>, false>
        12: rustc_query_impl::query_impl::check_well_formed::execute_query_non_incr::__rust_end_short_backtrace
        13: rustc_hir_analysis::check::wfcheck::check_type_wf
        14: rustc_query_impl::query_impl::check_type_wf::invoke_provider_fn::__rust_begin_short_backtrace
        15: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 1]>>, false>
        16: rustc_query_impl::query_impl::check_type_wf::execute_query_non_incr::__rust_end_short_backtrace
        17: rustc_hir_analysis::check_crate
        18: rustc_interface::passes::analysis
        19: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 0]>>, false>
        20: rustc_query_impl::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
        21: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
        22: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
        23: <std::thread::lifecycle::spawn_unchecked<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        24: <std::sys::thread::unix::Thread>::new::thread_start
        25: <unknown>
        26: <unknown>

 --> code.rs:5:5
  |
5 |     u8: TransmuteFrom<Option<String>>,
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: internal compiler error: silent safe transmute error
 --> code.rs:5:5
  |
5 |     u8: TransmuteFrom<Option<String>>,
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
note: delayed at /rustc-dev/a3e96d8cb8a420022828d0a595277ad3671928a7/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs:261:55
         0: <rustc_errors::DiagCtxtInner>::emit_diagnostic
         1: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
         2: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
         3: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, &str>
         4: <rustc_trait_selection::error_reporting::TypeErrCtxt>::report_selection_error
         5: <rustc_trait_selection::error_reporting::TypeErrCtxt>::report_fulfillment_errors
         6: rustc_hir_analysis::check::wfcheck::check_item_fn
         7: rustc_hir_analysis::check::check::check_item_type
         8: rustc_hir_analysis::check::wfcheck::check_well_formed
         9: rustc_query_impl::query_impl::check_well_formed::invoke_provider_fn::__rust_begin_short_backtrace
        10: rustc_query_impl::execution::try_execute_query::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::ErasedData<[u8; 1]>, rustc_middle::dep_graph::graph::DepNodeIndex>, false>
        11: rustc_query_impl::query_impl::check_well_formed::execute_query_non_incr::__rust_end_short_backtrace
        12: rustc_hir_analysis::check::wfcheck::check_type_wf
        13: rustc_query_impl::query_impl::check_type_wf::invoke_provider_fn::__rust_begin_short_backtrace
        14: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 1]>>, false>
        15: rustc_query_impl::query_impl::check_type_wf::execute_query_non_incr::__rust_end_short_backtrace
        16: rustc_hir_analysis::check_crate
        17: rustc_interface::passes::analysis
        18: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 0]>>, false>
        19: rustc_query_impl::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
        20: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
        21: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
        22: <std::thread::lifecycle::spawn_unchecked<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
        23: <std::sys::thread::unix::Thread>::new::thread_start
        24: <unknown>
        25: <unknown>

 --> code.rs:5:5
  |
5 |     u8: TransmuteFrom<Option<String>>,
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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 `/tmp/im/rustc-ice-2026-05-03T07_18_47-1169877.txt` to your bug report

note: rustc 1.97.0-nightly (a3e96d8cb 2026-05-02) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the provided code with the reported nightly compiler. Read compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs around the reported lines 261 and 2918, then trace the safe-transmute error reporting path. Done means the example no longer produces an internal compiler error and reports the underlying failure normally.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.