- Notifications
You must be signed in to change notification settings - Fork 14k
Open
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-borrow-checkerArea: The borrow checkerArea: The borrow checkerA-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsA-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️I-prioritizeIssue: Indicates that prioritization has been requested for this issue.Issue: Indicates that prioritization has been requested for this issue.S-has-bisectionStatus: A bisection has been found for this issueStatus: A bisection has been found for this issueS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: 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.Relevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.fixed-by-next-solverFixed by the next-generation trait solver, `-Znext-solver`.Fixed by the next-generation trait solver, `-Znext-solver`.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Description
Code
Although I managed to eliminate all dependencies, this is the smallest I could get the reproduction (my apologies for the size!):
use std::any::Any; fn main() { use_service(make_service()); let _future = async {}; } fn make_service() -> impl FooService<Box<dyn Any>, Response: Body> {} fn use_service<S, R>(_service: S) where S: FooService<R>, <S::Response as Body>::Data: Any, { } trait Service<Request> { type Response: Body; } impl<T, Request> Service<Request> for T { type Response = (); } trait FooService<Request>: Service<Request> {} impl<T, Request, Resp> FooService<Request> for T where T: Service<Request, Response = Resp>, Resp: Body, { } trait Body { type Data; } impl<T> Body for T { type Data = (); }Meta
This first shows up in 1.90.0 (I checked 1.86.0, 1.88.0, 1.89.0, 1.90.0 and 1.91.0; the latter two are broken). Nightly is also broken.
rustc --version --verbose:
rustc 1.90.0 (1159e78c4 2025-09-14) binary: rustc commit-hash: 1159e78c4747b02ef996e55082b704c09b970588 commit-date: 2025-09-14 host: x86_64-unknown-linux-gnu release: 1.90.0 LLVM version: 20.1.8 Error output
error: internal compiler error: unexpected ambiguity: CanonicalQueryInput { canonical: Canonical { value: ParamEnvAnd { param_env: ParamEnv { caller_bounds: [] }, value: AliasTy { args: [Alias(Projection, AliasTy { args: [Alias(Opaque, AliasTy { args: [], def_id: DefId(0:7 ~ min_ice[90f0]::make_service::{opaque#0}), .. }), std::boxed::Box<dyn [Binder { value: Trait(std::any::Any), bound_vars: [] }] + '^0, std::alloc::Global>], def_id: DefId(0:12 ~ min_ice[90f0]::Service::Response), .. })], def_id: DefId(0:24 ~ min_ice[90f0]::Body::Data), .. } }, max_universe: U0, variables: [Region(U0)] }, typing_mode: Analysis { defining_opaque_types_and_generators: [] } } Canonical { value: QueryResponse { var_values: CanonicalVarValues { var_values: ['^0] }, region_constraints: QueryRegionConstraints { outlives: [], assumptions: [] }, certainty: Ambiguous, opaque_types: [], value: NormalizationResult { normalized_ty: ^1 } }, max_universe: U0, variables: [Region(U0), Ty(General(U0))] } | = note: delayed at compiler/rustc_trait_selection/src/traits/query/normalize.rs:288:30 - disabled backtrace error: internal compiler error: error performing operation: fully_perform --> src/main.rs:4:5 | 4 | use_service(make_service()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: delayed at /rustc-dev/1159e78c4747b02ef996e55082b704c09b970588/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs:92:25 - disabled backtrace --> src/main.rs:4:5 | 4 | use_service(make_service()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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: unexpected ambiguity: CanonicalQueryInput { canonical: Canonical { value: ParamEnvAnd { param_env: ParamEnv { caller_bounds: [] }, value: AliasTy { args: [Alias(Projection, AliasTy { args: [Alias(Opaque, AliasTy { args: [], def_id: DefId(0:7 ~ min_ice[90f0]::make_service::{opaque#0}), .. }), std::boxed::Box<dyn [Binder { value: Trait(std::any::Any), bound_vars: [] }] + '^0, std::alloc::Global>], def_id: DefId(0:12 ~ min_ice[90f0]::Service::Response), .. })], def_id: DefId(0:24 ~ min_ice[90f0]::Body::Data), .. } }, max_universe: U0, variables: [Region(U0)] }, typing_mode: Analysis { defining_opaque_types_and_generators: [] } } Canonical { value: QueryResponse { var_values: CanonicalVarValues { var_values: ['^0] }, region_constraints: QueryRegionConstraints { outlives: [], assumptions: [] }, certainty: Ambiguous, opaque_types: [], value: NormalizationResult { normalized_ty: ^1 } }, max_universe: U0, variables: [Region(U0), Ty(General(U0))] } | = note: delayed at compiler/rustc_trait_selection/src/traits/query/normalize.rs:288: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_middle::ty::list::RawList<(), rustc_middle::ty::generic_args::GenericArg> 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_clause 7: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::type_op_normalize_clause::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>> 8: <rustc_query_impl::query_impl::type_op_normalize_clause::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_middle::ty::predicate::Clause>>>)>>::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_middle::traits::query::type_op::Normalize<rustc_middle::ty::Ty>>>, 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_middle::traits::query::type_op::Normalize<rustc_middle::ty::Ty>>>, 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_middle::traits::query::type_op::Normalize<rustc_middle::ty::Ty>>>)>>::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_middle::ty::predicate::Clause>>>, 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_clause::get_query_incr::__rust_end_short_backtrace 12: <rustc_borrowck::type_check::TypeChecker>::normalize_and_prove_instantiated_predicates 13: <rustc_borrowck::type_check::TypeChecker as rustc_middle::mir::visit::Visitor>::visit_operand 14: <rustc_borrowck::type_check::TypeChecker as rustc_middle::mir::visit::Visitor>::visit_body 15: rustc_borrowck::type_check::type_check 16: rustc_borrowck::do_mir_borrowck 17: rustc_borrowck::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_middle::ty::context::TyCtxt>::par_hir_body_owners::<rustc_interface::passes::run_required_analyses::{closure#1}::{closure#0}>::{closure#0} 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: start_thread at ./nptl/pthread_create.c:442:8 32: __GI___clone3 at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81:0 error: internal compiler error: error performing operation: fully_perform --> src/main.rs:4:5 | 4 | use_service(make_service()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: delayed at /rustc-dev/1159e78c4747b02ef996e55082b704c09b970588/compiler/rustc_trait_selection/src/traits/query/type_op/custom.rs:92: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_borrowck::type_check::TypeChecker>::normalize_and_prove_instantiated_predicates 5: <rustc_borrowck::type_check::TypeChecker as rustc_middle::mir::visit::Visitor>::visit_operand 6: <rustc_borrowck::type_check::TypeChecker as rustc_middle::mir::visit::Visitor>::visit_body 7: rustc_borrowck::type_check::type_check 8: rustc_borrowck::do_mir_borrowck 9: rustc_borrowck::mir_borrowck 10: 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]>> 11: 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> 12: rustc_query_impl::query_impl::mir_borrowck::get_query_incr::__rust_end_short_backtrace 13: <rustc_middle::ty::context::TyCtxt>::par_hir_body_owners::<rustc_interface::passes::run_required_analyses::{closure#1}::{closure#0}>::{closure#0} 14: rustc_interface::passes::analysis 15: 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]>> 16: 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> 17: rustc_query_impl::query_impl::analysis::get_query_incr::__rust_end_short_backtrace 18: 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} 19: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1} 20: 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}, ()> 21: <<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} 22: std::sys::pal::unix::thread::Thread::new::thread_start 23: start_thread at ./nptl/pthread_create.c:442:8 24: __GI___clone3 at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81:0 --> src/main.rs:4:5 | 4 | use_service(make_service()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Metadata
Metadata
Assignees
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-borrow-checkerArea: The borrow checkerArea: The borrow checkerA-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.A-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsA-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️I-prioritizeIssue: Indicates that prioritization has been requested for this issue.Issue: Indicates that prioritization has been requested for this issue.S-has-bisectionStatus: A bisection has been found for this issueStatus: A bisection has been found for this issueS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: 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.Relevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.fixed-by-next-solverFixed by the next-generation trait solver, `-Znext-solver`.Fixed by the next-generation trait solver, `-Znext-solver`.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.