diff --git a/Cargo.lock b/Cargo.lock index 7cd07e3847282..bdf77d3a44a45 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3670,6 +3670,7 @@ dependencies = [ "rustc_lexer", "rustc_middle", "rustc_mir_dataflow", + "rustc_mir_pretty", "rustc_serialize", "rustc_session", "rustc_span", @@ -3782,6 +3783,7 @@ dependencies = [ "rustc_macros", "rustc_middle", "rustc_mir_dataflow", + "rustc_mir_pretty", "rustc_query_system", "rustc_session", "rustc_span", @@ -3839,6 +3841,7 @@ dependencies = [ "rustc_lint", "rustc_metadata", "rustc_middle", + "rustc_mir_pretty", "rustc_parse", "rustc_plugin_impl", "rustc_save_analysis", @@ -4132,8 +4135,6 @@ version = "0.0.0" dependencies = [ "bitflags", "chalk-ir", - "either", - "gsgdt", "polonius-engine", "rand 0.8.4", "rand_xoshiro 0.6.0", @@ -4146,7 +4147,6 @@ dependencies = [ "rustc_data_structures", "rustc_errors", "rustc_feature", - "rustc_graphviz", "rustc_hir", "rustc_index", "rustc_macros", @@ -4195,6 +4195,7 @@ dependencies = [ "rustc_hir", "rustc_index", "rustc_middle", + "rustc_mir_pretty", "rustc_serialize", "rustc_session", "rustc_span", @@ -4203,6 +4204,23 @@ dependencies = [ "tracing", ] +[[package]] +name = "rustc_mir_pretty" +version = "0.0.0" +dependencies = [ + "either", + "gsgdt", + "rustc_data_structures", + "rustc_graphviz", + "rustc_hir", + "rustc_index", + "rustc_middle", + "rustc_session", + "rustc_span", + "rustc_target", + "tracing", +] + [[package]] name = "rustc_mir_transform" version = "0.0.0" @@ -4218,6 +4236,7 @@ dependencies = [ "rustc_index", "rustc_middle", "rustc_mir_dataflow", + "rustc_mir_pretty", "rustc_query_system", "rustc_serialize", "rustc_session", diff --git a/compiler/rustc_borrowck/Cargo.toml b/compiler/rustc_borrowck/Cargo.toml index 75e9c69af4e5c..027c5c561c0cb 100644 --- a/compiler/rustc_borrowck/Cargo.toml +++ b/compiler/rustc_borrowck/Cargo.toml @@ -22,6 +22,7 @@ rustc_lexer = { path = "../rustc_lexer" } rustc_middle = { path = "../rustc_middle" } rustc_const_eval = { path = "../rustc_const_eval" } rustc_mir_dataflow = { path = "../rustc_mir_dataflow" } +rustc_mir_pretty = { path = "../rustc_mir_pretty" } rustc_serialize = { path = "../rustc_serialize" } rustc_session = { path = "../rustc_session" } rustc_target = { path = "../rustc_target" } diff --git a/compiler/rustc_borrowck/src/nll.rs b/compiler/rustc_borrowck/src/nll.rs index 6ffab16577908..e8341e28cb089 100644 --- a/compiler/rustc_borrowck/src/nll.rs +++ b/compiler/rustc_borrowck/src/nll.rs @@ -4,12 +4,12 @@ use rustc_data_structures::vec_map::VecMap; use rustc_errors::Diagnostic; use rustc_index::vec::IndexVec; use rustc_infer::infer::InferCtxt; -use rustc_middle::mir::{create_dump_file, dump_enabled, dump_mir, PassWhere}; use rustc_middle::mir::{ BasicBlock, Body, ClosureOutlivesSubject, ClosureRegionRequirements, LocalKind, Location, Promoted, }; use rustc_middle::ty::{self, OpaqueTypeKey, RegionKind, RegionVid, Ty}; +use rustc_mir_pretty::{create_dump_file, dump_enabled, dump_mir, PassWhere}; use rustc_span::symbol::sym; use std::env; use std::fmt::Debug; diff --git a/compiler/rustc_codegen_cranelift/src/base.rs b/compiler/rustc_codegen_cranelift/src/base.rs index 1b30edd293862..5b81e04aaee7c 100644 --- a/compiler/rustc_codegen_cranelift/src/base.rs +++ b/compiler/rustc_codegen_cranelift/src/base.rs @@ -22,7 +22,7 @@ pub(crate) fn codegen_fn<'tcx>( let mir = tcx.instance_mir(instance.def); let _mir_guard = crate::PrintOnPanic(|| { let mut buf = Vec::new(); - rustc_middle::mir::write_mir_pretty(tcx, Some(instance.def_id()), &mut buf).unwrap(); + rustc_mir_pretty::write_mir_pretty(tcx, Some(instance.def_id()), &mut buf).unwrap(); String::from_utf8_lossy(&buf).into_owned() }); diff --git a/compiler/rustc_codegen_cranelift/src/lib.rs b/compiler/rustc_codegen_cranelift/src/lib.rs index beb97edf09e89..7ab85a099a5de 100644 --- a/compiler/rustc_codegen_cranelift/src/lib.rs +++ b/compiler/rustc_codegen_cranelift/src/lib.rs @@ -17,6 +17,7 @@ extern crate rustc_incremental; extern crate rustc_index; extern crate rustc_interface; extern crate rustc_metadata; +extern crate rustc_mir_pretty; extern crate rustc_session; extern crate rustc_span; extern crate rustc_target; diff --git a/compiler/rustc_const_eval/Cargo.toml b/compiler/rustc_const_eval/Cargo.toml index 4ed908a383332..cded3ba3a91d6 100644 --- a/compiler/rustc_const_eval/Cargo.toml +++ b/compiler/rustc_const_eval/Cargo.toml @@ -19,6 +19,7 @@ rustc_infer = { path = "../rustc_infer" } rustc_macros = { path = "../rustc_macros" } rustc_middle = { path = "../rustc_middle" } rustc_mir_dataflow = { path = "../rustc_mir_dataflow" } +rustc_mir_pretty = { path = "../rustc_mir_pretty" } rustc_query_system = { path = "../rustc_query_system" } rustc_session = { path = "../rustc_session" } rustc_target = { path = "../rustc_target" } diff --git a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs index 6d3a89c0a8a5b..d5fbf99b1e173 100644 --- a/compiler/rustc_const_eval/src/const_eval/eval_queries.rs +++ b/compiler/rustc_const_eval/src/const_eval/eval_queries.rs @@ -10,11 +10,11 @@ use rustc_errors::ErrorReported; use rustc_hir::def::DefKind; use rustc_middle::mir; use rustc_middle::mir::interpret::ErrorHandled; -use rustc_middle::mir::pretty::display_allocation; use rustc_middle::traits::Reveal; use rustc_middle::ty::layout::LayoutOf; use rustc_middle::ty::print::with_no_trimmed_paths; use rustc_middle::ty::{self, subst::Subst, TyCtxt}; +use rustc_mir_pretty::display_allocation; use rustc_span::source_map::Span; use rustc_target::abi::Abi; use std::borrow::Cow; diff --git a/compiler/rustc_const_eval/src/interpret/memory.rs b/compiler/rustc_const_eval/src/interpret/memory.rs index b8b6ff93753f0..6627546e0ff71 100644 --- a/compiler/rustc_const_eval/src/interpret/memory.rs +++ b/compiler/rustc_const_eval/src/interpret/memory.rs @@ -15,8 +15,8 @@ use std::ptr; use rustc_ast::Mutability; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; -use rustc_middle::mir::display_allocation; use rustc_middle::ty::{Instance, ParamEnv, TyCtxt}; +use rustc_mir_pretty::display_allocation; use rustc_target::abi::{Align, HasDataLayout, Size, TargetDataLayout}; use super::{ diff --git a/compiler/rustc_driver/Cargo.toml b/compiler/rustc_driver/Cargo.toml index ce3a3f5a3a212..cc7f908d24e25 100644 --- a/compiler/rustc_driver/Cargo.toml +++ b/compiler/rustc_driver/Cargo.toml @@ -22,6 +22,7 @@ rustc_feature = { path = "../rustc_feature" } rustc_hir = { path = "../rustc_hir" } rustc_hir_pretty = { path = "../rustc_hir_pretty" } rustc_metadata = { path = "../rustc_metadata" } +rustc_mir_pretty = { path = "../rustc_mir_pretty" } rustc_const_eval = { path = "../rustc_const_eval" } rustc_parse = { path = "../rustc_parse" } rustc_plugin_impl = { path = "../rustc_plugin_impl" } diff --git a/compiler/rustc_driver/src/pretty.rs b/compiler/rustc_driver/src/pretty.rs index 2e9050dd672e1..008715086fdf0 100644 --- a/compiler/rustc_driver/src/pretty.rs +++ b/compiler/rustc_driver/src/pretty.rs @@ -6,8 +6,8 @@ use rustc_errors::ErrorReported; use rustc_hir as hir; use rustc_hir_pretty as pprust_hir; use rustc_middle::hir::map as hir_map; -use rustc_middle::mir::{write_mir_graphviz, write_mir_pretty}; use rustc_middle::ty::{self, TyCtxt}; +use rustc_mir_pretty::{write_mir_graphviz, write_mir_pretty}; use rustc_session::config::{Input, PpAstTreeMode, PpHirMode, PpMode, PpSourceMode}; use rustc_session::Session; use rustc_span::symbol::Ident; diff --git a/compiler/rustc_middle/Cargo.toml b/compiler/rustc_middle/Cargo.toml index daeccde6024e6..735f1cdd3a7c3 100644 --- a/compiler/rustc_middle/Cargo.toml +++ b/compiler/rustc_middle/Cargo.toml @@ -9,8 +9,6 @@ doctest = false [dependencies] rustc_arena = { path = "../rustc_arena" } bitflags = "1.2.1" -either = "1.5.0" -gsgdt = "0.1.2" tracing = "0.1" rustc-rayon = "0.3.1" rustc-rayon-core = "0.3.1" @@ -24,7 +22,6 @@ rustc_macros = { path = "../rustc_macros" } rustc_data_structures = { path = "../rustc_data_structures" } rustc_query_system = { path = "../rustc_query_system" } rustc_errors = { path = "../rustc_errors" } -rustc_graphviz = { path = "../rustc_graphviz" } rustc_index = { path = "../rustc_index" } rustc_serialize = { path = "../rustc_serialize" } rustc_ast = { path = "../rustc_ast" } diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index 253ac266bedaa..1ed102ba87cde 100644 --- a/compiler/rustc_middle/src/mir/mod.rs +++ b/compiler/rustc_middle/src/mir/mod.rs @@ -41,17 +41,12 @@ use self::predecessors::{PredecessorCache, Predecessors}; pub use self::query::*; pub mod coverage; -mod generic_graph; -pub mod generic_graphviz; mod graph_cyclic_cache; -pub mod graphviz; pub mod interpret; pub mod mono; pub mod patch; mod predecessors; -pub mod pretty; mod query; -pub mod spanview; pub mod tcx; pub mod terminator; pub use terminator::*; @@ -59,12 +54,6 @@ pub mod traversal; mod type_foldable; pub mod visit; -pub use self::generic_graph::graphviz_safe_def_name; -pub use self::graphviz::write_mir_graphviz; -pub use self::pretty::{ - create_dump_file, display_allocation, dump_enabled, dump_mir, write_mir_pretty, PassWhere, -}; - /// Types for locals pub type LocalDecls<'tcx> = IndexVec>; diff --git a/compiler/rustc_mir_dataflow/Cargo.toml b/compiler/rustc_mir_dataflow/Cargo.toml index ffd7e3cd06bd2..0a10a10a4c765 100644 --- a/compiler/rustc_mir_dataflow/Cargo.toml +++ b/compiler/rustc_mir_dataflow/Cargo.toml @@ -17,6 +17,7 @@ rustc_graphviz = { path = "../rustc_graphviz" } rustc_hir = { path = "../rustc_hir" } rustc_index = { path = "../rustc_index" } rustc_middle = { path = "../rustc_middle" } +rustc_mir_pretty = { path = "../rustc_mir_pretty" } rustc_serialize = { path = "../rustc_serialize" } rustc_session = { path = "../rustc_session" } rustc_target = { path = "../rustc_target" } diff --git a/compiler/rustc_mir_dataflow/src/framework/engine.rs b/compiler/rustc_mir_dataflow/src/framework/engine.rs index 804abc3b42b53..c6ac73ad6561c 100644 --- a/compiler/rustc_mir_dataflow/src/framework/engine.rs +++ b/compiler/rustc_mir_dataflow/src/framework/engine.rs @@ -11,8 +11,8 @@ use rustc_hir::def_id::DefId; use rustc_index::bit_set::BitSet; use rustc_index::vec::{Idx, IndexVec}; use rustc_middle::mir::{self, traversal, BasicBlock}; -use rustc_middle::mir::{create_dump_file, dump_enabled}; use rustc_middle::ty::TyCtxt; +use rustc_mir_pretty::{create_dump_file, dump_enabled}; use rustc_span::symbol::{sym, Symbol}; use super::fmt::DebugWithContext; diff --git a/compiler/rustc_mir_dataflow/src/framework/graphviz.rs b/compiler/rustc_mir_dataflow/src/framework/graphviz.rs index a370f8e40f9ae..3dca3e5eb0644 100644 --- a/compiler/rustc_mir_dataflow/src/framework/graphviz.rs +++ b/compiler/rustc_mir_dataflow/src/framework/graphviz.rs @@ -6,8 +6,8 @@ use std::{io, ops, str}; use regex::Regex; use rustc_graphviz as dot; -use rustc_middle::mir::graphviz_safe_def_name; use rustc_middle::mir::{self, BasicBlock, Body, Location}; +use rustc_mir_pretty::graphviz_safe_def_name; use super::fmt::{DebugDiffWithAdapter, DebugWithAdapter, DebugWithContext}; use super::{Analysis, Direction, Results, ResultsRefCursor, ResultsVisitor}; diff --git a/compiler/rustc_mir_pretty/Cargo.toml b/compiler/rustc_mir_pretty/Cargo.toml new file mode 100644 index 0000000000000..ebe99d0b7d5b2 --- /dev/null +++ b/compiler/rustc_mir_pretty/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "rustc_mir_pretty" +version = "0.0.0" +edition = "2021" + +[lib] +doctest = false + +[dependencies] +either = "1.5.0" +gsgdt = "0.1.2" +tracing = "0.1" +rustc_data_structures = { path = "../rustc_data_structures" } +rustc_graphviz = { path = "../rustc_graphviz" } +rustc_hir = { path = "../rustc_hir" } +rustc_index = { path = "../rustc_index" } +rustc_middle = { path = "../rustc_middle" } +rustc_session = { path = "../rustc_session" } +rustc_span = { path = "../rustc_span" } +rustc_target = { path = "../rustc_target" } diff --git a/compiler/rustc_middle/src/mir/generic_graph.rs b/compiler/rustc_mir_pretty/src/generic_graph.rs similarity index 100% rename from compiler/rustc_middle/src/mir/generic_graph.rs rename to compiler/rustc_mir_pretty/src/generic_graph.rs diff --git a/compiler/rustc_middle/src/mir/generic_graphviz.rs b/compiler/rustc_mir_pretty/src/generic_graphviz.rs similarity index 100% rename from compiler/rustc_middle/src/mir/generic_graphviz.rs rename to compiler/rustc_mir_pretty/src/generic_graphviz.rs diff --git a/compiler/rustc_middle/src/mir/graphviz.rs b/compiler/rustc_mir_pretty/src/graphviz.rs similarity index 100% rename from compiler/rustc_middle/src/mir/graphviz.rs rename to compiler/rustc_mir_pretty/src/graphviz.rs diff --git a/compiler/rustc_mir_pretty/src/lib.rs b/compiler/rustc_mir_pretty/src/lib.rs new file mode 100644 index 0000000000000..7c7af12d593fb --- /dev/null +++ b/compiler/rustc_mir_pretty/src/lib.rs @@ -0,0 +1,19 @@ +#![feature(in_band_lifetimes)] +#![feature(try_blocks)] + +#[macro_use] +extern crate rustc_middle; +#[macro_use] +extern crate tracing; + +mod generic_graph; +pub mod generic_graphviz; +mod graphviz; +mod pretty; +pub mod spanview; + +pub use self::generic_graph::graphviz_safe_def_name; +pub use self::graphviz::write_mir_graphviz; +pub use self::pretty::{ + create_dump_file, display_allocation, dump_enabled, dump_mir, write_mir_pretty, PassWhere, +}; diff --git a/compiler/rustc_middle/src/mir/pretty.rs b/compiler/rustc_mir_pretty/src/pretty.rs similarity index 100% rename from compiler/rustc_middle/src/mir/pretty.rs rename to compiler/rustc_mir_pretty/src/pretty.rs diff --git a/compiler/rustc_middle/src/mir/spanview.rs b/compiler/rustc_mir_pretty/src/spanview.rs similarity index 100% rename from compiler/rustc_middle/src/mir/spanview.rs rename to compiler/rustc_mir_pretty/src/spanview.rs diff --git a/compiler/rustc_mir_transform/Cargo.toml b/compiler/rustc_mir_transform/Cargo.toml index e85d74ef3eaef..9ba394955f080 100644 --- a/compiler/rustc_mir_transform/Cargo.toml +++ b/compiler/rustc_mir_transform/Cargo.toml @@ -19,6 +19,7 @@ rustc_index = { path = "../rustc_index" } rustc_middle = { path = "../rustc_middle" } rustc_const_eval = { path = "../rustc_const_eval" } rustc_mir_dataflow = { path = "../rustc_mir_dataflow" } +rustc_mir_pretty = { path = "../rustc_mir_pretty" } rustc_query_system = { path = "../rustc_query_system" } rustc_serialize = { path = "../rustc_serialize" } rustc_session = { path = "../rustc_session" } diff --git a/compiler/rustc_mir_transform/src/coverage/debug.rs b/compiler/rustc_mir_transform/src/coverage/debug.rs index 513a85b591306..30cc3f81ed5e1 100644 --- a/compiler/rustc_mir_transform/src/coverage/debug.rs +++ b/compiler/rustc_mir_transform/src/coverage/debug.rs @@ -111,14 +111,13 @@ use super::graph::{BasicCoverageBlock, BasicCoverageBlockData, CoverageGraph}; use super::spans::CoverageSpan; -use rustc_middle::mir::create_dump_file; -use rustc_middle::mir::generic_graphviz::GraphvizWriter; -use rustc_middle::mir::spanview::{self, SpanViewable}; - use rustc_data_structures::fx::FxHashMap; use rustc_middle::mir::coverage::*; use rustc_middle::mir::{self, BasicBlock, TerminatorKind}; use rustc_middle::ty::TyCtxt; +use rustc_mir_pretty::create_dump_file; +use rustc_mir_pretty::generic_graphviz::GraphvizWriter; +use rustc_mir_pretty::spanview::{self, SpanViewable}; use rustc_span::Span; use std::iter; diff --git a/compiler/rustc_mir_transform/src/coverage/mod.rs b/compiler/rustc_mir_transform/src/coverage/mod.rs index 6807d02519e2b..f50253f869496 100644 --- a/compiler/rustc_mir_transform/src/coverage/mod.rs +++ b/compiler/rustc_mir_transform/src/coverage/mod.rs @@ -21,12 +21,12 @@ use rustc_index::vec::IndexVec; use rustc_middle::hir; use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags; use rustc_middle::mir::coverage::*; -use rustc_middle::mir::dump_enabled; use rustc_middle::mir::{ self, BasicBlock, BasicBlockData, Coverage, SourceInfo, Statement, StatementKind, Terminator, TerminatorKind, }; use rustc_middle::ty::TyCtxt; +use rustc_mir_pretty::dump_enabled; use rustc_span::def_id::DefId; use rustc_span::source_map::SourceMap; use rustc_span::{CharPos, ExpnKind, Pos, SourceFile, Span, Symbol}; diff --git a/compiler/rustc_mir_transform/src/coverage/spans.rs b/compiler/rustc_mir_transform/src/coverage/spans.rs index d13fa0729cd95..8e10935706c54 100644 --- a/compiler/rustc_mir_transform/src/coverage/spans.rs +++ b/compiler/rustc_mir_transform/src/coverage/spans.rs @@ -2,12 +2,12 @@ use super::debug::term_type; use super::graph::{BasicCoverageBlock, BasicCoverageBlockData, CoverageGraph, START_BCB}; use rustc_data_structures::graph::WithNumNodes; -use rustc_middle::mir::spanview::source_range_no_file; use rustc_middle::mir::{ self, AggregateKind, BasicBlock, FakeReadCause, Rvalue, Statement, StatementKind, Terminator, TerminatorKind, }; use rustc_middle::ty::TyCtxt; +use rustc_mir_pretty::spanview::source_range_no_file; use rustc_span::source_map::original_sp; use rustc_span::{BytePos, ExpnKind, MacroKind, Span, Symbol}; diff --git a/compiler/rustc_mir_transform/src/dest_prop.rs b/compiler/rustc_mir_transform/src/dest_prop.rs index 790d9243fbaec..b54ab16c0f979 100644 --- a/compiler/rustc_mir_transform/src/dest_prop.rs +++ b/compiler/rustc_mir_transform/src/dest_prop.rs @@ -105,7 +105,6 @@ use rustc_index::{ }; use rustc_middle::mir::tcx::PlaceTy; use rustc_middle::mir::visit::{MutVisitor, PlaceContext, Visitor}; -use rustc_middle::mir::{dump_mir, PassWhere}; use rustc_middle::mir::{ traversal, Body, InlineAsmOperand, Local, LocalKind, Location, Operand, Place, PlaceElem, Rvalue, Statement, StatementKind, Terminator, TerminatorKind, @@ -113,6 +112,7 @@ use rustc_middle::mir::{ use rustc_middle::ty::TyCtxt; use rustc_mir_dataflow::impls::{MaybeInitializedLocals, MaybeLiveLocals}; use rustc_mir_dataflow::Analysis; +use rustc_mir_pretty::{dump_mir, PassWhere}; // Empirical measurements have resulted in some observations: // - Running on a body with a single block and 500 locals takes barely any time diff --git a/compiler/rustc_mir_transform/src/dump_mir.rs b/compiler/rustc_mir_transform/src/dump_mir.rs index 6b995141a2bef..9d3b29a85fb90 100644 --- a/compiler/rustc_mir_transform/src/dump_mir.rs +++ b/compiler/rustc_mir_transform/src/dump_mir.rs @@ -5,9 +5,9 @@ use std::fs::File; use std::io; use crate::MirPass; -use rustc_middle::mir::write_mir_pretty; use rustc_middle::mir::Body; use rustc_middle::ty::TyCtxt; +use rustc_mir_pretty::write_mir_pretty; use rustc_session::config::{OutputFilenames, OutputType}; pub struct Marker(pub &'static str); diff --git a/compiler/rustc_mir_transform/src/generator.rs b/compiler/rustc_mir_transform/src/generator.rs index bc72e9d94a953..b91eed60459c1 100644 --- a/compiler/rustc_mir_transform/src/generator.rs +++ b/compiler/rustc_mir_transform/src/generator.rs @@ -57,7 +57,6 @@ use rustc_hir as hir; use rustc_hir::lang_items::LangItem; use rustc_index::bit_set::{BitMatrix, BitSet}; use rustc_index::vec::{Idx, IndexVec}; -use rustc_middle::mir::dump_mir; use rustc_middle::mir::visit::{MutVisitor, PlaceContext, Visitor}; use rustc_middle::mir::*; use rustc_middle::ty::subst::{Subst, SubstsRef}; @@ -68,6 +67,7 @@ use rustc_mir_dataflow::impls::{ }; use rustc_mir_dataflow::storage; use rustc_mir_dataflow::{self, Analysis}; +use rustc_mir_pretty::dump_mir; use rustc_target::abi::VariantIdx; use rustc_target::spec::PanicStrategy; use std::{iter, ops}; diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index f9ef314627807..7491e31514fc7 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -27,9 +27,10 @@ use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc_index::vec::IndexVec; use rustc_middle::mir::visit::Visitor as _; -use rustc_middle::mir::{dump_mir, traversal, Body, ConstQualifs, MirPhase, Promoted}; +use rustc_middle::mir::{traversal, Body, ConstQualifs, MirPhase, Promoted}; use rustc_middle::ty::query::Providers; use rustc_middle::ty::{self, TyCtxt, TypeFoldable}; +use rustc_mir_pretty::dump_mir; use rustc_span::{Span, Symbol}; mod abort_unwinding_calls; @@ -276,7 +277,7 @@ fn mir_const<'tcx>( let mut body = tcx.mir_built(def).steal(); - rustc_middle::mir::dump_mir(tcx, None, "mir_map", &0, &body, |_, _| Ok(())); + rustc_mir_pretty::dump_mir(tcx, None, "mir_map", &0, &body, |_, _| Ok(())); run_passes( tcx, diff --git a/compiler/rustc_mir_transform/src/shim.rs b/compiler/rustc_mir_transform/src/shim.rs index f59aaa664f3ad..7de2a0ac79228 100644 --- a/compiler/rustc_mir_transform/src/shim.rs +++ b/compiler/rustc_mir_transform/src/shim.rs @@ -791,7 +791,7 @@ pub fn build_adt_ctor(tcx: TyCtxt<'_>, ctor_id: DefId) -> Body<'_> { span, ); - rustc_middle::mir::dump_mir(tcx, None, "mir_map", &0, &body, |_, _| Ok(())); + rustc_mir_pretty::dump_mir(tcx, None, "mir_map", &0, &body, |_, _| Ok(())); body }