Skip to content

-Zunpretty=mir-cfg generates invalid dot syntax  #66985

Closed
@osa1

Description

@osa1

Program:

fn f(arg: (u8)) {}
fn main() { f((0)) }

Build with -Zunpretty=mir-cfg:

$ /home/omer/rust/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc -Zunpretty=mir-cfg test.rs > test.dot

Generated .dot file is not valid:

$ dot -Tpng test.dot > test.png
Error: test.dot: syntax error in line 15 near '>'

File contents:

digraph __crate__ {
subgraph cluster_Mir_0_4 {
    graph [fontname="monospace"];
    node [fontname="monospace"];
    edge [fontname="monospace"];
    label=<fn main() -&gt; ()<br align="left"/>>;
    bb0__0_4 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">0</td></tr><tr><td align="left">_0 = const f(const 0u8)</td></tr></table>>];
    bb1__0_4 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">1</td></tr><tr><td align="left">return</td></tr></table>>];
    bb0__0_4 -> bb1__0_4 [label="return"];
}
subgraph cluster_Mir_0_3 {
    graph [fontname="monospace"];
    node [fontname="monospace"];
    edge [fontname="monospace"];
    label=<fn f(_1: u8) -&gt; ()<br align="left"/>debug arg => _1;<br align="left"/>>;
    bb0__0_3 [shape="none", label=<<table border="0" cellborder="1" cellspacing="0"><tr><td bgcolor="gray" align="center" colspan="1">0</td></tr><tr><td align="left">return</td></tr></table>>];
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlA-prettyArea: Pretty printing (including `-Z unpretty`)C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions