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

-Znext-solver errors with impl for projected Self type #127149

Closed
fee1-dead opened this issue Jun 30, 2024 · 0 comments · Fixed by #127172
Closed

-Znext-solver errors with impl for projected Self type #127149

fee1-dead opened this issue Jun 30, 2024 · 0 comments · Fixed by #127172
Assignees
Labels
C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way. T-types Relevant to the types team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Comments

@fee1-dead
Copy link
Member

cc tracking issue #107374

godbolt

The code below compiles on nightly but errors with -Znext-solver:

pub trait Index {
    type Output;
}

impl Index for () { type Output = (); }

pub trait IndexMut where Self: Index {
    fn foo(&mut self);
}

impl IndexMut for <() as Index>::Output {
    fn foo(&mut self) {}
}

Error message:

error[E0271]: type mismatch resolving `<() as Index>::Output == &mut <() as Index>::Output`
  --> <source>:12:12
   |
12 |     fn foo(&mut self) {}
   |            ^^^^^^^^^ types differ

error: aborting due to 1 previous error

For more information about this error, try `rustc --explain E0271`.
Compiler returned: 1
Backtrace
thread 'rustc' panicked at compiler/rustc_errors/src/lib.rs:1767:17:
aborting due to `-Z treat-err-as-bug=1`
stack backtrace:
   0:     0x7fdd27b382b5 - std::backtrace_rs::backtrace::libunwind::trace::hfcb0e6e919fe8b02
                               at /rustc/e9e6e2e444c30c23a9c878a88fbc3978c2acad95/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x7fdd27b382b5 - std::backtrace_rs::backtrace::trace_unsynchronized::h2d7390b1768cc057
                               at /rustc/e9e6e2e444c30c23a9c878a88fbc3978c2acad95/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fdd27b382b5 - std::sys::backtrace::_print_fmt::h0a1fe72c74c3c92f
                               at /rustc/e9e6e2e444c30c23a9c878a88fbc3978c2acad95/library/std/src/sys/backtrace.rs:68:5
   3:     0x7fdd27b382b5 - <std::sys::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0efe09574522ab48
                               at /rustc/e9e6e2e444c30c23a9c878a88fbc3978c2acad95/library/std/src/sys/backtrace.rs:44:22
   4:     0x7fdd27b87d9b - core::fmt::rt::Argument::fmt::h86493f731d852471
                               at /rustc/e9e6e2e444c30c23a9c878a88fbc3978c2acad95/library/core/src/fmt/rt.rs:173:76
   5:     0x7fdd27b87d9b - core::fmt::write::hf027121cd79920f8
                               at /rustc/e9e6e2e444c30c23a9c878a88fbc3978c2acad95/library/core/src/fmt/mod.rs:1174:21
   6:     0x7fdd27b2ce9f - std::io::Write::write_fmt::h50f231aebdd6b44e
                               at /rustc/e9e6e2e444c30c23a9c878a88fbc3978c2acad95/library/std/src/io/mod.rs:1835:15
   7:     0x7fdd27b3808e - std::sys::backtrace::_print::ha583d08861e89abe
                               at /rustc/e9e6e2e444c30c23a9c878a88fbc3978c2acad95/library/std/src/sys/backtrace.rs:47:5
   8:     0x7fdd27b3808e - std::sys::backtrace::print::h326dfb2de669d6a9
                               at /rustc/e9e6e2e444c30c23a9c878a88fbc3978c2acad95/library/std/src/sys/backtrace.rs:34:9
   9:     0x7fdd27b3a9d9 - std::panicking::default_hook::{{closure}}::h338582459520bc95
  10:     0x7fdd27b3a77c - std::panicking::default_hook::ha253d2f95ed1a278
                               at /rustc/e9e6e2e444c30c23a9c878a88fbc3978c2acad95/library/std/src/panicking.rs:292:9
  11:     0x7fdd243bbe7f - std[a9a046d33cddffde]::panicking::update_hook::<alloc[acf10b35c0018119]::boxed::Box<rustc_driver_impl[f6a9d0df02f1d1bf]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7fdd27b3b2af - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h59cfa4ec21be1b23
                               at /rustc/e9e6e2e444c30c23a9c878a88fbc3978c2acad95/library/alloc/src/boxed.rs:2078:9
  13:     0x7fdd27b3b2af - std::panicking::rust_panic_with_hook::he6d3da0d6872d7e9
                               at /rustc/e9e6e2e444c30c23a9c878a88fbc3978c2acad95/library/std/src/panicking.rs:804:13
  14:     0x7fdd27b3aea3 - std::panicking::begin_panic_handler::{{closure}}::h562044d4931308b4
                               at /rustc/e9e6e2e444c30c23a9c878a88fbc3978c2acad95/library/std/src/panicking.rs:663:13
  15:     0x7fdd27b38779 - std::sys::backtrace::__rust_end_short_backtrace::h8d43a914ad44f7b8
                               at /rustc/e9e6e2e444c30c23a9c878a88fbc3978c2acad95/library/std/src/sys/backtrace.rs:171:18
  16:     0x7fdd27b3abb4 - rust_begin_unwind
                               at /rustc/e9e6e2e444c30c23a9c878a88fbc3978c2acad95/library/std/src/panicking.rs:661:5
  17:     0x7fdd27b84353 - core::panicking::panic_fmt::h72d84f0a9e5170e6
                               at /rustc/e9e6e2e444c30c23a9c878a88fbc3978c2acad95/library/core/src/panicking.rs:74:14
  18:     0x7fdd271d3096 - <rustc_errors[e779a9bbb6c56598]::DiagCtxtInner>::panic_if_treat_err_as_bug.cold
  19:     0x7fdd263f6022 - <rustc_errors[e779a9bbb6c56598]::DiagCtxtInner>::emit_diagnostic::{closure#3}
  20:     0x7fdd263e4246 - rustc_interface[2a6dcbe82196fb3f]::callbacks::track_diagnostic::<core[563965cbb8764b56]::option::Option<rustc_span[6197d43b7fdbf68b]::ErrorGuaranteed>>
  21:     0x7fdd263e237f - <rustc_errors[e779a9bbb6c56598]::DiagCtxtInner>::emit_diagnostic
  22:     0x7fdd263e2255 - <rustc_errors[e779a9bbb6c56598]::DiagCtxtHandle>::emit_diagnostic
  23:     0x7fdd268f929c - <rustc_span[6197d43b7fdbf68b]::ErrorGuaranteed as rustc_errors[e779a9bbb6c56598]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  24:     0x7fdd2509513d - <rustc_infer[3fbee8995ea8e832]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[5bf7e99b6c60346]::traits::error_reporting::type_err_ctxt_ext::InferCtxtPrivExt>::report_projection_error
  25:     0x7fdd25094926 - <rustc_infer[3fbee8995ea8e832]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[5bf7e99b6c60346]::traits::error_reporting::type_err_ctxt_ext::InferCtxtPrivExt>::report_fulfillment_error
  26:     0x7fdd2507f92e - <rustc_infer[3fbee8995ea8e832]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[5bf7e99b6c60346]::traits::error_reporting::type_err_ctxt_ext::TypeErrCtxtExt>::report_fulfillment_errors
  27:     0x7fdd25e782a6 - rustc_hir_analysis[e4ed5cdf7069fdab]::check::wfcheck::check_associated_item
  28:     0x7fdd23507eae - rustc_hir_analysis[e4ed5cdf7069fdab]::check::wfcheck::check_well_formed
  29:     0x7fdd25bdfcbd - rustc_query_impl[bd968423f59ba745]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bd968423f59ba745]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[1a9a6fb822666db]::query::erase::Erased<[u8; 1usize]>>
  30:     0x7fdd25bdff35 - rustc_query_system[411a21868c0145ef]::query::plumbing::try_execute_query::<rustc_query_impl[bd968423f59ba745]::DynamicConfig<rustc_query_system[411a21868c0145ef]::query::caches::VecCache<rustc_hir[4b11660a3be69043]::hir_id::OwnerId, rustc_middle[1a9a6fb822666db]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[bd968423f59ba745]::plumbing::QueryCtxt, false>
  31:     0x7fdd25bdfc9a - rustc_query_impl[bd968423f59ba745]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  32:     0x7fdd25be0af4 - rustc_hir_analysis[e4ed5cdf7069fdab]::check::wfcheck::check_mod_type_wf
  33:     0x7fdd25be0799 - rustc_query_impl[bd968423f59ba745]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bd968423f59ba745]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[1a9a6fb822666db]::query::erase::Erased<[u8; 1usize]>>
  34:     0x7fdd2635eeb8 - rustc_query_system[411a21868c0145ef]::query::plumbing::try_execute_query::<rustc_query_impl[bd968423f59ba745]::DynamicConfig<rustc_query_system[411a21868c0145ef]::query::caches::DefaultCache<rustc_span[6197d43b7fdbf68b]::def_id::LocalModDefId, rustc_middle[1a9a6fb822666db]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[bd968423f59ba745]::plumbing::QueryCtxt, false>
  35:     0x7fdd2635ec59 - rustc_query_impl[bd968423f59ba745]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  36:     0x7fdd25bf27a3 - rustc_hir_analysis[e4ed5cdf7069fdab]::check_crate
  37:     0x7fdd260c7255 - rustc_interface[2a6dcbe82196fb3f]::passes::analysis
  38:     0x7fdd260c6e15 - rustc_query_impl[bd968423f59ba745]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bd968423f59ba745]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[1a9a6fb822666db]::query::erase::Erased<[u8; 1usize]>>
  39:     0x7fdd2665a1a5 - rustc_query_system[411a21868c0145ef]::query::plumbing::try_execute_query::<rustc_query_impl[bd968423f59ba745]::DynamicConfig<rustc_query_system[411a21868c0145ef]::query::caches::SingleCache<rustc_middle[1a9a6fb822666db]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[bd968423f59ba745]::plumbing::QueryCtxt, false>
  40:     0x7fdd26659f0f - rustc_query_impl[bd968423f59ba745]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  41:     0x7fdd2656a9bf - rustc_interface[2a6dcbe82196fb3f]::interface::run_compiler::<core[563965cbb8764b56]::result::Result<(), rustc_span[6197d43b7fdbf68b]::ErrorGuaranteed>, rustc_driver_impl[f6a9d0df02f1d1bf]::run_compiler::{closure#0}>::{closure#1}
  42:     0x7fdd263cfd89 - std[a9a046d33cddffde]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[2a6dcbe82196fb3f]::util::run_in_thread_with_globals<rustc_interface[2a6dcbe82196fb3f]::util::run_in_thread_pool_with_globals<rustc_interface[2a6dcbe82196fb3f]::interface::run_compiler<core[563965cbb8764b56]::result::Result<(), rustc_span[6197d43b7fdbf68b]::ErrorGuaranteed>, rustc_driver_impl[f6a9d0df02f1d1bf]::run_compiler::{closure#0}>::{closure#1}, core[563965cbb8764b56]::result::Result<(), rustc_span[6197d43b7fdbf68b]::ErrorGuaranteed>>::{closure#0}, core[563965cbb8764b56]::result::Result<(), rustc_span[6197d43b7fdbf68b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[563965cbb8764b56]::result::Result<(), rustc_span[6197d43b7fdbf68b]::ErrorGuaranteed>>
  43:     0x7fdd263cfb3a - <<std[a9a046d33cddffde]::thread::Builder>::spawn_unchecked_<rustc_interface[2a6dcbe82196fb3f]::util::run_in_thread_with_globals<rustc_interface[2a6dcbe82196fb3f]::util::run_in_thread_pool_with_globals<rustc_interface[2a6dcbe82196fb3f]::interface::run_compiler<core[563965cbb8764b56]::result::Result<(), rustc_span[6197d43b7fdbf68b]::ErrorGuaranteed>, rustc_driver_impl[f6a9d0df02f1d1bf]::run_compiler::{closure#0}>::{closure#1}, core[563965cbb8764b56]::result::Result<(), rustc_span[6197d43b7fdbf68b]::ErrorGuaranteed>>::{closure#0}, core[563965cbb8764b56]::result::Result<(), rustc_span[6197d43b7fdbf68b]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[563965cbb8764b56]::result::Result<(), rustc_span[6197d43b7fdbf68b]::ErrorGuaranteed>>::{closure#2} as core[563965cbb8764b56]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  44:     0x7fdd27b4510b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h7cabb6ffc85af816
                               at /rustc/e9e6e2e444c30c23a9c878a88fbc3978c2acad95/library/alloc/src/boxed.rs:2064:9
  45:     0x7fdd27b4510b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h074441c25350c542
                               at /rustc/e9e6e2e444c30c23a9c878a88fbc3978c2acad95/library/alloc/src/boxed.rs:2064:9
  46:     0x7fdd27b4510b - std::sys::pal::unix::thread::Thread::new::thread_start::h8b982c8d97422db7
                               at /rustc/e9e6e2e444c30c23a9c878a88fbc3978c2acad95/library/std/src/sys/pal/unix/thread.rs:108:17
  47:     0x7fdd20c94ac3 - <unknown>
  48:     0x7fdd20d26850 - <unknown>
  49:                0x0 - <unknown>

error: 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: please make sure that you have updated to the latest nightly

note: please attach the file at `/app/rustc-ice-2024-06-30T07_05_54-1.txt` to your bug report

note: compiler flags: -C debuginfo=1 -C llvm-args=--x86-asm-syntax=intel --crate-type rlib -Z next-solver -Z treat-err-as-bug

query stack during panic:
#0 [check_well_formed] checking that `<impl at <source>:11:1: 11:40>::foo` is well-formed
#1 [check_mod_type_wf] checking that types are well-formed in top-level module
end of query stack
Compiler returned: 101
@fee1-dead fee1-dead added C-bug Category: This is a bug. requires-nightly This issue requires a nightly compiler in some way. T-types Relevant to the types team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Jun 30, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jun 30, 2024
@compiler-errors compiler-errors self-assigned this Jun 30, 2024
@fmease fmease removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jun 30, 2024
@bors bors closed this as completed in 89aefb9 Jul 8, 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. requires-nightly This issue requires a nightly compiler in some way. T-types Relevant to the types team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)
Projects
None yet
4 participants