Skip to content

ICE: did not expect successful goal when collecting ambiguity errors #122861

Closed

Description

snippet:

use std::fmt::{self, Display};

pub enum Cow<'a, B: ?Sized + 'a, O = <B as ToOwned>::Owned> {
    Owned(O),
}

impl ToString for Cow<'_, str> {}

impl<B: ?Sized> Display for Cow<'a, B> {}

Version information

rustc 1.79.0-nightly (cdb683f6e 2024-03-22)
binary: rustc
commit-hash: cdb683f6e4b0774b85c60eebe12af87f29d8ee4d
commit-date: 2024-03-22
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.2

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Znext-solver=coherence

Program output

error[E0261]: use of undeclared lifetime name `'a`
 --> /tmp/icemaker_global_tempdir.zCajRpRcQrMe/rustc_testrunner_tmpdir_reporting.6yVkPkyt3E9T/mvce.rs:9:33
  |
9 | impl<B: ?Sized> Display for Cow<'a, B> {}
  |      -                          ^^ undeclared lifetime
  |      |
  |      help: consider introducing lifetime `'a` here: `'a,`

warning: unused import: `self`
 --> /tmp/icemaker_global_tempdir.zCajRpRcQrMe/rustc_testrunner_tmpdir_reporting.6yVkPkyt3E9T/mvce.rs:1:16
  |
1 | use std::fmt::{self, Display};
  |                ^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.zCajRpRcQrMe/rustc_testrunner_tmpdir_reporting.6yVkPkyt3E9T/mvce.rs:9:42
  |
9 | impl<B: ?Sized> Display for Cow<'a, B> {}
  |                                          ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.zCajRpRcQrMe/rustc_testrunner_tmpdir_reporting.6yVkPkyt3E9T/mvce.rs`

error[E0392]: lifetime parameter `'a` is never used
 --> /tmp/icemaker_global_tempdir.zCajRpRcQrMe/rustc_testrunner_tmpdir_reporting.6yVkPkyt3E9T/mvce.rs:3:14
  |
3 | pub enum Cow<'a, B: ?Sized + 'a, O = <B as ToOwned>::Owned> {
  |              ^^ unused lifetime parameter
  |
  = help: consider removing `'a`, referring to it in a field, or using a marker such as `PhantomData`

error[E0392]: type parameter `B` is never used
 --> /tmp/icemaker_global_tempdir.zCajRpRcQrMe/rustc_testrunner_tmpdir_reporting.6yVkPkyt3E9T/mvce.rs:3:18
  |
3 | pub enum Cow<'a, B: ?Sized + 'a, O = <B as ToOwned>::Owned> {
  |                  ^ unused type parameter
  |
  = help: consider removing `B`, referring to it in a field, or using a marker such as `PhantomData`

error: internal compiler error: compiler/rustc_trait_selection/src/solve/fulfill.rs:253:17: did not expect successful goal when collecting ambiguity errors

thread 'rustc' panicked at compiler/rustc_trait_selection/src/solve/fulfill.rs:253:17:
Box<dyn Any>
stack backtrace:
   0:     0x771b988fdfa5 - std::backtrace_rs::backtrace::libunwind::trace::h11e387afc995a3f8
                               at /rustc/cdb683f6e4b0774b85c60eebe12af87f29d8ee4d/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0x771b988fdfa5 - std::backtrace_rs::backtrace::trace_unsynchronized::h8d670fb623231269
                               at /rustc/cdb683f6e4b0774b85c60eebe12af87f29d8ee4d/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x771b988fdfa5 - std::sys_common::backtrace::_print_fmt::ha2d84ab139add13a
                               at /rustc/cdb683f6e4b0774b85c60eebe12af87f29d8ee4d/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x771b988fdfa5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h358175ab738dc8f9
                               at /rustc/cdb683f6e4b0774b85c60eebe12af87f29d8ee4d/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x771b9894efeb - core::fmt::rt::Argument::fmt::hd5ffe1a165cb8c35
                               at /rustc/cdb683f6e4b0774b85c60eebe12af87f29d8ee4d/library/core/src/fmt/rt.rs:142:9
   5:     0x771b9894efeb - core::fmt::write::h29cad363bb870703
                               at /rustc/cdb683f6e4b0774b85c60eebe12af87f29d8ee4d/library/core/src/fmt/mod.rs:1153:17
   6:     0x771b988f2d3f - std::io::Write::write_fmt::h8f1b091813bcb5ee
                               at /rustc/cdb683f6e4b0774b85c60eebe12af87f29d8ee4d/library/std/src/io/mod.rs:1843:15
   7:     0x771b988fdd7e - std::sys_common::backtrace::_print::h57a35e81e6b3dfba
                               at /rustc/cdb683f6e4b0774b85c60eebe12af87f29d8ee4d/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x771b988fdd7e - std::sys_common::backtrace::print::h7752791d0652725b
                               at /rustc/cdb683f6e4b0774b85c60eebe12af87f29d8ee4d/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x771b989009f9 - std::panicking::default_hook::{{closure}}::h45d4c2226e553b54
  10:     0x771b98900763 - std::panicking::default_hook::h536257b3760a2836
                               at /rustc/cdb683f6e4b0774b85c60eebe12af87f29d8ee4d/library/std/src/panicking.rs:292:9
  11:     0x771b951d008f - std[e6c5cc86949723fb]::panicking::update_hook::<alloc[2488795b1f946429]::boxed::Box<rustc_driver_impl[553a65dd8cc54b99]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x771b98901150 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h7faa66ef91632f4d
                               at /rustc/cdb683f6e4b0774b85c60eebe12af87f29d8ee4d/library/alloc/src/boxed.rs:2029:9
  13:     0x771b98901150 - std::panicking::rust_panic_with_hook::h636b121c3987dd1a
                               at /rustc/cdb683f6e4b0774b85c60eebe12af87f29d8ee4d/library/std/src/panicking.rs:783:13
  14:     0x771b951fff84 - std[e6c5cc86949723fb]::panicking::begin_panic::<rustc_errors[dd38ec4cf0a21b5a]::ExplicitBug>::{closure#0}
  15:     0x771b951fccf6 - std[e6c5cc86949723fb]::sys_common::backtrace::__rust_end_short_backtrace::<std[e6c5cc86949723fb]::panicking::begin_panic<rustc_errors[dd38ec4cf0a21b5a]::ExplicitBug>::{closure#0}, !>
  16:     0x771b951fc9d6 - std[e6c5cc86949723fb]::panicking::begin_panic::<rustc_errors[dd38ec4cf0a21b5a]::ExplicitBug>
  17:     0x771b95209251 - <rustc_errors[dd38ec4cf0a21b5a]::diagnostic::BugAbort as rustc_errors[dd38ec4cf0a21b5a]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  18:     0x771b9569b30c - rustc_middle[b6c79b5c54b897c9]::util::bug::opt_span_bug_fmt::<rustc_span[b22bf4c4de274393]::span_encoding::Span>::{closure#0}
  19:     0x771b9567e7ba - rustc_middle[b6c79b5c54b897c9]::ty::context::tls::with_opt::<rustc_middle[b6c79b5c54b897c9]::util::bug::opt_span_bug_fmt<rustc_span[b22bf4c4de274393]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  20:     0x771b9567e63b - rustc_middle[b6c79b5c54b897c9]::ty::context::tls::with_context_opt::<rustc_middle[b6c79b5c54b897c9]::ty::context::tls::with_opt<rustc_middle[b6c79b5c54b897c9]::util::bug::opt_span_bug_fmt<rustc_span[b22bf4c4de274393]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  21:     0x771b93255760 - rustc_middle[b6c79b5c54b897c9]::util::bug::bug_fmt
  22:     0x771b95c98629 - <rustc_trait_selection[c6bb34c531b92309]::solve::fulfill::FulfillmentCtxt as rustc_infer[a6913a6345f74118]::traits::engine::TraitEngine>::collect_remaining_errors
  23:     0x771b96d5bfe5 - rustc_trait_selection[c6bb34c531b92309]::traits::coherence::overlap
  24:     0x771b96d5a838 - <rustc_middle[b6c79b5c54b897c9]::traits::specialization_graph::Children as rustc_trait_selection[c6bb34c531b92309]::traits::specialize::specialization_graph::ChildrenExt>::insert
  25:     0x771b9416761b - <rustc_middle[b6c79b5c54b897c9]::traits::specialization_graph::Graph as rustc_trait_selection[c6bb34c531b92309]::traits::specialize::specialization_graph::GraphExt>::insert
  26:     0x771b967d6e29 - rustc_trait_selection[c6bb34c531b92309]::traits::specialize::specialization_graph_provider
  27:     0x771b967d69af - rustc_query_impl[9d10e4cdc8661839]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9d10e4cdc8661839]::query_impl::specialization_graph_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b6c79b5c54b897c9]::query::erase::Erased<[u8; 8usize]>>
  28:     0x771b967d4d9c - rustc_query_system[fa840ac625a9d87c]::query::plumbing::try_execute_query::<rustc_query_impl[9d10e4cdc8661839]::DynamicConfig<rustc_query_system[fa840ac625a9d87c]::query::caches::DefIdCache<rustc_middle[b6c79b5c54b897c9]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[9d10e4cdc8661839]::plumbing::QueryCtxt, false>
  29:     0x771b96d2a55e - rustc_query_impl[9d10e4cdc8661839]::query_impl::specialization_graph_of::get_query_non_incr::__rust_end_short_backtrace
  30:     0x771b96c0dbb5 - rustc_hir_analysis[27c494469da79ded]::coherence::coherent_trait
  31:     0x771b96c0d8a7 - rustc_query_impl[9d10e4cdc8661839]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9d10e4cdc8661839]::query_impl::coherent_trait::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b6c79b5c54b897c9]::query::erase::Erased<[u8; 1usize]>>
  32:     0x771b968d69d1 - rustc_query_system[fa840ac625a9d87c]::query::plumbing::try_execute_query::<rustc_query_impl[9d10e4cdc8661839]::DynamicConfig<rustc_query_system[fa840ac625a9d87c]::query::caches::DefIdCache<rustc_middle[b6c79b5c54b897c9]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[9d10e4cdc8661839]::plumbing::QueryCtxt, false>
  33:     0x771b96c27409 - rustc_query_impl[9d10e4cdc8661839]::query_impl::coherent_trait::get_query_non_incr::__rust_end_short_backtrace
  34:     0x771b96c37fe3 - rustc_hir_analysis[27c494469da79ded]::check::wfcheck::check_well_formed
  35:     0x771b96c35db5 - rustc_query_impl[9d10e4cdc8661839]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9d10e4cdc8661839]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b6c79b5c54b897c9]::query::erase::Erased<[u8; 1usize]>>
  36:     0x771b96c35540 - rustc_query_system[fa840ac625a9d87c]::query::plumbing::try_execute_query::<rustc_query_impl[9d10e4cdc8661839]::DynamicConfig<rustc_query_system[fa840ac625a9d87c]::query::caches::VecCache<rustc_hir[3a74fa3b26513fe7]::hir_id::OwnerId, rustc_middle[b6c79b5c54b897c9]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[9d10e4cdc8661839]::plumbing::QueryCtxt, false>
  37:     0x771b96c352bf - rustc_query_impl[9d10e4cdc8661839]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  38:     0x771b96c331fa - rustc_hir_analysis[27c494469da79ded]::check::wfcheck::check_mod_type_wf
  39:     0x771b96c33021 - rustc_query_impl[9d10e4cdc8661839]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9d10e4cdc8661839]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b6c79b5c54b897c9]::query::erase::Erased<[u8; 1usize]>>
  40:     0x771b970a9430 - rustc_query_system[fa840ac625a9d87c]::query::plumbing::try_execute_query::<rustc_query_impl[9d10e4cdc8661839]::DynamicConfig<rustc_query_system[fa840ac625a9d87c]::query::caches::DefaultCache<rustc_span[b22bf4c4de274393]::def_id::LocalModDefId, rustc_middle[b6c79b5c54b897c9]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[9d10e4cdc8661839]::plumbing::QueryCtxt, false>
  41:     0x771b970a91db - rustc_query_impl[9d10e4cdc8661839]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  42:     0x771b9697a88f - rustc_hir_analysis[27c494469da79ded]::check_crate
  43:     0x771b96afbfea - rustc_interface[9d4fe0c88be31b0e]::passes::analysis
  44:     0x771b96afbb59 - rustc_query_impl[9d10e4cdc8661839]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9d10e4cdc8661839]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[b6c79b5c54b897c9]::query::erase::Erased<[u8; 1usize]>>
  45:     0x771b9741a383 - rustc_query_system[fa840ac625a9d87c]::query::plumbing::try_execute_query::<rustc_query_impl[9d10e4cdc8661839]::DynamicConfig<rustc_query_system[fa840ac625a9d87c]::query::caches::SingleCache<rustc_middle[b6c79b5c54b897c9]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[9d10e4cdc8661839]::plumbing::QueryCtxt, false>
  46:     0x771b9741a0ff - rustc_query_impl[9d10e4cdc8661839]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  47:     0x771b97265419 - rustc_interface[9d4fe0c88be31b0e]::interface::run_compiler::<core[53e1ce75f27368c2]::result::Result<(), rustc_span[b22bf4c4de274393]::ErrorGuaranteed>, rustc_driver_impl[553a65dd8cc54b99]::run_compiler::{closure#0}>::{closure#0}
  48:     0x771b9735a807 - std[e6c5cc86949723fb]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[9d4fe0c88be31b0e]::util::run_in_thread_with_globals<rustc_interface[9d4fe0c88be31b0e]::util::run_in_thread_pool_with_globals<rustc_interface[9d4fe0c88be31b0e]::interface::run_compiler<core[53e1ce75f27368c2]::result::Result<(), rustc_span[b22bf4c4de274393]::ErrorGuaranteed>, rustc_driver_impl[553a65dd8cc54b99]::run_compiler::{closure#0}>::{closure#0}, core[53e1ce75f27368c2]::result::Result<(), rustc_span[b22bf4c4de274393]::ErrorGuaranteed>>::{closure#0}, core[53e1ce75f27368c2]::result::Result<(), rustc_span[b22bf4c4de274393]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[53e1ce75f27368c2]::result::Result<(), rustc_span[b22bf4c4de274393]::ErrorGuaranteed>>
  49:     0x771b9735a634 - <<std[e6c5cc86949723fb]::thread::Builder>::spawn_unchecked_<rustc_interface[9d4fe0c88be31b0e]::util::run_in_thread_with_globals<rustc_interface[9d4fe0c88be31b0e]::util::run_in_thread_pool_with_globals<rustc_interface[9d4fe0c88be31b0e]::interface::run_compiler<core[53e1ce75f27368c2]::result::Result<(), rustc_span[b22bf4c4de274393]::ErrorGuaranteed>, rustc_driver_impl[553a65dd8cc54b99]::run_compiler::{closure#0}>::{closure#0}, core[53e1ce75f27368c2]::result::Result<(), rustc_span[b22bf4c4de274393]::ErrorGuaranteed>>::{closure#0}, core[53e1ce75f27368c2]::result::Result<(), rustc_span[b22bf4c4de274393]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[53e1ce75f27368c2]::result::Result<(), rustc_span[b22bf4c4de274393]::ErrorGuaranteed>>::{closure#1} as core[53e1ce75f27368c2]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  50:     0x771b9890a919 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h879e715adb7f28e1
                               at /rustc/cdb683f6e4b0774b85c60eebe12af87f29d8ee4d/library/alloc/src/boxed.rs:2015:9
  51:     0x771b9890a919 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3d351b6740b03726
                               at /rustc/cdb683f6e4b0774b85c60eebe12af87f29d8ee4d/library/alloc/src/boxed.rs:2015:9
  52:     0x771b9890a919 - std::sys::pal::unix::thread::Thread::new::thread_start::hd052af29f8fa57fe
                               at /rustc/cdb683f6e4b0774b85c60eebe12af87f29d8ee4d/library/std/src/sys/pal/unix/thread.rs:108:17
  53:     0x771b920a955a - <unknown>
  54:     0x771b92126a3c - <unknown>
  55:                0x0 - <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: rustc 1.79.0-nightly (cdb683f6e 2024-03-22) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z next-solver=coherence -Z dump-mir-dir=dir

query stack during panic:
#0 [specialization_graph_of] building specialization graph of trait `alloc::string::ToString`
#1 [coherent_trait] coherence checking all impls of trait `alloc::string::ToString`
#2 [check_well_formed] checking that `<impl at /tmp/icemaker_global_tempdir.zCajRpRcQrMe/rustc_testrunner_tmpdir_reporting.6yVkPkyt3E9T/mvce.rs:7:1: 7:31>` is well-formed
#3 [check_mod_type_wf] checking that types are well-formed in top-level module
#4 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 5 previous errors; 1 warning emitted

Some errors have detailed explanations: E0261, E0392, E0601.
For more information about an error, try `rustc --explain E0261`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Labels

A-traitsArea: Trait systemC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️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