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

Request textDocument/inlayHint failed: invalid offset #18881

Open
Systemcluster opened this issue Jan 8, 2025 · 3 comments
Open

Request textDocument/inlayHint failed: invalid offset #18881

Systemcluster opened this issue Jan 8, 2025 · 3 comments
Labels
A-inlay-hints inlay/inline hints A-macro macro expansion C-bug Category: bug I-panic

Comments

@Systemcluster
Copy link

The error notification Request textDocument/inlayHint failed appears every time the below source is focused or modified.

use tracing::info;

pub fn main() {
    info!("Hello, world!");
}

Removing the call to info! stops the error.

rust-analyzer version: 0.4.2252-standalone (cd12ef8547 2025-01-07)

rustc version: rustc 1.86.0-nightly (243d2ca4d 2025-01-06)

editor or extension: VSCode extension 0.3.2253 (and current pre-release)

Panic context:
> 
version: 0.4.2252-standalone (cd12ef8547 2025-01-07)
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: "/d%3A/Development/XXX/crates/XXX/main.rs",
            query: None,
            fragment: None,
        },
    },
    range: Range {
        start: Position {
            line: 0,
            character: 0,
        },
        end: Position {
            line: 5,
            character: 0,
        },
    },
}

thread 'Worker' panicked at C:\Users\runneradmin\.cargo\registry\src\index.crates.io-6f17d22bba15001f\line-index-0.1.2\src/lib.rs:111:35:
invalid offset
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf\library/std\src\panicking.rs:665
   1: core::panicking::panic_fmt
             at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf\library/core\src\panicking.rs:74
   2: core::panicking::panic_display
             at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf\library/core\src\panicking.rs:264
   3: core::option::expect_failed
             at /rustc/90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf\library/core\src\option.rs:2021
   4: rust_analyzer::lsp::to_proto::inlay_hint
   5: <alloc::vec::into_iter::IntoIter<T,A> as core::iter::traits::iterator::Iterator>::try_fold
   6: alloc::vec::in_place_collect::<impl alloc::vec::spec_from_iter::SpecFromIter<T,I> for alloc::vec::Vec<T>>::from_iter
   7: core::iter::adapters::try_process
   8: rust_analyzer::handlers::request::handle_inlay_hints
   9: core::ops::function::FnOnce::call_once{{vtable.shim}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 5:09:58 AM] Request textDocument/inlayHint failed.
  Message: request handler panicked: invalid offset
  Code: -32603 
@Systemcluster Systemcluster added the C-bug Category: bug label Jan 8, 2025
@Veykril
Copy link
Member

Veykril commented Jan 8, 2025

which inlay hints do you have enabled? (or asked differently, have you changed any of the inlay hint defaults?)

@Veykril Veykril added A-inlay-hints inlay/inline hints I-panic labels Jan 8, 2025
@Systemcluster
Copy link
Author

I narrowed it down to rust-analyzer.inlayHints.implicitDrops.enable.

@Veykril
Copy link
Member

Veykril commented Jan 8, 2025

Oh that will help a lot, thanks! So those hints are probably upmapping out of macros incorrectly

@Veykril Veykril added the A-macro macro expansion label Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-inlay-hints inlay/inline hints A-macro macro expansion C-bug Category: bug I-panic
Projects
None yet
Development

No branches or pull requests

2 participants