Skip to content

Panic due to auto-generated file diagnostics being incorrectly attributed to source files #15803

Closed as not planned
@CeleritasCelery

Description

@CeleritasCelery

I have been struggling to find a way to reproduce this issue, and it has been plaguing me for a few weeks. While editing rust-analyzer will panic "randomly". It happens multiple times a day. I can't seem to find a good way to make the issue reproducible, but here is the backtrace below. I have uninstalled and reinstalled rust-analyzer multiple times, and used cargo clean to clean up the cache, but nothing seems to fix it.

Panic context:
> fetch_native_diagnostics

thread 'Worker' panicked at 'invalid offset', /Users/brew/Library/Caches/Homebrew/cargo_cache/registry/src/index.crates.io-6f17d22bba15001f/line-index-0.1.0-pre.1/src/lib.rs:148:35
stack backtrace:
   0:        0x10332c8d4 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h782e083efa4700b5
   1:        0x103342910 - core::fmt::write::hdcd44492977669f9
   2:        0x103319590 - std::io::Write::write_fmt::h7f32f27b72970ad5
   3:        0x10332c6dc - std::sys_common::backtrace::print::h6868989d298a5d93
   4:        0x10331a268 - std::panicking::default_hook::{{closure}}::he58f0ab435f26824
   5:        0x103319fd4 - std::panicking::default_hook::h0f0ccb5a1a0c4466
   6:        0x1032acbc4 - std::thread::local::LocalKey<T>::with::h8a04591509e74c6c
   7:        0x10331a894 - std::panicking::rust_panic_with_hook::hf392a622566eb9b6
   8:        0x10332d23c - std::panicking::begin_panic_handler::{{closure}}::h07b7cf65243520e5
   9:        0x10332c9c8 - std::sys_common::backtrace::__rust_end_short_backtrace::h4972088065ba8a0d
  10:        0x10331a410 - _rust_begin_unwind
  11:        0x10340c2ec - core::panicking::panic_fmt::hc67fbbe16e2d8abd
  12:        0x10340c208 - core::option::expect_failed::h287fa49622669d1e
  13:        0x102b92d94 - line_index::LineIndex::line_col::h9da28fa25839dd78
  14:        0x102542d60 - rust_analyzer::lsp::to_proto::range::h6353167a0a495419
  15:        0x10259a4c8 - rust_analyzer::diagnostics::fetch_native_diagnostics::{{closure}}::{{closure}}::hecf8a81f0f825fad
  16:        0x1025928fc - <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold::h1c39745215b5ec36
  17:        0x1023decc8 - alloc::vec::in_place_collect::<impl alloc::vec::spec_from_iter::SpecFromIter<T,I> for alloc::vec::Vec<T>>::from_iter::hab9256ef809ab5d9
  18:        0x1024c3c74 - core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut::h275bc8a58b943c81
  19:        0x1023de7e8 - alloc::vec::in_place_collect::<impl alloc::vec::spec_from_iter::SpecFromIter<T,I> for alloc::vec::Vec<T>>::from_iter::ha439e318cacb3078
  20:        0x10254e588 - rust_analyzer::diagnostics::fetch_native_diagnostics::hb716dbe6f0d7efb0
  21:        0x1024427d4 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h4f72f34972931faf
  22:        0x1032b3860 - std::sys_common::backtrace::__rust_begin_short_backtrace::h41920f26e3f6a8de
  23:        0x1032b4c44 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hc0cb8167e3f64f0d
  24:        0x103310640 - std::sys::unix::thread::Thread::new::thread_start::hfdb57e802740a0f8
  25:        0x1909bffa8 - __pthread_joiner_wake
thread 'LspServer' panicked at 'called `Result::unwrap()` on an `Err` value: "SendError(..)"', /private/tmp/rust-analyzer-20231023-5820-ffnuam/crates/stdx/src/thread/pool.rs:86:35
stack backtrace:
   0:        0x10332c8d4 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h782e083efa4700b5
   1:        0x103342910 - core::fmt::write::hdcd44492977669f9
   2:        0x103319590 - std::io::Write::write_fmt::h7f32f27b72970ad5
   3:        0x10332c6dc - std::sys_common::backtrace::print::h6868989d298a5d93
   4:        0x10331a268 - std::panicking::default_hook::{{closure}}::he58f0ab435f26824
   5:        0x103319fd4 - std::panicking::default_hook::h0f0ccb5a1a0c4466
   6:        0x1032acbc4 - std::thread::local::LocalKey<T>::with::h8a04591509e74c6c
   7:        0x10331a894 - std::panicking::rust_panic_with_hook::hf392a622566eb9b6
   8:        0x10332d23c - std::panicking::begin_panic_handler::{{closure}}::h07b7cf65243520e5
   9:        0x10332c9c8 - std::sys_common::backtrace::__rust_end_short_backtrace::h4972088065ba8a0d
  10:        0x10331a410 - _rust_begin_unwind
  11:        0x10340c2ec - core::panicking::panic_fmt::hc67fbbe16e2d8abd
  12:        0x10340c2b8 - core::result::unwrap_failed::had2324ff96cef11b
  13:        0x102450e40 - stdx::thread::pool::Pool::spawn::h676b672002511263
  14:        0x102537588 - rust_analyzer::main_loop::<impl rust_analyzer::global_state::GlobalState>::run::h85cccb15a6f57591
  15:        0x1025a1270 - rust_analyzer::main_loop::main_loop::hced9114fa7d7bda5
  16:        0x102370d6c - rust_analyzer::run_server::h77f7ea5391c0891c
  17:        0x1023a37b0 - std::sys_common::backtrace::__rust_begin_short_backtrace::h6f9b411514b7c434
  18:        0x102396b94 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h139b1f5b35fd3948
  19:        0x103310640 - std::sys::unix::thread::Thread::new::thread_start::hfdb57e802740a0f8
  20:        0x1909bffa8 - __pthread_joiner_wake
thread '<unnamed>' panicked at 'receiver was dropped, failed to send a message: "SendError(..)"', /Users/brew/Library/Caches/Homebrew/cargo_cache/registry/src/index.crates.io-6f17d22bba15001f/lsp-server-0.7.4/src/stdio.rs:29:37
stack backtrace:
   0:        0x10332c8d4 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h782e083efa4700b5
   1:        0x103342910 - core::fmt::write::hdcd44492977669f9
   2:        0x103319590 - std::io::Write::write_fmt::h7f32f27b72970ad5
   3:        0x10332c6dc - std::sys_common::backtrace::print::h6868989d298a5d93
   4:        0x10331a268 - std::panicking::default_hook::{{closure}}::he58f0ab435f26824
   5:        0x103319fd4 - std::panicking::default_hook::h0f0ccb5a1a0c4466
   6:        0x1032acbc4 - std::thread::local::LocalKey<T>::with::h8a04591509e74c6c
   7:        0x10331a894 - std::panicking::rust_panic_with_hook::hf392a622566eb9b6
   8:        0x10332d23c - std::panicking::begin_panic_handler::{{closure}}::h07b7cf65243520e5
   9:        0x10332c9c8 - std::sys_common::backtrace::__rust_end_short_backtrace::h4972088065ba8a0d
  10:        0x10331a410 - _rust_begin_unwind
  11:        0x10340c2ec - core::panicking::panic_fmt::hc67fbbe16e2d8abd
  12:        0x10340c2b8 - core::result::unwrap_failed::had2324ff96cef11b
  13:        0x1032cdfc8 - std::sys_common::backtrace::__rust_begin_short_backtrace::hffb21713b0df89b6
  14:        0x1032beddc - core::ops::function::FnOnce::call_once{{vtable.shim}}::h9ac33306162a5bbb
  15:        0x103310640 - std::sys::unix::thread::Thread::new::thread_start::hfdb57e802740a0f8
  16:        0x1909bffa8 - __pthread_joiner_wake
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Any { .. }', /Users/brew/Library/Caches/Homebrew/cargo_cache/registry/src/index.crates.io-6f17d22bba15001f/jod-thread-0.1.2/src/lib.rs:33:22
stack backtrace:
   0:        0x10332c8d4 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h782e083efa4700b5
   1:        0x103342910 - core::fmt::write::hdcd44492977669f9
   2:        0x103319590 - std::io::Write::write_fmt::h7f32f27b72970ad5
   3:        0x10332c6dc - std::sys_common::backtrace::print::h6868989d298a5d93
   4:        0x10331a268 - std::panicking::default_hook::{{closure}}::he58f0ab435f26824
   5:        0x103319fd4 - std::panicking::default_hook::h0f0ccb5a1a0c4466
   6:        0x1032acbc4 - std::thread::local::LocalKey<T>::with::h8a04591509e74c6c
   7:        0x10331a894 - std::panicking::rust_panic_with_hook::hf392a622566eb9b6
   8:        0x10332d23c - std::panicking::begin_panic_handler::{{closure}}::h07b7cf65243520e5
   9:        0x10332c9c8 - std::sys_common::backtrace::__rust_end_short_backtrace::h4972088065ba8a0d
  10:        0x10331a410 - _rust_begin_unwind
  11:        0x10340c2ec - core::panicking::panic_fmt::hc67fbbe16e2d8abd
  12:        0x10340c2b8 - core::result::unwrap_failed::had2324ff96cef11b
  13:        0x1023a3c38 - jod_thread::JoinHandle<T>::join::h27d24a5684560a1c
  14:        0x1023a3b30 - rust_analyzer::with_extra_thread::hb6ebbb3b917cb384
  15:        0x10236fd1c - rust_analyzer::main::h63ad5db90324360b
  16:        0x1023a37c4 - std::sys_common::backtrace::__rust_begin_short_backtrace::hd3d0d914a4d9e9c3
  17:        0x1023961fc - std::rt::lang_start::{{closure}}::h141fca22b63bfc08
  18:        0x103318aa0 - std::rt::lang_start_internal::h3e84e2f86cd60d8c
  19:        0x102371558 - _main

Process rust-analyzer stderr finished

rust-analyzer version: rust-analyzer 0.0.0 (1087295 2023-10-22)

rustc version: rustc 1.74.0-beta.1 (b5c050feb 2023-10-03)

relevant settings: default settings

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsdiagnostics / error reportingC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions