Skip to content

VecDeque is_empty and get(0) together generate unreachable panic. #80836

Closed
@bugadani

Description

@bugadani

https://rust.godbolt.org/z/oe4q69

For some reason, the knowledge that a VecDeque is empty, is not preserved when calling get(0) (or even front) and the compiler generates panics which are unreachable.

Metadata

Metadata

Assignees

Labels

A-codegenArea: Code generationE-help-wantedCall for participation: Help is requested to fix this issue.E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-slowIssue: Problems and improvements with respect to performance of generated code.T-libsRelevant to the library team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions