rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.53k stars 12.74k forks source link

ICE: unexpected ambiguity #105299

Open haslersn opened 1 year ago

haslersn commented 1 year ago

Today I encountered a compiler panic with rustc 1.64.0.

Code

Unfortunately I cannot provide the code at this point, as it's not released, yet. The project makes heavy use of (const) generics. There were some errors in the code which probably lead to the compiler panic. After fixing some errors, the panic went away, too.

Meta

rustc --version --verbose:

rustc 1.64.0
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.64.0
LLVM version: 14.0.6

Error output

error: internal compiler error: compiler/rustc_trait_selection/src/traits/query/normalize.rs:257:21: unexpected ambiguity: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }], value: ParamEnvAnd { param_env: ParamEnv { caller_bounds: [Binder(TraitPredicate(<Open as std::marker::Send>, polarity:Positive), []), Binder(TraitPredicate(<Open as interface::Opener<P>>, polarity:Positive), []), Binder(TraitPredicate(<Deal as std::marker::Send>, polarity:Positive), []), Binder(TraitPredicate(<Deal as interface::Dealer<P>>, polarity:Positive), []), Binder(TraitPredicate(<Open as std::marker::Sized>, polarity:Positive), []), Binder(TraitPredicate(<Deal as std::marker::Sized>, polarity:Positive), [])], reveal: UserFacing, constness: NotConst }, value: ProjectionTy { substs: [futures_util::sink::Send<'_, async_bincode::tokio::AsyncBincodeWriter<quinn::SendStream, bgv::PublicKey<(bgv::params::phi_8191_mod_2k64::Phi8191Mod2k64, bgv::params::phi_8191_mod_p256::Phi8191ModP256)>, async_bincode::AsyncDestination>, bgv::PublicKey<(bgv::params::phi_8191_mod_2k64::Phi8191Mod2k64, bgv::params::phi_8191_mod_p256::Phi8191ModP256)>>], item_def_id: DefId(2:13778 ~ core[7bb8]::future::into_future::IntoFuture::IntoFuture) } } } Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }], value: QueryResponse { var_values: CanonicalVarValues { var_values: [ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0) })] }, region_constraints: QueryRegionConstraints { outlives: [Binder(OutlivesPredicate(ReLateBound(DebruijnIndex(1), BoundRegion { var: 0, kind: BrAnon(0) }), ReLateBound(DebruijnIndex(1), BoundRegion { var: 0, kind: BrAnon(0) })), []), Binder(OutlivesPredicate(ReLateBound(DebruijnIndex(1), BoundRegion { var: 0, kind: BrAnon(0) }), ReLateBound(DebruijnIndex(1), BoundRegion { var: 0, kind: BrAnon(0) })), [])], member_constraints: [] }, certainty: Ambiguous, opaque_types: [], value: NormalizationResult { normalized_ty: futures_util::sink::Send<'_, async_bincode::tokio::AsyncBincodeWriter<quinn::SendStream, bgv::PublicKey<(bgv::params::phi_8191_mod_2k64::Phi8191Mod2k64, bgv::params::phi_8191_mod_p256::Phi8191ModP256)>, async_bincode::AsyncDestination>, bgv::PublicKey<(bgv::params::phi_8191_mod_2k64::Phi8191Mod2k64, bgv::params::phi_8191_mod_p256::Phi8191ModP256)>> } } }

thread 'rustc' panicked at 'Box<dyn Any>', /build/rustc-1.64.0-src/compiler/rustc_errors/src/lib.rs:1392:9
stack backtrace:
   0:     0x7fce026f8fcc - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf2ea00d5f3b53d9f
   1:     0x7fce0277d20e - core::fmt::write::ha076a7e65c6b1874
   2:     0x7fce0271e931 - std::io::Write::write_fmt::h9630bb3b0fe886f5
   3:     0x7fce0272e1d5 - std::panicking::default_hook::{{closure}}::h64163197f96398c1
   4:     0x7fce0272de32 - std::panicking::default_hook::h92625161492e6b48
   5:     0x7fce02ea8186 - rustc_driver[19ffe5a3bc66cb18]::DEFAULT_HOOK::{closure#0}::{closure#0}
   6:     0x7fce0272e864 - std::panicking::rust_panic_with_hook::hfdd7d6bb6788c6c2
   7:     0x7fce05448363 - std[931cb317ac66052d]::panicking::begin_panic::<rustc_errors[97019275299da470]::ExplicitBug>::{closure#0}
   8:     0x7fce05447376 - std[931cb317ac66052d]::sys_common::backtrace::__rust_end_short_backtrace::<std[931cb317ac66052d]::panicking::begin_panic<rustc_errors[97019275299da470]::ExplicitBug>::{closure#0}, !>
   9:     0x7fce02e43956 - std[931cb317ac66052d]::panicking::begin_panic::<rustc_errors[97019275299da470]::ExplicitBug>
  10:     0x7fce05556606 - std[931cb317ac66052d]::panic::panic_any::<rustc_errors[97019275299da470]::ExplicitBug>
  11:     0x7fce05552130 - <rustc_errors[97019275299da470]::HandlerInner>::bug::<&alloc[4829ebc466f4407a]::string::String>
  12:     0x7fce05551d80 - <rustc_errors[97019275299da470]::Handler>::bug::<&alloc[4829ebc466f4407a]::string::String>
  13:     0x7fce0547bb1a - rustc_middle[24a43b036384cdea]::ty::context::tls::with_opt::<rustc_middle[24a43b036384cdea]::util::bug::opt_span_bug_fmt<rustc_span[7bd57098f377ce8e]::span_encoding::Span>::{closure#0}, ()>
  14:     0x7fce05486279 - rustc_middle[24a43b036384cdea]::util::bug::opt_span_bug_fmt::<rustc_span[7bd57098f377ce8e]::span_encoding::Span>
  15:     0x7fce02e3f2a5 - rustc_middle[24a43b036384cdea]::util::bug::bug_fmt
  16:     0x7fce05148458 - <rustc_trait_selection[8b7b3846a6727d49]::traits::query::normalize::QueryNormalizer as rustc_middle[24a43b036384cdea]::ty::fold::FallibleTypeFolder>::try_fold_ty
  17:     0x7fce040fed1e - <&rustc_middle[24a43b036384cdea]::ty::list::List<rustc_middle[24a43b036384cdea]::ty::Ty> as rustc_middle[24a43b036384cdea]::ty::fold::TypeFoldable>::try_fold_with::<rustc_trait_selection[8b7b3846a6727d49]::traits::query::normalize::QueryNormalizer>
  18:     0x7fce040fa31b - <rustc_infer[1ecafacbaf0000e]::infer::at::At as rustc_trait_selection[8b7b3846a6727d49]::traits::query::normalize::AtExt>::normalize::<rustc_middle[24a43b036384cdea]::ty::sty::FnSig>
  19:     0x7fce0404af7d - rustc_traits[173e904b178c6214]::type_op::type_op_normalize::<rustc_middle[24a43b036384cdea]::ty::sty::FnSig>
  20:     0x7fce0410f367 - <rustc_infer[1ecafacbaf0000e]::infer::InferCtxtBuilder as rustc_trait_selection[8b7b3846a6727d49]::infer::InferCtxtBuilderExt>::enter_canonical_trait_query::<rustc_middle[24a43b036384cdea]::ty::ParamEnvAnd<rustc_middle[24a43b036384cdea]::traits::query::type_op::Normalize<rustc_middle[24a43b036384cdea]::ty::sty::FnSig>>, rustc_middle[24a43b036384cdea]::ty::sty::FnSig, rustc_traits[173e904b178c6214]::type_op::type_op_normalize<rustc_middle[24a43b036384cdea]::ty::sty::FnSig>>
  21:     0x7fce0404b237 - rustc_traits[173e904b178c6214]::type_op::type_op_normalize_fn_sig
  22:     0x7fce0446d31f - <rustc_middle[24a43b036384cdea]::dep_graph::dep_node::DepKind as rustc_query_system[3f5e5ed0745db86]::dep_graph::DepKind>::with_deps::<<rustc_query_system[3f5e5ed0745db86]::dep_graph::graph::DepGraph<rustc_middle[24a43b036384cdea]::dep_graph::dep_node::DepKind>>::with_task_impl<rustc_middle[24a43b036384cdea]::ty::context::TyCtxt, rustc_middle[24a43b036384cdea]::infer::canonical::Canonical<rustc_middle[24a43b036384cdea]::ty::ParamEnvAnd<rustc_middle[24a43b036384cdea]::traits::query::type_op::Normalize<rustc_middle[24a43b036384cdea]::ty::sty::FnSig>>>, core[7bb80ef76712da0f]::result::Result<&rustc_middle[24a43b036384cdea]::infer::canonical::Canonical<rustc_middle[24a43b036384cdea]::infer::canonical::QueryResponse<rustc_middle[24a43b036384cdea]::ty::sty::FnSig>>, rustc_middle[24a43b036384cdea]::traits::query::NoSolution>>::{closure#0}, core[7bb80ef76712da0f]::result::Result<&rustc_middle[24a43b036384cdea]::infer::canonical::Canonical<rustc_middle[24a43b036384cdea]::infer::canonical::QueryResponse<rustc_middle[24a43b036384cdea]::ty::sty::FnSig>>, rustc_middle[24a43b036384cdea]::traits::query::NoSolution>>
  23:     0x7fce047d013b - <rustc_query_system[3f5e5ed0745db86]::dep_graph::graph::DepGraph<rustc_middle[24a43b036384cdea]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[24a43b036384cdea]::ty::context::TyCtxt, rustc_middle[24a43b036384cdea]::infer::canonical::Canonical<rustc_middle[24a43b036384cdea]::ty::ParamEnvAnd<rustc_middle[24a43b036384cdea]::traits::query::type_op::Normalize<rustc_middle[24a43b036384cdea]::ty::sty::FnSig>>>, core[7bb80ef76712da0f]::result::Result<&rustc_middle[24a43b036384cdea]::infer::canonical::Canonical<rustc_middle[24a43b036384cdea]::infer::canonical::QueryResponse<rustc_middle[24a43b036384cdea]::ty::sty::FnSig>>, rustc_middle[24a43b036384cdea]::traits::query::NoSolution>>
  24:     0x7fce0464684f - rustc_query_system[3f5e5ed0745db86]::query::plumbing::try_execute_query::<rustc_query_impl[dc4559cc831b2512]::plumbing::QueryCtxt, rustc_query_system[3f5e5ed0745db86]::query::caches::DefaultCache<rustc_middle[24a43b036384cdea]::infer::canonical::Canonical<rustc_middle[24a43b036384cdea]::ty::ParamEnvAnd<rustc_middle[24a43b036384cdea]::traits::query::type_op::Normalize<rustc_middle[24a43b036384cdea]::ty::sty::FnSig>>>, core[7bb80ef76712da0f]::result::Result<&rustc_middle[24a43b036384cdea]::infer::canonical::Canonical<rustc_middle[24a43b036384cdea]::infer::canonical::QueryResponse<rustc_middle[24a43b036384cdea]::ty::sty::FnSig>>, rustc_middle[24a43b036384cdea]::traits::query::NoSolution>>>
  25:     0x7fce0473eede - rustc_query_system[3f5e5ed0745db86]::query::plumbing::get_query::<rustc_query_impl[dc4559cc831b2512]::queries::type_op_normalize_fn_sig, rustc_query_impl[dc4559cc831b2512]::plumbing::QueryCtxt>
  26:     0x7fce0444a2a6 - <rustc_query_impl[dc4559cc831b2512]::Queries as rustc_middle[24a43b036384cdea]::ty::query::QueryEngine>::type_op_normalize_fn_sig
  27:     0x7fce050f154d - <rustc_middle[24a43b036384cdea]::ty::sty::FnSig as rustc_trait_selection[8b7b3846a6727d49]::traits::query::type_op::normalize::Normalizable>::type_op_method
  28:     0x7fce03feb72d - <rustc_middle[24a43b036384cdea]::traits::query::type_op::Normalize<rustc_middle[24a43b036384cdea]::ty::sty::FnSig> as rustc_trait_selection[8b7b3846a6727d49]::traits::query::type_op::QueryTypeOp>::fully_perform_into
  29:     0x7fce03e9f1af - <rustc_middle[24a43b036384cdea]::ty::ParamEnvAnd<rustc_middle[24a43b036384cdea]::traits::query::type_op::Normalize<rustc_middle[24a43b036384cdea]::ty::sty::FnSig>> as rustc_trait_selection[8b7b3846a6727d49]::traits::query::type_op::TypeOp>::fully_perform
  30:     0x7fce04003dc3 - <rustc_borrowck[d0d5f35690ef8b2f]::type_check::TypeChecker>::typeck_mir
  31:     0x7fce03ff02da - rustc_borrowck[d0d5f35690ef8b2f]::type_check::type_check
  32:     0x7fce03fa04db - rustc_borrowck[d0d5f35690ef8b2f]::nll::compute_regions
  33:     0x7fce03de1f7c - rustc_borrowck[d0d5f35690ef8b2f]::do_mir_borrowck
  34:     0x7fce03ee6f00 - <rustc_infer[1ecafacbaf0000e]::infer::InferCtxtBuilder>::enter::<rustc_middle[24a43b036384cdea]::mir::query::BorrowCheckResult, rustc_borrowck[d0d5f35690ef8b2f]::mir_borrowck::{closure#0}>
  35:     0x7fce03dd7ea5 - rustc_borrowck[d0d5f35690ef8b2f]::mir_borrowck
  36:     0x7fce03db490f - <rustc_borrowck[d0d5f35690ef8b2f]::provide::{closure#0} as core[7bb80ef76712da0f]::ops::function::FnOnce<(rustc_middle[24a43b036384cdea]::ty::context::TyCtxt, rustc_span[7bd57098f377ce8e]::def_id::LocalDefId)>>::call_once
  37:     0x7fce047dfb2a - <rustc_query_system[3f5e5ed0745db86]::dep_graph::graph::DepGraph<rustc_middle[24a43b036384cdea]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[24a43b036384cdea]::ty::context::TyCtxt, rustc_span[7bd57098f377ce8e]::def_id::LocalDefId, &rustc_middle[24a43b036384cdea]::mir::query::BorrowCheckResult>
  38:     0x7fce04662b4c - rustc_query_system[3f5e5ed0745db86]::query::plumbing::try_execute_query::<rustc_query_impl[dc4559cc831b2512]::plumbing::QueryCtxt, rustc_query_system[3f5e5ed0745db86]::query::caches::DefaultCache<rustc_span[7bd57098f377ce8e]::def_id::LocalDefId, &rustc_middle[24a43b036384cdea]::mir::query::BorrowCheckResult>>
  39:     0x7fce047195a7 - rustc_query_system[3f5e5ed0745db86]::query::plumbing::get_query::<rustc_query_impl[dc4559cc831b2512]::queries::mir_borrowck, rustc_query_impl[dc4559cc831b2512]::plumbing::QueryCtxt>
  40:     0x7fce03ff7306 - <rustc_borrowck[d0d5f35690ef8b2f]::type_check::TypeChecker>::prove_closure_bounds
  41:     0x7fce03ffc163 - <rustc_borrowck[d0d5f35690ef8b2f]::type_check::TypeChecker>::check_rvalue
  42:     0x7fce0400270a - <rustc_borrowck[d0d5f35690ef8b2f]::type_check::TypeChecker>::typeck_mir
  43:     0x7fce03ff02da - rustc_borrowck[d0d5f35690ef8b2f]::type_check::type_check
  44:     0x7fce03fa04db - rustc_borrowck[d0d5f35690ef8b2f]::nll::compute_regions
  45:     0x7fce03de1f7c - rustc_borrowck[d0d5f35690ef8b2f]::do_mir_borrowck
  46:     0x7fce03ee6f00 - <rustc_infer[1ecafacbaf0000e]::infer::InferCtxtBuilder>::enter::<rustc_middle[24a43b036384cdea]::mir::query::BorrowCheckResult, rustc_borrowck[d0d5f35690ef8b2f]::mir_borrowck::{closure#0}>
  47:     0x7fce03dd7ea5 - rustc_borrowck[d0d5f35690ef8b2f]::mir_borrowck
  48:     0x7fce03db490f - <rustc_borrowck[d0d5f35690ef8b2f]::provide::{closure#0} as core[7bb80ef76712da0f]::ops::function::FnOnce<(rustc_middle[24a43b036384cdea]::ty::context::TyCtxt, rustc_span[7bd57098f377ce8e]::def_id::LocalDefId)>>::call_once
  49:     0x7fce047dfb2a - <rustc_query_system[3f5e5ed0745db86]::dep_graph::graph::DepGraph<rustc_middle[24a43b036384cdea]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[24a43b036384cdea]::ty::context::TyCtxt, rustc_span[7bd57098f377ce8e]::def_id::LocalDefId, &rustc_middle[24a43b036384cdea]::mir::query::BorrowCheckResult>
  50:     0x7fce04662b4c - rustc_query_system[3f5e5ed0745db86]::query::plumbing::try_execute_query::<rustc_query_impl[dc4559cc831b2512]::plumbing::QueryCtxt, rustc_query_system[3f5e5ed0745db86]::query::caches::DefaultCache<rustc_span[7bd57098f377ce8e]::def_id::LocalDefId, &rustc_middle[24a43b036384cdea]::mir::query::BorrowCheckResult>>
  51:     0x7fce047195a7 - rustc_query_system[3f5e5ed0745db86]::query::plumbing::get_query::<rustc_query_impl[dc4559cc831b2512]::queries::mir_borrowck, rustc_query_impl[dc4559cc831b2512]::plumbing::QueryCtxt>
  52:     0x7fce03ff7306 - <rustc_borrowck[d0d5f35690ef8b2f]::type_check::TypeChecker>::prove_closure_bounds
  53:     0x7fce03ffc163 - <rustc_borrowck[d0d5f35690ef8b2f]::type_check::TypeChecker>::check_rvalue
  54:     0x7fce0400270a - <rustc_borrowck[d0d5f35690ef8b2f]::type_check::TypeChecker>::typeck_mir
  55:     0x7fce03ff02da - rustc_borrowck[d0d5f35690ef8b2f]::type_check::type_check
  56:     0x7fce03fa04db - rustc_borrowck[d0d5f35690ef8b2f]::nll::compute_regions
  57:     0x7fce03de1f7c - rustc_borrowck[d0d5f35690ef8b2f]::do_mir_borrowck
  58:     0x7fce03ee6f00 - <rustc_infer[1ecafacbaf0000e]::infer::InferCtxtBuilder>::enter::<rustc_middle[24a43b036384cdea]::mir::query::BorrowCheckResult, rustc_borrowck[d0d5f35690ef8b2f]::mir_borrowck::{closure#0}>
  59:     0x7fce03dd7ea5 - rustc_borrowck[d0d5f35690ef8b2f]::mir_borrowck
  60:     0x7fce03db490f - <rustc_borrowck[d0d5f35690ef8b2f]::provide::{closure#0} as core[7bb80ef76712da0f]::ops::function::FnOnce<(rustc_middle[24a43b036384cdea]::ty::context::TyCtxt, rustc_span[7bd57098f377ce8e]::def_id::LocalDefId)>>::call_once
  61:     0x7fce047dfb2a - <rustc_query_system[3f5e5ed0745db86]::dep_graph::graph::DepGraph<rustc_middle[24a43b036384cdea]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[24a43b036384cdea]::ty::context::TyCtxt, rustc_span[7bd57098f377ce8e]::def_id::LocalDefId, &rustc_middle[24a43b036384cdea]::mir::query::BorrowCheckResult>
  62:     0x7fce04662b4c - rustc_query_system[3f5e5ed0745db86]::query::plumbing::try_execute_query::<rustc_query_impl[dc4559cc831b2512]::plumbing::QueryCtxt, rustc_query_system[3f5e5ed0745db86]::query::caches::DefaultCache<rustc_span[7bd57098f377ce8e]::def_id::LocalDefId, &rustc_middle[24a43b036384cdea]::mir::query::BorrowCheckResult>>
  63:     0x7fce047195a7 - rustc_query_system[3f5e5ed0745db86]::query::plumbing::get_query::<rustc_query_impl[dc4559cc831b2512]::queries::mir_borrowck, rustc_query_impl[dc4559cc831b2512]::plumbing::QueryCtxt>
  64:     0x7fce03787d14 - rustc_typeck[b5551f214753a0f4]::collect::type_of::find_opaque_ty_constraints_for_rpit
  65:     0x7fce0378689e - rustc_typeck[b5551f214753a0f4]::collect::type_of::type_of
  66:     0x7fce047ea574 - <rustc_query_system[3f5e5ed0745db86]::dep_graph::graph::DepGraph<rustc_middle[24a43b036384cdea]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[24a43b036384cdea]::ty::context::TyCtxt, rustc_span[7bd57098f377ce8e]::def_id::DefId, rustc_middle[24a43b036384cdea]::ty::Ty>
  67:     0x7fce0467d6e0 - rustc_query_system[3f5e5ed0745db86]::query::plumbing::try_execute_query::<rustc_query_impl[dc4559cc831b2512]::plumbing::QueryCtxt, rustc_query_system[3f5e5ed0745db86]::query::caches::DefaultCache<rustc_span[7bd57098f377ce8e]::def_id::DefId, rustc_middle[24a43b036384cdea]::ty::Ty>>
  68:     0x7fce0474db56 - rustc_query_system[3f5e5ed0745db86]::query::plumbing::get_query::<rustc_query_impl[dc4559cc831b2512]::queries::type_of, rustc_query_impl[dc4559cc831b2512]::plumbing::QueryCtxt>
  69:     0x7fce0387a539 - rustc_typeck[b5551f214753a0f4]::check::check::check_opaque
  70:     0x7fce0387c619 - rustc_typeck[b5551f214753a0f4]::check::check::check_item_type
  71:     0x7fce0388519e - rustc_typeck[b5551f214753a0f4]::check::check::check_mod_item_types
  72:     0x7fce047e0d89 - <rustc_query_system[3f5e5ed0745db86]::dep_graph::graph::DepGraph<rustc_middle[24a43b036384cdea]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[24a43b036384cdea]::ty::context::TyCtxt, rustc_span[7bd57098f377ce8e]::def_id::LocalDefId, ()>
  73:     0x7fce04665713 - rustc_query_system[3f5e5ed0745db86]::query::plumbing::try_execute_query::<rustc_query_impl[dc4559cc831b2512]::plumbing::QueryCtxt, rustc_query_system[3f5e5ed0745db86]::query::caches::DefaultCache<rustc_span[7bd57098f377ce8e]::def_id::LocalDefId, ()>>
  74:     0x7fce0472f4d5 - rustc_query_system[3f5e5ed0745db86]::query::plumbing::get_query::<rustc_query_impl[dc4559cc831b2512]::queries::check_mod_item_types, rustc_query_impl[dc4559cc831b2512]::plumbing::QueryCtxt>
  75:     0x7fce03796ff9 - <rustc_session[b73e6758d52e72ca]::session::Session>::time::<(), rustc_typeck[b5551f214753a0f4]::check_crate::{closure#6}>
  76:     0x7fce03a0ac43 - rustc_typeck[b5551f214753a0f4]::check_crate
  77:     0x7fce03013dd1 - rustc_interface[dec67a8ecb269d20]::passes::analysis
  78:     0x7fce0480e399 - <rustc_query_system[3f5e5ed0745db86]::dep_graph::graph::DepGraph<rustc_middle[24a43b036384cdea]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[24a43b036384cdea]::ty::context::TyCtxt, (), core[7bb80ef76712da0f]::result::Result<(), rustc_errors[97019275299da470]::ErrorGuaranteed>>
  79:     0x7fce046af117 - rustc_query_system[3f5e5ed0745db86]::query::plumbing::try_execute_query::<rustc_query_impl[dc4559cc831b2512]::plumbing::QueryCtxt, rustc_query_system[3f5e5ed0745db86]::query::caches::DefaultCache<(), core[7bb80ef76712da0f]::result::Result<(), rustc_errors[97019275299da470]::ErrorGuaranteed>>>
  80:     0x7fce0474dc67 - rustc_query_system[3f5e5ed0745db86]::query::plumbing::get_query::<rustc_query_impl[dc4559cc831b2512]::queries::analysis, rustc_query_impl[dc4559cc831b2512]::plumbing::QueryCtxt>
  81:     0x7fce02ed7904 - <rustc_interface[dec67a8ecb269d20]::passes::QueryContext>::enter::<rustc_driver[19ffe5a3bc66cb18]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[7bb80ef76712da0f]::result::Result<(), rustc_errors[97019275299da470]::ErrorGuaranteed>>
  82:     0x7fce02ed3c61 - <rustc_interface[dec67a8ecb269d20]::interface::Compiler>::enter::<rustc_driver[19ffe5a3bc66cb18]::run_compiler::{closure#1}::{closure#2}, core[7bb80ef76712da0f]::result::Result<core[7bb80ef76712da0f]::option::Option<rustc_interface[dec67a8ecb269d20]::queries::Linker>, rustc_errors[97019275299da470]::ErrorGuaranteed>>
  83:     0x7fce02e85229 - rustc_span[7bd57098f377ce8e]::with_source_map::<core[7bb80ef76712da0f]::result::Result<(), rustc_errors[97019275299da470]::ErrorGuaranteed>, rustc_interface[dec67a8ecb269d20]::interface::create_compiler_and_run<core[7bb80ef76712da0f]::result::Result<(), rustc_errors[97019275299da470]::ErrorGuaranteed>, rustc_driver[19ffe5a3bc66cb18]::run_compiler::{closure#1}>::{closure#1}>
  84:     0x7fce02ef7c0b - std[931cb317ac66052d]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[dec67a8ecb269d20]::util::run_in_thread_pool_with_globals<rustc_interface[dec67a8ecb269d20]::interface::run_compiler<core[7bb80ef76712da0f]::result::Result<(), rustc_errors[97019275299da470]::ErrorGuaranteed>, rustc_driver[19ffe5a3bc66cb18]::run_compiler::{closure#1}>::{closure#0}, core[7bb80ef76712da0f]::result::Result<(), rustc_errors[97019275299da470]::ErrorGuaranteed>>::{closure#0}, core[7bb80ef76712da0f]::result::Result<(), rustc_errors[97019275299da470]::ErrorGuaranteed>>
  85:     0x7fce02efad59 - <<std[931cb317ac66052d]::thread::Builder>::spawn_unchecked_<rustc_interface[dec67a8ecb269d20]::util::run_in_thread_pool_with_globals<rustc_interface[dec67a8ecb269d20]::interface::run_compiler<core[7bb80ef76712da0f]::result::Result<(), rustc_errors[97019275299da470]::ErrorGuaranteed>, rustc_driver[19ffe5a3bc66cb18]::run_compiler::{closure#1}>::{closure#0}, core[7bb80ef76712da0f]::result::Result<(), rustc_errors[97019275299da470]::ErrorGuaranteed>>::{closure#0}, core[7bb80ef76712da0f]::result::Result<(), rustc_errors[97019275299da470]::ErrorGuaranteed>>::{closure#1} as core[7bb80ef76712da0f]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  86:     0x7fce02721e63 - std::sys::unix::thread::Thread::new::thread_start::h1f2eb64c3e9233cd
  87:     0x7fce024efe86 - start_thread
  88:     0x7fce02576c60 - __clone3
  89:                0x0 - <unknown>

note: 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: rustc 1.64.0 running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C debuginfo=2 -C incremental

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [type_op_normalize_fn_sig] normalizing `Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Region(U0) }], value: ParamEnvAnd { param_env: ParamEnv { caller_bounds: [Binder(TraitPredicate(<Open as core::marker::Send>, polarity:Positive), []), Binder(TraitPredicate(<Open as interface::Opener<P>>, polarity:Positive), []), Binder(TraitPredicate(<Deal as core::marker::Send>, polarity:Positive), []), Binder(TraitPredicate(<Deal as interface::Dealer<P>>, polarity:Positive), []), Binder(TraitPredicate(<Open as core::marker::Sized>, polarity:Positive), []), Binder(TraitPredicate(<Deal as core::marker::Sized>, polarity:Positive), [])], reveal: UserFacing, constness: NotConst }, value: Normalize { value: ([futures_util::sink::send::Send<'_, async_bincode::tokio::AsyncBincodeWriter<quinn::send_stream::SendStream, bgv::PublicKey<(bgv::params::phi_8191_mod_2k64::Phi8191Mod2k64, bgv::params::phi_8191_mod_p256::Phi8191ModP256)>, async_bincode::writer::AsyncDestination>, bgv::PublicKey<(bgv::params::phi_8191_mod_2k64::Phi8191Mod2k64, bgv::params::phi_8191_mod_p256::Phi8191ModP256)>>]; c_variadic: false)-><futures_util::sink::send::Send<'_, async_bincode::tokio::AsyncBincodeWriter<quinn::send_stream::SendStream, bgv::PublicKey<(bgv::params::phi_8191_mod_2k64::Phi8191Mod2k64, bgv::params::phi_8191_mod_p256::Phi8191ModP256)>, async_bincode::writer::AsyncDestination>, bgv::PublicKey<(bgv::params::phi_8191_mod_2k64::Phi8191Mod2k64, bgv::params::phi_8191_mod_p256::Phi8191ModP256)>> as core::future::into_future::IntoFuture>::IntoFuture } } }`
#1 [mir_borrowck] borrow-checking `low_gear_preproc::<impl at src/low_gear_preproc/mod.rs:70:1: 70:68>::new::{closure#0}::{closure#0}`
#2 [mir_borrowck] borrow-checking `low_gear_preproc::<impl at src/low_gear_preproc/mod.rs:70:1: 70:68>::new::{closure#0}`
#3 [mir_borrowck] borrow-checking `low_gear_preproc::<impl at src/low_gear_preproc/mod.rs:70:1: 70:68>::new`
#4 [type_of] computing type of `low_gear_preproc::<impl at src/low_gear_preproc/mod.rs:70:1: 70:68>::new::{opaque#0}`
#5 [check_mod_item_types] checking item types in module `low_gear_preproc`
#6 [analysis] running analysis passes on this crate
end of query stack
Some errors have detailed explanations: E0046, E0223, E0609.
For more information about an error, try `rustc --explain E0046`.
Backtrace

``` ```

Rageking8 commented 1 year ago

@rustbot label +E-needs-mcve

Rageking8 commented 1 year ago

Also you could try to see if this repros on the latest stable 1.65. If possible you can also try the latest nightly 1.67.

jdahlstrom commented 1 year ago

Possibly the same bug or a closely related one can be triggered with the following MCVE on both current stable and nightly. If this is a different bug, I can open a new issue or comment on another issue.

pub trait Foo: Clone {}

pub struct Bar<'a, T: Clone> {
    pub cow: std::borrow::Cow<'a, [T]>,

    pub THIS_CAUSES_ICE: (), // #1
}

impl<T> Bar<'_, T>
where
    T: Clone,
    [T]: Foo,
{
    pub fn MOVES_SELF(self) {} // #2
}

(playground)

results in

error: internal compiler error: unexpected ambiguity: Canonical { max_universe: U0, variables: [], value: ParamEnvAnd { param_env: ParamEnv { caller_bounds: [Binder(TraitPredicate(<[T] as Foo>, polarity:Positive), []), Binder(TraitPredicate(<[T] as std::clone::Clone>, polarity:Positive), []), Binder(TraitPredicate(<[T] as std::marker::Sized>, polarity:Positive), []), Binder(TraitPredicate(<T as std::clone::Clone>, polarity:Positive), []), Binder(TraitPredicate(<T as std::marker::Sized>, polarity:Positive), [])], reveal: UserFacing, constness: NotConst }, value: ProjectionTy { substs: [[T]], item_def_id: DefId(5:859 ~ alloc[d987]::borrow::ToOwned::Owned) } } } Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }], value: QueryResponse { var_values: CanonicalVarValues { var_values: [] }, region_constraints: QueryRegionConstraints { outlives: [], member_constraints: [] }, certainty: Ambiguous, opaque_types: [], value: NormalizationResult { normalized_ty: ^0 } } }
Full compiler output ```text Compiling playground v0.0.1 (/playground) thread '' panicked at 'called `Result::unwrap()` on an `Err` value: NoSolution', compiler/rustc_borrowck/src/type_check/liveness/trace.rs:574:88 stack backtrace: 0: 0x7efcb7fab9a0 - std::backtrace_rs::backtrace::libunwind::trace::he615646ea344481f at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5 1: 0x7efcb7fab9a0 - std::backtrace_rs::backtrace::trace_unsynchronized::h6ea8eaac68705b9c at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x7efcb7fab9a0 - std::sys_common::backtrace::_print_fmt::h7ac486a935ce0bf7 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:65:5 3: 0x7efcb7fab9a0 - ::fmt::h1b5a095d3db2e28f at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:44:22 4: 0x7efcb800798e - core::fmt::write::h445545b92224a1cd at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/fmt/mod.rs:1209:17 5: 0x7efcb7f9bb15 - std::io::Write::write_fmt::h55a43474c6520b00 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/io/mod.rs:1682:15 6: 0x7efcb7fab765 - std::sys_common::backtrace::_print::h65d20526fdb736b0 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:47:5 7: 0x7efcb7fab765 - std::sys_common::backtrace::print::h6555fbe12a1cc41b at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:34:9 8: 0x7efcb7fae56f - std::panicking::default_hook::{{closure}}::hbdf58083140e7ac6 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:267:22 9: 0x7efcb7fae2aa - std::panicking::default_hook::haef8271c56b74d85 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:286:9 10: 0x7efcb7faed78 - std::panicking::rust_panic_with_hook::hfd45b6b6c12d9fa5 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:688:13 11: 0x7efcb7faeb17 - std::panicking::begin_panic_handler::{{closure}}::hf591e8609a75bd4b at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:579:13 12: 0x7efcb7fabe4c - std::sys_common::backtrace::__rust_end_short_backtrace::h81899558795e4ff7 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:137:18 13: 0x7efcb7fae832 - rust_begin_unwind at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:575:5 14: 0x7efcb8004373 - core::panicking::panic_fmt::h4235fa9b4675b332 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/panicking.rs:65:14 15: 0x7efcb80048e3 - core::result::unwrap_failed::ha17dbf463031a5e1 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/result.rs:1791:5 16: 0x7efcb9f9aefa - rustc_borrowck[60153a3fde5c674a]::type_check::liveness::trace::trace 17: 0x7efcb9f6bc67 - rustc_borrowck[60153a3fde5c674a]::type_check::liveness::generate 18: 0x7efcb9f66f76 - rustc_borrowck[60153a3fde5c674a]::type_check::type_check 19: 0x7efcb9f5730a - rustc_borrowck[60153a3fde5c674a]::nll::compute_regions 20: 0x7efcb9f3865f - rustc_borrowck[60153a3fde5c674a]::do_mir_borrowck 21: 0x7efcb9f1e996 - rustc_borrowck[60153a3fde5c674a]::mir_borrowck 22: 0x7efcba29651c - rustc_query_system[330b635d327008f7]::query::plumbing::try_execute_query::> 23: 0x7efcb954e072 - rustc_data_structures[e8a5264856147ea5]::sync::par_for_each_in::<&[rustc_span[14998722174c1bca]::def_id::LocalDefId], ::par_body_owners::{closure#0}> 24: 0x7efcb954cb4f - ::time::<(), rustc_interface[ee1a3f92e887e004]::passes::analysis::{closure#2}> 25: 0x7efcb954aa87 - rustc_interface[ee1a3f92e887e004]::passes::analysis 26: 0x7efcba987ac4 - rustc_query_system[330b635d327008f7]::query::plumbing::try_execute_query::>> 27: 0x7efcba9877c7 - rustc_query_system[330b635d327008f7]::query::plumbing::get_query:: 28: 0x7efcba4c9acd - ::enter::> 29: 0x7efcba4c5f7f - ::enter::, rustc_errors[21897ed46328f955]::ErrorGuaranteed>> 30: 0x7efcba4bdac2 - rustc_span[14998722174c1bca]::with_source_map::, rustc_interface[ee1a3f92e887e004]::interface::run_compiler, rustc_driver[9c4183344b2d0066]::run_compiler::{closure#1}>::{closure#0}::{closure#1}> 31: 0x7efcba4bd5b9 - >::set::, rustc_driver[9c4183344b2d0066]::run_compiler::{closure#1}>::{closure#0}, core[b97a30f8df81432d]::result::Result<(), rustc_errors[21897ed46328f955]::ErrorGuaranteed>> 32: 0x7efcba4bcbc8 - std[bbad73ae434e23e5]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver[9c4183344b2d0066]::run_compiler::{closure#1}>::{closure#0}, core[b97a30f8df81432d]::result::Result<(), rustc_errors[21897ed46328f955]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[b97a30f8df81432d]::result::Result<(), rustc_errors[21897ed46328f955]::ErrorGuaranteed>> 33: 0x7efcba4bc8ec - <::spawn_unchecked_, rustc_driver[9c4183344b2d0066]::run_compiler::{closure#1}>::{closure#0}, core[b97a30f8df81432d]::result::Result<(), rustc_errors[21897ed46328f955]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[b97a30f8df81432d]::result::Result<(), rustc_errors[21897ed46328f955]::ErrorGuaranteed>>::{closure#1} as core[b97a30f8df81432d]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 34: 0x7efcbbe666a3 - as core::ops::function::FnOnce>::call_once::h4273f95ec44459b3 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/alloc/src/boxed.rs:1987:9 35: 0x7efcbbe666a3 - as core::ops::function::FnOnce>::call_once::h70f28fa4ddc269e5 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/alloc/src/boxed.rs:1987:9 36: 0x7efcbbe666a3 - std::sys::unix::thread::Thread::new::thread_start::h85a9c16b988e2bd0 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys/unix/thread.rs:108:17 37: 0x7efcb7e8a609 - start_thread 38: 0x7efcb7dad133 - clone 39: 0x0 - error: internal compiler error: no errors encountered even though `delay_span_bug` issued error: internal compiler error: unexpected ambiguity: Canonical { max_universe: U0, variables: [], value: ParamEnvAnd { param_env: ParamEnv { caller_bounds: [Binder(TraitPredicate(<[T] as Foo>, polarity:Positive), []), Binder(TraitPredicate(<[T] as std::clone::Clone>, polarity:Positive), []), Binder(TraitPredicate(<[T] as std::marker::Sized>, polarity:Positive), []), Binder(TraitPredicate(, polarity:Positive), []), Binder(TraitPredicate(, polarity:Positive), [])], reveal: UserFacing, constness: NotConst }, value: ProjectionTy { substs: [[T]], item_def_id: DefId(5:859 ~ alloc[d987]::borrow::ToOwned::Owned) } } } Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }], value: QueryResponse { var_values: CanonicalVarValues { var_values: [] }, region_constraints: QueryRegionConstraints { outlives: [], member_constraints: [] }, certainty: Ambiguous, opaque_types: [], value: NormalizationResult { normalized_ty: ^0 } } } | = note: delayed at compiler/rustc_trait_selection/src/traits/query/normalize.rs:260:34 thread 'rustc' panicked at 'Box', compiler/rustc_errors/src/lib.rs:1553:13 stack backtrace: 0: 0x7efcbbe5ce20 - std::backtrace_rs::backtrace::libunwind::trace::he615646ea344481f at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5 1: 0x7efcbbe5ce20 - std::backtrace_rs::backtrace::trace_unsynchronized::h6ea8eaac68705b9c at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x7efcbbe5ce20 - std::sys_common::backtrace::_print_fmt::h7ac486a935ce0bf7 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:65:5 3: 0x7efcbbe5ce20 - ::fmt::h1b5a095d3db2e28f at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:44:22 4: 0x7efcb800798e - core::fmt::write::h445545b92224a1cd at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/fmt/mod.rs:1209:17 5: 0x7efcbbe50ad5 - std::io::Write::write_fmt::h55a43474c6520b00 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/io/mod.rs:1682:15 6: 0x7efcbbe5cbe5 - std::sys_common::backtrace::_print::h65d20526fdb736b0 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:47:5 7: 0x7efcbbe5cbe5 - std::sys_common::backtrace::print::h6555fbe12a1cc41b at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:34:9 8: 0x7efcbbe5ef3f - std::panicking::default_hook::{{closure}}::hbdf58083140e7ac6 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:267:22 9: 0x7efcbbe5ec7a - std::panicking::default_hook::haef8271c56b74d85 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:286:9 10: 0x7efcbb122cd4 - >::call_once::{shim:vtable#0} 11: 0x7efcbbe5f729 - as core::ops::function::Fn>::call::h44df53ea2a13204b at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/alloc/src/boxed.rs:2001:9 12: 0x7efcbbe5f729 - std::panicking::rust_panic_with_hook::hfd45b6b6c12d9fa5 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:692:13 13: 0x7efcbb1510b1 - std[bbad73ae434e23e5]::panicking::begin_panic::::{closure#0} 14: 0x7efcbb14f846 - std[bbad73ae434e23e5]::sys_common::backtrace::__rust_end_short_backtrace::::{closure#0}, !> 15: 0x7efcbb149636 - std[bbad73ae434e23e5]::panicking::begin_panic:: 16: 0x7efcbb14bcc6 - std[bbad73ae434e23e5]::panic::panic_any:: 17: 0x7efcba6c4b71 - ::flush_delayed::, &str> 18: 0x7efcba6c3bb2 - ::drop 19: 0x7efcba50cd58 - core[b97a30f8df81432d]::ptr::drop_in_place:: 20: 0x7efcba4bedf8 - core[b97a30f8df81432d]::ptr::drop_in_place:: 21: 0x7efcba4beb19 - core[b97a30f8df81432d]::ptr::drop_in_place:: 22: 0x7efcba4bdf2e - rustc_span[14998722174c1bca]::with_source_map::, rustc_interface[ee1a3f92e887e004]::interface::run_compiler, rustc_driver[9c4183344b2d0066]::run_compiler::{closure#1}>::{closure#0}::{closure#1}> 23: 0x7efcba4bd5b9 - >::set::, rustc_driver[9c4183344b2d0066]::run_compiler::{closure#1}>::{closure#0}, core[b97a30f8df81432d]::result::Result<(), rustc_errors[21897ed46328f955]::ErrorGuaranteed>> 24: 0x7efcba4bcbc8 - std[bbad73ae434e23e5]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver[9c4183344b2d0066]::run_compiler::{closure#1}>::{closure#0}, core[b97a30f8df81432d]::result::Result<(), rustc_errors[21897ed46328f955]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[b97a30f8df81432d]::result::Result<(), rustc_errors[21897ed46328f955]::ErrorGuaranteed>> 25: 0x7efcba4bc8ec - <::spawn_unchecked_, rustc_driver[9c4183344b2d0066]::run_compiler::{closure#1}>::{closure#0}, core[b97a30f8df81432d]::result::Result<(), rustc_errors[21897ed46328f955]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[b97a30f8df81432d]::result::Result<(), rustc_errors[21897ed46328f955]::ErrorGuaranteed>>::{closure#1} as core[b97a30f8df81432d]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 26: 0x7efcbbe666a3 - as core::ops::function::FnOnce>::call_once::h4273f95ec44459b3 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/alloc/src/boxed.rs:1987:9 27: 0x7efcbbe666a3 - as core::ops::function::FnOnce>::call_once::h70f28fa4ddc269e5 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/alloc/src/boxed.rs:1987:9 28: 0x7efcbbe666a3 - std::sys::unix::thread::Thread::new::thread_start::h85a9c16b988e2bd0 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys/unix/thread.rs:108:17 29: 0x7efcb7e8a609 - start_thread 30: 0x7efcb7dad133 - clone 31: 0x0 - note: 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: rustc 1.66.0 (69f9c33d7 2022-12-12) running on x86_64-unknown-linux-gnu note: compiler flags: --crate-type lib -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2 note: some of the compiler flags provided by cargo are hidden query stack during panic: end of query stack thread '' panicked at 'panic in a function that cannot unwind', library/core/src/panicking.rs:90:58 stack backtrace: 0: 0x7efcb7fab9a0 - std::backtrace_rs::backtrace::libunwind::trace::he615646ea344481f at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5 1: 0x7efcb7fab9a0 - std::backtrace_rs::backtrace::trace_unsynchronized::h6ea8eaac68705b9c at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x7efcb7fab9a0 - std::sys_common::backtrace::_print_fmt::h7ac486a935ce0bf7 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:65:5 3: 0x7efcb7fab9a0 - ::fmt::h1b5a095d3db2e28f at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:44:22 4: 0x7efcb800798e - core::fmt::write::h445545b92224a1cd at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/fmt/mod.rs:1209:17 5: 0x7efcb7f9bb15 - std::io::Write::write_fmt::h55a43474c6520b00 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/io/mod.rs:1682:15 6: 0x7efcb7fab765 - std::sys_common::backtrace::_print::h65d20526fdb736b0 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:47:5 7: 0x7efcb7fab765 - std::sys_common::backtrace::print::h6555fbe12a1cc41b at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:34:9 8: 0x7efcb7fae56f - std::panicking::default_hook::{{closure}}::hbdf58083140e7ac6 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:267:22 9: 0x7efcb7fae2aa - std::panicking::default_hook::haef8271c56b74d85 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:286:9 10: 0x7efcb7faed78 - std::panicking::rust_panic_with_hook::hfd45b6b6c12d9fa5 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:688:13 11: 0x7efcb7faead1 - std::panicking::begin_panic_handler::{{closure}}::hf591e8609a75bd4b at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:577:13 12: 0x7efcb7fabe4c - std::sys_common::backtrace::__rust_end_short_backtrace::h81899558795e4ff7 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys_common/backtrace.rs:137:18 13: 0x7efcb7fae832 - rust_begin_unwind at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/panicking.rs:575:5 14: 0x7efcb80043f3 - core::panicking::panic_str_nounwind::h2959ea310e934ac1 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/panicking.rs:93:14 15: 0x7efcb8004563 - core::panicking::panic_no_unwind::h31a06247391473ac at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/core/src/panicking.rs:164:5 16: 0x7efcba4bdf45 - rustc_span[14998722174c1bca]::with_source_map::, rustc_interface[ee1a3f92e887e004]::interface::run_compiler, rustc_driver[9c4183344b2d0066]::run_compiler::{closure#1}>::{closure#0}::{closure#1}> 17: 0x7efcba4bd5b9 - >::set::, rustc_driver[9c4183344b2d0066]::run_compiler::{closure#1}>::{closure#0}, core[b97a30f8df81432d]::result::Result<(), rustc_errors[21897ed46328f955]::ErrorGuaranteed>> 18: 0x7efcba4bcbc8 - std[bbad73ae434e23e5]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver[9c4183344b2d0066]::run_compiler::{closure#1}>::{closure#0}, core[b97a30f8df81432d]::result::Result<(), rustc_errors[21897ed46328f955]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[b97a30f8df81432d]::result::Result<(), rustc_errors[21897ed46328f955]::ErrorGuaranteed>> 19: 0x7efcba4bc8ec - <::spawn_unchecked_, rustc_driver[9c4183344b2d0066]::run_compiler::{closure#1}>::{closure#0}, core[b97a30f8df81432d]::result::Result<(), rustc_errors[21897ed46328f955]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[b97a30f8df81432d]::result::Result<(), rustc_errors[21897ed46328f955]::ErrorGuaranteed>>::{closure#1} as core[b97a30f8df81432d]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 20: 0x7efcbbe666a3 - as core::ops::function::FnOnce>::call_once::h4273f95ec44459b3 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/alloc/src/boxed.rs:1987:9 21: 0x7efcbbe666a3 - as core::ops::function::FnOnce>::call_once::h70f28fa4ddc269e5 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/alloc/src/boxed.rs:1987:9 22: 0x7efcbbe666a3 - std::sys::unix::thread::Thread::new::thread_start::h85a9c16b988e2bd0 at /rustc/69f9c33d71c871fc16ac445211281c6e7a340943/library/std/src/sys/unix/thread.rs:108:17 23: 0x7efcb7e8a609 - start_thread 24: 0x7efcb7dad133 - clone 25: 0x0 - thread panicked while panicking. aborting. error: could not compile `playground` ```

The critical lines are marked as #1 and #2; commenting out #1 prevents the ICE and gives the following error which is presumably caused by the compiler not being able to prove that Cow<'_, [T]> is Sized (presumably caused by missing ToOwned bound?) Removing line #2, or changing it to borrow self makes the code compile, as expected.

EDIT

Seems this is related to the fact that a DST can be the last field, but only the last field, of a struct. Moving #1 one line up also makes the ICE go away.

error[[E0284]](https://doc.rust-lang.org/stable/error-index.html#E0284): type annotations needed
  --> src/lib.rs:17:23
   |
17 |     pub fn MOVES_SELF(self) {}
   |                       ^^^^ cannot infer type
   |
   = note: cannot satisfy `<[T] as ToOwned>::Owned == _`
note: required because it appears within the type `Bar<'_, T>`
  --> src/lib.rs:3:12
   |
3  | pub struct Bar<'a, T>
   |            ^^^
help: function arguments must have a statically known size, borrowed types always have a known size
   |
17 |     pub fn MOVES_SELF(&self) {}
   |                       +
kpreid commented 10 months ago

@rustbot label -E-needs-mcve