Skip to content

RA parser gets stuck on indexing: 0.3.2519-standalone #20171

Closed
@raldone01

Description

@raldone01

rust-analyzer version: 0.3.2519-standalone

rustc version: rustc 1.90.0-nightly (da58c0513 2025-07-03)

editor or extension: VSCode

repository link (if public, optional): Snippet below.

Just create a main.rs with the following contents:

code snippet to reproduce:

fn test_parser_error_bad_length() {
    assert!(matches!(
        drive_parser(&mut parser, data, false),
        Err(TarParserError::CorruptField {
            field: CorruptFieldContext::PaxKvLength,
            error: GeneralParseError::ParseInt(ParseIntError { .. })
        )}) // the first round bracket in this line causes the errors
    ));
}

RA error:

thread 'Worker4' panicked at crates/parser/src/parser.rs:56:9:
the parser seems stuck
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: parser::parser::Parser::err_recover
   3: parser::grammar::expressions::stmt
   4: parser::grammar::entry::top::macro_stmts
   5: syntax_bridge::token_tree_to_syntax_node
   6: <<DB as hir_expand::db::ExpandDatabase>::parse_macro_expansion::parse_macro_expansion_shim::Configuration_ as salsa::function::Configuration>::execute
   7: salsa::function::execute::<impl salsa::function::IngredientImpl<C>>::execute
   8: salsa::function::fetch::<impl salsa::function::IngredientImpl<C>>::fetch_cold_with_retry
   9: <DB as hir_expand::db::ExpandDatabase>::parse_macro_expansion::parse_macro_expansion_shim
  10: <DB as hir_expand::db::ExpandDatabase>::parse_macro_expansion
  11: hir_expand::db::parse_or_expand
  12: salsa::function::execute::<impl salsa::function::IngredientImpl<C>>::execute
  13: salsa::function::fetch::<impl salsa::function::IngredientImpl<C>>::fetch_cold_with_retry
  14: <DB as hir_expand::db::ExpandDatabase>::ast_id_map::ast_id_map_shim
  15: <hir_def::item_tree::file_item_tree_query::Configuration_ as salsa::function::Configuration>::execute
  16: salsa::function::execute::<impl salsa::function::IngredientImpl<C>>::execute
  17: salsa::function::fetch::<impl salsa::function::IngredientImpl<C>>::fetch_cold_with_retry
  18: salsa::function::fetch::<impl salsa::function::IngredientImpl<C>>::fetch
  19: std::thread::local::LocalKey<T>::with
  20: <DB as hir_def::db::DefDatabase>::file_item_tree
  21: hir_def::nameres::collector::DefCollector::collect_macro_expansion
  22: hir_def::nameres::collector::collect_defs
  23: <hir_def::nameres::block_def_map::Configuration_ as salsa::function::Configuration>::execute
  24: salsa::function::execute::<impl salsa::function::IngredientImpl<C>>::execute
  25: salsa::function::fetch::<impl salsa::function::IngredientImpl<C>>::fetch_cold_with_retry
  26: hir_def::nameres::block_def_map
  27: hir_def::expr_store::lower::ExprCollector::collect_block_
  28: hir_def::expr_store::lower::ExprCollector::maybe_collect_expr
  29: hir_def::expr_store::lower::lower_body
  30: hir_def::expr_store::body::Body::body_with_source_map_query
  31: salsa::function::execute::<impl salsa::function::IngredientImpl<C>>::execute
  32: salsa::function::fetch::<impl salsa::function::IngredientImpl<C>>::fetch_cold_with_retry
  33: salsa::function::fetch::<impl salsa::function::IngredientImpl<C>>::fetch
  34: <DB as hir_def::db::DefDatabase>::body_with_source_map
  35: hir::semantics::SemanticsImpl::get_unsafe_ops
  36: ide::syntax_highlighting::highlight
  37: salsa::cancelled::Cancelled::catch
  38: ide::Analysis::highlight
  39: rust_analyzer::handlers::request::handle_semantic_tokens_full_delta
  40: core::ops::function::FnOnce::call_once{{vtable.shim}}
  41: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
query stacktrace:
   0: parse_macro_expansion_shim(Id(2fc00)) -> (R2257, Durability::MEDIUM)
             at crates/hir-expand/src/db.rs:52
   1: ast_id_map_shim(Id(2fc00)) -> (R1, Durability::HIGH)
             at crates/hir-expand/src/db.rs:52
   2: file_item_tree_query(Id(2fc00)) -> (R1, Durability::HIGH)
             at crates/hir-def/src/item_tree.rs:89
   3: block_def_map(Id(6400)) -> (R2257, Durability::MEDIUM)
             at crates/hir-def/src/nameres.rs:421
   4: body_with_source_map_shim(Id(5400)) -> (R2257, Durability::MEDIUM)
             at crates/hir-def/src/db.rs:98

additional context:
   0: 
version: 0.3.2519-standalone
request: textDocument/semanticTokens/full/delta SemanticTokensDeltaParams {
    work_done_progress_params: WorkDoneProgressParams {
        work_done_token: None,
    },
    partial_result_params: PartialResultParams {
        partial_result_token: None,
    },
    text_document: TextDocumentIdentifier {
        uri: Url {
            scheme: "file",
            cannot_be_a_base: false,
            username: "",
            password: None,
            host: None,
            port: None,
            path: "/home/main/Downloads/rustanaltest/rustanaltest/src/main.rs",
            query: None,
            fragment: None,
        },
    },
    previous_result_id: "1",
}

[Error - 19:31:06] Request textDocument/semanticTokens/full/delta failed.
  Message: request handler panicked: the parser seems stuck
  Code: -32603 

Metadata

Metadata

Labels

C-bugCategory: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions