Auto merge of #83842 - LeSeulArtichaut:thir-vec, r=nikomatsakis
Store THIR in `IndexVec`s instead of an `Arena` This is a necessary step to store the THIR in a query: #85273. See [relevant discussion on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/278509-project-thir-unsafeck/topic/THIR-dependent.20queries.20design). r? `@ghost` cc `@cjgillot` `@nikomatsakis`
This commit is contained in:
commit
f94942d842
20 changed files with 781 additions and 727 deletions
|
@ -8,14 +8,12 @@ use rustc_hir_pretty as pprust_hir;
|
|||
use rustc_middle::hir::map as hir_map;
|
||||
use rustc_middle::ty::{self, TyCtxt};
|
||||
use rustc_mir::util::{write_mir_graphviz, write_mir_pretty};
|
||||
use rustc_mir_build::thir;
|
||||
use rustc_session::config::{Input, PpAstTreeMode, PpHirMode, PpMode, PpSourceMode};
|
||||
use rustc_session::Session;
|
||||
use rustc_span::symbol::Ident;
|
||||
use rustc_span::FileName;
|
||||
|
||||
use std::cell::Cell;
|
||||
use std::fmt::Write;
|
||||
use std::path::Path;
|
||||
|
||||
pub use self::PpMode::*;
|
||||
|
@ -490,18 +488,8 @@ fn print_with_analysis(
|
|||
}
|
||||
|
||||
ThirTree => {
|
||||
let mut out = String::new();
|
||||
abort_on_err(rustc_typeck::check_crate(tcx), tcx.sess);
|
||||
debug!("pretty printing THIR tree");
|
||||
for did in tcx.body_owners() {
|
||||
let hir = tcx.hir();
|
||||
let body = hir.body(hir.body_owned_by(hir.local_def_id_to_hir_id(did)));
|
||||
let arena = thir::Arena::default();
|
||||
let thir =
|
||||
thir::build_thir(tcx, ty::WithOptConstParam::unknown(did), &arena, &body.value);
|
||||
let _ = writeln!(out, "{:?}:\n{:#?}\n", did, thir);
|
||||
}
|
||||
out
|
||||
// FIXME(rust-lang/project-thir-unsafeck#8)
|
||||
todo!()
|
||||
}
|
||||
|
||||
_ => unreachable!(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue