Skip to content

Panic: no value set for FileSourceRootQuery #11357

@agrover

Description

@agrover

Happens every time I git checkout a significantly older version of my Rust project that I'm using rust-analyzer on. Using rust-analyzer via emacs and lsp.

See salsa-rs/salsa#254 : "This is a rust-analyzer bug". "Sounds like you made an input query and then tried to use it like an on-demand one. Input queries have to have a value in them before you can read one."

thread 'main' panicked at 'no value set for FileSourceRootQuery(FileId(6447))', /home/agrover/.cargo/registry/src/github.com-1ecc6299db9ec823/salsa-0.17.0-pre.2/src/input.rs:106:32
stack backtrace:
   0: rust_begin_unwind
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:498:5
   1: core::panicking::panic_fmt
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/panicking.rs:107:14
   2: <salsa::input::InputStorage<Q> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch::{{closure}}
   3: <salsa::input::InputStorage<Q> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
   4: <DB as base_db::SourceDatabaseExt>::file_source_root::__shim
   5: <core::iter::adapters::copied::Copied<I> as core::iter::traits::iterator::Iterator>::fold
   6: <base_db::SourceRootCratesQuery as salsa::plumbing::QueryFunction>::execute
   7: salsa::runtime::Runtime::execute_query_implementation
   8: salsa::derived::slot::Slot<Q,MP>::read_upgrade
   9: salsa::derived::slot::Slot<Q,MP>::read
  10: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  11: <DB as base_db::SourceDatabaseExt>::source_root_crates::__shim
  12: <base_db::FileLoaderDelegate<&T> as base_db::FileLoader>::relevant_crates
  13: <ide_db::RootDatabase as base_db::FileLoader>::relevant_crates
  14: rust_analyzer::global_state::GlobalState::process_changes
  15: rust_analyzer::reload::<impl rust_analyzer::global_state::GlobalState>::switch_workspaces
  16: rust_analyzer::main_loop::<impl rust_analyzer::global_state::GlobalState>::handle_event
  17: rust_analyzer::main_loop::<impl rust_analyzer::global_state::GlobalState>::run
  18: rust_analyzer::main_loop::main_loop
  19: rust_analyzer::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: "SendError(..)"', /home/agrover/.cargo/registry/src/github.com-1ecc6299db9ec823/lsp-server-0.5.2/src/stdio.rs:29:37
stack backtrace:
   0: rust_begin_unwind
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/std/src/panicking.rs:498:5
   1: core::panicking::panic_fmt
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/panicking.rs:107:14
   2: core::result::unwrap_failed
             at /rustc/db9d1b20bba1968c1ec1fc49616d4742c1725b4b/library/core/src/result.rs:1613:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Process rust-analyzer stderr finished

rust-analyzer version: (eg. output of "Rust Analyzer: Show RA Version" command)
rust-analyzer 8b779e8 2022-01-21 dev

rustc version: (eg. output of rustc -V)
rustc 1.58.1 (db9d1b20b 2022-01-20)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Broken WindowBugs / technical debt to be addressed immediatelyC-bugCategory: bugI-panicS-actionableSomeone could pick this issue up and work on it right now

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions