rust-analyzer / rowan

Apache License 2.0
704 stars 58 forks source link

Bad offset: range 0..558 offset 564 in cursor.rs #146

Closed ebadta81 closed 1 year ago

ebadta81 commented 1 year ago

Hi,

I run into this error message when trying to add tailwindcss to my leptos project, according to this comment.

Is there a missing boundary check in cursor.rs?

thread 'Worker' panicked at 'Bad offset: range 0..558 offset 564', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/rowan-0.15.10/src/cursor.rs:751:9
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: rowan::cursor::SyntaxNode::token_at_offset
   3: ide_completion::context::analysis::expand_and_analyze
   4: ide_completion::context::CompletionContext::new
   5: ide_completion::completions
   6: std::panicking::try
   7: rust_analyzer::handlers::handle_completion
   8: std::panicking::try
   9: <F as threadpool::FnBox>::call_box
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 11:34:53 AM] Request textDocument/completion failed.
  Message: request handler panicked: Bad offset: range 0..558 offset 564
  Code: -32603 
lnicola commented 1 year ago

Can you reliably trigger this crash? Anyway, you should probably file it against the rust-analyzer repo, it's not necessarily a rowan issue.

ebadta81 commented 1 year ago

unfortunately not. After VS restart, I don't have the error.

lnicola commented 1 year ago

If you remember where you were typing (I'm assuming it was in a macro call or something with a macro attribute), feel free to open an issue in the other repo.