Closed
Description
Code
trait Handler {
fn handle(&self) {}
}
impl<H: Handler, F: Fn() -> H> Handler for F {}
impl<L: Handler> Handler for (L,) {}
fn one() -> impl Handler {
(one,)
}
fn main() {
one.handle();
}
Meta
rustc --version --verbose
:
rustc 1.76.0 (07dca489a 2024-02-04)
binary: rustc
commit-hash: 07dca489ac2d933c78d3c5158e3f43beefeb02ce
commit-date: 2024-02-04
host: x86_64-pc-windows-msvc
release: 1.76.0
LLVM version: 17.0.6
Error output
error: internal compiler error: compiler\rustc_middle\src\ty\instance.rs:414:25: failed to resolve instance for <fn() -> impl Handler {one} as Handler>::handle: Ok(
None,
)
Backtrace
thread 'rustc' panicked at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce\compiler\rustc_errors\src\lib.rs:1119:75:
Box<dyn Any>
stack backtrace:
0: 0x7ffe056a22c2 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h7851e041f2b8bcc2
1: 0x7ffe056d4cdd - core::fmt::write::h1642dfca37b49735
2: 0x7ffe05698ca1 - <std::io::IoSlice as core::fmt::Debug>::fmt::h7801514a6fc13a4a
3: 0x7ffe056a20ea - std::sys_common::backtrace::lock::h8caaa69a6cc2258b
4: 0x7ffe056a5529 - std::panicking::default_hook::h67f6260a0bf37eca
5: 0x7ffe056a51e5 - std::panicking::default_hook::h67f6260a0bf37eca
6: 0x7ffe09f2fb03 - <tracing_subscriber[b129777695c18cc]::fmt::format::Writer>::write_fmt
7: 0x7ffe056a5b43 - std::panicking::rust_panic_with_hook::h870983d929e74e12
8: 0x7ffe0b3b7438 - <rustc_span[64dbdf40f18d9543]::symbol::MacroRulesNormalizedIdent as rustc_errors[9e3a9f6acb1d6850]::diagnostic::IntoDiagnosticArg>::into_diagnostic_arg
9: 0x7ffe0b3b6d59 - <rustc_span[64dbdf40f18d9543]::symbol::MacroRulesNormalizedIdent as rustc_errors[9e3a9f6acb1d6850]::diagnostic::IntoDiagnosticArg>::into_diagnostic_arg
10: 0x7ffe0b3afb39 - <std[9ab95dd99822253f]::io::error::Error as rustc_errors[9e3a9f6acb1d6850]::diagnostic::IntoDiagnosticArg>::into_diagnostic_arg
11: 0x7ffe0b39747c - <rustc_errors[9e3a9f6acb1d6850]::diagnostic_builder::Bug as rustc_errors[9e3a9f6acb1d6850]::diagnostic_builder::EmissionGuarantee>::diagnostic_builder_emit_producing_guarantee
12: 0x7ffe0b23f3b7 - rustc_middle[29ac2ae09cb008db]::ty::context::tls::TLV::__getit::destroy
13: 0x7ffe0b23d3b3 - rustc_middle[29ac2ae09cb008db]::util::bug::bug_fmt
14: 0x7ffe0b23d21d - <rustc_middle[29ac2ae09cb008db]::traits::util::Elaborator as core[d8a3f01ca499b8ab]::iter::traits::iterator::Iterator>::next
15: 0x7ffe0b23d1ea - <rustc_middle[29ac2ae09cb008db]::traits::util::Elaborator as core[d8a3f01ca499b8ab]::iter::traits::iterator::Iterator>::next
16: 0x7ffe0b23d2c2 - rustc_middle[29ac2ae09cb008db]::util::bug::bug_fmt
17: 0x7ffe09de7917 - <rustc_middle[29ac2ae09cb008db]::ty::instance::Instance>::expect_resolve
18: 0x7ffe091dbf2b - <rustc_monomorphize[5b0405cbcca7e001]::collector::MirUsedCollector as rustc_middle[29ac2ae09cb008db]::mir::visit::Visitor>::visit_constant
19: 0x7ffe091d8c8b - <rustc_monomorphize[5b0405cbcca7e001]::collector::MirUsedCollector as rustc_middle[29ac2ae09cb008db]::mir::visit::Visitor>::visit_operand
20: 0x7ffe088a6645 - <rustc_hir_analysis[2ba85467cc3c2e66]::check::wfcheck::check_where_clauses::{closure#2}::CountParams as rustc_type_ir[fb309861c70c8016]::visit::TypeVisitor<rustc_middle[29ac2ae09cb008db]::ty::context::TyCtxt>>::visit_const
21: 0x7ffe088abe52 - <rustc_hir_analysis[2ba85467cc3c2e66]::check::wfcheck::check_where_clauses::{closure#2}::CountParams as rustc_type_ir[fb309861c70c8016]::visit::TypeVisitor<rustc_middle[29ac2ae09cb008db]::ty::context::TyCtxt>>::visit_const
22: 0x7ffe088a8518 - <rustc_hir_analysis[2ba85467cc3c2e66]::check::wfcheck::check_where_clauses::{closure#2}::CountParams as rustc_type_ir[fb309861c70c8016]::visit::TypeVisitor<rustc_middle[29ac2ae09cb008db]::ty::context::TyCtxt>>::visit_const
23: 0x7ffe091d14bd - rustc_monomorphize[5b0405cbcca7e001]::partitioning::collect_and_partition_mono_items
24: 0x7ffe08ad038a - rustc_query_impl[1b1c3ff2f5873f4d]::profiling_support::alloc_self_profile_query_strings
25: 0x7ffe08a9b22d - rustc_traits[39dfbaf382113380]::type_op::type_op_normalize_fn_sig
26: 0x7ffe08b493fc - rustc_query_impl[1b1c3ff2f5873f4d]::profiling_support::alloc_self_profile_query_strings
27: 0x7ffe08aee434 - rustc_query_impl[1b1c3ff2f5873f4d]::profiling_support::alloc_self_profile_query_strings
28: 0x7ffe08afaf7e - rustc_query_impl[1b1c3ff2f5873f4d]::profiling_support::alloc_self_profile_query_strings
29: 0x7ffe0ab43c44 - <rustc_query_impl[1b1c3ff2f5873f4d]::plumbing::QueryCtxt as rustc_query_system[79eaec2bcc989eb1]::query::QueryContext>::depth_limit_error
30: 0x7ffe06100464 - <rustc_codegen_llvm[8a535c964cfc05c8]::back::lto::ModuleBuffer as core[d8a3f01ca499b8ab]::ops::drop::Drop>::drop
31: 0x7ffe060e2cff - <rustc_codegen_llvm[8a535c964cfc05c8]::LlvmCodegenBackend as rustc_codegen_ssa[1dc4bfd57c326e00]::traits::backend::CodegenBackend>::codegen_crate
32: 0x7ffe060a9439 - rustc_interface[9ef98228d448de4b]::interface::parse_check_cfg
33: 0x7ffe06090b37 - rustc_interface[9ef98228d448de4b]::passes::start_codegen
34: 0x7ffe060a27e2 - rustc_interface[9ef98228d448de4b]::interface::parse_check_cfg
35: 0x7ffe06081b0f - <rustc_interface[9ef98228d448de4b]::queries::Queries>::codegen_and_build_linker
36: 0x7ffe06040ee1 - rustc_driver_impl[5ff3db5439d2e5e5]::args::arg_expand_all
37: 0x7ffe06058809 - <rustc_middle[29ac2ae09cb008db]::ty::SymbolName as core[d8a3f01ca499b8ab]::fmt::Debug>::fmt
38: 0x7ffe0605770f - <rustc_middle[29ac2ae09cb008db]::ty::SymbolName as core[d8a3f01ca499b8ab]::fmt::Debug>::fmt
39: 0x7ffe06061068 - <rustc_middle[29ac2ae09cb008db]::ty::SymbolName as core[d8a3f01ca499b8ab]::fmt::Debug>::fmt
40: 0x7ffe056b7ebc - std::sys::windows::thread::Thread::new::h827e23232df84eef
41: 0x7fff00ab257d - BaseThreadInitThunk
42: 0x7fff0196aa58 - RtlUserThreadStart
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.76.0 (07dca489a 2024-02-04) running on x86_64-pc-windows-msvc
note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental=[REDACTED]
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
Metadata
Metadata
Assignees
Labels
Area: Trait systemCategory: This is a bug.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Status: A Minimal Complete and Verifiable Example has been found for this issueRelevant to the compiler team, which will review and decide on the PR/issue.Fixed by the next-generation trait solver, `-Znext-solver`.