Skip to content

Commit e2271cd

Browse files
Rollup merge of rust-lang#88129 - willcrichton:expose-graphviz-modules, r=ecstatic-morse
Fix dataflow graphviz bug, make dataflow graphviz modules public I'm working on a rustc plugin that uses the dataflow framework for MIR analysis. I've found the graphviz utilities extremely helpful for debugging. However, I had to fork the compiler to expose them since they're currently private. I would appreciate if they could be made public so I can build against a nightly instead of a custom fork. Specifically, this PR: * Makes public the `rustc_mir::dataflow::framework::graphviz` module. * Makes public the `rustc_mir::util::pretty::write_mir_fn` function. Here's a concrete example of how I'm using the graphviz module: https://github.com/willcrichton/flowistry/blob/97b843b8b06b4004fbb79b5fcfca3e33c7143bc0/src/slicing/mod.rs#L186-L203 Additionally, this PR fixes a small bug in the diff code that incorrectly shows the updated object as the old object. r? `@ecstatic-morse`
2 parents 75c6a91 + 0ce96bd commit e2271cd

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

compiler/rustc_mir/src/dataflow/framework/fmt.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub trait DebugWithContext<C>: Eq + fmt::Debug {
3333
}
3434

3535
write!(f, "\u{001f}-")?;
36-
self.fmt_with(ctxt, f)
36+
old.fmt_with(ctxt, f)
3737
}
3838
}
3939

compiler/rustc_mir/src/dataflow/framework/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ mod cursor;
4242
mod direction;
4343
mod engine;
4444
pub mod fmt;
45-
mod graphviz;
45+
pub mod graphviz;
4646
pub mod lattice;
4747
mod visitor;
4848

compiler/rustc_mir/src/dataflow/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc_span::symbol::{sym, Symbol};
55

66
pub(crate) use self::drop_flag_effects::*;
77
pub use self::framework::{
8-
fmt, lattice, visit_results, Analysis, AnalysisDomain, Backward, BorrowckFlowState,
8+
fmt, graphviz, lattice, visit_results, Analysis, AnalysisDomain, Backward, BorrowckFlowState,
99
BorrowckResults, Engine, Forward, GenKill, GenKillAnalysis, JoinSemiLattice, Results,
1010
ResultsCursor, ResultsRefCursor, ResultsVisitor, SwitchIntEdgeEffects,
1111
};

compiler/rustc_mir/src/util/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ pub use self::alignment::is_disaligned;
1818
pub use self::find_self_call::find_self_call;
1919
pub use self::generic_graph::graphviz_safe_def_name;
2020
pub use self::graphviz::write_mir_graphviz;
21-
pub use self::pretty::{dump_enabled, dump_mir, write_mir_pretty, PassWhere};
21+
pub use self::pretty::{dump_enabled, dump_mir, write_mir_fn, write_mir_pretty, PassWhere};

0 commit comments

Comments
 (0)