From a4e94ec9b81c4d4c4c30103952804538e2a96acc Mon Sep 17 00:00:00 2001 From: Vishnunarayan K I Date: Tue, 27 Oct 2020 20:14:38 +0530 Subject: [PATCH] update gsgdt --- Cargo.lock | 4 ++-- compiler/rustc_mir/Cargo.toml | 2 +- compiler/rustc_mir/src/util/generic_graph.rs | 7 +++---- compiler/rustc_mir/src/util/graphviz.rs | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fb52f4201c0..e4b566e6690 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1342,9 +1342,9 @@ dependencies = [ [[package]] name = "gsgdt" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cb4a3313cdc3c65906272ddd8987c7291ff6df4b5c9997c1232b6acd1ceab24" +checksum = "a0d876ce7262df96262a2a19531da6ff9a86048224d49580a585fc5c04617825" dependencies = [ "serde", ] diff --git a/compiler/rustc_mir/Cargo.toml b/compiler/rustc_mir/Cargo.toml index 28ba089d062..b2af26575f1 100644 --- a/compiler/rustc_mir/Cargo.toml +++ b/compiler/rustc_mir/Cargo.toml @@ -10,7 +10,7 @@ doctest = false [dependencies] either = "1.5.0" rustc_graphviz = { path = "../rustc_graphviz" } -gsgdt = "0.1.1" +gsgdt = "0.1.2" itertools = "0.9" tracing = "0.1" polonius-engine = "0.12.0" diff --git a/compiler/rustc_mir/src/util/generic_graph.rs b/compiler/rustc_mir/src/util/generic_graph.rs index df9f94016c8..acaca435aa1 100644 --- a/compiler/rustc_mir/src/util/generic_graph.rs +++ b/compiler/rustc_mir/src/util/generic_graph.rs @@ -1,13 +1,12 @@ -use gsgdt::{Edge, Graph, GraphKind, Node, NodeStyle}; +use gsgdt::{Edge, Graph, Node, NodeStyle}; use rustc_hir::def_id::DefId; use rustc_index::vec::Idx; use rustc_middle::mir::*; use rustc_middle::ty::TyCtxt; /// Convert an MIR function into a gsgdt Graph -pub fn mir_fn_to_generic_graph<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'_>, subgraph: bool) -> Graph { +pub fn mir_fn_to_generic_graph<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'_>) -> Graph { let def_id = body.source.def_id(); - let kind = if subgraph { GraphKind::Subgraph } else { GraphKind::Digraph }; let def_name = graphviz_safe_def_name(def_id); let graph_name = format!("Mir_{}", def_name); let dark_mode = tcx.sess.opts.debugging_opts.graphviz_dark_mode; @@ -33,7 +32,7 @@ pub fn mir_fn_to_generic_graph<'tcx>(tcx: TyCtxt<'tcx>, body: &Body<'_>, subgrap } } - Graph::new(graph_name, kind, nodes, edges) + Graph::new(graph_name, nodes, edges) } fn bb_to_graph_node(block: BasicBlock, body: &Body<'_>, dark_mode: bool) -> Node { diff --git a/compiler/rustc_mir/src/util/graphviz.rs b/compiler/rustc_mir/src/util/graphviz.rs index 8060eaab874..d81759267b2 100644 --- a/compiler/rustc_mir/src/util/graphviz.rs +++ b/compiler/rustc_mir/src/util/graphviz.rs @@ -60,14 +60,14 @@ where let mut label = String::from(""); // FIXME: remove this unwrap write_graph_label(tcx, body, &mut label).unwrap(); - let g = mir_fn_to_generic_graph(tcx, body, subgraph); + let g = mir_fn_to_generic_graph(tcx, body); let settings = GraphvizSettings { graph_attrs: Some(graph_attrs.join(" ")), node_attrs: Some(content_attrs.join(" ")), edge_attrs: Some(content_attrs.join(" ")), graph_label: Some(label), }; - g.to_dot(w, &settings) + g.to_dot(w, &settings, subgraph) } /// Write the graphviz DOT label for the overall graph. This is essentially a block of text that