Skip to content

Panic at 'index out of bounds: the len is 2 but the index is 2' #10179

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

Closed
WaffleLapkin opened this issue Sep 7, 2021 · 6 comments · Fixed by #10212
Closed

Panic at 'index out of bounds: the len is 2 but the index is 2' #10179

WaffleLapkin opened this issue Sep 7, 2021 · 6 comments · Fixed by #10212
Assignees
Labels
A-ty type system / type inference / traits / method resolution

Comments

@WaffleLapkin
Copy link
Member

When editing a pacticular project I keep getting this panic message from RA (b73b321 2021-09-06 stable, VS Code, Arch Linux). Here is the error output in VS code: <gist>.

Repro:

; git clone https://github.com/WaffleLapkin/sudoku-solve.git && cd sudoku-solve && git switch --detach d57e314f70b55040698ffb60ed84e47d071c7650
; rust-analyzer --version
rust-analyzer b73b32147 2021-09-06 dev
; rust-analyzer analysis-stats .
Database loaded:     965.22ms, 68minstr (metadata 640.72ms, 1141kinstr; build 280.63ms, 633kinstr)
  crates: 1, mods: 1, decls: 17, fns: 8
Item Collection:     3.20s, 21ginstr
4/8 50% processing: newthread 'main' panicked at 'index out of bounds: the len is 2 but the index is 2', /build/.cargo/registry/src/github.com-1ecc6299db9ec823/chalk-ir-0.70.0/src/lib.rs:2752:10
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
@jonas-schievink jonas-schievink added the A-ty type system / type inference / traits / method resolution label Sep 7, 2021
@maoe
Copy link

maoe commented Sep 8, 2021

I saw a similar issue with our in-house codebase. The error message looked identical apart from the len/index values (1/1 for me). FWIW I was able to work around the issue by downgrading the rust-analyzer vscode extension to v0.2.710. All newer versions seem to suffer from this issue.

@flodiebold
Copy link
Member

Likely a duplicate of #10046

@flodiebold flodiebold self-assigned this Sep 8, 2021
@lnicola
Copy link
Member

lnicola commented Sep 10, 2021

Lazy minimization:

use bitvec::array::BitArray;

fn main() {
    let mut holes = BitArray::default();
    holes.set(0, true);
}

@flodiebold
Copy link
Member

Seems like the same case as mine then.

flodiebold added a commit to flodiebold/rust-analyzer that referenced this issue Sep 12, 2021
Should fix rust-lang#10090, rust-lang#10046, rust-lang#10179.
This is only a workaround, but the proper fix requires some bigger
refactoring (also related to fixing rust-lang#10058), and this at least prevents
the crash.
@bors bors bot closed this as completed in 80552d4 Sep 12, 2021
@bors bors bot closed this as completed in #10212 Sep 12, 2021
@flodiebold
Copy link
Member

Should be fixed with the next release.

@WaffleLapkin
Copy link
Member Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ty type system / type inference / traits / method resolution
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants