Skip to content

ICE:called Result::unwrap() on an Err value: NoSolution #141806

Open
@sososopy

Description

@sososopy

The code is generated by a fuzzer and reduced manually
I tried searching but couldn't find any related errors

Code

trait Trait<T> {}
struct X;
fn func<T>(x: *const dyn Trait<X>)
where
    for<'a> T_1: Sized,
{
    let x: *const dyn Trait<T> = x as _;
}

Meta

rustc --version --verbose:

rustc 1.89.0-nightly (70b3f4666 2025-05-30)
binary: rustc
commit-hash: 70b3f4666e24ce22fc32f5e357dbcf85d3254e63
commit-date: 2025-05-30
host: x86_64-pc-windows-msvc
release: 1.89.0-nightly
LLVM version: 20.1.5

Error output

error[E0412]: cannot find type `T_1` in this scope
 --> .\test.rs:5:13
  |
5 |     for<'a> T_1: Sized,
  |             ^^^ not found in this scope
Backtrace

thread 'rustc' panicked at compiler\rustc_borrowck\src\type_check\mod.rs:1546:38:
called `Result::unwrap()` on an `Err` value: NoSolution
stack backtrace:
   0:     0x7ffe27e06082 - std::backtrace_rs::backtrace::win64::trace
                               at /rustc/70b3f4666e24ce22fc32f5e357dbcf85d3254e63/library\std\src\..\..\backtrace\src\backtrace\win64.rs:85
   1:     0x7ffe27e06082 - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/70b3f4666e24ce22fc32f5e357dbcf85d3254e63/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ffe27e06082 - std::sys::backtrace::_print_fmt
                               at /rustc/70b3f4666e24ce22fc32f5e357dbcf85d3254e63/library\std\src\sys\backtrace.rs:66
   3:     0x7ffe27e06082 - std::sys::backtrace::impl$0::print::impl$0::fmt
                               at /rustc/70b3f4666e24ce22fc32f5e357dbcf85d3254e63/library\std\src\sys\backtrace.rs:39
   4:     0x7ffe27e39beb - core::fmt::rt::Argument::fmt
                               at /rustc/70b3f4666e24ce22fc32f5e357dbcf85d3254e63/library\core\src\fmt\rt.rs:173
   5:     0x7ffe27e39beb - core::fmt::write
                               at /rustc/70b3f4666e24ce22fc32f5e357dbcf85d3254e63/library\core\src\fmt\mod.rs:1446
   6:     0x7ffe27dfb9f7 - std::io::default_write_fmt
                               at /rustc/70b3f4666e24ce22fc32f5e357dbcf85d3254e63/library\std\src\io\mod.rs:639
   7:     0x7ffe27dfb9f7 - std::io::Write::write_fmt<std::sys::stdio::windows::Stderr>
                               at /rustc/70b3f4666e24ce22fc32f5e357dbcf85d3254e63/library\std\src\io\mod.rs:1914
   8:     0x7ffe27e05ec5 - std::sys::backtrace::BacktraceLock::print
                               at /rustc/70b3f4666e24ce22fc32f5e357dbcf85d3254e63/library\std\src\sys\backtrace.rs:42
   9:     0x7ffe27e0bc5a - std::panicking::default_hook::closure$0
                               at /rustc/70b3f4666e24ce22fc32f5e357dbcf85d3254e63/library\std\src\panicking.rs:300
  10:     0x7ffe27e0b9f0 - std::panicking::default_hook
                               at /rustc/70b3f4666e24ce22fc32f5e357dbcf85d3254e63/library\std\src\panicking.rs:327
  11:     0x7ffe295e4939 - core[41883027321c69d]::slice::sort::unstable::heapsort::heapsort::<((rustc_lint_defs[c6afabcd45b33dea]::Level, &str), usize), <((rustc_lint_defs[c6afabcd45b33dea]::Level, &str), usize) as core[41883027321c69d]::cmp::PartialOrd>::lt>
  12:     0x7ffe27e0c8de - std::panicking::rust_panic_with_hook
                               at /rustc/70b3f4666e24ce22fc32f5e357dbcf85d3254e63/library\std\src\panicking.rs:841
  13:     0x7ffe27e0c639 - std::panicking::begin_panic_handler::closure$0
                               at /rustc/70b3f4666e24ce22fc32f5e357dbcf85d3254e63/library\std\src\panicking.rs:706
  14:     0x7ffe27e06e4f - std::sys::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>
                               at /rustc/70b3f4666e24ce22fc32f5e357dbcf85d3254e63/library\std\src\sys\backtrace.rs:168
  15:     0x7ffe27e0c23e - std::panicking::begin_panic_handler
                               at /rustc/70b3f4666e24ce22fc32f5e357dbcf85d3254e63/library\std\src\panicking.rs:697
  16:     0x7ffe2b032461 - core::panicking::panic_fmt
                               at /rustc/70b3f4666e24ce22fc32f5e357dbcf85d3254e63/library\core\src\panicking.rs:75
  17:     0x7ffe2b032a20 - core::result::unwrap_failed
                               at /rustc/70b3f4666e24ce22fc32f5e357dbcf85d3254e63/library\core\src\result.rs:1762
  18:     0x7ffe28679067 - <rustc_borrowck[e7ef4d8e0c81bd89]::type_check::TypeChecker as rustc_middle[7d96dcf9592acf23]::mir::visit::Visitor>::visit_rvalue
  19:     0x7ffe2862b4d8 - <rustc_borrowck[e7ef4d8e0c81bd89]::type_check::TypeChecker as rustc_middle[7d96dcf9592acf23]::mir::visit::Visitor>::visit_body
  20:     0x7ffe286b7380 - <rustc_borrowck[e7ef4d8e0c81bd89]::type_check::TypeChecker as rustc_middle[7d96dcf9592acf23]::mir::visit::Visitor>::visit_const_operand
  21:     0x7ffe285d927d - rustc_borrowck[e7ef4d8e0c81bd89]::mir_borrowck
  22:     0x7ffe28d6ae4b - rustc_query_impl[678ad264131b9188]::plumbing::query_key_hash_verify_all
  23:     0x7ffe28cb05a4 - RINvNtNtCs41YRoa67ONq_18rustc_query_system5query8plumbing17try_execute_queryINtCs8T9uthRx4cC_16rustc_query_impl13DynamicConfigINtNtCs2IPh3W6Af3f_21rustc_data_structures9vec_cache8VecCacheNtNtCsCuiHuraXL5_10rustc_span6def_id10LocalDefIdINtNtNtCsaMvyobqvdvz_
  24:     0x7ffe28d745d2 - rustc_query_impl[678ad264131b9188]::plumbing::query_key_hash_verify_all
  25:     0x7ffe27e7b084 - <rustc_interface[d66ed646d922d3e3]::passes::LintStoreExpandImpl as rustc_expand[32f7ad9713d55b7b]::base::LintStoreExpand>::pre_expansion_lint
  26:     0x7ffe24443d47 - rustc_interface[d66ed646d922d3e3]::passes::analysis
  27:     0x7ffe279ce36a - <alloc[40671bb55bd7e7eb]::sync::Arc<rustc_session[1833ef01fbdfa47f]::config::OutputFilenames>>::drop_slow
  28:     0x7ffe278d3c6a - RINvNtNtCs41YRoa67ONq_18rustc_query_system5query8plumbing17try_execute_queryINtCs8T9uthRx4cC_16rustc_query_impl13DynamicConfigINtNtB4_6caches11SingleCacheINtNtNtCsaMvyobqvdvz_12rustc_middle5query5erase6ErasedAhj0_EEKb0_KB3s_KB3s_ENtNtB1f_8plumbing9QueryCtx
  29:     0x7ffe279d4693 - rustc_query_impl[678ad264131b9188]::query_system
  30:     0x7ffe244091b4 - std[aa810135f6511839]::sys::backtrace::__rust_begin_short_backtrace::<<std[aa810135f6511839]::thread::Builder>::spawn_unchecked_<ctrlc[f2e6f1d10cfc7921]::set_handler_inner<rustc_driver_impl[e74b92f706932448]::install_ctrlc_handler::{closure#0}>::{closure#0}, ()>::{closure#1}::{closure#0}::{closure#0}, ()>
  31:     0x7ffe24403465 - std[aa810135f6511839]::sys::backtrace::__rust_begin_short_backtrace::<<std[aa810135f6511839]::thread::Builder>::spawn_unchecked_<ctrlc[f2e6f1d10cfc7921]::set_handler_inner<rustc_driver_impl[e74b92f706932448]::install_ctrlc_handler::{closure#0}>::{closure#0}, ()>::{closure#1}::{closure#0}::{closure#0}, ()>
  32:     0x7ffe243fed0f - RINvNtNtCseDAtLUMLJ79_3std3sys9backtrace28___rust_begin_short_backtraceNCNCINvNtCsipq8CQmOuQ1_15rustc_interface4util26run_in_thread_with_globalsNCINvB1e_31run_in_thread_pool_with_globalsNCINvNtB1g_9interface12run_compileruNCNvCsjRb60sNhVyu_17rustc_driver_i
  33:     0x7ffe2440d53d - std[aa810135f6511839]::sys::backtrace::__rust_begin_short_backtrace::<<std[aa810135f6511839]::thread::Builder>::spawn_unchecked_<ctrlc[f2e6f1d10cfc7921]::set_handler_inner<rustc_driver_impl[e74b92f706932448]::install_ctrlc_handler::{closure#0}>::{closure#0}, ()>::{closure#1}::{closure#0}::{closure#0}, ()>
  34:     0x7ffe27e10c3d - alloc::boxed::impl$28::call_once
                               at /rustc/70b3f4666e24ce22fc32f5e357dbcf85d3254e63/library\alloc\src\boxed.rs:1966
  35:     0x7ffe27e10c3d - alloc::boxed::impl$28::call_once
                               at /rustc/70b3f4666e24ce22fc32f5e357dbcf85d3254e63/library\alloc\src\boxed.rs:1966
  36:     0x7ffe27e10c3d - std::sys::pal::windows::thread::impl$0::new::thread_start
                               at /rustc/70b3f4666e24ce22fc32f5e357dbcf85d3254e63/library\std\src\sys\pal\windows\thread.rs:56
  37:     0x7ffedfd37374 - BaseThreadInitThunk
  38:     0x7ffee13bcc91 - RtlUserThreadStart

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

query stack during panic:
#0 [mir_borrowck] borrow-checking `func`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 1 previous error; 1 warning emitted

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions