-
Couldn't load subscription status.
- Fork 13.9k
Fix -Zunpretty=mir-cfg to render multiple items
#65459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This is only to make the generated DOT more legible.
|
r? @estebank (rust_highfive has picked a reviewer for you, use r? to override) |
c73fc1e to
3fa99f9
Compare
This comment has been minimized.
This comment has been minimized.
|
@bors r+ |
|
📌 Commit cd3e9c4 has been approved by |
|
⌛ Testing commit cd3e9c4 with merge fb1250994dbee50d5d0d4c7dec070eb7ef3849f0... |
…=estebank Fix `-Zunpretty=mir-cfg` to render multiple items `-Zunpretty=mir-cfg` outputs DOT to stdout for all items being compiled. However, it puts all of these items in separate `digraph`s, which means the result of redirecting that output to a file is not valid. Most dot renderers (I have tried `dot` and `xdot`) cannot render the output. This PR checks to see if `write_mir_graphviz` will process multiple items, and writes them each as a `subgraph` in a single, top-level `digraph`. As a result, DOT can be viewed without manually editing the output file. The output is unchanged when printing a single item (e.g.`-Zunpretty=mir-cfg=item_name`). Here's the output of `xdot` for a rust file containing three items:  The borders are a result of the nonstandard–but well-supported–[`cluster` prefix](https://graphviz.gitlab.io/_pages/doc/info/lang.html) (search for "Subgraphs and Clusters"). They will not appear if your renderer does not support this extension, but the graph will still render properly.
|
@bors retry rolled up |
Rollup of 14 pull requests Successful merges: - #65112 (Add lint and tests for unnecessary parens around types) - #65459 (Fix `-Zunpretty=mir-cfg` to render multiple items) - #65471 (Add long error explanation for E0578) - #65857 (rustdoc: Resolve module-level doc references more locally) - #65914 (Use structured suggestion for unnecessary bounds in type aliases) - #65945 (Optimize long-linker-command-line test) - #65946 (Make `promote_consts` emit the errors when required promotion fails) - #65960 (doc: reword iter module example and mention other methods) - #65963 (update submodules to rust-lang) - #65972 (Fix libunwind build: Define __LITTLE_ENDIAN__ for LE targets) - #65977 (Fix incorrect diagnostics for expected type in E0271 with an associated type) - #65995 (Add error code E0743 for "C-variadic has been used on a non-foreign function") - #65997 (Fix outdated rustdoc of Once::init_locking function) - #66005 (vxWorks: remove code related unix socket) Failed merges: r? @ghost
Fix `-Zunpretty=mir-cfg` to render multiple items `-Zunpretty=mir-cfg` outputs DOT to stdout for all items being compiled. However, it puts all of these items in separate `digraph`s, which means the result of redirecting that output to a file is not valid. Most dot renderers (I have tried `dot` and `xdot`) cannot render the output. This PR checks to see if `write_mir_graphviz` will process multiple items, and writes them each as a `subgraph` in a single, top-level `digraph`. As a result, DOT can be viewed without manually editing the output file. The output is unchanged when printing a single item (e.g.`-Zunpretty=mir-cfg=item_name`). Here's the output of `xdot` for a rust file containing three items:  The borders are a result of the nonstandard–but well-supported–[`cluster` prefix](https://graphviz.gitlab.io/_pages/doc/info/lang.html) (search for "Subgraphs and Clusters"). They will not appear if your renderer does not support this extension, but the graph will still render properly.
|
☀️ Test successful - checks-azure |
-Zunpretty=mir-cfgoutputs DOT to stdout for all items being compiled. However, it puts all of these items in separatedigraphs, which means the result of redirecting that output to a file is not valid. Most dot renderers (I have trieddotandxdot) cannot render the output.This PR checks to see if
write_mir_graphvizwill process multiple items, and writes them each as asubgraphin a single, top-leveldigraph. As a result, DOT can be viewed without manually editing the output file. The output is unchanged when printing a single item (e.g.-Zunpretty=mir-cfg=item_name).Here's the output of

xdotfor a rust file containing three items:The borders are a result of the nonstandard–but well-supported–
clusterprefix (search for "Subgraphs and Clusters"). They will not appear if your renderer does not support this extension, but the graph will still render properly.