Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
felipelalli opened this issue Feb 21, 2024 · 15 comments · Fixed by #16637
Labels
A-project-model project model and workspace related issues Broken Window Bugs / technical debt to be addressed immediately I-panic

Comments

@felipelalli
Copy link

felipelalli commented Feb 21, 2024

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.

@felipelalli felipelalli added the Broken Window Bugs / technical debt to be addressed immediately label Feb 21, 2024
@saiintbrisson
Copy link
Contributor

Is this a thing for all projects you've tested? Are any particular steps needed to reproduce? btw r/suddenlycaralho

@felipelalli
Copy link
Author

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

@amaanq
Copy link

amaanq commented Feb 21, 2024

I'm getting this in the tree-sitter repository, when invoking goto definition in this file at this line, with the following error message:

rust_analyzer: -32603: request handler panicked: Fail to convert given literal Literal {
    text: "\"\"Some tests failed to parse with unexpected `ERROR` or `MISSING` nodes, as shown above, and cannot be updated automatically.\nEither fix the grammar or manually update the tests if this is expected.\"\"",
    span: SpanData {
        range: 2078..2317,
        anchor: SpanAnchor(
            FileId(
                0,
            ),
            21,
        ),
        ctx: SyntaxContextId(
            0,
        ),
    },
}

The text that is mentioned in the error can be located here

hope this helps a bit

r-a version:

$ rust-analyzer --version                                                                                                                                                                                                                                                                                                           
rust-analyzer 0.3.1850-standalone
full error log

Panic context:

version: 0.3.1850-standalone
request: textDocument/inlayHint InlayHintParams {
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
text_document: TextDocumentIdentifier {
uri: Url {
scheme: "file",
cannot_be_a_base: false,
username: "",
password: None,
host: None,
port: None,
path: "/home/amaanq/projects/tree-sitter/cli/src/test.rs",
query: None,
fragment: None,
},
},
range: Range {
start: Position {
line: 0,
character: 0,
},
end: Position {
line: 1027,
character: 1,
},
},
}

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: """Some tests failed to parse with unexpected ERROR or MISSING nodes, as shown above, and cannot be updated automatically.\nEither fix the grammar or manually update the tests if this is expected.""",
span: SpanData {
range: 2078..2317,
anchor: SpanAnchor(
FileId(
0,
),
21,
),
ctx: SyntaxContextId(
0,
),
},
}
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>::fetch
9: ::parse_macro_expansion
10: hir_def::body::lower::ExprCollector::collect_macro_call
11: hir_def::body::lower::ExprCollector::maybe_collect_expr
12: hir_def::body::lower::ExprCollector::collect_expr_opt
13: hir_def::body::lower::ExprCollector::maybe_collect_expr
14: hir_def::body::lower::ExprCollector::collect_expr_opt
15: hir_def::body::lower::ExprCollector::maybe_collect_expr
16: hir_def::body::lower::ExprCollector::collect_stmt
17: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
18: hir_def::body::lower::ExprCollector::collect_block

19: hir_def::body::lower::ExprCollector::maybe_collect_expr
20: <alloc::vec::Vec as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
21: <alloc::boxed::Box<[I]> as core::iter::traits::collect::FromIterator>::from_iter
22: hir_def::body::lower::ExprCollector::maybe_collect_expr
23: hir_def::body::lower::ExprCollector::collect_macro_call
24: hir_def::body::lower::ExprCollector::maybe_collect_expr
25: <alloc::vec::Vec as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
26: <alloc::boxed::Box<[I]> as core::iter::traits::collect::FromIterator>::from_iter
27: hir_def::body::lower::ExprCollector::maybe_collect_expr
28: hir_def::body::lower::ExprCollector::collect_block

29: hir_def::body::lower::ExprCollector::maybe_collect_expr
30: hir_def::body::lower::ExprCollector::collect_block_
31: hir_def::body::lower::ExprCollector::maybe_collect_expr
32: hir_def::body::lower::ExprCollector::collect_block_
33: hir_def::body::lower::ExprCollector::maybe_collect_expr
34: hir_def::body::lower::ExprCollector::collect_block_
35: hir_def::body::lower::ExprCollector::maybe_collect_expr
36: hir_def::body::lower::ExprCollector::collect_expr_opt
37: hir_def::body::lower::lower
38: hir_def::body::Body::body_with_source_map_query
39: salsa::Cycle::catch
40: salsa::derived::slot::Slot<Q,MP>::execute
41: salsa::derived::slot::Slot<Q,MP>::read
42: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps>::fetch
43: ::body_with_source_map
44: hir::source_analyzer::SourceAnalyzer::new_for_body_no_infer
45: hir::semantics::SemanticsImpl::analyze_impl
46: hir::semantics::SemanticsImpl::descend_into_macros_impl
47: hir::semantics::SemanticsImpl::descend_node_into_attributes
48: ide::inlay_hints::chaining::hints
49: ide::inlay_hints::hints
50: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
51: ide::inlay_hints::inlay_hints
52: salsa::Cancelled::catch
53: ide::Analysis::inlay_hints
54: rust_analyzer::handlers::request::handle_inlay_hints
55: std::panicking::try
56: core::ops::function::FnOnce::call_once{{vtable.shim}}
note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.

@felipelalli
Copy link
Author

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.

@saiintbrisson
Copy link
Contributor

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

@felipelalli
Copy link
Author

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.

@amaanq
Copy link

amaanq commented Feb 21, 2024

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

@felipelalli
Copy link
Author

I have downgraded my version from rust-analyzer 1.78.0-nightly (3246e79 2024-02-19) to rust-analyzer 1.77.0-nightly (11f32b7 2024-01-31) and it solved my problem.

I'm using this Rust toolchains and rust-analyzer nightly for Nix and there are 3 main branches:

  • main
  • staging
  • monthly

I just have switched from main to monthly.

For NixOS users:

Instead of using:

let
  fenix = import (fetchTarball "https://github.com/nix-community/fenix/archive/main.tar.gz") { }; # Rust
in

you should use:

let
  fenix = import (fetchTarball "https://github.com/nix-community/fenix/archive/monthly.tar.gz") { }; # Rust
in

@Veykril
Copy link
Member

Veykril commented Feb 21, 2024

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

@Veykril Veykril added I-panic A-project-model project model and workspace related issues labels Feb 21, 2024
@felipelalli felipelalli changed the title Critical bug that completely prevents the use of rust-analyzer (v0.4.1.1853) in VS Code (1.86.2) Critical bug that completely prevents the use of rust-analyzer (1.78.0-nightly (3246e79 2024-02-19) in VS Code (1.86.2) Feb 21, 2024
@leolace
Copy link

leolace commented Feb 22, 2024

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

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

@thooton
Copy link

thooton commented Feb 25, 2024

Also experiencing this:

[Error - 9:47:02 AM] Request textDocument/hover failed.
  Message: request handler panicked: Fail to convert given literal Literal {
    text: "\"\"PortableRegistry\"\"",
    span: SpanData {
        range: 391..392,
        anchor: SpanAnchor(
            FileId(
                9334,
            ),
            0,
        ),
        ctx: SyntaxContextId(
            20340,
        ),
    },
}

I'm not able to fix the issue by downgrading rust-analyzer.
I think this issue should not be closed until it is fixed in the latest release.

@amaanq
Copy link

amaanq commented Feb 25, 2024

I don't think it should be open until a new release if it is fixed, however, I too can still reproduce my issue with tree-sitter on the latest nightly (02-24) and from the 02-05 release, downgrading didn't work in my case either.

I can paste my backtrace log on request

@Veykril
Copy link
Member

Veykril commented Feb 25, 2024

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

@thooton
Copy link

thooton commented Feb 26, 2024

Works great @Veykril, thanks so much for your work on this issue :)

@amaanq
Copy link

amaanq commented Feb 26, 2024

Thank you so much @Veykril, just updated and it works great now

amatveiakin added a commit to amatveiakin/bughouse-chess that referenced this issue Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-project-model project model and workspace related issues Broken Window Bugs / technical debt to be addressed immediately I-panic
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants