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

Stream of panics while typing a macro_rule floods error toasts #15314

Closed
juliusl opened this issue Jul 20, 2023 · 1 comment
Closed

Stream of panics while typing a macro_rule floods error toasts #15314

juliusl opened this issue Jul 20, 2023 · 1 comment
Labels
C-bug Category: bug

Comments

@juliusl
Copy link

juliusl commented Jul 20, 2023

Since #14193 mentions to report the panics, here is one that I get a constant stream of while I am in the middle of typing out a macro_rule, before hitting save while I am in the middle of typing.

Eventually I get in a state where the macro is finished, everything is correct but the language server is stuck in a panic loop while indexing.

I get two panics related to hir-expand? (not sure what this is for) But, it looks like an unwrap() is being used, and just puts ra in a bad state.

Panic output -- textDocument/codeLens

version: 0.3.1591-standalone (d82451103 2023-07-16)
request: textDocument/codeLens CodeLensParams {
    text_document: TextDocumentIdentifier {
        uri: Url {
            scheme: "file",
            cannot_be_a_base: false,
            username: "",
            password: None,
            host: None,
            port: None,
            path: <omitted>,
            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 'called `Option::unwrap()` on a `None` value', crates\hir-expand\src\db.rs:540:51
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\std\src\panicking.rs:593
   1: core::panicking::panic_fmt
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\core\src\panicking.rs:67
   2: core::panicking::panic
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\core\src\panicking.rs:117
   3: <hir_expand::db::MacroExpandQuery as salsa::plumbing::QueryFunction>::execute
   4: salsa::runtime::Runtime::execute_query_implementation
   5: core::ptr::drop_in_place<salsa::derived::slot::Memo<hir_expand::db::MacroArgNodeQuery>>
   6: salsa::derived::slot::Slot<Q,MP>::read
   7: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
   8: <DB as hir_expand::db::ExpandDatabase>::macro_expand
   9: <hir_expand::db::ParseMacroExpansionQuery as salsa::plumbing::QueryFunction>::execute
  10: salsa::runtime::Runtime::execute_query_implementation
  11: core::ptr::drop_in_place<salsa::derived::slot::Memo<hir_expand::db::MacroArgNodeQuery>>
  12: salsa::derived::slot::Slot<Q,MP>::read
  13: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  14: <DB as hir_expand::db::ExpandDatabase>::parse_macro_expansion
  15: salsa::runtime::Runtime::execute_query_implementation
  16: core::ptr::drop_in_place<salsa::derived::slot::Memo<hir_expand::db::MacroArgNodeQuery>>
  17: salsa::derived::slot::Slot<Q,MP>::read
  18: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  19: <DB as hir_expand::db::ExpandDatabase>::parse_macro_expansion_error
  20: hir_def::nameres::collector::DefCollector::record_resolved_import
  21: hir_def::nameres::collector::collect_defs
  22: <hir_def::db::CrateDefMapQueryQuery as salsa::plumbing::QueryFunction>::execute
  23: salsa::runtime::Runtime::execute_query_implementation
  24: core::ptr::drop_in_place<salsa::derived::slot::Memo<hir_def::db::UnionDataWithDiagnosticsQuery>>
  25: salsa::derived::slot::Slot<Q,MP>::read
  26: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  27: <DB as hir_def::db::DefDatabase>::crate_def_map_query
  28: hir_def::db::crate_def_map_wait
  29: <core::iter::adapters::copied::Copied<I> as core::iter::traits::iterator::Iterator>::try_fold
  30: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
  31: ide::parent_module::crates_for
  32: std::panicking::try
  33: rust_analyzer::cargo_target_spec::CargoTargetSpec::for_file
  34: rust_analyzer::handlers::request::handle_code_lens
  35: core::ops::function::FnOnce::call_once{{vtable.shim}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 5:32:37 PM] Request textDocument/codeLens failed.
  Message: request handler panicked: called `Option::unwrap()` on a `None` value
  Code: -32603 

Panic output for textDocument/inlayHint

version: 0.3.1591-standalone (d82451103 2023-07-16)
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: <omitted>,
            query: None,
            fragment: None,
        },
    },
    range: Range {
        start: Position {
            line: 72,
            character: 0,
        },
        end: Position {
            line: 184,
            character: 9,
        },
    },
}

thread 'Worker' panicked at 'called `Option::unwrap()` on a `None` value', crates\hir-expand\src\db.rs:540:51
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\std\src\panicking.rs:593
   1: core::panicking::panic_fmt
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\core\src\panicking.rs:67
   2: core::panicking::panic
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library\core\src\panicking.rs:117
   3: <hir_expand::db::MacroExpandQuery as salsa::plumbing::QueryFunction>::execute
   4: salsa::runtime::Runtime::execute_query_implementation
   5: core::ptr::drop_in_place<salsa::derived::slot::Memo<hir_expand::db::MacroArgNodeQuery>>
   6: salsa::derived::slot::Slot<Q,MP>::read
   7: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
   8: <DB as hir_expand::db::ExpandDatabase>::macro_expand
   9: <hir_expand::db::ParseMacroExpansionQuery as salsa::plumbing::QueryFunction>::execute
  10: salsa::runtime::Runtime::execute_query_implementation
  11: core::ptr::drop_in_place<salsa::derived::slot::Memo<hir_expand::db::MacroArgNodeQuery>>
  12: salsa::derived::slot::Slot<Q,MP>::read
  13: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  14: <DB as hir_expand::db::ExpandDatabase>::parse_macro_expansion
  15: salsa::runtime::Runtime::execute_query_implementation
  16: core::ptr::drop_in_place<salsa::derived::slot::Memo<hir_expand::db::MacroArgNodeQuery>>
  17: salsa::derived::slot::Slot<Q,MP>::read
  18: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  19: <DB as hir_expand::db::ExpandDatabase>::parse_macro_expansion_error
  20: hir_def::nameres::collector::DefCollector::record_resolved_import
  21: hir_def::nameres::collector::collect_defs
  22: <hir_def::db::CrateDefMapQueryQuery as salsa::plumbing::QueryFunction>::execute
  23: salsa::runtime::Runtime::execute_query_implementation
  24: core::ptr::drop_in_place<salsa::derived::slot::Memo<hir_def::db::UnionDataWithDiagnosticsQuery>>
  25: salsa::derived::slot::Slot<Q,MP>::read
  26: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  27: <DB as hir_def::db::DefDatabase>::crate_def_map_query
  28: hir_def::db::crate_def_map_wait
  29: hir::semantics::source_to_def::SourceToDefCtx::file_to_def
  30: hir::semantics::source_to_def::SourceToDefCtx::find_container
  31: hir::semantics::SemanticsImpl::analyze_impl
  32: hir::semantics::SemanticsImpl::scope
  33: ide::inlay_hints::inlay_hints
  34: std::panicking::try
  35: rust_analyzer::handlers::request::handle_inlay_hints
  36: core::ops::function::FnOnce::call_once{{vtable.shim}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 5:27:38 PM] Request textDocument/inlayHint failed.
  Message: request handler panicked: called `Option::unwrap()` on a `None` value
  Code: -32603 

rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P)
rust-analyzer version: 0.3.1591-standalone (d824511 2023-07-16)

rustc version: (eg. output of rustc -V)
rustc 1.71.0 (8ede3aae2 2023-07-12) (Windows)

relevant settings: (eg. client settings, or environment variables like CARGO, RUSTC, RUSTUP_HOME or CARGO_HOME)

@juliusl juliusl added the C-bug Category: bug label Jul 20, 2023
@Veykril
Copy link
Member

Veykril commented Jul 30, 2023

Fixed in #15357

@Veykril Veykril closed this as completed Jul 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants