Relating different kinds: '?1 Bar · Issue #126129 · rust-lang/rust (original) (raw)

Code

trait Foo<'s> {}

impl<'s> Foo<'s> for () {}

struct Bar;

impl<'s, T: Foo<'s>> From for Bar { fn from(_: T) -> Self { Bar } }

fn main() { let _: Bar = ((),).into(); }

Meta

rustc --version --verbose:

rustc 1.80.0-nightly (98489f248 2024-06-06)
binary: rustc
commit-hash: 98489f2487465f3765e5dd28d7305ebfd40f0865
commit-date: 2024-06-06
host: x86_64-pc-windows-msvc
release: 1.80.0-nightly
LLVM version: 18.1.7

Error output

error: internal compiler error: compiler\rustc_infer\src\infer\at.rs:364:21: relating different kinds: '?1 Bar

Backtrace

thread 'rustc' panicked at compiler\rustc_infer\src\infer\at.rs:364:21:
Box<dyn Any>
stack backtrace:
   0:     0x7ff8840dd5c3 - std::backtrace_rs::backtrace::dbghelp64::trace
                               at /rustc/98489f2487465f3765e5dd28d7305ebfd40f0865/library\std\src\..\..\backtrace\src\backtrace\dbghelp64.rs:91
   1:     0x7ff8840dd5c3 - std::backtrace_rs::backtrace::trace_unsynchronized
                               at /rustc/98489f2487465f3765e5dd28d7305ebfd40f0865/library\std\src\..\..\backtrace\src\backtrace\mod.rs:66
   2:     0x7ff8840dd5c3 - std::backtrace::Backtrace::create
                               at /rustc/98489f2487465f3765e5dd28d7305ebfd40f0865/library\std\src\backtrace.rs:331
   3:     0x7ff8840dd50a - std::backtrace::Backtrace::force_capture
                               at /rustc/98489f2487465f3765e5dd28d7305ebfd40f0865/library\std\src\backtrace.rs:312
   4:     0x7ff86553eeb0 - memchr
   5:     0x7ff8840f7127 - alloc::boxed::impl$50::call
                               at /rustc/98489f2487465f3765e5dd28d7305ebfd40f0865/library\alloc\src\boxed.rs:2077
   6:     0x7ff8840f7127 - std::panicking::rust_panic_with_hook
                               at /rustc/98489f2487465f3765e5dd28d7305ebfd40f0865/library\std\src\panicking.rs:799
   7:     0x7ff8669442b8 - <rustc_hir_pretty[4c0de44792ef1cfb]::State>::print_variant
   8:     0x7ff866940c69 - <rustc_hir_pretty[4c0de44792ef1cfb]::State>::print_variant
   9:     0x7ff866940959 - <rustc_hir_pretty[4c0de44792ef1cfb]::State>::print_variant
  10:     0x7ff866950c95 - <rustc_errors[99fd697b917f4736]::diagnostic::BugAbort as rustc_errors[99fd697b917f4736]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  11:     0x7ff86686cde7 - rustc_middle[5dc078e192a68ea9]::util:🐛:bug_fmt
  12:     0x7ff86684f7fd - rustc_middle[5dc078e192a68ea9]::ty::consts::const_param_default
  13:     0x7ff86684f636 - rustc_middle[5dc078e192a68ea9]::ty::consts::const_param_default
  14:     0x7ff86686ccf2 - rustc_middle[5dc078e192a68ea9]::util:🐛:bug_fmt
  15:     0x7ff863e6536c - <rustc_middle[5dc078e192a68ea9]::ty::generic_args::GenericArg as rustc_infer[a6d3d17cf94ac3b1]::infer::at::ToTrace>::to_trace
  16:     0x7ff86616e75e - <rustc_const_eval[7ec54cfaef628c24]::errors::WriteThroughImmutablePointer as rustc_errors[99fd697b917f4736]::diagnostic::LintDiagnostic<()>>::decorate_lint
  17:     0x7ff866280c98 - <rustc_infer[a6d3d17cf94ac3b1]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[b8bc7545bfc5c697]::traits::error_reporting::type_err_ctxt_ext::InferCtxtPrivExt>::report_similar_impl_candidates
  18:     0x7ff86628c459 - <rustc_infer[a6d3d17cf94ac3b1]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[b8bc7545bfc5c697]::traits::error_reporting::type_err_ctxt_ext::InferCtxtPrivExt>::try_to_add_help_message
  19:     0x7ff86627b369 - <rustc_infer[a6d3d17cf94ac3b1]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[b8bc7545bfc5c697]::traits::error_reporting::type_err_ctxt_ext::TypeErrCtxtExt>::report_selection_error
  20:     0x7ff86628f7d1 - <rustc_infer[a6d3d17cf94ac3b1]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[b8bc7545bfc5c697]::traits::error_reporting::type_err_ctxt_ext::InferCtxtPrivExt>::report_fulfillment_error
  21:     0x7ff866275f16 - <rustc_infer[a6d3d17cf94ac3b1]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[b8bc7545bfc5c697]::traits::error_reporting::type_err_ctxt_ext::TypeErrCtxtExt>::report_fulfillment_errors
  22:     0x7ff8642b3792 - <rustc_codegen_llvm[5c8af4c302afe308]::builder::Builder as rustc_codegen_ssa[1683cac83e930815]::traits::builder::BuilderMethods>::load_operand
  23:     0x7ff8643238c5 - rustc_hir_typeck[1794d65660cbff74]::typeck
  24:     0x7ff864bc303a - rustc_query_impl[6ec7f1b502ec4006]::plumbing::query_key_hash_verify_all
  25:     0x7ff864b15b89 - rustc_ty_utils[87d1b6c5c188bb5e]::ty::self_ty_of_trait_impl_enabling_order_dep_trait_object_hack
  26:     0x7ff864bcb104 - rustc_query_impl[6ec7f1b502ec4006]::plumbing::query_key_hash_verify_all
  27:     0x7ff86438dba5 - <rustc_hir_typeck[1794d65660cbff74]::upvar::InferBorrowKind as rustc_hir_typeck[1794d65660cbff74]::expr_use_visitor::Delegate>::borrow
  28:     0x7ff864403c5d - rustc_hir_analysis[47701f7ab1204fd1]::check_crate
  29:     0x7ff864160352 - rustc_interface[64758328f8f95d43]::passes::resolver_for_lowering_raw
  30:     0x7ff8613a7e57 - rustc_interface[64758328f8f95d43]::passes::analysis
  31:     0x7ff863d4a6ea - <dyn std[f65618803adafc2b]::io::Write as nu_ansi_term[8940d970465991f5]::write::AnyWrite>::write_str
  32:     0x7ff863c6adc9 - rustc_ty_utils[87d1b6c5c188bb5e]::ty::adt_sized_constraint
  33:     0x7ff863d4fc53 - rustc_query_impl[6ec7f1b502ec4006]::query_system
  34:     0x7ff8613651ad - _LNan_C
  35:     0x7ff86136256f - _LNan_C
  36:     0x7ff86136a269 - _LNan_C
  37:     0x7ff88410832d - alloc::boxed::impl$48::call_once
                               at /rustc/98489f2487465f3765e5dd28d7305ebfd40f0865/library\alloc\src\boxed.rs:2063
  38:     0x7ff88410832d - alloc::boxed::impl$48::call_once
                               at /rustc/98489f2487465f3765e5dd28d7305ebfd40f0865/library\alloc\src\boxed.rs:2063
  39:     0x7ff88410832d - std::sys::pal::windows::thread::impl$0:🆕:thread_start
                               at /rustc/98489f2487465f3765e5dd28d7305ebfd40f0865/library\std\src\sys\pal\windows\thread.rs:52
  40:     0x7ff8f3c37344 - BaseThreadInitThunk
  41:     0x7ff8f4b026b1 - RtlUserThreadStart


rustc version: 1.80.0-nightly (98489f248 2024-06-06)
platform: x86_64-pc-windows-msvc

query stack during panic:
#0 [typeck] type-checking `main`
#1 [analysis] running analysis passes on this crate
end of query stack