rust-analyzer icon indicating copy to clipboard operation
rust-analyzer copied to clipboard

Failed to lookup [email protected] in this Semantics.

Open kxxt opened this issue 1 year ago • 7 comments

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

kxxt avatar Sep 19 '22 00:09 kxxt

Odd, I can't seem to reproduce this after cloning.

Veykril avatar Sep 19 '22 07:09 Veykril

I can still reproduce this after cloning it into a new directory and typing n after the last comma of that file when rust-analyzer is loaded.

Maybe it's something related to my setup? (Although I guess it's my macros' fault)

VSCode Info
Version: 1.71.2
Commit: 74b1f979648cc44d385a2286793c226e611f59e7
Date: 2022-09-14T21:12:14.256Z
Electron: 19.0.12
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Linux x64 5.19.8-zen1-1-zen
Sandboxed: No

kxxt avatar Sep 19 '22 07:09 kxxt

Peek 2022-09-19 15-50

This bug is persistent.

I also got it when editing other parts of the same file.

(rust-analyzer has already done a good job when providing auto completions for macro arguments. I really want to say thank you to the development team)

kxxt avatar Sep 19 '22 07:09 kxxt

well, I have no clue whats going on here, it works fine for me ... And I don't see how this panic could happen where the backtrace is pointing to grafik

Veykril avatar Sep 20 '22 12:09 Veykril

Do you have any specific r-a settings set? Can you retry with the latest release?

Veykril avatar Sep 20 '22 12:09 Veykril

I only set RUST_BACKTRACE to full to get full stacktrace output. I'm already using the latest version of rust-analyzer plugin for vscode. I will try the latest pre-release now.

Do you have any specific r-a settings set? Can you retry with the latest release?

kxxt avatar Sep 20 '22 12:09 kxxt

I am still getting this panic in rust-analyzer 0.4.1214-standalone

Edit: I am still getting this after disabling all other vscode plugins. Second Edit: I installed vscodium alongside vscode and this panic also happens in a new vscodium with an empty settings.json.

logs
Panic context:
> 
version: 0.4.1214-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: "/home/kxxt/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:     0x5566b580c5f4 - std::backtrace_rs::backtrace::libunwind::trace::h8217d0a8f3fd2f41
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x5566b580c5f4 - std::backtrace_rs::backtrace::trace_unsynchronized::h308103876b3af410
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x5566b580c5f4 - std::sys_common::backtrace::_print_fmt::hc208018c6153605e
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x5566b580c5f4 - <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:     0x5566b48bb43c - core::fmt::write::h21038c1382fe4264
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/fmt/mod.rs:1197:17
   5:     0x5566b5807065 - std::io::Write::write_fmt::h7dbb1c9a3c254aef
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/io/mod.rs:1672:15
   6:     0x5566b580e3da - std::sys_common::backtrace::_print::h4e8889719c9ddeb8
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x5566b580e3da - std::sys_common::backtrace::print::h1506fe2cb3022667
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x5566b580e3da - std::panicking::default_hook::{{closure}}::hd9d7ce2a8a782440
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:295:22
   9:     0x5566b580e0d5 - std::panicking::default_hook::h5b16ec25444b1b5d
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:314:9
  10:     0x5566b581f884 - std::thread::local::LocalKey<T>::with::hb058a7bed0d2905b
  11:     0x5566b580eae2 - std::panicking::rust_panic_with_hook::hb0138cb6e6fea3e4
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:702:17
  12:     0x5566b580e904 - std::panicking::begin_panic_handler::{{closure}}::h4cb67095557cd1aa
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:588:13
  13:     0x5566b580cb24 - std::sys_common::backtrace::__rust_end_short_backtrace::h2bfcac279dcdc911
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/sys_common/backtrace.rs:138:18
  14:     0x5566b580e66d - rust_begin_unwind
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/panicking.rs:584:5
  15:     0x5566b47b2e53 - core::panicking::panic_fmt::h1de71520faaa17d3
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/core/src/panicking.rs:142:14
  16:     0x5566b49413d7 - hir::semantics::SemanticsImpl::find_file::h8ad30798c07661ac
  17:     0x5566b50f13b8 - <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold::hc8f4062127f9c000
  18:     0x5566b50b95e1 - ide_completion::context::analysis::<impl ide_completion::context::CompletionContext>::classify_name_ref::{{closure}}::h6ea5cb7fc57f3a6a
  19:     0x5566b50b77aa - ide_completion::context::analysis::<impl ide_completion::context::CompletionContext>::classify_name_ref::h62a4f3fef38c99db
  20:     0x5566b50b2768 - ide_completion::context::analysis::<impl ide_completion::context::CompletionContext>::expand_and_analyze::h2e0a975ed586b3e7
  21:     0x5566b50be0d4 - ide_completion::context::CompletionContext::new::h4b9a9176954ef238
  22:     0x5566b5128c0f - ide_completion::completions::h37999e5c105e6b98
  23:     0x5566b4e9288b - std::panicking::try::hb10968870dd45258
  24:     0x5566b56fed32 - rust_analyzer::handlers::handle_completion::h6e0ba316df939429
  25:     0x5566b555fa01 - std::panicking::try::h8ca3b3f4dedbb183
  26:     0x5566b5556e59 - <F as threadpool::FnBox>::call_box::h78bd89d190aa8628
  27:     0x5566b5872b38 - std::sys_common::backtrace::__rust_begin_short_backtrace::h903b5fd7ab5d73b5
  28:     0x5566b58723c1 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h961008efc1db8c80
  29:     0x5566b5812ef5 - <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:     0x5566b5812ef5 - <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:     0x5566b5812ef5 - std::sys::unix::thread::Thread::new::thread_start::h5d4e11bbda4161c8
                               at /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/std/src/sys/unix/thread.rs:108:17
  32:     0x7fd81300274d - <unknown>
  33:     0x7fd813084700 - <unknown>
  34:                0x0 - <unknown>
[Error - 8:34:03 PM] 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 

kxxt avatar Sep 20 '22 12:09 kxxt