rust-lang / rust-lang/rust

ICE: unexpected ambiguity: CanonicalQueryInput - broken MIR

Open
#141,478 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug fixed-by-next-solver I-ICE S-has-bisection S-has-mcve T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Code

I tried to minimize the code but ended up with quite a lot. Clone the below repo and run cargo check.

https://gitlab.com/konnorandrews/supply/-/tree/rustc-ice-ambiguity?ref_type=heads

Meta

rustc --version --verbose:

rustc 1.87.0 (17067e9ac 2025-05-09)
binary: rustc
commit-hash: 17067e9ac6d7ecb70e50f92c1944e545188d2359
commit-date: 2025-05-09
host: x86_64-unknown-linux-gnu
release: 1.87.0
LLVM version: 20.1.1

Also tested on beta and nightly with same error.

Error output
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: unexpected ambiguity: CanonicalQueryInput { canonical: Canonical { value: ParamEnvAnd { param_env: ParamEnv { caller_bounds: [Binder { value: TraitPredicate(<T as ToProviderRef<'_>>, polarity:Positive), bound_vars: [] }, Binder { value: TraitPredicate(<T as std::marker::Sized>, polarity:Positive), bound_vars: [] }] }, value: AliasTy { args: [Value<i32, Infer, ty_tag::DefaultGroup>, ty_tag::lifetime_list::Lt<'^1, ty_tag::lifetime_list::Lt<'^2, Alias(Projection, AliasTy { args: [T/#1, '^2, &'^3 T/#1], def_id: DefId(0:52 ~ supply[8b9a]::ToProviderRef::LifetimesRef), .. })>>], def_id: DefId(0:38 ~ supply[8b9a]::RequestWithArg::Output), .. } }, max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }] }, typing_mode: Analysis { defining_opaque_types: [] } } Canonical { value: QueryResponse { var_values: CanonicalVarValues { var_values: ['^0, '^1, '^2, '^3] }, region_constraints: QueryRegionConstraints { outlives: [(OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^1, '^1), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate('^2, '^2), BoringNoLocation), (OutlivesPredicate(ty_tag::num::NOne<ty_tag::num::NZero>, 'static), BoringNoLocation), (OutlivesPredicate(ty_tag::num::NZero, 'static), BoringNoLocation), (OutlivesPredicate(ty_tag::lifetime_list::projection::NRange<ty_tag::num::NOne<ty_tag::num::NZero>, ty_tag::num::NOne<ty_tag::num::NZero>>, 'static), BoringNoLocation), (OutlivesPredicate(ty_tag::num::NOne<ty_tag::num::NZero>, 'static), BoringNoLocation), (OutlivesPredicate(ty_tag::num::NOne<ty_tag::num::NOne<Alias(Projection, AliasTy { args: [Alias(Projection, AliasTy { args: [T/#1, '^2, &'^3 T/#1], def_id: DefId(0:52 ~ supply[8b9a]::ToProviderRef::LifetimesRef), .. })], def_id: DefId(20:902 ~ ty_tag[fb59]::lifetime_list::LifetimeListType::Len), .. })>>, 'static), BoringNoLocation), (OutlivesPredicate(ty_tag::num::NOne<Alias(Projection, AliasTy { args: [Alias(Projection, AliasTy { args: [T/#1, '^2, &'^3 T/#1], def_id: DefId(0:52 ~ supply[8b9a]::ToProviderRef::LifetimesRef), .. })], def_id: DefId(20:902 ~ ty_tag[fb59]::lifetime_list::LifetimeListType::Len), .. })>, 'static), BoringNoLocation), (OutlivesPredicate(ty_tag::num::NOne<ty_tag::num::NZero>, 'static), BoringNoLocation), (OutlivesPredicate(ty_tag::num::NZero, 'static), BoringNoLocation), (OutlivesPredicate(ty_tag::external_tags::core::I32, 'static), BoringNoLocation), (OutlivesPredicate(ty_tag::lifetime_list::projection::NRange<ty_tag::num::NOne<ty_tag::num::NZero>, ty_tag::num::NOne<ty_tag::num::NZero>>, 'static), BoringNoLocation), (OutlivesPredicate(ty_tag::num::NOne<ty_tag::num::NZero>, 'static), BoringNoLocation), (OutlivesPredicate(ty_tag::num::NOne<ty_tag::num::NZero>, 'static), BoringNoLocation), (OutlivesPredicate(ty_tag::num::NZero, 'static), BoringNoLocation), (OutlivesPredicate(ty_tag::lifetime_list::projection::NRange<ty_tag::num::NOne<ty_tag::num::NZero>, ty_tag::num::NOne<ty_tag::num::NZero>>, 'static), BoringNoLocation), (OutlivesPredicate(Alias(Projection, AliasTy { args: [Alias(Projection, AliasTy { args: [T/#1, '^2, &'^3 T/#1], def_id: DefId(0:52 ~ supply[8b9a]::ToProviderRef::LifetimesRef), .. })], def_id: DefId(20:902 ~ ty_tag[fb59]::lifetime_list::LifetimeListType::Len), .. }), 'static), BoringNoLocation)] }, certainty: Ambiguous, opaque_types: [], value: NormalizationResult { normalized_ty: std::option::Option<i32> } }, max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }, CanonicalVarInfo { kind: Region(U0) }] }
  |
  = note: delayed at compiler/rustc_trait_selection/src/traits/query/normalize.rs:287:30 - disabled backtrace

error: internal compiler error: error performing operation: fully_perform
  --> src/lib.rs:14:5
   |
14 |     x.to_provider_ref().request::<Value<i32>>();
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: delayed at /rustc/17067e9ac6d7ecb70e50f92c1944e545188d2359/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs:87:25 - disabled backtrace
  --> src/lib.rs:14:5
   |
14 |     x.to_provider_ref().request::<Value<i32>>();
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: internal compiler error: broken MIR in DefId(0:26 ~ supply[8b9a]::pretty_print) (Terminator { source_info: SourceInfo { span: src/lib.rs:14:5: 14:48 (#0), scope: scope[0] }, kind: _2 = <<T as ToProviderRef<'_, &T>>::ProviderRef as RequestExt>::request::<'_, Value<i32>>(move _3) -> [return: bb2, unwind: bb3] }): call dest mismatch (std::option::Option<i32> <- Alias(Projection, AliasTy { args: [Value<i32, Infer, ty_tag::DefaultGroup>, ty_tag::lifetime_list::Lt<'?8, Alias(Projection, AliasTy { args: [Alias(Projection, AliasTy { args: [T/#1, '?6, &'?7 T/#1], def_id: DefId(0:53 ~ supply[8b9a]::ToProviderRef::ProviderRef), .. })], def_id: DefId(0:47 ~ supply[8b9a]::HasLifetimes::Lifetimes), .. })>], def_id: DefId(0:38 ~ supply[8b9a]::RequestWithArg::Output), .. })): NoSolution
  --> src/lib.rs:14:25
   |
14 |     x.to_provider_ref().request::<Value<i32>>();
   |                         ^^^^^^^
   |
note: delayed at compiler/rustc_borrowck/src/type_check/mod.rs:1950:21 - disabled backtrace
  --> src/lib.rs:14:25
   |
14 |     x.to_provider_ref().request::<Value<i32>>();
   |                         ^^^^^^^

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: rustc 1.87.0 (17067e9ac 2025-05-09) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -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:
end of query stack
Backtrace

There are three errors so three backtraces.

  = note: delayed at compiler/rustc_trait_selection/src/traits/query/normalize.rs:287:30
             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_trait_selection::traits::query::normalize::QueryNormalizer as rustc_type_ir::fold::FallibleTypeFolder<rustc_middle::ty::context::TyCtxt>>::try_fold_ty
             5: <rustc_type_ir::ty_kind::FnSig<rustc_middle::ty::context::TyCtxt> as rustc_type_ir::fold::TypeFoldable<rustc_middle::ty::context::TyCtxt>>::try_fold_with::<rustc_trait_selection::traits::query::normalize::QueryNormalizer>
             6: rustc_traits::type_op::type_op_normalize_fn_sig
             7: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::type_op_normalize_fn_sig::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
             8: <rustc_query_impl::query_impl::type_op_normalize_fn_sig::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_type_ir::canonical::CanonicalQueryInput<rustc_middle::ty::context::TyCtxt, rustc_middle::ty::ParamEnvAnd<rustc_middle::traits::query::type_op::Normalize<rustc_type_ir::ty_kind::FnSig<rustc_middle::ty::context::TyCtxt>>>>)>>::call_once
             9: <rustc_query_system::query::plumbing::execute_job_incr<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_type_ir::canonical::CanonicalQueryInput<rustc_middle::ty::context::TyCtxt, rustc_middle::ty::ParamEnvAnd<rustc_type_ir::ty_kind::AliasTy<rustc_middle::ty::context::TyCtxt>>>, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt>::{closure#2}::{closure#2} as core::ops::function::FnOnce<((rustc_query_impl::plumbing::QueryCtxt, rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_type_ir::canonical::CanonicalQueryInput<rustc_middle::ty::context::TyCtxt, rustc_middle::ty::ParamEnvAnd<rustc_type_ir::ty_kind::AliasTy<rustc_middle::ty::context::TyCtxt>>>, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>), rustc_type_ir::canonical::CanonicalQueryInput<rustc_middle::ty::context::TyCtxt, rustc_middle::ty::ParamEnvAnd<rustc_type_ir::ty_kind::AliasTy<rustc_middle::ty::context::TyCtxt>>>)>>::call_once
            10: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefaultCache<rustc_type_ir::canonical::CanonicalQueryInput<rustc_middle::ty::context::TyCtxt, rustc_middle::ty::ParamEnvAnd<rustc_middle::traits::query::type_op::Normalize<rustc_type_ir::ty_kind::FnSig<rustc_middle::ty::context::TyCtxt>>>>, rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, true>
            11: rustc_query_impl::query_impl::type_op_normalize_fn_sig::get_query_incr::__rust_end_short_backtrace
            12: <rustc_type_ir::ty_kind::FnSig<rustc_middle::ty::context::TyCtxt> as rustc_trait_selection::traits::query::type_op::normalize::Normalizable>::type_op_method
            13: <rustc_middle::ty::ParamEnvAnd<rustc_middle::traits::query::type_op::DeeplyNormalize<rustc_type_ir::ty_kind::FnSig<rustc_middle::ty::context::TyCtxt>>> as rustc_trait_selection::traits::query::type_op::TypeOp>::fully_perform
            14: <rustc_borrowck::type_check::TypeChecker as rustc_middle::mir::visit::Visitor>::visit_body
            15: rustc_borrowck::type_check::type_check
            16: rustc_borrowck::nll::compute_regions
            17: rustc_borrowck::do_mir_borrowck
            18: 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]>>
            19: 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, true>
            20: rustc_query_impl::query_impl::mir_borrowck::get_query_incr::__rust_end_short_backtrace
            21: rustc_interface::passes::run_required_analyses
            22: rustc_interface::passes::analysis
            23: 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]>>
            24: 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, true>
            25: rustc_query_impl::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
            26: 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}
            27: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
            28: 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}, ()>
            29: <<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}
            30: std::sys::pal::unix::thread::Thread::new::thread_start
            31: <unknown>
            32: <unknown>
note: delayed at /rustc/17067e9ac6d7ecb70e50f92c1944e545188d2359/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs:87:25
         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_middle::ty::ParamEnvAnd<rustc_middle::traits::query::type_op::DeeplyNormalize<rustc_type_ir::ty_kind::FnSig<rustc_middle::ty::context::TyCtxt>>> as rustc_trait_selection::traits::query::type_op::TypeOp>::fully_perform
         5: <rustc_borrowck::type_check::TypeChecker as rustc_middle::mir::visit::Visitor>::visit_body
         6: rustc_borrowck::type_check::type_check
         7: rustc_borrowck::nll::compute_regions
         8: rustc_borrowck::do_mir_borrowck
         9: 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]>>
        10: 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, true>
        11: rustc_query_impl::query_impl::mir_borrowck::get_query_incr::__rust_end_short_backtrace
        12: rustc_interface::passes::run_required_analyses
        13: rustc_interface::passes::analysis
        14: 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]>>
        15: 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, true>
        16: rustc_query_impl::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
        17: 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}
        18: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
        19: 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}, ()>
        20: <<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}
        21: std::sys::pal::unix::thread::Thread::new::thread_start
        22: <unknown>
        23: <unknown>
note: delayed at compiler/rustc_borrowck/src/type_check/mod.rs:1950:21
         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::TypeChecker as rustc_middle::mir::visit::Visitor>::visit_body
         5: rustc_borrowck::type_check::type_check
         6: rustc_borrowck::nll::compute_regions
         7: rustc_borrowck::do_mir_borrowck
         8: 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]>>
         9: 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, true>
        10: rustc_query_impl::query_impl::mir_borrowck::get_query_incr::__rust_end_short_backtrace
        11: rustc_interface::passes::run_required_analyses
        12: rustc_interface::passes::analysis
        13: 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]>>
        14: 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, true>
        15: rustc_query_impl::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
        16: 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}
        17: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
        18: 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}, ()>
        19: <<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}
        20: std::sys::pal::unix::thread::Thread::new::thread_start
        21: <unknown>
        22: <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.

Research direction

Clone the linked supply repository and run cargo check to reproduce the ICE at src/lib.rs:14. Then trace the delayed ambiguity through compiler/rustc_trait_selection/src/traits/query/normalize.rs, custom.rs, and compiler/rustc_borrowck/src/type_check/mod.rs. Done means the reproducer no longer reports unexpected ambiguity, broken MIR, or an internal compiler error.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.