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: relating different kinds: ?2t '?2 #127745

Closed
Naserume opened this issue Jul 15, 2024 · 4 comments · Fixed by #127780
Closed

ICE: relating different kinds: ?2t '?2 #127745

Naserume opened this issue Jul 15, 2024 · 4 comments · Fixed by #127780
Assignees
Labels
C-bug Category: This is a bug. 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

@Naserume
Copy link

Code

#![feature(fn_traits, unboxed_closures)]

trait Lt<'a> {
    type T;
}
impl<'f> Lt<'a> for () {
    type T;
}

struct Foo<T>(T);

impl<T: Copy> Fn<()> for Foo<T> {
    fn call(&self, _: ()) -> T {
        match *self {
            Foo(t) => t,
        }
    }
}

impl<T: Copy> FnMut<<() as Lt<'_>>::T> for Foo<T> {}

impl<T: Copy> FnOnce<H> for Foo<T> {
    type Output = T;

    fn call_once(self, _: ()) -> T {
        self.call(())
    }
}

fn main() {}

Meta

rustc --version --verbose:

rustc 1.81.0-nightly (fcaa6fdfb 2024-07-13)
binary: rustc
commit-hash: fcaa6fdfbee1316184e7ad98c53241d52cd30a5f
commit-date: 2024-07-13
host: x86_64-apple-darwin
release: 1.81.0-nightly
LLVM version: 18.1.7

Error output

error: associated type in `impl` without body
 --> ./B8BC8.rs:7:5
  |
7 |     type T;
  |     ^^^^^^-
  |           |
  |           help: provide a definition for the type: `= <type>;`

error[E0261]: use of undeclared lifetime name `'a`
 --> ./B8BC8.rs:6:13
  |
6 | impl<'f> Lt<'a> for () {
  |      -      ^^ undeclared lifetime
  |      |
  |      help: consider introducing lifetime `'a` here: `'a,`

error[E0412]: cannot find type `H` in this scope
  --> ./B8BC8.rs:22:22
   |
22 | impl<T: Copy> FnOnce<H> for Foo<T> {
   |      -               ^
   |      |
   |      similarly named type parameter `T` defined here
   |
help: a type parameter with a similar name exists
   |
22 | impl<T: Copy> FnOnce<T> for Foo<T> {
   |                      ~
help: you might be missing a type parameter
   |
22 | impl<T: Copy, H> FnOnce<H> for Foo<T> {
   |             +++

error[E0277]: expected a `FnOnce()` closure, found `Foo<T>`
  --> ./B8BC8.rs:12:26
   |
12 | impl<T: Copy> Fn<()> for Foo<T> {
   |                          ^^^^^^ expected an `FnOnce()` closure, found `Foo<T>`
   |
   = help: the trait `FnOnce()` is not implemented for `Foo<T>`, which is required by `Foo<T>: FnMut()`
   = note: wrap the `Foo<T>` in a closure with no arguments: `|| { /* code */ }`
   = note: required for `Foo<T>` to implement `FnMut()`
note: required by a bound in `Fn`
  --> /Users/sal/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:76:28
   |
76 | pub trait Fn<Args: Tuple>: FnMut<Args> {
   |                            ^^^^^^^^^^^ required by this bound in `Fn`

error[E0277]: the trait bound `(): Lt<'_>` is not satisfied
  --> ./B8BC8.rs:12:26
   |
12 | impl<T: Copy> Fn<()> for Foo<T> {
   |                          ^^^^^^ the trait `Lt<'_>` is not implemented for `()`, which is required by `Foo<T>: FnMut()`
   |
note: required by a bound in `Fn`
  --> /Users/sal/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:76:28
   |
76 | pub trait Fn<Args: Tuple>: FnMut<Args> {
   |                            ^^^^^^^^^^^ required by this bound in `Fn`

error[E0053]: method `call` has an incompatible type for trait
  --> ./B8BC8.rs:13:5
   |
13 |     fn call(&self, _: ()) -> T {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected "rust-call" fn, found "Rust" fn
   |
   = note: expected signature `extern "rust-call" fn(&Foo<_>, ()) -> _`
              found signature `fn(&Foo<_>, ()) -> T`

error[E0277]: the trait bound `(): Lt<'_>` is not satisfied
  --> ./B8BC8.rs:20:15
   |
20 | impl<T: Copy> FnMut<<() as Lt<'_>>::T> for Foo<T> {}
   |               ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Lt<'_>` is not implemented for `()`

error[E0277]: expected a `FnOnce<_>` closure, found `Foo<T>`
   --> ./B8BC8.rs:20:44
    |
20  | impl<T: Copy> FnMut<<() as Lt<'_>>::T> for Foo<T> {}
    |                                            ^^^^^^ expected an `FnOnce<_>` closure, found `Foo<T>`
    |
    = help: the trait `FnOnce<_>` is not implemented for `Foo<T>`
note: required by a bound in `FnMut`
   --> /Users/sal/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:163:31
    |
163 | pub trait FnMut<Args: Tuple>: FnOnce<Args> {
    |                               ^^^^^^^^^^^^ required by this bound in `FnMut`

error[E0277]: the trait bound `(): Lt<'_>` is not satisfied
  --> ./B8BC8.rs:20:44
   |
20 | impl<T: Copy> FnMut<<() as Lt<'_>>::T> for Foo<T> {}
   |                                            ^^^^^^ the trait `Lt<'_>` is not implemented for `()`, which is required by `Foo<T>: FnMut<_>`

error[E0277]: the trait bound `(): Lt<'_>` is not satisfied
  --> ./B8BC8.rs:20:21
   |
20 | impl<T: Copy> FnMut<<() as Lt<'_>>::T> for Foo<T> {}
   |                     ^^^^^^^^^^^^^^^^^ the trait `Lt<'_>` is not implemented for `()`

error[E0046]: not all trait items implemented, missing: `call_mut`
  --> ./B8BC8.rs:20:1
   |
20 | impl<T: Copy> FnMut<<() as Lt<'_>>::T> for Foo<T> {}
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `call_mut` in implementation
   |
   = help: implement the missing item: `fn call_mut(&mut self, _: <() as Lt<'_>>::T) -> <Self as FnOnce<<() as Lt<'_>>::T>>::Output { todo!() }`

error[E0277]: expected a `FnOnce()` closure, found `Foo<T>`
  --> ./B8BC8.rs:26:14
   |
26 |         self.call(())
   |              ^^^^ expected an `FnOnce()` closure, found `Foo<T>`
   |
   = help: the trait `FnOnce()` is not implemented for `Foo<T>`
   = note: wrap the `Foo<T>` in a closure with no arguments: `|| { /* code */ }`

error: internal compiler error: compiler/rustc_infer/src/infer/at.rs:415:21: relating different kinds: ?2t '?2
Backtrace

thread 'rustc' panicked at compiler/rustc_infer/src/infer/at.rs:415:21:
Box<dyn Any>
stack backtrace:
   0:        0x109af6373 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h605d51fc858e32d3
   1:        0x109b412fb - core::fmt::write::he70b1f5b242a09e4
   2:        0x109aec0be - std::io::Write::write_fmt::hbfde528b9dfff91a
   3:        0x109af8c1a - std::panicking::default_hook::{{closure}}::hfdc91bfcaaf40c09
   4:        0x109af88ca - std::panicking::default_hook::h8673ceadddb8316e
   5:        0x112e7d8dc - std[8bfe66706d3bd117]::panicking::update_hook::<alloc[ea04c33bd6f71985]::boxed::Box<rustc_driver_impl[d8a49a9463f03e6]::install_ice_hook::{closure#0}>>::{closure#0}
   6:        0x109af9a09 - std::panicking::rust_panic_with_hook::h206b639ed4704bb1
   7:        0x112ef0bb7 - std[8bfe66706d3bd117]::panicking::begin_panic::<rustc_errors[7f155011d809a3bf]::ExplicitBug>::{closure#0}
   8:        0x112edc9f9 - std[8bfe66706d3bd117]::sys::backtrace::__rust_end_short_backtrace::<std[8bfe66706d3bd117]::panicking::begin_panic<rustc_errors[7f155011d809a3bf]::ExplicitBug>::{closure#0}, !>
   9:        0x117957469 - std[8bfe66706d3bd117]::panicking::begin_panic::<rustc_errors[7f155011d809a3bf]::ExplicitBug>
  10:        0x112f02c06 - <rustc_errors[7f155011d809a3bf]::diagnostic::BugAbort as rustc_errors[7f155011d809a3bf]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  11:        0x113bc8b45 - rustc_middle[66eaac359ba8a608]::util::bug::opt_span_bug_fmt::<rustc_span[9df13b32b3ae4eb2]::span_encoding::Span>::{closure#0}
  12:        0x113b7f0b7 - rustc_middle[66eaac359ba8a608]::ty::context::tls::with_opt::<rustc_middle[66eaac359ba8a608]::util::bug::opt_span_bug_fmt<rustc_span[9df13b32b3ae4eb2]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  13:        0x113b7ebf5 - rustc_middle[66eaac359ba8a608]::ty::context::tls::with_context_opt::<rustc_middle[66eaac359ba8a608]::ty::context::tls::with_opt<rustc_middle[66eaac359ba8a608]::util::bug::opt_span_bug_fmt<rustc_span[9df13b32b3ae4eb2]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  14:        0x117a1ff9b - rustc_middle[66eaac359ba8a608]::util::bug::bug_fmt
  15:        0x11366776e - <rustc_middle[66eaac359ba8a608]::ty::generic_args::GenericArg as rustc_infer[3da7f7f7e3fca22e]::infer::at::ToTrace>::to_trace
  16:        0x1149f5ace - <rustc_infer[3da7f7f7e3fca22e]::infer::at::At>::eq::<rustc_middle[66eaac359ba8a608]::ty::generic_args::GenericArg>
  17:        0x114ba8079 - <rustc_infer[3da7f7f7e3fca22e]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[bf739c384407ce51]::error_reporting::traits::suggestions::TypeErrCtxtExt>::note_function_argument_obligation::<rustc_span[9df13b32b3ae4eb2]::ErrorGuaranteed>
  18:        0x114b9f41d - <rustc_infer[3da7f7f7e3fca22e]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[bf739c384407ce51]::error_reporting::traits::suggestions::TypeErrCtxtExt>::note_obligation_cause_code::<rustc_span[9df13b32b3ae4eb2]::ErrorGuaranteed, rustc_middle[66eaac359ba8a608]::ty::predicate::Predicate>
  19:        0x114b75162 - <rustc_infer[3da7f7f7e3fca22e]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[bf739c384407ce51]::error_reporting::traits::fulfillment_errors::InferCtxtPrivExt>::note_obligation_cause
  20:        0x114b66703 - <rustc_infer[3da7f7f7e3fca22e]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[bf739c384407ce51]::error_reporting::traits::fulfillment_errors::TypeErrCtxtSelectionErrExt>::report_selection_error
  21:        0x114bb3a45 - <rustc_infer[3da7f7f7e3fca22e]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[bf739c384407ce51]::error_reporting::traits::TypeErrCtxtExt>::report_fulfillment_error
  22:        0x114bb29a6 - <rustc_infer[3da7f7f7e3fca22e]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[bf739c384407ce51]::error_reporting::traits::TypeErrCtxtExt>::report_fulfillment_errors
  23:        0x11352a915 - <rustc_hir_typeck[a7633e0d641b9efc]::fn_ctxt::FnCtxt>::resolve_vars_with_obligations
  24:        0x11352c91e - <rustc_hir_typeck[a7633e0d641b9efc]::fn_ctxt::FnCtxt>::expected_inputs_for_expected_output
  25:        0x113471658 - <rustc_hir_typeck[a7633e0d641b9efc]::fn_ctxt::FnCtxt>::check_method_argument_types
  26:        0x1135272f0 - <rustc_hir_typeck[a7633e0d641b9efc]::fn_ctxt::FnCtxt>::check_expr_kind
  27:        0x11343ea9e - <rustc_hir_typeck[a7633e0d641b9efc]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  28:        0x113480da6 - <rustc_hir_typeck[a7633e0d641b9efc]::fn_ctxt::FnCtxt>::check_block_with_expected
  29:        0x11343ea9e - <rustc_hir_typeck[a7633e0d641b9efc]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  30:        0x113440c74 - <rustc_hir_typeck[a7633e0d641b9efc]::fn_ctxt::FnCtxt>::check_return_expr
  31:        0x113501e36 - rustc_hir_typeck[a7633e0d641b9efc]::check::check_fn
  32:        0x1134fd551 - rustc_hir_typeck[a7633e0d641b9efc]::typeck
  33:        0x11456666c - rustc_query_impl[ab99e8e391ad42b2]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ab99e8e391ad42b2]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[66eaac359ba8a608]::query::erase::Erased<[u8; 8usize]>>
  34:        0x1143e3fae - rustc_query_system[55587a8be6cb95b6]::query::plumbing::try_execute_query::<rustc_query_impl[ab99e8e391ad42b2]::DynamicConfig<rustc_query_system[55587a8be6cb95b6]::query::caches::VecCache<rustc_span[9df13b32b3ae4eb2]::def_id::LocalDefId, rustc_middle[66eaac359ba8a608]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[ab99e8e391ad42b2]::plumbing::QueryCtxt, false>
  35:        0x114589dab - rustc_query_impl[ab99e8e391ad42b2]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  36:        0x113100df6 - <rustc_middle[66eaac359ba8a608]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[c06ca58d4f3a4935]::check_crate::{closure#4}>::{closure#0}
  37:        0x11324f94c - rustc_hir_analysis[c06ca58d4f3a4935]::check_crate
  38:        0x11380ce37 - rustc_interface[f3798eed8f7e14ff]::passes::run_required_analyses
  39:        0x11380f2d3 - rustc_interface[f3798eed8f7e14ff]::passes::analysis
  40:        0x11456671c - rustc_query_impl[ab99e8e391ad42b2]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ab99e8e391ad42b2]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[66eaac359ba8a608]::query::erase::Erased<[u8; 1usize]>>
  41:        0x11433ebfe - rustc_query_system[55587a8be6cb95b6]::query::plumbing::try_execute_query::<rustc_query_impl[ab99e8e391ad42b2]::DynamicConfig<rustc_query_system[55587a8be6cb95b6]::query::caches::SingleCache<rustc_middle[66eaac359ba8a608]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[ab99e8e391ad42b2]::plumbing::QueryCtxt, false>
  42:        0x114570c77 - rustc_query_impl[ab99e8e391ad42b2]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  43:        0x112e23537 - <rustc_interface[f3798eed8f7e14ff]::queries::QueryResult<&rustc_middle[66eaac359ba8a608]::ty::context::GlobalCtxt>>::enter::<core[84f3396b7379d157]::result::Result<(), rustc_span[9df13b32b3ae4eb2]::ErrorGuaranteed>, rustc_driver_impl[d8a49a9463f03e6]::run_compiler::{closure#0}::{closure#1}::{closure#5}>
  44:        0x112e84c1b - rustc_interface[f3798eed8f7e14ff]::interface::run_compiler::<core[84f3396b7379d157]::result::Result<(), rustc_span[9df13b32b3ae4eb2]::ErrorGuaranteed>, rustc_driver_impl[d8a49a9463f03e6]::run_compiler::{closure#0}>::{closure#1}
  45:        0x112e6ffc1 - std[8bfe66706d3bd117]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[f3798eed8f7e14ff]::util::run_in_thread_with_globals<rustc_interface[f3798eed8f7e14ff]::util::run_in_thread_pool_with_globals<rustc_interface[f3798eed8f7e14ff]::interface::run_compiler<core[84f3396b7379d157]::result::Result<(), rustc_span[9df13b32b3ae4eb2]::ErrorGuaranteed>, rustc_driver_impl[d8a49a9463f03e6]::run_compiler::{closure#0}>::{closure#1}, core[84f3396b7379d157]::result::Result<(), rustc_span[9df13b32b3ae4eb2]::ErrorGuaranteed>>::{closure#0}, core[84f3396b7379d157]::result::Result<(), rustc_span[9df13b32b3ae4eb2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[84f3396b7379d157]::result::Result<(), rustc_span[9df13b32b3ae4eb2]::ErrorGuaranteed>>
  46:        0x112e8b5e6 - <<std[8bfe66706d3bd117]::thread::Builder>::spawn_unchecked_<rustc_interface[f3798eed8f7e14ff]::util::run_in_thread_with_globals<rustc_interface[f3798eed8f7e14ff]::util::run_in_thread_pool_with_globals<rustc_interface[f3798eed8f7e14ff]::interface::run_compiler<core[84f3396b7379d157]::result::Result<(), rustc_span[9df13b32b3ae4eb2]::ErrorGuaranteed>, rustc_driver_impl[d8a49a9463f03e6]::run_compiler::{closure#0}>::{closure#1}, core[84f3396b7379d157]::result::Result<(), rustc_span[9df13b32b3ae4eb2]::ErrorGuaranteed>>::{closure#0}, core[84f3396b7379d157]::result::Result<(), rustc_span[9df13b32b3ae4eb2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[84f3396b7379d157]::result::Result<(), rustc_span[9df13b32b3ae4eb2]::ErrorGuaranteed>>::{closure#2} as core[84f3396b7379d157]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  47:        0x109b029bb - std::sys::pal::unix::thread::Thread::new::thread_start::hff8a09cc296b9c2d
  48:     0x7ff801f5318b - __pthread_start

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 `/Users/sal/Documents/240714/rustc-ice-2024-07-15T01_37_11-61737.txt` to your bug report

query stack during panic:
#0 [typeck] type-checking `<impl at ./B8BC8.rs:22:1: 22:35>::call_once`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 13 previous errors

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

Note

ICE location

impl<'tcx> ToTrace<'tcx> for ty::GenericArg<'tcx> {
fn to_trace(
cause: &ObligationCause<'tcx>,
a_is_expected: bool,
a: Self,
b: Self,
) -> TypeTrace<'tcx> {
TypeTrace {
cause: cause.clone(),
values: match (a.unpack(), b.unpack()) {
(GenericArgKind::Lifetime(a), GenericArgKind::Lifetime(b)) => {
ValuePairs::Regions(ExpectedFound::new(a_is_expected, a, b))
}
(GenericArgKind::Type(a), GenericArgKind::Type(b)) => {
ValuePairs::Terms(ExpectedFound::new(a_is_expected, a.into(), b.into()))
}
(GenericArgKind::Const(a), GenericArgKind::Const(b)) => {
ValuePairs::Terms(ExpectedFound::new(a_is_expected, a.into(), b.into()))
}
(
GenericArgKind::Lifetime(_),
GenericArgKind::Type(_) | GenericArgKind::Const(_),
)
| (
GenericArgKind::Type(_),
GenericArgKind::Lifetime(_) | GenericArgKind::Const(_),
)
| (
GenericArgKind::Const(_),
GenericArgKind::Lifetime(_) | GenericArgKind::Type(_),
) => {
bug!("relating different kinds: {a:?} {b:?}")
}
},
}
}
}

@rustbot label +F-unboxed_closures

@Naserume Naserume added C-bug Category: This is a bug. 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. labels Jul 15, 2024
@rustbot rustbot added needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. F-unboxed_closures `#![feature(unboxed_closures)]` labels Jul 15, 2024
@Naserume
Copy link
Author

Regression in nightly-2024-03-22

@theemathas
Copy link
Contributor

theemathas commented Jul 15, 2024

Minimized:

trait EmptyTrait<'a> {
    type Associated;
}
type Bogus = <i64 as EmptyTrait<'static>>::Associated;

trait Subtrait: Supertrait<i32> {
    fn do_thing(self);
}
trait Supertrait<T> {}

struct Foo;

impl Subtrait for Foo {
    fn do_thing(self) {}
}
impl Supertrait<Bogus> for Foo {}

fn what() {
    Foo.do_thing();
}
Error output
   Compiling playground v0.0.1 (/playground)
error[E0277]: the trait bound `i64: EmptyTrait<'static>` is not satisfied
  --> src/lib.rs:13:21
   |
13 | impl Supertrait for Foo {
   |                     ^^^ the trait `EmptyTrait<'static>` is not implemented for `i64`, which is required by `Foo: Subtrait<i32>`
   |
help: this trait has no implementations, consider adding one
  --> src/lib.rs:1:1
   |
1  | trait EmptyTrait<'a> {
   | ^^^^^^^^^^^^^^^^^^^^
note: required by a bound in `Supertrait`
  --> src/lib.rs:6:19
   |
6  | trait Supertrait: Subtrait<i32> {
   |                   ^^^^^^^^^^^^^ required by this bound in `Supertrait`

error[E0277]: the trait bound `i64: EmptyTrait<'static>` is not satisfied
  --> src/lib.rs:16:6
   |
16 | impl Subtrait<Bogus> for Foo {}
   |      ^^^^^^^^^^^^^^^ the trait `EmptyTrait<'static>` is not implemented for `i64`
   |
help: this trait has no implementations, consider adding one
  --> src/lib.rs:1:1
   |
1  | trait EmptyTrait<'a> {
   | ^^^^^^^^^^^^^^^^^^^^

error[E0277]: the trait bound `i64: EmptyTrait<'static>` is not satisfied
  --> src/lib.rs:16:15
   |
16 | impl Subtrait<Bogus> for Foo {}
   |               ^^^^^ the trait `EmptyTrait<'static>` is not implemented for `i64`
   |
help: this trait has no implementations, consider adding one
  --> src/lib.rs:1:1
   |
1  | trait EmptyTrait<'a> {
   | ^^^^^^^^^^^^^^^^^^^^

error: internal compiler error: compiler/rustc_infer/src/infer/at.rs:400:21: relating different kinds: i32 'static

thread 'rustc' panicked at compiler/rustc_infer/src/infer/at.rs:400:21:
Box<dyn Any>
stack backtrace:
   0:     0x7f0aab0c8035 - std::backtrace_rs::backtrace::libunwind::trace::h1a07e5dba0da0cd2
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0x7f0aab0c8035 - std::backtrace_rs::backtrace::trace_unsynchronized::h61b9b8394328c0bc
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f0aab0c8035 - std::sys_common::backtrace::_print_fmt::h1c5e18b460934cff
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f0aab0c8035 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1e1a1972118942ad
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f0aab11729b - core::fmt::rt::Argument::fmt::h07af2b4071d536cd
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/fmt/rt.rs:165:63
   5:     0x7f0aab11729b - core::fmt::write::hc090a2ffd6b28c4a
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/core/src/fmt/mod.rs:1157:21
   6:     0x7f0aab0bcbdf - std::io::Write::write_fmt::h8898bac6ff039a23
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/io/mod.rs:1832:15
   7:     0x7f0aab0c7e0e - std::sys_common::backtrace::_print::h4e80c5803d4ee35b
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f0aab0c7e0e - std::sys_common::backtrace::print::ha96650907276675e
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f0aab0ca779 - std::panicking::default_hook::{{closure}}::h215c2a0a8346e0e0
  10:     0x7f0aab0ca4bd - std::panicking::default_hook::h207342be97478370
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:298:9
  11:     0x7f0aadfc51b7 - std[3c8ba8ebcf555201]::panicking::update_hook::<alloc[bfbae7e348dce413]::boxed::Box<rustc_driver_impl[c88438ade88661f4]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f0aab0cae76 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::ha9c3bc81d312fd83
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/alloc/src/boxed.rs:2036:9
  13:     0x7f0aab0cae76 - std::panicking::rust_panic_with_hook::hac8bdceee1e4fe2c
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/panicking.rs:799:13
  14:     0x7f0aadff2b44 - std[3c8ba8ebcf555201]::panicking::begin_panic::<rustc_errors[80cf825e20fac581]::ExplicitBug>::{closure#0}
  15:     0x7f0aadfef4f6 - std[3c8ba8ebcf555201]::sys_common::backtrace::__rust_end_short_backtrace::<std[3c8ba8ebcf555201]::panicking::begin_panic<rustc_errors[80cf825e20fac581]::ExplicitBug>::{closure#0}, !>
  16:     0x7f0aadfeab66 - std[3c8ba8ebcf555201]::panicking::begin_panic::<rustc_errors[80cf825e20fac581]::ExplicitBug>
  17:     0x7f0aadffbf01 - <rustc_errors[80cf825e20fac581]::diagnostic::BugAbort as rustc_errors[80cf825e20fac581]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  18:     0x7f0aae475b1c - rustc_middle[3ff731b746e7b038]::util::bug::opt_span_bug_fmt::<rustc_span[8c7415e9d33ddd75]::span_encoding::Span>::{closure#0}
  19:     0x7f0aae45cc2a - rustc_middle[3ff731b746e7b038]::ty::context::tls::with_opt::<rustc_middle[3ff731b746e7b038]::util::bug::opt_span_bug_fmt<rustc_span[8c7415e9d33ddd75]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  20:     0x7f0aae45cacb - rustc_middle[3ff731b746e7b038]::ty::context::tls::with_context_opt::<rustc_middle[3ff731b746e7b038]::ty::context::tls::with_opt<rustc_middle[3ff731b746e7b038]::util::bug::opt_span_bug_fmt<rustc_span[8c7415e9d33ddd75]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  21:     0x7f0aac1cd740 - rustc_middle[3ff731b746e7b038]::util::bug::bug_fmt
  22:     0x7f0aaff1cfe4 - <rustc_middle[3ff731b746e7b038]::ty::generic_args::GenericArg as rustc_infer[abd41066181445be]::infer::at::ToTrace>::to_trace
  23:     0x7f0aae9f1cfa - <rustc_infer[abd41066181445be]::infer::at::At>::eq::<rustc_middle[3ff731b746e7b038]::ty::generic_args::GenericArg>
  24:     0x7f0aae9e55e4 - <rustc_infer[abd41066181445be]::infer::InferCtxt>::enter_forall::<rustc_middle[3ff731b746e7b038]::ty::predicate::TraitPredicate, (), <rustc_infer[abd41066181445be]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[173dcaf5d960508e]::traits::error_reporting::suggestions::TypeErrCtxtExt>::note_function_argument_obligation<rustc_span[8c7415e9d33ddd75]::ErrorGuaranteed>::{closure#1}>
  25:     0x7f0aaeac5c7d - <rustc_infer[abd41066181445be]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[173dcaf5d960508e]::traits::error_reporting::suggestions::TypeErrCtxtExt>::note_function_argument_obligation::<rustc_span[8c7415e9d33ddd75]::ErrorGuaranteed>
  26:     0x7f0aaeac005c - <rustc_infer[abd41066181445be]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[173dcaf5d960508e]::traits::error_reporting::suggestions::TypeErrCtxtExt>::note_obligation_cause_code::<rustc_span[8c7415e9d33ddd75]::ErrorGuaranteed, rustc_middle[3ff731b746e7b038]::ty::predicate::Predicate>
  27:     0x7f0aaeaded5c - <rustc_infer[abd41066181445be]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[173dcaf5d960508e]::traits::error_reporting::type_err_ctxt_ext::InferCtxtPrivExt>::note_obligation_cause
  28:     0x7f0aaead0239 - <rustc_infer[abd41066181445be]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[173dcaf5d960508e]::traits::error_reporting::type_err_ctxt_ext::TypeErrCtxtExt>::report_selection_error
  29:     0x7f0aaeae4102 - <rustc_infer[abd41066181445be]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[173dcaf5d960508e]::traits::error_reporting::type_err_ctxt_ext::InferCtxtPrivExt>::report_fulfillment_error
  30:     0x7f0aaeace0c0 - <rustc_infer[abd41066181445be]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[173dcaf5d960508e]::traits::error_reporting::type_err_ctxt_ext::TypeErrCtxtExt>::report_fulfillment_errors
  31:     0x7f0aac1e26ea - <rustc_hir_typeck[e95414a4bbf7473d]::fn_ctxt::FnCtxt>::check_method_argument_types
  32:     0x7f0aafdf81d5 - <rustc_hir_typeck[e95414a4bbf7473d]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  33:     0x7f0aafdf0aec - <rustc_hir_typeck[e95414a4bbf7473d]::fn_ctxt::FnCtxt>::check_block_with_expected
  34:     0x7f0aafdf664d - <rustc_hir_typeck[e95414a4bbf7473d]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  35:     0x7f0aaf819c8c - rustc_hir_typeck[e95414a4bbf7473d]::check::check_fn
  36:     0x7f0aaf80ebaf - rustc_hir_typeck[e95414a4bbf7473d]::typeck
  37:     0x7f0aaf80d88d - rustc_query_impl[a12402620de91e8]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a12402620de91e8]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3ff731b746e7b038]::query::erase::Erased<[u8; 8usize]>>
  38:     0x7f0aaf451f2d - rustc_query_system[4e189ce2c77124d]::query::plumbing::try_execute_query::<rustc_query_impl[a12402620de91e8]::DynamicConfig<rustc_query_system[4e189ce2c77124d]::query::caches::VecCache<rustc_span[8c7415e9d33ddd75]::def_id::LocalDefId, rustc_middle[3ff731b746e7b038]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[a12402620de91e8]::plumbing::QueryCtxt, false>
  39:     0x7f0aaf451924 - rustc_query_impl[a12402620de91e8]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  40:     0x7f0aafb069b5 - rustc_hir_analysis[46a17d8846b4335f]::check_crate
  41:     0x7f0aafcc50e0 - rustc_interface[640972162e3c086f]::passes::analysis
  42:     0x7f0aafcc4aef - rustc_query_impl[a12402620de91e8]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a12402620de91e8]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3ff731b746e7b038]::query::erase::Erased<[u8; 1usize]>>
  43:     0x7f0ab001e022 - rustc_query_system[4e189ce2c77124d]::query::plumbing::try_execute_query::<rustc_query_impl[a12402620de91e8]::DynamicConfig<rustc_query_system[4e189ce2c77124d]::query::caches::SingleCache<rustc_middle[3ff731b746e7b038]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[a12402620de91e8]::plumbing::QueryCtxt, false>
  44:     0x7f0ab001ddc9 - rustc_query_impl[a12402620de91e8]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  45:     0x7f0aafebf149 - rustc_interface[640972162e3c086f]::interface::run_compiler::<core[868bc93c3f2beb33]::result::Result<(), rustc_span[8c7415e9d33ddd75]::ErrorGuaranteed>, rustc_driver_impl[c88438ade88661f4]::run_compiler::{closure#0}>::{closure#1}
  46:     0x7f0aafe7cf8b - std[3c8ba8ebcf555201]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[640972162e3c086f]::util::run_in_thread_with_globals<rustc_interface[640972162e3c086f]::interface::run_compiler<core[868bc93c3f2beb33]::result::Result<(), rustc_span[8c7415e9d33ddd75]::ErrorGuaranteed>, rustc_driver_impl[c88438ade88661f4]::run_compiler::{closure#0}>::{closure#1}, core[868bc93c3f2beb33]::result::Result<(), rustc_span[8c7415e9d33ddd75]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[868bc93c3f2beb33]::result::Result<(), rustc_span[8c7415e9d33ddd75]::ErrorGuaranteed>>
  47:     0x7f0aafe7cd80 - <<std[3c8ba8ebcf555201]::thread::Builder>::spawn_unchecked_<rustc_interface[640972162e3c086f]::util::run_in_thread_with_globals<rustc_interface[640972162e3c086f]::interface::run_compiler<core[868bc93c3f2beb33]::result::Result<(), rustc_span[8c7415e9d33ddd75]::ErrorGuaranteed>, rustc_driver_impl[c88438ade88661f4]::run_compiler::{closure#0}>::{closure#1}, core[868bc93c3f2beb33]::result::Result<(), rustc_span[8c7415e9d33ddd75]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[868bc93c3f2beb33]::result::Result<(), rustc_span[8c7415e9d33ddd75]::ErrorGuaranteed>>::{closure#2} as core[868bc93c3f2beb33]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  48:     0x7f0aab0d4cab - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h09e5a4c541afa800
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/alloc/src/boxed.rs:2022:9
  49:     0x7f0aab0d4cab - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9c8b03c22f4e7026
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/alloc/src/boxed.rs:2022:9
  50:     0x7f0aab0d4cab - std::sys::pal::unix::thread::Thread::new::thread_start::h522bc89a54da820a
                               at /rustc/129f3b9964af4d4a709d1383930ade12dfe7c081/library/std/src/sys/pal/unix/thread.rs:108:17
  51:     0x7f0aaafe2609 - start_thread
  52:     0x7f0aaaf05353 - clone
  53:                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 (129f3b996 2024-06-10) 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:
#0 [typeck] type-checking `what`
#1 [analysis] running analysis passes on this crate
end of query stack
For more information about this error, try `rustc --explain E0277`.
error: could not compile `playground` (lib) due to 3 previous errors

@rustbot labels -F-unboxed_closures

@rustbot rustbot removed the F-unboxed_closures `#![feature(unboxed_closures)]` label Jul 15, 2024
@matthiaskrgr
Copy link
Member

duplicate of #126416 ?

@matthiaskrgr
Copy link
Member

@Naserume it would be nice if you could check the bugtracker before posting something, as right now about 30-50% of your bugreports are just re-reports of ices we already know about it seems 🙃

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jul 15, 2024
Make sure trait def ids match before zipping args in `note_function_argument_obligation`

Fixes rust-lang#126416
Fixes rust-lang#127745

Didn't add both tests b/c I felt like it was unnecessary.
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 16, 2024
tgross35 added a commit to tgross35/rust that referenced this issue Jul 16, 2024
Make sure trait def ids match before zipping args in `note_function_argument_obligation`

Fixes rust-lang#126416
Fixes rust-lang#127745

Didn't add both tests b/c I felt like it was unnecessary.
@bors bors closed this as completed in 1abed9f Jul 16, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jul 16, 2024
Rollup merge of rust-lang#127780 - compiler-errors:zip-args, r=jieyouxu

Make sure trait def ids match before zipping args in `note_function_argument_obligation`

Fixes rust-lang#126416
Fixes rust-lang#127745

Didn't add both tests b/c I felt like it was unnecessary.
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. 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
None yet
6 participants