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

Stack overflow when calling "impl Fn(&impl Trait)" #17498

Closed
Philip-Trettner opened this issue Jun 26, 2024 · 2 comments · Fixed by #17541
Closed

Stack overflow when calling "impl Fn(&impl Trait)" #17498

Philip-Trettner opened this issue Jun 26, 2024 · 2 comments · Fixed by #17541
Assignees
Labels
C-bug Category: bug I-crash

Comments

@Philip-Trettner
Copy link

Philip-Trettner commented Jun 26, 2024

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.

@Philip-Trettner Philip-Trettner added the C-bug Category: bug label Jun 26, 2024
@lnicola
Copy link
Member

lnicola commented Jun 27, 2024

[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]

@ShoyuVanilla
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug I-crash
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants