Skip to content

"Bad offset" panic when searching for references #10201

@jonas-schievink

Description

@jonas-schievink

Ran into this panic when invoking "find all references" on the last trap_unreachable token in this code: https://github.com/rust-lang/rust/blob/7bf0736e130e2203c58654f7353dbf9575e49d5c/compiler/rustc_codegen_llvm/src/back/write.rs#L181

thread '<unnamed>' panicked at 'Bad offset: range 0..43636 offset 46384', /home/jonas/.cargo/registry/src/github.com-1ecc6299db9ec823/rowan-0.13.2/src/cursor.rs:757:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:515:5
   1: std::panicking::begin_panic_fmt
             at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/std/src/panicking.rs:457:5
   2: rowan::cursor::SyntaxNode::token_at_offset
   3: syntax::algo::ancestors_at_offset
   4: ide::references::decl_access
   5: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once
   6: <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter
   7: ide::references::find_all_refs
   8: std::panicking::try
   9: ide::Analysis::find_all_refs
  10: rust_analyzer::handlers::handle_references

Metadata

Metadata

Assignees

No one assigned

    Labels

    Broken WindowBugs / technical debt to be addressed immediately

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions