rust-analyzer: Critical bug that completely prevents the use of rust-analyzer (1.78.0-nightly (3246e79 2024-02-19) in VS Code (1.86.2)

This is a serious regression in nightly and it’s important to fix it before the next release.

rust-analizer extension: v0.4.1853 (pre-release) rust-analyzer: 1.78.0-nightly (3246e79 2024-02-19) rustup: 1.26.0 (1980-01-01) rustc: 1.78.0-nightly (3246e7951 2024-02-19) VS Code: 1.86.2

rust-analyzer analysis-stats . the output is: https://pastebin.com/YRNzDaXV

RA_LOG=info rust-analyzer analysis-stats . the output is so big that I had to upload it to Mega.nz: https://mega.nz/file/IsIATYSR#LQMQZy5FR0JrXpB27J6dI8igABvMioHzaaiaExbfvfI

the Output inside VS Code is:

Panic context:
> 
version: 0.4.1853-standalone
request: textDocument/documentHighlight DocumentHighlightParams {
    text_document_position_params: TextDocumentPositionParams {
        text_document: TextDocumentIdentifier {
            uri: Url {
                scheme: "file",
                cannot_be_a_base: false,
                username: "",
                password: None,
                host: None,
                port: None,
                path: "/mnt/hdd_aux/wa/autopod/src/bin/cli.rs",
                query: None,
                fragment: None,
            },
        },
        position: Position {
            line: 319,
            character: 19,
        },
    },
    work_done_progress_params: WorkDoneProgressParams {
        work_done_token: None,
    },
    partial_result_params: PartialResultParams {
        partial_result_token: None,
    },
}

thread 'Worker' panicked at /__w/rust-analyzer/rust-analyzer/crates/mbe/src/to_parser_input.rs:45:48:
Fail to convert given literal Literal {
    text: "\"\"variant identifier\"\"",
    span: SpanData {
        range: 469..470,
        anchor: SpanAnchor(
            FileId(
                4489,
            ),
            0,
        ),
        ctx: SyntaxContextId(
            7828,
        ),
    },
}
stack backtrace:
   0: rust_begin_unwind
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
   2: mbe::to_parser_input::to_parser_input
   3: mbe::syntax_bridge::token_tree_to_syntax_node
   4: <hir_expand::db::ParseMacroExpansionQuery as salsa::plumbing::QueryFunction>::execute
   5: salsa::Cycle::catch
   6: salsa::derived::slot::Slot<Q,MP>::execute
   7: salsa::derived::slot::Slot<Q,MP>::read
   8: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
   9: <DB as hir_expand::db::ExpandDatabase>::parse_macro_expansion
  10: <hir_expand::db::ParseMacroExpansionErrorQuery as salsa::plumbing::QueryFunction>::execute
  11: salsa::Cycle::catch
  12: salsa::derived::slot::Slot<Q,MP>::execute
  13: salsa::derived::slot::Slot<Q,MP>::read
  14: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
  15: <DB as hir_expand::db::ExpandDatabase>::parse_macro_expansion_error
  16: hir_def::nameres::collector::DefCollector::collect_macro_expansion
  17: hir_def::nameres::collector::collect_defs
  18: hir_def::nameres::DefMap::crate_def_map_query
  19: salsa::Cycle::catch
  20: salsa::derived::slot::Slot<Q,MP>::execute
  21: salsa::derived::slot::Slot<Q,MP>::read
  22: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
  23: <DB as hir_def::db::DefDatabase>::crate_def_map_query
  24: hir_def::db::crate_def_map_wait
  25: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro_single
  26: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro
  27: hir_def::nameres::collector::DefCollector::resolve_import
  28: alloc::vec::in_place_collect::<impl alloc::vec::spec_from_iter::SpecFromIter<T,I> for alloc::vec::Vec<T>>::from_iter
  29: hir_def::nameres::collector::collect_defs
  30: hir_def::nameres::DefMap::crate_def_map_query
  31: salsa::Cycle::catch
  32: salsa::derived::slot::Slot<Q,MP>::execute
  33: salsa::derived::slot::Slot<Q,MP>::read
  34: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
  35: <DB as hir_def::db::DefDatabase>::crate_def_map_query
  36: hir_def::db::crate_def_map_wait
  37: hir_def::nameres::collector::DefCollector::import_macros_from_extern_crate
  38: hir_def::nameres::collector::ModCollector::collect::{{closure}}
  39: hir_def::nameres::collector::ModCollector::collect
  40: hir_def::nameres::collector::collect_defs
  41: hir_def::nameres::DefMap::crate_def_map_query
  42: salsa::Cycle::catch
  43: salsa::derived::slot::Slot<Q,MP>::execute
  44: salsa::derived::slot::Slot<Q,MP>::read
  45: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
  46: <DB as hir_def::db::DefDatabase>::crate_def_map_query
  47: hir_def::db::crate_def_map_wait
  48: hir::semantics::source_to_def::SourceToDefCtx::file_to_def
  49: hir::semantics::source_to_def::SourceToDefCtx::find_container
  50: hir::semantics::source_to_def::SourceToDefCtx::find_container
  51: hir::semantics::SemanticsImpl::analyze_impl
  52: hir::semantics::SemanticsImpl::descend_into_macros_impl
  53: hir::semantics::SemanticsImpl::descend_into_macros
  54: ide::highlight_related::highlight_related
  55: std::panicking::try
  56: ide::Analysis::highlight_related
  57: rust_analyzer::handlers::request::handle_document_highlight
  58: std::panicking::try
  59: core::ops::function::FnOnce::call_once{{vtable.shim}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 11:45:42 PM] Request textDocument/documentHighlight failed.
  Message: request handler panicked: Fail to convert given literal Literal {
    text: "\"\"variant identifier\"\"",
    span: SpanData {
        range: 469..470,
        anchor: SpanAnchor(
            FileId(
                4489,
            ),
            0,
        ),
        ctx: SyntaxContextId(
            7828,
        ),
    },
}
  Code: -32603 
Panic context:
> 
version: 0.4.1853-standalone
request: textDocument/codeAction CodeActionParams {
    text_document: TextDocumentIdentifier {
        uri: Url {
            scheme: "file",
            cannot_be_a_base: false,
            username: "",
            password: None,
            host: None,
            port: None,
            path: "/mnt/hdd_aux/wa/autopod/src/bin/cli.rs",
            query: None,
            fragment: None,
        },
    },
    range: Range {
        start: Position {
            line: 319,
            character: 19,
        },
        end: Position {
            line: 319,
            character: 19,
        },
    },
    context: CodeActionContext {
        diagnostics: [],
        only: None,
        trigger_kind: Some(
            Automatic,
        ),
    },
    work_done_progress_params: WorkDoneProgressParams {
        work_done_token: None,
    },
    partial_result_params: PartialResultParams {
        partial_result_token: None,
    },
}

thread 'Worker' panicked at /__w/rust-analyzer/rust-analyzer/crates/mbe/src/to_parser_input.rs:45:48:
Fail to convert given literal Literal {
    text: "\"\"variant identifier\"\"",
    span: SpanData {
        range: 469..470,
        anchor: SpanAnchor(
            FileId(
                4489,
            ),
            0,
        ),
        ctx: SyntaxContextId(
            7828,
        ),
    },
}
stack backtrace:
   0: rust_begin_unwind
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
   2: mbe::to_parser_input::to_parser_input
   3: mbe::syntax_bridge::token_tree_to_syntax_node
   4: <hir_expand::db::ParseMacroExpansionQuery as salsa::plumbing::QueryFunction>::execute
   5: salsa::Cycle::catch
   6: salsa::derived::slot::Slot<Q,MP>::execute
   7: salsa::derived::slot::Slot<Q,MP>::read
   8: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
   9: <DB as hir_expand::db::ExpandDatabase>::parse_macro_expansion
  10: <hir_expand::db::ParseMacroExpansionErrorQuery as salsa::plumbing::QueryFunction>::execute
  11: salsa::Cycle::catch
  12: salsa::derived::slot::Slot<Q,MP>::execute
  13: salsa::derived::slot::Slot<Q,MP>::read
  14: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
  15: <DB as hir_expand::db::ExpandDatabase>::parse_macro_expansion_error
  16: hir_def::nameres::collector::DefCollector::collect_macro_expansion
  17: hir_def::nameres::collector::collect_defs
  18: hir_def::nameres::DefMap::crate_def_map_query
  19: salsa::Cycle::catch
  20: salsa::derived::slot::Slot<Q,MP>::execute
  21: salsa::derived::slot::Slot<Q,MP>::read
  22: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
  23: <DB as hir_def::db::DefDatabase>::crate_def_map_query
  24: hir_def::db::crate_def_map_wait
  25: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro_single
  26: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro
  27: hir_def::nameres::collector::DefCollector::resolve_import
  28: alloc::vec::in_place_collect::<impl alloc::vec::spec_from_iter::SpecFromIter<T,I> for alloc::vec::Vec<T>>::from_iter
  29: hir_def::nameres::collector::collect_defs
  30: hir_def::nameres::DefMap::crate_def_map_query
  31: salsa::Cycle::catch
  32: salsa::derived::slot::Slot<Q,MP>::execute
  33: salsa::derived::slot::Slot<Q,MP>::read
  34: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
  35: <DB as hir_def::db::DefDatabase>::crate_def_map_query
  36: hir_def::db::crate_def_map_wait
  37: hir_def::nameres::collector::DefCollector::import_macros_from_extern_crate
  38: hir_def::nameres::collector::ModCollector::collect::{{closure}}
  39: hir_def::nameres::collector::ModCollector::collect
  40: hir_def::nameres::collector::collect_defs
  41: hir_def::nameres::DefMap::crate_def_map_query
  42: salsa::Cycle::catch
  43: salsa::derived::slot::Slot<Q,MP>::execute
  44: salsa::derived::slot::Slot<Q,MP>::read
  45: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
  46: <DB as hir_def::db::DefDatabase>::crate_def_map_query
  47: hir_def::db::crate_def_map_wait
  48: hir::semantics::source_to_def::SourceToDefCtx::file_to_def
  49: ide_diagnostics::diagnostics
  50: std::panicking::try
  51: ide::Analysis::assists_with_fixes
  52: rust_analyzer::handlers::request::handle_code_action
  53: std::panicking::try
  54: core::ops::function::FnOnce::call_once{{vtable.shim}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Panic context:
> 
version: 0.4.1853-standalone
request: textDocument/codeLens CodeLensParams {
    text_document: TextDocumentIdentifier {
        uri: Url {
            scheme: "file",
            cannot_be_a_base: false,
            username: "",
            password: None,
            host: None,
            port: None,
            path: "/mnt/hdd_aux/wa/autopod/src/bin/cli.rs",
            query: None,
            fragment: None,
        },
    },
    work_done_progress_params: WorkDoneProgressParams {
        work_done_token: None,
    },
    partial_result_params: PartialResultParams {
        partial_result_token: None,
    },
}

thread 'Worker' panicked at /__w/rust-analyzer/rust-analyzer/crates/mbe/src/to_parser_input.rs:45:48:
Fail to convert given literal Literal {
    text: "\"\"variant identifier\"\"",
    span: SpanData {
        range: 469..470,
        anchor: SpanAnchor(
            FileId(
                4489,
            ),
            0,
        ),
        ctx: SyntaxContextId(
            7828,
        ),
    },
}
stack backtrace:
   0: rust_begin_unwind
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
   2: mbe::to_parser_input::to_parser_input
   3: mbe::syntax_bridge::token_tree_to_syntax_node
   4: <hir_expand::db::ParseMacroExpansionQuery as salsa::plumbing::QueryFunction>::execute
   5: salsa::Cycle::catch
   6: salsa::derived::slot::Slot<Q,MP>::execute
   7: salsa::derived::slot::Slot<Q,MP>::read
   8: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
   9: <DB as hir_expand::db::ExpandDatabase>::parse_macro_expansion
  10: <hir_expand::db::ParseMacroExpansionErrorQuery as salsa::plumbing::QueryFunction>::execute
  11: salsa::Cycle::catch
  12: salsa::derived::slot::Slot<Q,MP>::execute
  13: salsa::derived::slot::Slot<Q,MP>::read
  14: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
  15: <DB as hir_expand::db::ExpandDatabase>::parse_macro_expansion_error
  16: hir_def::nameres::collector::DefCollector::collect_macro_expansion
  17: hir_def::nameres::collector::collect_defs
  18: hir_def::nameres::DefMap::crate_def_map_query
  19: salsa::Cycle::catch
  20: salsa::derived::slot::Slot<Q,MP>::execute
  21: salsa::derived::slot::Slot<Q,MP>::read
  22: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
  23: <DB as hir_def::db::DefDatabase>::crate_def_map_query
  24: hir_def::db::crate_def_map_wait
  25: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro_single
  26: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro
  27: hir_def::nameres::collector::DefCollector::resolve_import
  28: alloc::vec::in_place_collect::<impl alloc::vec::spec_from_iter::SpecFromIter<T,I> for alloc::vec::Vec<T>>::from_iter
  29: hir_def::nameres::collector::collect_defs
  30: hir_def::nameres::DefMap::crate_def_map_query
  31: salsa::Cycle::catch
  32: salsa::derived::slot::Slot<Q,MP>::execute
  33: salsa::derived::slot::Slot<Q,MP>::read
  34: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
  35: <DB as hir_def::db::DefDatabase>::crate_def_map_query
  36: hir_def::db::crate_def_map_wait
  37: hir_def::nameres::collector::DefCollector::import_macros_from_extern_crate
  38: hir_def::nameres::collector::ModCollector::collect::{{closure}}
  39: hir_def::nameres::collector::ModCollector::collect
  40: hir_def::nameres::collector::collect_defs
  41: hir_def::nameres::DefMap::crate_def_map_query
  42: salsa::Cycle::catch
  43: salsa::derived::slot::Slot<Q,MP>::execute
  44: salsa::derived::slot::Slot<Q,MP>::read
  45: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
  46: <DB as hir_def::db::DefDatabase>::crate_def_map_query
  47: hir_def::db::crate_def_map_wait
  48: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  49: ide::parent_module::crates_for
  50: salsa::Cancelled::catch
  51: rust_analyzer::cargo_target_spec::CargoTargetSpec::for_file
  52: rust_analyzer::handlers::request::handle_code_lens
  53: std::panicking::try
  54: core::ops::function::FnOnce::call_once{{vtable.shim}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 11:45:42 PM] Request textDocument/codeLens failed.
  Message: request handler panicked: Fail to convert given literal Literal {
    text: "\"\"variant identifier\"\"",
    span: SpanData {
        range: 469..470,
        anchor: SpanAnchor(
            FileId(
                4489,
            ),
            0,
        ),
        ctx: SyntaxContextId(
            7828,
        ),
    },
}
  Code: -32603 
Panic context:
> 
version: 0.4.1853-standalone
request: textDocument/codeAction CodeActionParams {
    text_document: TextDocumentIdentifier {
        uri: Url {
            scheme: "file",
            cannot_be_a_base: false,
            username: "",
            password: None,
            host: None,
            port: None,
            path: "/mnt/hdd_aux/wa/autopod/src/bin/cli.rs",
            query: None,
            fragment: None,
        },
    },
    range: Range {
        start: Position {
            line: 0,
            character: 0,
        },
        end: Position {
            line: 1379,
            character: 0,
        },
    },
    context: CodeActionContext {
        diagnostics: [],
        only: None,
        trigger_kind: Some(
            Automatic,
        ),
    },
    work_done_progress_params: WorkDoneProgressParams {
        work_done_token: None,
    },
    partial_result_params: PartialResultParams {
        partial_result_token: None,
    },
}

thread 'Worker' panicked at /__w/rust-analyzer/rust-analyzer/crates/mbe/src/to_parser_input.rs:45:48:
Fail to convert given literal Literal {
    text: "\"\"variant identifier\"\"",
    span: SpanData {
        range: 469..470,
        anchor: SpanAnchor(
            FileId(
                4489,
            ),
            0,
        ),
        ctx: SyntaxContextId(
            7828,
        ),
    },
}
stack backtrace:
   0: rust_begin_unwind
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
   2: mbe::to_parser_input::to_parser_input
   3: mbe::syntax_bridge::token_tree_to_syntax_node
   4: <hir_expand::db::ParseMacroExpansionQuery as salsa::plumbing::QueryFunction>::execute
   5: salsa::Cycle::catch
   6: salsa::derived::slot::Slot<Q,MP>::execute
   7: salsa::derived::slot::Slot<Q,MP>::read
   8: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
   9: <DB as hir_expand::db::ExpandDatabase>::parse_macro_expansion
  10: <hir_expand::db::ParseMacroExpansionErrorQuery as salsa::plumbing::QueryFunction>::execute
  11: salsa::Cycle::catch
  12: salsa::derived::slot::Slot<Q,MP>::execute
  13: salsa::derived::slot::Slot<Q,MP>::read
  14: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
  15: <DB as hir_expand::db::ExpandDatabase>::parse_macro_expansion_error
  16: hir_def::nameres::collector::DefCollector::collect_macro_expansion
  17: hir_def::nameres::collector::collect_defs
  18: hir_def::nameres::DefMap::crate_def_map_query
  19: salsa::Cycle::catch
  20: salsa::derived::slot::Slot<Q,MP>::execute
  21: salsa::derived::slot::Slot<Q,MP>::read
  22: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
  23: <DB as hir_def::db::DefDatabase>::crate_def_map_query
  24: hir_def::db::crate_def_map_wait
  25: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro_single
  26: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro
  27: hir_def::nameres::collector::DefCollector::resolve_import
  28: alloc::vec::in_place_collect::<impl alloc::vec::spec_from_iter::SpecFromIter<T,I> for alloc::vec::Vec<T>>::from_iter
  29: hir_def::nameres::collector::collect_defs
  30: hir_def::nameres::DefMap::crate_def_map_query
  31: salsa::Cycle::catch
  32: salsa::derived::slot::Slot<Q,MP>::execute
  33: salsa::derived::slot::Slot<Q,MP>::read
  34: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
  35: <DB as hir_def::db::DefDatabase>::crate_def_map_query
  36: hir_def::db::crate_def_map_wait
  37: hir_def::nameres::collector::DefCollector::import_macros_from_extern_crate
  38: hir_def::nameres::collector::ModCollector::collect::{{closure}}
  39: hir_def::nameres::collector::ModCollector::collect
  40: hir_def::nameres::collector::collect_defs
  41: hir_def::nameres::DefMap::crate_def_map_query
  42: salsa::Cycle::catch
  43: salsa::derived::slot::Slot<Q,MP>::execute
  44: salsa::derived::slot::Slot<Q,MP>::read
  45: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
  46: <DB as hir_def::db::DefDatabase>::crate_def_map_query
  47: hir_def::db::crate_def_map_wait
  48: hir::semantics::source_to_def::SourceToDefCtx::file_to_def
  49: ide_diagnostics::diagnostics
  50: std::panicking::try
  51: ide::Analysis::assists_with_fixes
  52: rust_analyzer::handlers::request::handle_code_action
  53: std::panicking::try
  54: core::ops::function::FnOnce::call_once{{vtable.shim}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Panic context:
> 
version: 0.4.1853-standalone
request: textDocument/definition GotoDefinitionParams {
    text_document_position_params: TextDocumentPositionParams {
        text_document: TextDocumentIdentifier {
            uri: Url {
                scheme: "file",
                cannot_be_a_base: false,
                username: "",
                password: None,
                host: None,
                port: None,
                path: "/mnt/hdd_aux/wa/autopod/src/bin/cli.rs",
                query: None,
                fragment: None,
            },
        },
        position: Position {
            line: 313,
            character: 75,
        },
    },
    work_done_progress_params: WorkDoneProgressParams {
        work_done_token: None,
    },
    partial_result_params: PartialResultParams {
        partial_result_token: None,
    },
}

thread 'Worker' panicked at /__w/rust-analyzer/rust-analyzer/crates/mbe/src/to_parser_input.rs:45:48:
Fail to convert given literal Literal {
    text: "\"\"variant identifier\"\"",
    span: SpanData {
        range: 469..470,
        anchor: SpanAnchor(
            FileId(
                4489,
            ),
            0,
        ),
        ctx: SyntaxContextId(
            7828,
        ),
    },
}
stack backtrace:
   0: rust_begin_unwind
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
   2: mbe::to_parser_input::to_parser_input
   3: mbe::syntax_bridge::token_tree_to_syntax_node
   4: <hir_expand::db::ParseMacroExpansionQuery as salsa::plumbing::QueryFunction>::execute
   5: salsa::Cycle::catch
   6: salsa::derived::slot::Slot<Q,MP>::execute
   7: salsa::derived::slot::Slot<Q,MP>::read
   8: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
   9: <DB as hir_expand::db::ExpandDatabase>::parse_macro_expansion
  10: <hir_expand::db::ParseMacroExpansionErrorQuery as salsa::plumbing::QueryFunction>::execute
  11: salsa::Cycle::catch
  12: salsa::derived::slot::Slot<Q,MP>::execute
  13: salsa::derived::slot::Slot<Q,MP>::read
  14: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
  15: <DB as hir_expand::db::ExpandDatabase>::parse_macro_expansion_error
  16: hir_def::nameres::collector::DefCollector::collect_macro_expansion
  17: hir_def::nameres::collector::collect_defs
  18: hir_def::nameres::DefMap::crate_def_map_query
  19: salsa::Cycle::catch
  20: salsa::derived::slot::Slot<Q,MP>::execute
  21: salsa::derived::slot::Slot<Q,MP>::read
  22: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
  23: <DB as hir_def::db::DefDatabase>::crate_def_map_query
  24: hir_def::db::crate_def_map_wait
  25: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro_single
  26: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro
  27: hir_def::nameres::collector::DefCollector::resolve_import
  28: alloc::vec::in_place_collect::<impl alloc::vec::spec_from_iter::SpecFromIter<T,I> for alloc::vec::Vec<T>>::from_iter
  29: hir_def::nameres::collector::collect_defs
  30: hir_def::nameres::DefMap::crate_def_map_query
  31: salsa::Cycle::catch
  32: salsa::derived::slot::Slot<Q,MP>::execute
  33: salsa::derived::slot::Slot<Q,MP>::read
  34: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
  35: <DB as hir_def::db::DefDatabase>::crate_def_map_query
  36: hir_def::db::crate_def_map_wait
  37: hir_def::nameres::collector::DefCollector::import_macros_from_extern_crate
  38: hir_def::nameres::collector::ModCollector::collect::{{closure}}
  39: hir_def::nameres::collector::ModCollector::collect
  40: hir_def::nameres::collector::collect_defs
  41: hir_def::nameres::DefMap::crate_def_map_query
  42: salsa::Cycle::catch
  43: salsa::derived::slot::Slot<Q,MP>::execute
  44: salsa::derived::slot::Slot<Q,MP>::read
  45: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
  46: <DB as hir_def::db::DefDatabase>::crate_def_map_query
  47: hir_def::db::crate_def_map_wait
  48: hir::semantics::source_to_def::SourceToDefCtx::file_to_def
  49: hir::semantics::source_to_def::SourceToDefCtx::find_container
  50: hir::semantics::source_to_def::SourceToDefCtx::find_container
  51: hir::semantics::SemanticsImpl::analyze_impl
  52: hir::semantics::SemanticsImpl::descend_into_macros_impl
  53: hir::semantics::SemanticsImpl::descend_into_macros
  54: ide::goto_definition::goto_definition
  55: salsa::Cancelled::catch
  56: rust_analyzer::handlers::request::handle_goto_definition
  57: std::panicking::try
  58: core::ops::function::FnOnce::call_once{{vtable.shim}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 11:45:47 PM] Request textDocument/definition failed.
  Message: request handler panicked: Fail to convert given literal Literal {
    text: "\"\"variant identifier\"\"",
    span: SpanData {
        range: 469..470,
        anchor: SpanAnchor(
            FileId(
                4489,
            ),
            0,
        ),
        ctx: SyntaxContextId(
            7828,
        ),
    },
}
  Code: -32603 
Panic context:
> fetch_native_diagnostics

thread 'Worker' panicked at /__w/rust-analyzer/rust-analyzer/crates/mbe/src/to_parser_input.rs:45:48:
Fail to convert given literal Literal {
    text: "\"\"variant identifier\"\"",
    span: SpanData {
        range: 469..470,
        anchor: SpanAnchor(
            FileId(
                4489,
            ),
            0,
        ),
        ctx: SyntaxContextId(
            7828,
        ),
    },
}
stack backtrace:
   0: rust_begin_unwind
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
   2: mbe::to_parser_input::to_parser_input
   3: mbe::syntax_bridge::token_tree_to_syntax_node
   4: <hir_expand::db::ParseMacroExpansionQuery as salsa::plumbing::QueryFunction>::execute
   5: salsa::Cycle::catch
   6: salsa::derived::slot::Slot<Q,MP>::execute
   7: salsa::derived::slot::Slot<Q,MP>::read
   8: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
   9: <DB as hir_expand::db::ExpandDatabase>::parse_macro_expansion
  10: <hir_expand::db::ParseMacroExpansionErrorQuery as salsa::plumbing::QueryFunction>::execute
  11: salsa::Cycle::catch
  12: salsa::derived::slot::Slot<Q,MP>::execute
  13: salsa::derived::slot::Slot<Q,MP>::read
  14: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
  15: <DB as hir_expand::db::ExpandDatabase>::parse_macro_expansion_error
  16: hir_def::nameres::collector::DefCollector::collect_macro_expansion
  17: hir_def::nameres::collector::collect_defs
  18: hir_def::nameres::DefMap::crate_def_map_query
  19: salsa::Cycle::catch
  20: salsa::derived::slot::Slot<Q,MP>::execute
  21: salsa::derived::slot::Slot<Q,MP>::read
  22: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
  23: <DB as hir_def::db::DefDatabase>::crate_def_map_query
  24: hir_def::db::crate_def_map_wait
  25: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro_single
  26: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro
  27: hir_def::nameres::collector::DefCollector::resolve_import
  28: alloc::vec::in_place_collect::<impl alloc::vec::spec_from_iter::SpecFromIter<T,I> for alloc::vec::Vec<T>>::from_iter
  29: hir_def::nameres::collector::collect_defs
  30: hir_def::nameres::DefMap::crate_def_map_query
  31: salsa::Cycle::catch
  32: salsa::derived::slot::Slot<Q,MP>::execute
  33: salsa::derived::slot::Slot<Q,MP>::read
  34: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
  35: <DB as hir_def::db::DefDatabase>::crate_def_map_query
  36: hir_def::db::crate_def_map_wait
  37: hir_def::nameres::collector::DefCollector::import_macros_from_extern_crate
  38: hir_def::nameres::collector::ModCollector::collect::{{closure}}
  39: hir_def::nameres::collector::ModCollector::collect
  40: hir_def::nameres::collector::collect_defs
  41: hir_def::nameres::DefMap::crate_def_map_query
  42: salsa::Cycle::catch
  43: salsa::derived::slot::Slot<Q,MP>::execute
  44: salsa::derived::slot::Slot<Q,MP>::read
  45: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
  46: <DB as hir_def::db::DefDatabase>::crate_def_map_query
  47: hir_def::db::crate_def_map_wait
  48: hir::semantics::source_to_def::SourceToDefCtx::file_to_def
  49: ide_diagnostics::diagnostics
  50: salsa::Cancelled::catch
  51: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
  52: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  53: rust_analyzer::diagnostics::fetch_native_diagnostics
  54: core::ops::function::FnOnce::call_once{{vtable.shim}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Please don’t hesitate to contact me if you require any additional information or if there’s any way I can assist you further.

About this issue

  • Original URL
  • State: closed
  • Created 4 months ago
  • Reactions: 3
  • Comments: 15 (4 by maintainers)

Commits related to this issue

Most upvoted comments

Same here, but I use rust-analyzer on Nvim with Mason.

I resolved by downgrading rust-analyzer to the 2024-02-11 version.

Wasn’t able to reproduce it on today’s and yesterday’s nightly r-a on tree-sitter

dang, I just reproduced it with today’s nightly as well. I use neovim not vscode though fwiw, but that shouldn’t really affect how r-a behaves.

like @felipelalli said ^^ I’m happy to help debug further, just need pointers

Wasn’t able to reproduce it on today’s and yesterday’s nightly r-a on tree-sitter

What debugging strategies do you suggest for resolving this issue? It’s significantly hindering my daily tasks.

The bug exists in the proc-macro server (a rustup component) so you’ll have to update your rust toolchain to tomorrows nightly (as the sync only happened today). Hence why downgrading didn’t help either for you

Are any particular steps needed to reproduce?

Just open VS Code.

The rust-analyzer is able to make like a “first analysis”. So, if I keep closing / opening / closing it is possible to detect some errors / warnings in the project. But few seconds later it starts to panic and the rust-analyzer doesn’t work at all.

Might be https://docs.rs/indoc/latest/indoc/ causing troubles again given the linked source snippet

Wasn’t able to reproduce it on today’s and yesterday’s nightly r-a on tree-sitter

I am working on just one project in Rust. Do you recommend any specific open source project to test?