Skip to content

Failed to lookup [email protected] in this Semantics. #13255

Closed
@kxxt

Description

@kxxt

rust-analyzer version:0.3.1203-standalone

rustc version: rustc 1.65.0-nightly (f03ce3096 2022-08-08)
relevant settings:

"rust-analyzer.server.extraEnv": {
    "RUST_BACKTRACE": "full"
  },

Error Message

I am getting this error message when having fun playing with macros.
Actually I also got bad offset panic once, but I forgot when I got it and thus failed to reproduce it.

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]
Full error log with `RUST_BACKTRACE=full` (click to show)
Panic context:
> 
version: 0.3.1203-standalone
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: "/mnt/data/Repos/nand2tetris/jack-compiler/src/parser/tests.rs",
                query: None,
                fragment: None,
            },
        },
        position: Position {
            line: 142,
            character: 10,
        },
    },
    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 'Worker' 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:1307:13
stack backtrace:
   0:     0x558db3817544 - std::backtrace_rs::backtrace::libunwind::trace::h8217d0a8f3fd2f41
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x558db3817544 - std::backtrace_rs::backtrace::trace_unsynchronized::h308103876b3af410
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x558db3817544 - std::sys_common::backtrace::_print_fmt::hc208018c6153605e
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x558db3817544 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf89a7ed694dfb585
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x558db28db3ac - core::fmt::write::h21038c1382fe4264
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/fmt/mod.rs:1197:17
   5:     0x558db3811fb5 - std::io::Write::write_fmt::h7dbb1c9a3c254aef
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/io/mod.rs:1672:15
   6:     0x558db381932a - std::sys_common::backtrace::_print::h4e8889719c9ddeb8
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x558db381932a - std::sys_common::backtrace::print::h1506fe2cb3022667
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x558db381932a - std::panicking::default_hook::{{closure}}::hd9d7ce2a8a782440
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:295:22
   9:     0x558db3819025 - std::panicking::default_hook::h5b16ec25444b1b5d
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:314:9
  10:     0x558db382a7d4 - std::thread::local::LocalKey<T>::with::hb058a7bed0d2905b
  11:     0x558db3819a32 - std::panicking::rust_panic_with_hook::hb0138cb6e6fea3e4
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:702:17
  12:     0x558db3819854 - std::panicking::begin_panic_handler::{{closure}}::h4cb67095557cd1aa
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:588:13
  13:     0x558db3817a74 - std::sys_common::backtrace::__rust_end_short_backtrace::h2bfcac279dcdc911
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/sys_common/backtrace.rs:138:18
  14:     0x558db38195bd - rust_begin_unwind
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:584:5
  15:     0x558db27b3b93 - core::panicking::panic_fmt::h1de71520faaa17d3
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/panicking.rs:142:14
  16:     0x558db29615a7 - hir::semantics::SemanticsImpl::find_file::h8ad30798c07661ac
  17:     0x558db311d2a8 - <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold::h9191d2cf54b7631e
  18:     0x558db30d7491 - ide_completion::context::analysis::<impl ide_completion::context::CompletionContext>::classify_name_ref::{{closure}}::h2eb561fd3143ef7c
  19:     0x558db30d565a - ide_completion::context::analysis::<impl ide_completion::context::CompletionContext>::classify_name_ref::h890378171f928c9b
  20:     0x558db30d0618 - ide_completion::context::analysis::<impl ide_completion::context::CompletionContext>::expand_and_analyze::h6636671b32a86672
  21:     0x558db30dbf84 - ide_completion::context::CompletionContext::new::hf626338704a54f50
  22:     0x558db3147bcf - ide_completion::completions::hbea581a6c4388a9d
  23:     0x558db2eb244b - std::panicking::try::h2dbbce45139cb49c
  24:     0x558db370a2a2 - rust_analyzer::handlers::handle_completion::hf607a3c93b2e569f
  25:     0x558db35411c1 - std::panicking::try::hbdcb3cda4da451e6
  26:     0x558db3536288 - <F as threadpool::FnBox>::call_box::h522027e9397b96c1
  27:     0x558db387da88 - std::sys_common::backtrace::__rust_begin_short_backtrace::h903b5fd7ab5d73b5
  28:     0x558db387d311 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h961008efc1db8c80
  29:     0x558db381de45 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h1680342795a2dc08
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/alloc/src/boxed.rs:1951:9
  30:     0x558db381de45 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h45204a69827b0e83
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/alloc/src/boxed.rs:1951:9
  31:     0x558db381de45 - std::sys::unix::thread::Thread::new::thread_start::h5d4e11bbda4161c8
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/sys/unix/thread.rs:108:17
  32:     0x7fc2cadad74d - <unknown>
  33:     0x7fc2cae2f700 - <unknown>
  34:                0x0 - <unknown>
[Error - 8:37:09 AM] Request textDocument/completion failed.
  Message: request handler panicked: 

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]


  Code: -32603 

How to Reproduce

  1. git clone https://github.com/kxxt/nand2tetris -b ra-reproduce
  2. Open the repo using vscode
  3. Open file jack-compiler/src/parser/tests.rs and go to the bottom of the file.
  4. Typing n after the last comma
  5. You get a Request textDocument/completion failed error popup.

Screenshot_89

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions