Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: failed to resolve instance for ErrorGuaranteed() #127826

Open
matthiaskrgr opened this issue Jul 16, 2024 · 1 comment
Open

ICE: failed to resolve instance for ErrorGuaranteed() #127826

matthiaskrgr opened this issue Jul 16, 2024 · 1 comment
Labels
C-bug Category: This is a bug. F-const_closures `#![feature(const_closures)]` F-const_trait_impl `#![feature(const_trait_impl)]` F-effects `#![feature(effects)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

auto-reduced (treereduce-rust):

#![feature(const_trait_impl, effects, const_closures)]

trait Bar {
    fn foo(&self);
}

impl Bar for () {}

const Branch: () = {
    (const || (&() as &dyn Bar).foo())();
};

original:

#![feature(const_trait_impl, effects, const_closures)]

#[derive(Eq, PartialEq)]
trait Bar {
    fn foo(&self);
}

impl Bar for () {
    type R = U;
}

const Branch: () = {
    (const || (&() as &dyn Bar).foo())();
};

Version information

rustc 1.81.0-nightly (16b569057 2024-07-16)
binary: rustc
commit-hash: 16b569057e4d1591b4bee05f10df34000308dedc
commit-date: 2024-07-16
host: x86_64-unknown-linux-gnu
release: 1.81.0-nightly
LLVM version: 18.1.7

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

warning: the feature `effects` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /tmp/icemaker_global_tempdir.Yy3tFb0ckOY1/rustc_testrunner_tmpdir_reporting.zpJOe0CdlMnS/mvce.rs:1:30
  |
1 | #![feature(const_trait_impl, effects, const_closures)]
  |                              ^^^^^^^
  |
  = note: see issue #102090 <https://github.com/rust-lang/rust/issues/102090> for more information
  = note: `#[warn(incomplete_features)]` on by default

warning: the feature `const_closures` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /tmp/icemaker_global_tempdir.Yy3tFb0ckOY1/rustc_testrunner_tmpdir_reporting.zpJOe0CdlMnS/mvce.rs:1:39
  |
1 | #![feature(const_trait_impl, effects, const_closures)]
  |                                       ^^^^^^^^^^^^^^
  |
  = note: see issue #106003 <https://github.com/rust-lang/rust/issues/106003> for more information

error[E0601]: `main` function not found in crate `mvce`
  --> /tmp/icemaker_global_tempdir.Yy3tFb0ckOY1/rustc_testrunner_tmpdir_reporting.zpJOe0CdlMnS/mvce.rs:11:3
   |
11 | };
   |   ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.Yy3tFb0ckOY1/rustc_testrunner_tmpdir_reporting.zpJOe0CdlMnS/mvce.rs`

error: using `#![feature(effects)]` without enabling next trait solver globally
  |
  = note: the next trait solver must be enabled globally for the effects feature to work correctly
  = help: use `-Znext-solver` to enable

error[E0046]: not all trait items implemented, missing: `foo`
 --> /tmp/icemaker_global_tempdir.Yy3tFb0ckOY1/rustc_testrunner_tmpdir_reporting.zpJOe0CdlMnS/mvce.rs:7:1
  |
4 |     fn foo(&self);
  |     -------------- `foo` from trait
...
7 | impl Bar for () {}
  | ^^^^^^^^^^^^^^^ missing `foo` in implementation

error: internal compiler error: compiler/rustc_middle/src/ty/instance.rs:605:25: failed to resolve instance for <() as Bar>::foo: Err(
                                    ErrorGuaranteed(
                                        (),
                                    ),
                                )
 --> /tmp/icemaker_global_tempdir.Yy3tFb0ckOY1/rustc_testrunner_tmpdir_reporting.zpJOe0CdlMnS/mvce.rs:4:5
  |
4 |     fn foo(&self);
  |     ^^^^^^^^^^^^^^

thread 'rustc' panicked at compiler/rustc_middle/src/ty/instance.rs:605:25:
Box<dyn Any>
stack backtrace:
   0:     0x78373547f3e5 - std::backtrace_rs::backtrace::libunwind::trace::hfb477357653a4e4f
                               at /rustc/16b569057e4d1591b4bee05f10df34000308dedc/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x78373547f3e5 - std::backtrace_rs::backtrace::trace_unsynchronized::h525c0fd0df716fa6
                               at /rustc/16b569057e4d1591b4bee05f10df34000308dedc/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x78373547f3e5 - std::sys::backtrace::_print_fmt::ha838f41c5e535f51
                               at /rustc/16b569057e4d1591b4bee05f10df34000308dedc/library/std/src/sys/backtrace.rs:65:5
   3:     0x78373547f3e5 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h1e9b6837be55babe
                               at /rustc/16b569057e4d1591b4bee05f10df34000308dedc/library/std/src/sys/backtrace.rs:40:26
   4:     0x7837354cee1b - core::fmt::rt::Argument::fmt::h964c89d0f98e9825
                               at /rustc/16b569057e4d1591b4bee05f10df34000308dedc/library/core/src/fmt/rt.rs:173:76
   5:     0x7837354cee1b - core::fmt::write::h806b4533fac49ea3
                               at /rustc/16b569057e4d1591b4bee05f10df34000308dedc/library/core/src/fmt/mod.rs:1182:21
   6:     0x783735473e9f - std::io::Write::write_fmt::h63c0ff199204c41f
                               at /rustc/16b569057e4d1591b4bee05f10df34000308dedc/library/std/src/io/mod.rs:1827:15
   7:     0x783735481bd1 - std::sys::backtrace::BacktraceLock::print::h64a586f07964a880
                               at /rustc/16b569057e4d1591b4bee05f10df34000308dedc/library/std/src/sys/backtrace.rs:43:9
   8:     0x783735481bd1 - std::panicking::default_hook::{{closure}}::h027d3d88677b9c45
                               at /rustc/16b569057e4d1591b4bee05f10df34000308dedc/library/std/src/panicking.rs:269:22
   9:     0x7837354818ac - std::panicking::default_hook::hb3342887544240f4
                               at /rustc/16b569057e4d1591b4bee05f10df34000308dedc/library/std/src/panicking.rs:296:9
  10:     0x7837317fab3a - std[e26dd15980711d9]::panicking::update_hook::<alloc[4a4297c918417764]::boxed::Box<rustc_driver_impl[c14dc3c35b3af881]::install_ice_hook::{closure#0}>>::{closure#0}
  11:     0x78373548259f - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h40fc715dd10a461f
                               at /rustc/16b569057e4d1591b4bee05f10df34000308dedc/library/alloc/src/boxed.rs:2084:9
  12:     0x78373548259f - std::panicking::rust_panic_with_hook::hb25aeb72f7ce42c5
                               at /rustc/16b569057e4d1591b4bee05f10df34000308dedc/library/std/src/panicking.rs:808:13
  13:     0x783731835ab1 - std[e26dd15980711d9]::panicking::begin_panic::<rustc_errors[c28d6f5ecad04e0f]::ExplicitBug>::{closure#0}
  14:     0x783731828a66 - std[e26dd15980711d9]::sys::backtrace::__rust_end_short_backtrace::<std[e26dd15980711d9]::panicking::begin_panic<rustc_errors[c28d6f5ecad04e0f]::ExplicitBug>::{closure#0}, !>
  15:     0x783731823d36 - std[e26dd15980711d9]::panicking::begin_panic::<rustc_errors[c28d6f5ecad04e0f]::ExplicitBug>
  16:     0x78373183f0f1 - <rustc_errors[c28d6f5ecad04e0f]::diagnostic::BugAbort as rustc_errors[c28d6f5ecad04e0f]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  17:     0x783731db00fd - <rustc_errors[c28d6f5ecad04e0f]::DiagCtxtHandle>::span_bug::<rustc_span[145419c69115c40]::span_encoding::Span, alloc[4a4297c918417764]::string::String>
  18:     0x783731e4db68 - rustc_middle[37b79f53eb06cf87]::util::bug::opt_span_bug_fmt::<rustc_span[145419c69115c40]::span_encoding::Span>::{closure#0}
  19:     0x783731e33d4a - rustc_middle[37b79f53eb06cf87]::ty::context::tls::with_opt::<rustc_middle[37b79f53eb06cf87]::util::bug::opt_span_bug_fmt<rustc_span[145419c69115c40]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  20:     0x783731e33beb - rustc_middle[37b79f53eb06cf87]::ty::context::tls::with_context_opt::<rustc_middle[37b79f53eb06cf87]::ty::context::tls::with_opt<rustc_middle[37b79f53eb06cf87]::util::bug::opt_span_bug_fmt<rustc_span[145419c69115c40]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  21:     0x783731e4da97 - rustc_middle[37b79f53eb06cf87]::util::bug::span_bug_fmt::<rustc_span[145419c69115c40]::span_encoding::Span>
  22:     0x7837331745b9 - <rustc_middle[37b79f53eb06cf87]::ty::instance::Instance>::expect_resolve
  23:     0x783733206c72 - <rustc_middle[37b79f53eb06cf87]::ty::instance::Instance>::expect_resolve_for_vtable
  24:     0x78373381eb9e - rustc_trait_selection[ed3e3a96aaaeccc4]::traits::vtable::vtable_entries::{closure#0}
  25:     0x78373381d79f - rustc_trait_selection[ed3e3a96aaaeccc4]::traits::vtable::vtable_entries
  26:     0x78373381d128 - rustc_query_impl[3483f987c0d12bd8]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[3483f987c0d12bd8]::query_impl::vtable_entries::dynamic_query::{closure#2}::{closure#0}, rustc_middle[37b79f53eb06cf87]::query::erase::Erased<[u8; 16usize]>>
  27:     0x78373381d0e7 - <rustc_query_impl[3483f987c0d12bd8]::query_impl::vtable_entries::dynamic_query::{closure#2} as core[3c089f87181ffccd]::ops::function::FnOnce<(rustc_middle[37b79f53eb06cf87]::ty::context::TyCtxt, rustc_type_ir[5352cd0572541382]::binder::Binder<rustc_middle[37b79f53eb06cf87]::ty::context::TyCtxt, rustc_type_ir[5352cd0572541382]::predicate::TraitRef<rustc_middle[37b79f53eb06cf87]::ty::context::TyCtxt>>)>>::call_once
  28:     0x783733b91e77 - rustc_query_system[24d50461402a49d7]::query::plumbing::try_execute_query::<rustc_query_impl[3483f987c0d12bd8]::DynamicConfig<rustc_query_system[24d50461402a49d7]::query::caches::DefaultCache<rustc_type_ir[5352cd0572541382]::binder::Binder<rustc_middle[37b79f53eb06cf87]::ty::context::TyCtxt, rustc_type_ir[5352cd0572541382]::predicate::TraitRef<rustc_middle[37b79f53eb06cf87]::ty::context::TyCtxt>>, rustc_middle[37b79f53eb06cf87]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[3483f987c0d12bd8]::plumbing::QueryCtxt, false>
  29:     0x783733b91bb9 - rustc_query_impl[3483f987c0d12bd8]::query_impl::vtable_entries::get_query_non_incr::__rust_end_short_backtrace
  30:     0x78373176a706 - rustc_middle[37b79f53eb06cf87]::query::plumbing::query_get_at::<rustc_query_system[24d50461402a49d7]::query::caches::DefaultCache<rustc_type_ir[5352cd0572541382]::binder::Binder<rustc_middle[37b79f53eb06cf87]::ty::context::TyCtxt, rustc_type_ir[5352cd0572541382]::predicate::TraitRef<rustc_middle[37b79f53eb06cf87]::ty::context::TyCtxt>>, rustc_middle[37b79f53eb06cf87]::query::erase::Erased<[u8; 16usize]>>>
  31:     0x783733933d29 - <rustc_const_eval[93ad04c5b7bd53c7]::interpret::eval_context::InterpCx<rustc_const_eval[93ad04c5b7bd53c7]::const_eval::machine::CompileTimeMachine>>::eval_fn_call
  32:     0x7837339dfb01 - rustc_const_eval[93ad04c5b7bd53c7]::const_eval::eval_queries::eval_to_allocation_raw_provider
  33:     0x7837339ddab6 - rustc_query_impl[3483f987c0d12bd8]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[3483f987c0d12bd8]::query_impl::eval_to_allocation_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[37b79f53eb06cf87]::query::erase::Erased<[u8; 24usize]>>
  34:     0x7837339d9751 - rustc_query_system[24d50461402a49d7]::query::plumbing::try_execute_query::<rustc_query_impl[3483f987c0d12bd8]::DynamicConfig<rustc_query_system[24d50461402a49d7]::query::caches::DefaultCache<rustc_middle[37b79f53eb06cf87]::ty::ParamEnvAnd<rustc_middle[37b79f53eb06cf87]::mir::interpret::GlobalId>, rustc_middle[37b79f53eb06cf87]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[3483f987c0d12bd8]::plumbing::QueryCtxt, false>
  35:     0x7837339d9330 - rustc_query_impl[3483f987c0d12bd8]::query_impl::eval_to_allocation_raw::get_query_non_incr::__rust_end_short_backtrace
  36:     0x7837339daaaa - rustc_const_eval[93ad04c5b7bd53c7]::const_eval::eval_queries::eval_to_const_value_raw_provider
  37:     0x7837339da8b6 - rustc_query_impl[3483f987c0d12bd8]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[3483f987c0d12bd8]::query_impl::eval_to_const_value_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[37b79f53eb06cf87]::query::erase::Erased<[u8; 24usize]>>
  38:     0x7837339d9714 - rustc_query_system[24d50461402a49d7]::query::plumbing::try_execute_query::<rustc_query_impl[3483f987c0d12bd8]::DynamicConfig<rustc_query_system[24d50461402a49d7]::query::caches::DefaultCache<rustc_middle[37b79f53eb06cf87]::ty::ParamEnvAnd<rustc_middle[37b79f53eb06cf87]::mir::interpret::GlobalId>, rustc_middle[37b79f53eb06cf87]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[3483f987c0d12bd8]::plumbing::QueryCtxt, false>
  39:     0x7837339d9236 - rustc_query_impl[3483f987c0d12bd8]::query_impl::eval_to_const_value_raw::get_query_non_incr::__rust_end_short_backtrace
  40:     0x7837330582b6 - <rustc_middle[37b79f53eb06cf87]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[2f70e26aa6aa2212]::check_crate::{closure#3}>::{closure#0}
  41:     0x783733055a54 - rustc_hir_analysis[2f70e26aa6aa2212]::check_crate
  42:     0x783733208455 - rustc_interface[8230c53daf47eda8]::passes::analysis
  43:     0x78373320800d - rustc_query_impl[3483f987c0d12bd8]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[3483f987c0d12bd8]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[37b79f53eb06cf87]::query::erase::Erased<[u8; 1usize]>>
  44:     0x783733cef5a5 - rustc_query_system[24d50461402a49d7]::query::plumbing::try_execute_query::<rustc_query_impl[3483f987c0d12bd8]::DynamicConfig<rustc_query_system[24d50461402a49d7]::query::caches::SingleCache<rustc_middle[37b79f53eb06cf87]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[3483f987c0d12bd8]::plumbing::QueryCtxt, false>
  45:     0x783733cef30f - rustc_query_impl[3483f987c0d12bd8]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  46:     0x783733bde045 - rustc_interface[8230c53daf47eda8]::interface::run_compiler::<core[3c089f87181ffccd]::result::Result<(), rustc_span[145419c69115c40]::ErrorGuaranteed>, rustc_driver_impl[c14dc3c35b3af881]::run_compiler::{closure#0}>::{closure#1}
  47:     0x783733bbcfc9 - std[e26dd15980711d9]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[8230c53daf47eda8]::util::run_in_thread_with_globals<rustc_interface[8230c53daf47eda8]::util::run_in_thread_pool_with_globals<rustc_interface[8230c53daf47eda8]::interface::run_compiler<core[3c089f87181ffccd]::result::Result<(), rustc_span[145419c69115c40]::ErrorGuaranteed>, rustc_driver_impl[c14dc3c35b3af881]::run_compiler::{closure#0}>::{closure#1}, core[3c089f87181ffccd]::result::Result<(), rustc_span[145419c69115c40]::ErrorGuaranteed>>::{closure#0}, core[3c089f87181ffccd]::result::Result<(), rustc_span[145419c69115c40]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[3c089f87181ffccd]::result::Result<(), rustc_span[145419c69115c40]::ErrorGuaranteed>>
  48:     0x783733bbcd7a - <<std[e26dd15980711d9]::thread::Builder>::spawn_unchecked_<rustc_interface[8230c53daf47eda8]::util::run_in_thread_with_globals<rustc_interface[8230c53daf47eda8]::util::run_in_thread_pool_with_globals<rustc_interface[8230c53daf47eda8]::interface::run_compiler<core[3c089f87181ffccd]::result::Result<(), rustc_span[145419c69115c40]::ErrorGuaranteed>, rustc_driver_impl[c14dc3c35b3af881]::run_compiler::{closure#0}>::{closure#1}, core[3c089f87181ffccd]::result::Result<(), rustc_span[145419c69115c40]::ErrorGuaranteed>>::{closure#0}, core[3c089f87181ffccd]::result::Result<(), rustc_span[145419c69115c40]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[3c089f87181ffccd]::result::Result<(), rustc_span[145419c69115c40]::ErrorGuaranteed>>::{closure#2} as core[3c089f87181ffccd]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  49:     0x78373548c5fb - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h442e913a0171ae2e
                               at /rustc/16b569057e4d1591b4bee05f10df34000308dedc/library/alloc/src/boxed.rs:2070:9
  50:     0x78373548c5fb - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hfda8e09c8c96ddbb
                               at /rustc/16b569057e4d1591b4bee05f10df34000308dedc/library/alloc/src/boxed.rs:2070:9
  51:     0x78373548c5fb - std::sys::pal::unix::thread::Thread::new::thread_start::h2322d98845956ea2
                               at /rustc/16b569057e4d1591b4bee05f10df34000308dedc/library/std/src/sys/pal/unix/thread.rs:108:17
  52:     0x783735220ded - <unknown>
  53:     0x7837352a40dc - <unknown>
  54:                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: please make sure that you have updated to the latest nightly

note: rustc 1.81.0-nightly (16b569057 2024-07-16) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [vtable_entries] finding all vtable entries for trait `Bar`
#1 [eval_to_allocation_raw] const-evaluating + checking `Branch`
end of query stack
error: aborting due to 4 previous errors; 2 warnings emitted

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

@rustbot label +F-const_trait_impl +F-effects +F-const_closures

@matthiaskrgr matthiaskrgr added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Jul 16, 2024
@rustbot rustbot added needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. F-const_closures `#![feature(const_closures)]` F-const_trait_impl `#![feature(const_trait_impl)]` F-effects `#![feature(effects)]` labels Jul 16, 2024
@GrigorenkoPV
Copy link
Contributor

Regression in #121087

@tgross35 tgross35 removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. F-const_closures `#![feature(const_closures)]` F-const_trait_impl `#![feature(const_trait_impl)]` F-effects `#![feature(effects)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
Status: Todo
Development

No branches or pull requests

4 participants