Skip to content

Crash when parsing invalid type #19734

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

Closed
Coder-256 opened this issue May 3, 2025 · 0 comments · Fixed by #19738
Closed

Crash when parsing invalid type #19734

Coder-256 opened this issue May 3, 2025 · 0 comments · Fixed by #19738
Labels
C-bug Category: bug I-panic

Comments

@Coder-256
Copy link
Contributor

rust-analyzer version: 0.3.2441-standalone (d8887c0 2025-04-26)

rustc version: rustc 1.86.0 (05f9846f8 2025-03-31)

editor or extension: VS Code (extension version 0.3.2441)

relevant settings: N/A

repository link (if public, optional): N/A

code snippet to reproduce:

trait Foo {
    type Gat<'o>;
}

trait Bar {
    fn baz() -> <Self::Xyz as Foo::Gat<'_>;
}

rust-analyzer keeps crashing whenever I am in the middle of writing a type. Crash log:

thread 'Worker' panicked at crates/hir-ty/src/lower/path.rs:1231:21:
the only possible situation here is incorrect lifetime order
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: hir_ty::lower::path::PathLoweringContext::substs_from_args_and_bindings
   3: hir_ty::lower::path::PathLoweringContext::substs_from_path_segment
   4: hir_ty::lower::path::PathLoweringContext::lower_partly_resolved_path
   5: hir_ty::lower::TyLoweringContext::lower_ty_ext
   6: hir_ty::infer::infer_query
   7: salsa::function::execute::<impl salsa::function::IngredientImpl<C>>::execute
   8: salsa::function::fetch::<impl salsa::function::IngredientImpl<C>>::fetch_cold
   9: salsa::function::fetch::<impl salsa::function::IngredientImpl<C>>::fetch
  10: <DB as hir_ty::db::HirDatabase>::infer::infer_shim
  11: hir::DefWithBody::diagnostics
  12: hir::Module::diagnostics
  13: ide_diagnostics::semantic_diagnostics
  14: ide_diagnostics::full_diagnostics
  15: salsa::cancelled::Cancelled::catch
  16: ide::Analysis::assists_with_fixes
  17: rust_analyzer::handlers::request::handle_code_action
  18: core::ops::function::FnOnce::call_once{{vtable.shim}}
  19: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Panic context:
> 
version: 0.3.2441-standalone (d8887c0758 2025-04-26)
request: textDocument/codeAction CodeActionParams {
    text_document: TextDocumentIdentifier {
        uri: Url {
            scheme: "file",
            cannot_be_a_base: false,
            username: "",
            password: None,
            host: None,
            port: None,
            path: "<N/A>",
            query: None,
            fragment: None,
        },
    },
    range: Range {
        start: Position {
            line: 1,
            character: 13,
        },
        end: Position {
            line: 1,
            character: 13,
        },
    },
    context: CodeActionContext {
        diagnostics: [],
        only: None,
        trigger_kind: Some(
            Automatic,
        ),
    },
    work_done_progress_params: WorkDoneProgressParams {
        work_done_token: None,
    },
    partial_result_params: PartialResultParams {
        partial_result_token: None,
    },
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug I-panic
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants