Skip to content

"Failed to lookup [email protected] in this Semantics" #9382

@jonas-schievink

Description

@jonas-schievink

Occasionally I get panics like this one from the flyimport completions:

Panic context:
> 
version: 488c9ef9c 2021-06-21 dev
request: textDocument/completion CompletionParams {
    text_document_position: TextDocumentPositionParams {
        text_document: TextDocumentIdentifier {
            uri: Url {
                scheme: "file",
                cannot_be_a_base: false,
                username: "",
                password: None,
                host: None,
                port: None,
                path: "/home/jonas/dev/rust-analyzer/crates/hir_expand/src/db.rs",
                query: None,
                fragment: None,
            },
        },
        position: Position {
            line: 373,
            character: 79,
        },
    },
    work_done_progress_params: WorkDoneProgressParams {
        work_done_token: None,
    },
    partial_result_params: PartialResultParams {
        partial_result_token: None,
    },
    context: Some(
        CompletionContext {
            trigger_kind: Invoked,
            trigger_character: None,
        },
    ),
}

thread '<unnamed>' panicked at '

Failed to lookup [email protected] in this Semantics.
Make sure to use only query nodes, derived from this instance of Semantics.
root node:   [email protected]
known nodes: [email protected], [email protected], [email protected]

', crates/hir/src/semantics.rs:717:13
stack backtrace:
   0: rust_begin_unwind
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:493:5
   1: std::panicking::begin_panic_fmt
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:435:5
   2: hir::semantics::SemanticsImpl::find_file::{{closure}}
   3: hir::semantics::SemanticsImpl::find_file
   4: hir::semantics::SemanticsImpl::analyze_impl
   5: hir::semantics::SemanticsImpl::scope
   6: ide_db::helpers::import_assets::ImportAssets::search_for
   7: ide_db::helpers::import_assets::ImportAssets::search_for_imports
   8: ide_completion::completions::flyimport::import_on_the_fly
   9: ide_completion::completions
  10: std::panicking::try
  11: ide::Analysis::completions
  12: rust_analyzer::handlers::handle_completion
  13: <F as threadpool::FnBox>::call_box
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-completionautocompletionBroken WindowBugs / technical debt to be addressed immediately

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions