Rollup merge of #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: 97b843b8b0/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`
This commit is contained in:
Guillaume Gomez 2021-08-18 19:55:04 +02:00 committed by GitHub
commit e2271cd422
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 4 deletions

View File

@ -33,7 +33,7 @@ pub trait DebugWithContext<C>: Eq + fmt::Debug {
}
write!(f, "\u{001f}-")?;
self.fmt_with(ctxt, f)
old.fmt_with(ctxt, f)
}
}

View File

@ -42,7 +42,7 @@ mod cursor;
mod direction;
mod engine;
pub mod fmt;
mod graphviz;
pub mod graphviz;
pub mod lattice;
mod visitor;

View File

@ -5,7 +5,7 @@ use rustc_span::symbol::{sym, Symbol};
pub(crate) use self::drop_flag_effects::*;
pub use self::framework::{
fmt, lattice, visit_results, Analysis, AnalysisDomain, Backward, BorrowckFlowState,
fmt, graphviz, lattice, visit_results, Analysis, AnalysisDomain, Backward, BorrowckFlowState,
BorrowckResults, Engine, Forward, GenKill, GenKillAnalysis, JoinSemiLattice, Results,
ResultsCursor, ResultsRefCursor, ResultsVisitor, SwitchIntEdgeEffects,
};

View File

@ -18,4 +18,4 @@ pub use self::alignment::is_disaligned;
pub use self::find_self_call::find_self_call;
pub use self::generic_graph::graphviz_safe_def_name;
pub use self::graphviz::write_mir_graphviz;
pub use self::pretty::{dump_enabled, dump_mir, write_mir_pretty, PassWhere};
pub use self::pretty::{dump_enabled, dump_mir, write_mir_fn, write_mir_pretty, PassWhere};