Skip to content

Clippy --fix panics with index error #8734

Closed
@tvallotton

Description

@tvallotton

Summary

cargo clippy --fix causes an index error.

Reproducer

I pushed the code that causes the error to this repo, so you can reproduce it. The error was triggerd by cargo clippy --fix. Note that this does not seem to panic in stable.

thread 'main' panicked at 'slice index starts at 1 but ends at 0', library/core/src/slice/index.rs:91:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: could not compile `chess`
warning: build failed, waiting for other jobs to finish...
thread 'main' panicked at 'slice index starts at 1 but ends at 0', library/core/src/slice/index.rs:91:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: could not compile `chess`

Version

rustc 1.61.0-nightly (76d770ac2 2022-04-02)
binary: rustc
commit-hash: 76d770ac21d9521db6a92a48c7b3d5b2cc535941
commit-date: 2022-04-02
host: aarch64-apple-darwin
release: 1.61.0-nightly
LLVM version: 14.0.0

Additional Labels

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-ICEIssue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions