Skip to content

Rustfmt destroys extern types that have generics or rhs #4159

Closed
@dtolnay

Description

@dtolnay

Repro as of current master (2da4f63):

$ echo 'extern "Rust" { type T = crate::U; }' | cargo run --bin rustfmt
extern "Rust" {
    type T;
}

The = crate::U is silently dropped.

Similarly this test case in the compiler test suite gets destroyed.

- type A: Ord;
- type A<'a> where 'a: 'static;
- type A<T: Ord> where T: 'static;
- type A = u8;
- type A<'a: 'static, T: Ord + 'static>: Eq + PartialEq where T: 'static + Copy = Vec<u8>;
+ type A;
+ type A;
+ type A;
+ type A;
+ type A;

Relevant to me because I need this syntax for dtolnay/cxx#99.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugPanic, non-idempotency, invalid code, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions