Skip to content

Panic when typing the names on a tuple: index out of bounds: the len is 0 but the index is 0 #16746

Closed
@ThomasMiz

Description

@ThomasMiz

When deleting characters from the name of one element in a tuple, if you delete the last one a panic will occur.

To reproduce, create a new empty project and add this to your main.rs:

fn main() {
    let (a, b) = (0, 0);
}

Then place your cursor right after the 'b' character and press backspace, making your code look like this:

fn main() {
    let (a, ) = (0, 0);
}

This panic message is printed to stderr.

rust-analyzer version: 0.4.1867-standalone (037924c 2024-03-03)
rustc version: rustc 1.78.0-nightly (516b6162a 2024-03-03)

(sidenote: I know this is the third issue about panics from me in the past 5 days, I apologize if I'm getting annoying)

Metadata

Metadata

Assignees

Labels

A-patternpattern handling related thingsC-bugCategory: bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions