rust-lang / rust-lang/rust

[ICE]: next solver: ` error performing operation: fully_perform` / `OpaqueTypeStorage`

Open
#159,171 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug F-type_alias_impl_trait I-ICE needs-triage T-compiler WG-trait-system-refactor
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

code:

//@compile-flags: -Znext-solver=globally
#![feature(type_alias_impl_trait)]
fn id2<'a, 'b>(s: (&'a str, &'b str)) -> (&'a str, &'b str) {
    s
}
type Opaque<'a> = impl Sized + 'a;
#[define_opaque(Opaque)]
fn test() -> impl for<'a, 'b> Fn((&'a str, &'b str)) -> (Opaque<'a>, Opaque<'b>) {
    id2
}
fn main() {}


Version information

rustc 1.99.0-nightly (be8e82435 2026-07-11)
binary: rustc
commit-hash: be8e82435eb04fbe75ed5286b52735366e160bed
commit-date: 2026-07-11
host: x86_64-unknown-linux-gnu
release: 1.99.0-nightly
LLVM version: 22.1.8

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zcrate-attr=feature(min_generic_const_args) -Znext-solver=globally

Program output

warning: function `id2` is never used
 --> a.rs:2:4
  |
2 | fn id2<'a, 'b>(s: (&'a str, &'b str)) -> (&'a str, &'b str) {
  |    ^^^
  |
  = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default

warning: type alias `Opaque` is never used
 --> a.rs:5:6
  |
5 | type Opaque<'a> = impl Sized + 'a;
  |      ^^^^^^

warning: function `test` is never used
 --> a.rs:7:4
  |
7 | fn test() -> impl for<'a, 'b> Fn((&'a str, &'b str)) -> (Opaque<'a>, Opaque<'b>) {
  |    ^^^^

warning: 3 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: error performing operation: query type op
 --> a.rs:7:1
  |
7 | fn test() -> impl for<'a, 'b> Fn((&'a str, &'b str)) -> (Opaque<'a>, Opaque<'b>) {
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
note: delayed at /rustc-dev/be8e82435eb04fbe75ed5286b52735366e160bed/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs:126:26
         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, alloc::string::String>
         4: <rustc_borrowck::type_check::free_region_relations::UniversalRegionRelationsBuilder>::add_implied_bounds
         5: rustc_borrowck::type_check::type_check
         6: <rustc_borrowck::root_cx::BorrowCheckRootCtxt>::do_mir_borrowck
         7: rustc_borrowck::mir_borrowck
         8: rustc_query_impl::query_impl::mir_borrowck::invoke_provider_fn::__rust_begin_short_backtrace
         9: rustc_query_impl::execution::try_execute_query::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::ErasedData<[u8; 8]>, rustc_middle::dep_graph::graph::DepNodeIndex>, false>
        10: rustc_query_impl::query_impl::mir_borrowck::execute_query_non_incr::__rust_end_short_backtrace
        11: <rustc_hir_analysis::collect::type_of::opaque::TaitConstraintLocator>::check
        12: rustc_hir_analysis::collect::type_of::opaque::find_opaque_ty_constraints_for_tait
        13: rustc_hir_analysis::collect::type_of::type_of_opaque.cold
        14: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::DefIdCache<rustc_middle::query::erase::ErasedData<[u8; 8]>>, false>
        15: rustc_query_impl::query_impl::type_of_opaque::execute_query_non_incr::__rust_end_short_backtrace
        16: rustc_hir_analysis::collect::type_of::type_of
        17: rustc_query_impl::query_impl::type_of::invoke_provider_fn::__rust_begin_short_backtrace
        18: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::DefIdCache<rustc_middle::query::erase::ErasedData<[u8; 8]>>, false>
        19: rustc_query_impl::query_impl::type_of::execute_query_non_incr::__rust_end_short_backtrace
        20: rustc_hir_analysis::check::check::check_opaque
        21: rustc_hir_analysis::check::check::check_item_type
        22: rustc_hir_analysis::check::wfcheck::check_well_formed
        23: rustc_query_impl::query_impl::check_well_formed::invoke_provider_fn::__rust_begin_short_backtrace
        24: 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>
        25: rustc_query_impl::query_impl::check_well_formed::execute_query_non_incr::__rust_end_short_backtrace
        26: rustc_hir_analysis::check::wfcheck::check_type_wf
        27: rustc_query_impl::query_impl::check_type_wf::invoke_provider_fn::__rust_begin_short_backtrace
        28: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 1]>>, false>
        29: rustc_query_impl::query_impl::check_type_wf::execute_query_non_incr::__rust_end_short_backtrace
        30: rustc_hir_analysis::check_crate
        31: rustc_interface::passes::analysis
        32: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 0]>>, false>
        33: rustc_query_impl::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
        34: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
        35: 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}, ()>
        36: <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}
        37: <std::sys::thread::unix::Thread>::new::thread_start
        38: <unknown>
        39: <unknown>

 --> a.rs:7:1
  |
7 | fn test() -> impl for<'a, 'b> Fn((&'a str, &'b str)) -> (Opaque<'a>, Opaque<'b>) {
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: internal compiler error: error performing operation: query type op
 --> a.rs:7:1
  |
7 | fn test() -> impl for<'a, 'b> Fn((&'a str, &'b str)) -> (Opaque<'a>, Opaque<'b>) {
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
note: delayed at /rustc-dev/be8e82435eb04fbe75ed5286b52735366e160bed/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs:126:26
         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, alloc::string::String>
         4: <rustc_borrowck::BorrowckInferCtxt>::fully_perform::<rustc_middle::traits::query::type_op::DeeplyNormalize<rustc_middle::ty::Ty>>
         5: rustc_borrowck::type_check::type_check
         6: <rustc_borrowck::root_cx::BorrowCheckRootCtxt>::do_mir_borrowck
         7: rustc_borrowck::mir_borrowck
         8: rustc_query_impl::query_impl::mir_borrowck::invoke_provider_fn::__rust_begin_short_backtrace
         9: rustc_query_impl::execution::try_execute_query::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::ErasedData<[u8; 8]>, rustc_middle::dep_graph::graph::DepNodeIndex>, false>
        10: rustc_query_impl::query_impl::mir_borrowck::execute_query_non_incr::__rust_end_short_backtrace
        11: <rustc_hir_analysis::collect::type_of::opaque::TaitConstraintLocator>::check
        12: rustc_hir_analysis::collect::type_of::opaque::find_opaque_ty_constraints_for_tait
        13: rustc_hir_analysis::collect::type_of::type_of_opaque.cold
        14: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::DefIdCache<rustc_middle::query::erase::ErasedData<[u8; 8]>>, false>
        15: rustc_query_impl::query_impl::type_of_opaque::execute_query_non_incr::__rust_end_short_backtrace
        16: rustc_hir_analysis::collect::type_of::type_of
        17: rustc_query_impl::query_impl::type_of::invoke_provider_fn::__rust_begin_short_backtrace
        18: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::DefIdCache<rustc_middle::query::erase::ErasedData<[u8; 8]>>, false>
        19: rustc_query_impl::query_impl::type_of::execute_query_non_incr::__rust_end_short_backtrace
        20: rustc_hir_analysis::check::check::check_opaque
        21: rustc_hir_analysis::check::check::check_item_type
        22: rustc_hir_analysis::check::wfcheck::check_well_formed
        23: rustc_query_impl::query_impl::check_well_formed::invoke_provider_fn::__rust_begin_short_backtrace
        24: 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>
        25: rustc_query_impl::query_impl::check_well_formed::execute_query_non_incr::__rust_end_short_backtrace
        26: rustc_hir_analysis::check::wfcheck::check_type_wf
        27: rustc_query_impl::query_impl::check_type_wf::invoke_provider_fn::__rust_begin_short_backtrace
        28: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 1]>>, false>
        29: rustc_query_impl::query_impl::check_type_wf::execute_query_non_incr::__rust_end_short_backtrace
        30: rustc_hir_analysis::check_crate
        31: rustc_interface::passes::analysis
        32: rustc_query_impl::execution::try_execute_query::<rustc_middle::query::caches::SingleCache<rustc_middle::query::erase::ErasedData<[u8; 0]>>, false>
        33: rustc_query_impl::query_impl::analysis::execute_query_non_incr::__rust_end_short_backtrace
        34: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
        35: 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}, ()>
        36: <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}
        37: <std::sys::thread::unix::Thread>::new::thread_start
        38: <unknown>
        39: <unknown>

 --> a.rs:7:1
  |
7 | fn test() -> impl for<'a, 'b> Fn((&'a str, &'b str)) -> (Opaque<'a>, Opaque<'b>) {
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

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/nextsolv/rustc-ice-2026-07-12T07_23_35-3812194.txt` to your bug report

note: rustc 1.99.0-nightly (be8e82435 2026-07-11) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z next-solver=globally

query stack during panic:
end of query stack

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

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

Reproduce the ICE with the supplied a.rs and -Znext-solver=globally command. Start at compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs:126, then follow the borrow-checking type_check and fully_perform frames in the report. Done means this opaque-type example no longer produces an internal compiler error and has regression coverage.

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
Active
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.