Skip to content

rusfmt hangs when using cfg-if macro #4442

@gliderkite

Description

@gliderkite

rusfmt hangs when using cfg-if macro

To reproduce run rustftm main.rs, where:

// main.rs
cfg_if::cfg_if! {
    if #[cfg(not(feature = "client"))] {
        if #[cfg(feature = "server")] {
        }
    }
}
rustfmt -V
rustfmt 1.4.18-stable (8157a3f 2020-07-15)

From the logs RUST_LOG=trace rustftm main.rs I can see it just keeps logging:

[2020-09-29T14:17:39Z DEBUG rustc_ap_rustc_parse::parser::attr] parse_outer_attributes: self.token=Token { kind: Ident("if", false), span: Span { lo: BytePos(67), hi: BytePos(69), ctxt: #0 } }
[2020-09-29T14:17:39Z DEBUG rustc_ap_rustc_parse::parser::attr] parse_outer_attributes: self.token=Token { kind: Ident("if", false), span: Span { lo: BytePos(67), hi: BytePos(69), ctxt: #0 } }
[2020-09-29T14:17:39Z DEBUG rustc_ap_rustc_parse::parser::attr] parse_outer_attributes: self.token=Token { kind: Ident("if", false), span: Span { lo: BytePos(67), hi: BytePos(69), ctxt: #0 } }

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