Skip to content

cargo fix: Panic with "Cannot replace slice of data that was already replaced" #13030

Open

Description

I have a PR to add a new suggestion to rustc: rust-lang/rust#88672. It uses Diagnostic::multipart_suggestions since there are multiple ways for the user to change their code. These multiple suggestions are exclusive since they modify the same code.

However, rustfix is panicking when I use run-rustfix in a test: "Cannot replace slice of data that was already replaced".

The relevant code in my PR is here: https://github.com/rust-lang/rust/blob/6a89e97ab14cd4c6be70b47fd139c87fd90150b7/compiler/rustc_parse/src/parser/diagnostics.rs#L226-L234
and here: https://github.com/rust-lang/rust/blob/6a89e97ab14cd4c6be70b47fd139c87fd90150b7/compiler/rustc_parse/src/parser/diagnostics.rs#L1272-L1277

I'm not sure how to fix this problem in rustfix, but I'm willing to try with some mentoring :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bugCommand-fixS-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or review

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions