Rust-analyzer not working correctly in VS Code

⚓ rust    📅 2025-04-26    👤 surdeus    👁️ 9      

surdeus

Warning

This post was published 65 days ago. The information described in this article may have changed.

I'm trying to implement SIMD acceleration for my raytracer (using nightly rust), but I am getting bogus errors. Here is an offending piece of code:

impl<const N: usize> SimdRay<N>
where LaneCount<N>: SupportedLaneCount {
    pub fn from_array(array: [Ray; N]) -> Self {
        todo!()
    }
}

Errors appear after const N: missing type for const parameter and expected COMMA,
And on SimdRay<N>: expected R_ANGLE.

I am also getting some notifications from VS Code saying the LSP server failed somehow.
Here is the error message:

[Error - 9:30:28 AM] Document pull failed for text document file:///c%3A/Users/noah/Projects/rustprojects/raytracer/src/ray.rs
  Message: request handler panicked: dependency graph cycle when querying const_param_ty_with_diagnostics_shim(Id(2c69b)), set cycle_fn/cycle_initial to fixpoint iterate.
Query stack:
[
    inherent_impls_in_crate_shim(Id(5038)),
    impl_self_ty_with_diagnostics_shim(Id(1a1a5)),
    const_param_ty_with_diagnostics_shim(Id(2c69b)),
]
  Code: -32603 
Panic context:
> 
version: 0.4.2438-standalone (df594ba8f4 2025-04-25)
request: textDocument/diagnostic DocumentDiagnosticParams {
    text_document: TextDocumentIdentifier {
        uri: Url {
            scheme: "file",
            cannot_be_a_base: false,
            username: "",
            password: None,
            host: None,
            port: None,
            path: "/c%3A/Users/noah/Projects/rustprojects/raytracer/src/debug.rs",
            query: None,
            fragment: None,
        },
    },
    identifier: Some(
        "rust-analyzer",
    ),
    previous_result_id: Some(
        "rust-analyzer",
    ),
    work_done_progress_params: WorkDoneProgressParams {
        work_done_token: None,
    },
    partial_result_params: PartialResultParams {
        partial_result_token: None,
    },
}


thread 'Worker' panicked at C:\Users\runneradmin\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\salsa-0.20.0\src\function\fetch.rs:138:25:
dependency graph cycle when querying const_param_ty_with_diagnostics_shim(Id(2c69b)), set cycle_fn/cycle_initial to fixpoint iterate.
Query stack:
[
    inherent_impls_in_crate_shim(Id(5038)),
    impl_self_ty_with_diagnostics_shim(Id(1a1a5)),
    const_param_ty_with_diagnostics_shim(Id(2c69b)),
]
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\std\src\panicking.rs:695
   1: core::panicking::panic_fmt
             at /rustc/05f9846f893b09a1be1fc8560e33fc3c815cfecb/library\core\src\panicking.rs:75
   2: salsa::function::fetch::<impl salsa::function::IngredientImpl<C>>::fetch_cold
   3: salsa::function::fetch::<impl salsa::function::IngredientImpl<C>>::fetch
   4: <DB as hir_ty::db::HirDatabase>::const_param_ty_with_diagnostics::const_param_ty_with_diagnostics_shim
   5: <DB as hir_ty::db::HirDatabase>::const_param_ty
   6: hir_ty::consteval::path_to_const
   7: hir_ty::lower::TyLoweringContext::lower_path_as_const
   8: hir_ty::lower::path::PathLoweringContext::substs_from_args_and_bindings
   9: hir_ty::lower::path::PathLoweringContext::lower_path_inner
  10: hir_ty::lower::path::PathLoweringContext::lower_partly_resolved_path
  11: hir_ty::lower::TyLoweringContext::lower_ty_ext
  12: hir_ty::lower::const_param_ty_with_diagnostics_query
  13: salsa::function::fetch::<impl salsa::function::IngredientImpl<C>>::fetch_cold
  14: salsa::function::fetch::<impl salsa::function::IngredientImpl<C>>::fetch_cold
  15: salsa::function::fetch::<impl salsa::function::IngredientImpl<C>>::fetch
  16: <DB as hir_ty::db::HirDatabase>::const_param_ty_with_diagnostics::const_param_ty_with_diagnostics_shim
  17: <DB as hir_ty::db::HirDatabase>::const_param_ty
  18: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  19: hir_ty::make_binders
  20: hir_ty::lower::impl_self_ty_with_diagnostics_query
  21: salsa::function::fetch::<impl salsa::function::IngredientImpl<C>>::fetch_cold
  22: salsa::function::fetch::<impl salsa::function::IngredientImpl<C>>::fetch_cold
  23: salsa::function::fetch::<impl salsa::function::IngredientImpl<C>>::fetch
  24: <DB as hir_ty::db::HirDatabase>::impl_self_ty_with_diagnostics::impl_self_ty_with_diagnostics_shim
  25: hir_ty::lower::impl_self_ty_query
  26: hashbrown::raw::RawTable<T,A>::shrink_to
  27: hir_ty::method_resolution::InherentImpls::inherent_impls_in_crate_query
  28: salsa::function::fetch::<impl salsa::function::IngredientImpl<C>>::fetch_cold
  29: salsa::function::fetch::<impl salsa::function::IngredientImpl<C>>::fetch_cold
  30: salsa::function::fetch::<impl salsa::function::IngredientImpl<C>>::fetch
  31: <DB as hir_ty::db::HirDatabase>::inherent_impls_in_crate::inherent_impls_in_crate_shim
  32: hir::Module::diagnostics
  33: ide_diagnostics::semantic_diagnostics
  34: ide_diagnostics::full_diagnostics
  35: salsa::cancelled::Cancelled::catch
  36: ide::Analysis::full_diagnostics
  37: rust_analyzer::handlers::request::handle_document_diagnostics
  38: <T as serde::de::Expected>::fmt
  39: <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.
[Error - 9:30:28 AM] Request textDocument/diagnostic failed.
  Message: request handler panicked: dependency graph cycle when querying const_param_ty_with_diagnostics_shim(Id(2c69b)), set cycle_fn/cycle_initial to fixpoint iterate.
Query stack:
[
    inherent_impls_in_crate_shim(Id(5038)),
    impl_self_ty_with_diagnostics_shim(Id(1a1a5)),
    const_param_ty_with_diagnostics_shim(Id(2c69b)),
]
  Code: -32603

I've tried restarting VS Code multiple times, and each time I restart it, it works for a few minutes, but then it always does the same thing (but in a different place).

2 posts - 2 participants

Read full topic

🏷️ rust_feed