Skip to content

ICE: next solver: errors selecting obligation during MIR typeck: [Ambiguity] #139409

Open
@matthiaskrgr

Description

@matthiaskrgr

Code

this goes from compile-pass -> ice with the next solver

fn main() {
    trait B<C> {}
    impl<C> B<C> for () {}
    trait D<C, E>: B<C> + B<E> {
        fn f(&self) {}
    }
    impl<C, E> D<C, E> for () {}
    (&() as &dyn D<&(), &()>).f()
}

Meta

rustc --version --verbose:

rustc 1.88.0-nightly (17ffbc81a 2025-04-04)
binary: rustc
commit-hash: 17ffbc81a30c094193836a5d7f90dff273b5df93
commit-date: 2025-04-04
host: x86_64-unknown-linux-gnu
release: 1.88.0-nightly
LLVM version: 20.1.2

Error output


Backtrace

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: errors selecting obligation during MIR typeck: [Ambiguity]
  |
  = note: delayed at /rustc/17ffbc81a30c094193836a5d7f90dff273b5df93/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs:95:18
             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>::delayed_bug::<alloc::string::String>
             4: <rustc_borrowck::type_check::TypeChecker>::fully_perform_op::<(), rustc_middle::ty::ParamEnvAnd<rustc_middle::traits::query::type_op::ProvePredicate>>
             5: <rustc_borrowck::type_check::TypeChecker>::normalize_and_prove_instantiated_predicates
             6: <rustc_borrowck::type_check::TypeChecker as rustc_middle::mir::visit::Visitor>::visit_operand
             7: <rustc_borrowck::type_check::TypeChecker as rustc_middle::mir::visit::Visitor>::visit_body
             8: rustc_borrowck::type_check::type_check
             9: rustc_borrowck::nll::compute_regions
            10: rustc_borrowck::do_mir_borrowck
            11: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
            12: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            13: rustc_query_impl::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
            14: rustc_interface::passes::run_required_analyses
            15: rustc_interface::passes::analysis
            16: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
            17: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
            18: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
            19: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
            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::Builder>::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::pal::unix::thread::Thread::new::thread_start
            24: <unknown>
            25: <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: please attach the file at `/home/matthias/vcs/github/CRED/rustc-ice-2025-04-05T11_40_19-4021268.txt` to your bug report

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

query stack during panic:
end of query stack

Metadata

Metadata

Labels

C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.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