rust-analyzer version: 0.3.2896
rustc version: rustc 1.95.0 (59807616e 2026-04-14)
editor: both VSCode and Zed
OS / Distro: Ubuntu 24.04 (WSL2) and Ubuntu 25.10
repository link: libpnet
Hi, I encountered an rust-analyzer panic when trying to go to any pnet::packet::*::*Packet packet abstraction struct implementation. Example:
// ...
let ethernet_frame = EthernetPacket::new(&packet).unwrap();
if ethernet_frame.get_ethertype() == EtherTypes::Ipv4 { ... }
when I try to peek the get_ethertype definition I get the following error:
thread 'Worker1' (13429) panicked at /github/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/line-index-0.1.2/src/lib.rs:111:35:
invalid offset
stack backtrace:
0: __rustc::rust_begin_unwind
1: core::panicking::panic_fmt
2: core::option::expect_failed
3: line_index::LineIndex::line_col
4: rust_analyzer::lsp::to_proto::position
5: rust_analyzer::lsp::to_proto::location_info
6: rust_analyzer::lsp::to_proto::location_link
7: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::try_fold
8: <core::iter::adapters::GenericShunt<I,R> as core::iter::traits::iterator::Iterator>::next
9: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
10: core::iter::adapters::try_process
11: rust_analyzer::lsp::to_proto::goto_definition_response
12: rust_analyzer::handlers::request::handle_goto_definition
13: core::ops::function::FnOnce::call_once{{vtable.shim}}
14: <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.
additional context:
0:
version: 0.3.2896-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: ".../src/main.rs",
query: None,
fragment: None,
},
},
position: Position {
line: 105,
character: 26,
},
},
work_done_progress_params: WorkDoneProgressParams {
work_done_token: None,
},
partial_result_params: PartialResultParams {
partial_result_token: None,
},
}
[Error - 6:47:32 PM] Request textDocument/definition failed.
Message: request handler panicked: invalid offset
Code: -32603
Seems like the custom derive(Packet) messes with rust-analyzer lsp
rust-analyzer version: 0.3.2896
rustc version: rustc 1.95.0 (59807616e 2026-04-14)
editor: both VSCode and Zed
OS / Distro: Ubuntu 24.04 (WSL2) and Ubuntu 25.10
repository link: libpnet
Hi, I encountered an rust-analyzer panic when trying to go to any
pnet::packet::*::*Packetpacket abstraction struct implementation. Example:when I try to peek the
get_ethertypedefinition I get the following error:Seems like the custom
derive(Packet)messes with rust-analyzer lsp