Reimplement pretty printing
This commit is contained in:
parent
e5a0dd7c6e
commit
e6d6c37968
@ -1639,6 +1639,7 @@ pub type FreevarMap = NodeMap<Vec<Freevar>>;
|
||||
|
||||
pub type CaptureModeMap = NodeMap<CaptureClause>;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct TraitCandidate {
|
||||
pub def_id: DefId,
|
||||
pub import_id: Option<NodeId>,
|
||||
|
@ -108,6 +108,7 @@ pub type Disr = ConstInt;
|
||||
|
||||
/// The complete set of all analyses described in this module. This is
|
||||
/// produced by the driver and fed to trans and later passes.
|
||||
#[derive(Clone)]
|
||||
pub struct CrateAnalysis<'a> {
|
||||
pub export_map: ExportMap,
|
||||
pub access_levels: middle::privacy::AccessLevels,
|
||||
|
@ -61,6 +61,7 @@ use syntax::visit;
|
||||
use syntax;
|
||||
use syntax_ext;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Resolutions {
|
||||
pub def_map: RefCell<DefMap>,
|
||||
pub freevars: FreevarMap,
|
||||
@ -209,6 +210,8 @@ pub fn compile_input(sess: &Session,
|
||||
&arenas,
|
||||
&cstore,
|
||||
&hir_map,
|
||||
&analysis,
|
||||
&resolutions,
|
||||
&expanded_crate,
|
||||
&hir_map.krate(),
|
||||
&id),
|
||||
@ -384,6 +387,7 @@ pub struct CompileState<'a, 'b, 'ast: 'a, 'tcx: 'b> where 'ast: 'tcx {
|
||||
pub expanded_crate: Option<&'a ast::Crate>,
|
||||
pub hir_crate: Option<&'a hir::Crate>,
|
||||
pub ast_map: Option<&'a hir_map::Map<'ast>>,
|
||||
pub resolutions: Option<&'a Resolutions>,
|
||||
pub mir_map: Option<&'b MirMap<'tcx>>,
|
||||
pub analysis: Option<&'a ty::CrateAnalysis<'a>>,
|
||||
pub tcx: Option<&'b TyCtxt<'tcx>>,
|
||||
@ -408,6 +412,7 @@ impl<'a, 'b, 'ast, 'tcx> CompileState<'a, 'b, 'ast, 'tcx> {
|
||||
expanded_crate: None,
|
||||
hir_crate: None,
|
||||
ast_map: None,
|
||||
resolutions: None,
|
||||
analysis: None,
|
||||
mir_map: None,
|
||||
tcx: None,
|
||||
@ -454,6 +459,8 @@ impl<'a, 'b, 'ast, 'tcx> CompileState<'a, 'b, 'ast, 'tcx> {
|
||||
arenas: &'ast ty::CtxtArenas<'ast>,
|
||||
cstore: &'a CStore,
|
||||
hir_map: &'a hir_map::Map<'ast>,
|
||||
analysis: &'a ty::CrateAnalysis,
|
||||
resolutions: &'a Resolutions,
|
||||
krate: &'a ast::Crate,
|
||||
hir_crate: &'a hir::Crate,
|
||||
crate_name: &'a str)
|
||||
@ -463,6 +470,8 @@ impl<'a, 'b, 'ast, 'tcx> CompileState<'a, 'b, 'ast, 'tcx> {
|
||||
arenas: Some(arenas),
|
||||
cstore: Some(cstore),
|
||||
ast_map: Some(hir_map),
|
||||
analysis: Some(analysis),
|
||||
resolutions: Some(resolutions),
|
||||
expanded_crate: Some(krate),
|
||||
hir_crate: Some(hir_crate),
|
||||
out_file: out_file.as_ref().map(|s| &**s),
|
||||
|
@ -469,6 +469,8 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls {
|
||||
control.after_write_deps.callback = box move |state| {
|
||||
pretty::print_after_write_deps(state.session,
|
||||
state.ast_map.unwrap(),
|
||||
state.analysis.unwrap(),
|
||||
state.resolutions.unwrap(),
|
||||
state.input,
|
||||
&state.expanded_crate.take().unwrap(),
|
||||
state.crate_name.unwrap(),
|
||||
|
@ -15,7 +15,8 @@ pub use self::PpSourceMode::*;
|
||||
pub use self::PpMode::*;
|
||||
use self::NodesMatchingUII::*;
|
||||
|
||||
use {driver, abort_on_err};
|
||||
use abort_on_err;
|
||||
use driver::{self, Resolutions};
|
||||
|
||||
use rustc::dep_graph::DepGraph;
|
||||
use rustc::ty::{self, TyCtxt};
|
||||
@ -25,7 +26,6 @@ use rustc::session::Session;
|
||||
use rustc::session::config::Input;
|
||||
use rustc_borrowck as borrowck;
|
||||
use rustc_borrowck::graphviz as borrowck_dot;
|
||||
use rustc_resolve as resolve;
|
||||
|
||||
use rustc_mir::pretty::write_mir_pretty;
|
||||
use rustc_mir::graphviz::write_mir_graphviz;
|
||||
@ -202,6 +202,8 @@ impl PpSourceMode {
|
||||
fn call_with_pp_support_hir<'tcx, A, B, F>(&self,
|
||||
sess: &'tcx Session,
|
||||
ast_map: &hir_map::Map<'tcx>,
|
||||
analysis: &ty::CrateAnalysis,
|
||||
resolutions: &Resolutions,
|
||||
arenas: &'tcx ty::CtxtArenas<'tcx>,
|
||||
id: &str,
|
||||
payload: B,
|
||||
@ -226,12 +228,12 @@ impl PpSourceMode {
|
||||
f(&annotation, payload, ast_map.forest.krate())
|
||||
}
|
||||
PpmTyped => {
|
||||
/*
|
||||
abort_on_err(driver::phase_3_run_analysis_passes(sess,
|
||||
ast_map.clone(),
|
||||
analysis.clone(),
|
||||
resolutions.clone(),
|
||||
arenas,
|
||||
id,
|
||||
resolve::MakeGlobMap::No,
|
||||
|tcx, _, _, _| {
|
||||
let annotation = TypedAnnotation {
|
||||
tcx: tcx,
|
||||
@ -241,8 +243,6 @@ impl PpSourceMode {
|
||||
payload,
|
||||
ast_map.forest.krate())
|
||||
}), sess)
|
||||
*/
|
||||
unimplemented!()
|
||||
}
|
||||
_ => panic!("Should use call_with_pp_support"),
|
||||
}
|
||||
@ -814,6 +814,8 @@ pub fn print_after_parsing(sess: &Session,
|
||||
|
||||
pub fn print_after_write_deps<'tcx, 'a: 'tcx>(sess: &'a Session,
|
||||
ast_map: &hir_map::Map<'tcx>,
|
||||
analysis: &ty::CrateAnalysis,
|
||||
resolutions: &Resolutions,
|
||||
input: &Input,
|
||||
krate: &ast::Crate,
|
||||
crate_name: &str,
|
||||
@ -825,7 +827,8 @@ pub fn print_after_write_deps<'tcx, 'a: 'tcx>(sess: &'a Session,
|
||||
let _ignore = dep_graph.in_ignore();
|
||||
|
||||
if ppm.needs_analysis() {
|
||||
print_with_analysis(sess, ast_map, crate_name, arenas, ppm, opt_uii, ofile);
|
||||
print_with_analysis(sess, ast_map, analysis, resolutions,
|
||||
crate_name, arenas, ppm, opt_uii, ofile);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -856,6 +859,8 @@ pub fn print_after_write_deps<'tcx, 'a: 'tcx>(sess: &'a Session,
|
||||
let out: &mut Write = &mut out;
|
||||
s.call_with_pp_support_hir(sess,
|
||||
ast_map,
|
||||
analysis,
|
||||
resolutions,
|
||||
arenas,
|
||||
crate_name,
|
||||
box out,
|
||||
@ -877,6 +882,8 @@ pub fn print_after_write_deps<'tcx, 'a: 'tcx>(sess: &'a Session,
|
||||
let out: &mut Write = &mut out;
|
||||
s.call_with_pp_support_hir(sess,
|
||||
ast_map,
|
||||
analysis,
|
||||
resolutions,
|
||||
arenas,
|
||||
crate_name,
|
||||
(out,uii),
|
||||
@ -917,6 +924,8 @@ pub fn print_after_write_deps<'tcx, 'a: 'tcx>(sess: &'a Session,
|
||||
// Instead, we call that function ourselves.
|
||||
fn print_with_analysis<'tcx, 'a: 'tcx>(sess: &'a Session,
|
||||
ast_map: &hir_map::Map<'tcx>,
|
||||
analysis: &ty::CrateAnalysis,
|
||||
resolutions: &Resolutions,
|
||||
crate_name: &str,
|
||||
arenas: &'tcx ty::CtxtArenas<'tcx>,
|
||||
ppm: PpMode,
|
||||
@ -930,14 +939,14 @@ fn print_with_analysis<'tcx, 'a: 'tcx>(sess: &'a Session,
|
||||
None
|
||||
};
|
||||
|
||||
/*
|
||||
let mut out = Vec::new();
|
||||
|
||||
abort_on_err(driver::phase_3_run_analysis_passes(sess,
|
||||
ast_map.clone(),
|
||||
analysis.clone(),
|
||||
resolutions.clone(),
|
||||
arenas,
|
||||
crate_name,
|
||||
resolve::MakeGlobMap::No,
|
||||
|tcx, mir_map, _, _| {
|
||||
match ppm {
|
||||
PpmMir | PpmMirCFG => {
|
||||
@ -1002,6 +1011,4 @@ fn print_with_analysis<'tcx, 'a: 'tcx>(sess: &'a Session,
|
||||
}), sess).unwrap();
|
||||
|
||||
write_output(out, ofile);
|
||||
*/
|
||||
unimplemented!()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user