Skip to content

rustfmt duplicates Trait identifier causing syntax error #7053

Description

@matthiaskrgr

it turns out that after formatting weird_exprs from #7052 with comments, it no longer compiles.

The problem is that given a code like
trait /* 1 */ Trait /* 2 */ {}
rustfmt will turn this into trait Trait Trait which is invalid code

rustfmt --check output.rs
Diff in /tmp/fmt/2/output.rs:1:
-trait /* 1 */ Trait /* 2 */ {}
+trait Trait /* 1 */ Trait /* 2 */ {}

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-commentsArea: commentsC-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEI-invalid-codeIssue: formatting causes compile-pass code to compile-fail

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions