rust-lang / rust-lang/rust

[ICE]: `called Result::unwrap() on an Err value: NoSolution`

Open
#162,377 2 comments 0 reactions 1 assignee View on GitHub

@darklyspaced is already working on this.

Since Sep 13, 2026.

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

Description

Code
#![feature(reborrow)]

use core::marker::{CoerceShared, PhantomData, Reborrow};
use core::ptr::NonNull;

pub struct Ref<'a, T> {
    ptr: NonNull<T>,
    phantom: PhantomData<&'a T>,
}

impl<'a, T> Clone for Ref<'a, T> {
    fn clone(&self) -> Self {
        Self {
            ptr: self.ptr,
            phantom: PhantomData,
        }
    }
}
impl<'a, T> Copy for Ref<'a, T> {}

#[derive(Reborrow, CoerceShared)]
#[coerce_shared(Ref<'a, T>)]
pub struct MutRef<'a, T> {
    ptr: NonNull<T>,
    // This below is the load bearing part of the ICE.
    phantom: PhantomData<&'a mut T>,
    // This type checks successfully.
    // phantom: PhantomData<&'a T>,
}

// This is required for the ICE to present itself.
fn coerce<'a, T>(ptr: &MutRef<'a, T>) -> Ref<'a, T> {
    *ptr
}
Meta

rustc --version --verbose:

rustc 1.100.0-nightly (f248f4038 2026-09-05)
binary: rustc
commit-hash: f248f4038796913873f11ca65b1b901e311c8dae
commit-date: 2026-09-05
host: x86_64-unknown-linux-gnu
release: 1.100.0-nightly
LLVM version: 23.1.1
Error output
thread 'rustc' (207684) panicked at /rustc-dev/f248f4038796913873f11ca65b1b901e311c8dae/compiler/rustc_borrowck/src/type_check/mod.rs:2638:22:
called `Result::unwrap()` on an `Err` value: NoSolution
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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: please attach the file at `[REDACTED]` to your bug report

note: rustc 1.100.0-nightly (f248f4038 2026-09-05) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [mir_borrowck] borrow-checking `coerce`
#1 [analysis] running analysis passes on crate `testing`
end of query stack
Backtrace

stack backtrace:
   0:     0x7967e62a94c5 - <std[61df1907fac46151]::backtrace::Backtrace>::create
   1:     0x7967e62a9415 - <std[61df1907fac46151]::backtrace::Backtrace>::force_capture
   2:     0x7967e520a1d3 - std[61df1907fac46151]::panicking::update_hook::<alloc[7e397f34f10f5a13]::boxed::Box<rustc_driver_impl[d0dfc904937c321c]::install_ice_hook::{closure#1}>>::{closure#0}
   3:     0x7967e62bf882 - std[61df1907fac46151]::panicking::panic_with_hook
   4:     0x7967e629da42 - std[61df1907fac46151]::panicking::panic_handler::{closure#0}
   5:     0x7967e6295b19 - std[61df1907fac46151]::sys::backtrace::__rust_end_short_backtrace::<std[61df1907fac46151]::panicking::panic_handler::{closure#0}, !>
   6:     0x7967e629f61d - __rustc[b2c26a8019506c29]::rust_begin_unwind
   7:     0x7967e2f1e3ac - core[7e687561305e769d]::panicking::panic_fmt
   8:     0x7967e241e082 - core[7e687561305e769d]::result::unwrap_failed
   9:     0x7967e8285022 - <rustc_borrowck[233f8885b19190d7]::type_check::TypeChecker as rustc_middle[789052493a7b00a6]::mir::visit::Visitor>::visit_body
  10:     0x7967e7cdac5b - rustc_borrowck[233f8885b19190d7]::borrowck_collect_region_constraints
  11:     0x7967e7cecbb8 - <rustc_borrowck[233f8885b19190d7]::root_cx::BorrowCheckRootCtxt>::do_mir_borrowck
  12:     0x7967e7ceba44 - rustc_borrowck[233f8885b19190d7]::mir_borrowck
  13:     0x7967e7ceb759 - rustc_query_impl[8ec6c8f76662406c]::query_vtables::mir_borrowck::invoke_provider_fn::__rust_begin_short_backtrace
  14:     0x7967e6e3fe73 - rustc_query_impl[8ec6c8f76662406c]::execution::try_execute_query::<rustc_data_structures[fcf0440987e88381]::vec_cache::VecCache<rustc_span[1e82e3f30aa7aabd]::def_id::LocalDefId, rustc_middle[789052493a7b00a6]::>
  15:     0x7967e6e2d7e8 - rustc_query_impl[8ec6c8f76662406c]::query_vtables::mir_borrowck::execute_query_incr::__rust_end_short_backtrace
  16:     0x7967e70a4015 - <rustc_middle[789052493a7b00a6]::ty::context::TyCtxt>::par_hir_body_owners::<rustc_interface[80d4db0ca0ab0929]::passes::run_required_analyses::{closure#2}::{closure#0}>::{closure#0}
  17:     0x7967e70a334e - rustc_interface[80d4db0ca0ab0929]::passes::analysis
  18:     0x7967e8208389 - rustc_query_impl[8ec6c8f76662406c]::execution::try_execute_query::<rustc_middle[789052493a7b00a6]::query::caches::SingleCache<rustc_middle[789052493a7b00a6]::query::erase::ErasedData<[u8; 0usize]>>, true>
  19:     0x7967e8207bdc - rustc_query_impl[8ec6c8f76662406c]::query_vtables::analysis::execute_query_incr::__rust_end_short_backtrace
  20:     0x7967e7d98a57 - rustc_interface[80d4db0ca0ab0929]::interface::run_compiler::<(), rustc_driver_impl[d0dfc904937c321c]::run_compiler::{closure#0}>::{closure#2}
  21:     0x7967e7e1c324 - std[61df1907fac46151]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[80d4db0ca0ab0929]::util::run_in_thread_with_globals<rustc_interface[80d4db0ca0ab0929]::util::run_in_thread_pool_with_globals>
  22:     0x7967e7e1c0cb - <std[61df1907fac46151]::thread::lifecycle::spawn_unchecked<rustc_interface[80d4db0ca0ab0929]::util::run_in_thread_with_globals<rustc_interface[80d4db0ca0ab0929]::util::run_in_thread_pool_with_globals<rustc_inte>
  23:     0x7967e7e1f187 - <std[61df1907fac46151]::sys::thread::unix::Thread>::new::thread_start
  24:     0x7967e0e9cb84 - start_thread
                               at ./nptl/pthread_create.c:447:8
  25:     0x7967e0f29d6c - clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:78:0
  26:                0x0 - <unknown>

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.