Skip to content

Fails to format certain macro calls after encountering one with invalid syntax #3757

Open
@topecongiro

Description

@topecongiro

If rustfmt encounters a macro call with invalid syntax, it fails to format some macro calls that comes after.

E.g., in the following code snippet,

foo!(|x = y|);

f!(match a {
    _ => (  ),
});

g!( 1, 2, 3 );

the argument of foo! is not valid syntax of rust. It fails to format f! that comes after, but successfully formats g!.

Interestingly, if g! comes before f!, then rustfmt is able to format both f! and g!.

foo!(|x = y|);

g!( 1, 2, 3 );

f!(match a {
    _ => (  ),
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions