rust-analyzer
rust-analyzer copied to clipboard
Stack overflow when calling "impl Fn(&impl Trait)"
rust-analyzer version: rust-analyzer version: 0.3.2011-standalone
rustc version: rustc 1.79.0 (129f3b996 2024-06-10)
editor or extension: VSCode rust-analyzer v0.3.2011
code snippet to reproduce:
trait Foo { }
struct SFoo;
impl Foo for SFoo { }
fn test(f: impl Fn(&impl Foo)) {
let foo = SFoo {};
f(&foo);
}
I'm getting:
thread 'Worker' has overflowed its stack fatal runtime error: stack overflow
Then the extension restarts and crashes again.
[snip]
#12035 0x0000555556b6e75f in hir_ty::display::hir_fmt_generic_arguments ()
#12036 0x0000555556b6f7a1 in hir_ty::display::write_bounds_like_dyn_trait_with_prefix ()
#12037 0x000055555685d516 in <chalk_ir::Ty<hir_ty::interner::Interner> as hir_ty::display::HirDisplay>::hir_fmt ()
#12038 0x000055555685e18c in <chalk_ir::Ty<hir_ty::interner::Interner> as hir_ty::display::HirDisplay>::hir_fmt ()
#12039 0x0000555556b6e75f in hir_ty::display::hir_fmt_generic_arguments ()
#12040 0x0000555556b6f7a1 in hir_ty::display::write_bounds_like_dyn_trait_with_prefix ()
#12041 0x000055555685d516 in <chalk_ir::Ty<hir_ty::interner::Interner> as hir_ty::display::HirDisplay>::hir_fmt ()
#12042 0x000055555685e18c in <chalk_ir::Ty<hir_ty::interner::Interner> as hir_ty::display::HirDisplay>::hir_fmt ()
#12043 0x000055555635d347 in <hir_ty::display::HirDisplayWrapper<T> as core::fmt::Display>::fmt ()
#12044 0x00005555570b556b in core::fmt::write ()
#12045 0x00005555570aba8b in alloc::fmt::format::format_inner ()
#12046 0x0000555556341f5b in ide_diagnostics::handlers::type_mismatch::type_mismatch ()
#12047 0x00005555562ce668 in ide_diagnostics::diagnostics ()
[snip]
I was hoping that #17505 might fix this but it doesn't.
As I'm fixing stack overflow issues related to impl Trait, I'll handle this, too.
@rustbot claim