Auto merge of #56601 - Zoxc:lifetime-killer, r=nikomatsakis
Make the 'a lifetime on TyCtxt useless cc @rust-lang/compiler r? @nikomatsakis
This commit is contained in:
commit
0a4a4ffc69
@ -37,7 +37,7 @@
|
|||||||
use ty::fold::TypeFoldable;
|
use ty::fold::TypeFoldable;
|
||||||
use ty::relate::{RelateResult, TraitObjectMode};
|
use ty::relate::{RelateResult, TraitObjectMode};
|
||||||
use ty::subst::{Kind, Substs};
|
use ty::subst::{Kind, Substs};
|
||||||
use ty::{self, GenericParamDefKind, Ty, TyCtxt};
|
use ty::{self, GenericParamDefKind, Ty, TyCtxt, CtxtInterners};
|
||||||
use ty::{FloatVid, IntVid, TyVid};
|
use ty::{FloatVid, IntVid, TyVid};
|
||||||
use util::nodemap::FxHashMap;
|
use util::nodemap::FxHashMap;
|
||||||
|
|
||||||
@ -474,6 +474,7 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|||||||
pub struct InferCtxtBuilder<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
|
pub struct InferCtxtBuilder<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
|
||||||
global_tcx: TyCtxt<'a, 'gcx, 'gcx>,
|
global_tcx: TyCtxt<'a, 'gcx, 'gcx>,
|
||||||
arena: SyncDroplessArena,
|
arena: SyncDroplessArena,
|
||||||
|
interners: Option<CtxtInterners<'tcx>>,
|
||||||
fresh_tables: Option<RefCell<ty::TypeckTables<'tcx>>>,
|
fresh_tables: Option<RefCell<ty::TypeckTables<'tcx>>>,
|
||||||
trait_object_mode: TraitObjectMode,
|
trait_object_mode: TraitObjectMode,
|
||||||
}
|
}
|
||||||
@ -483,6 +484,7 @@ pub fn infer_ctxt(self) -> InferCtxtBuilder<'a, 'gcx, 'tcx> {
|
|||||||
InferCtxtBuilder {
|
InferCtxtBuilder {
|
||||||
global_tcx: self,
|
global_tcx: self,
|
||||||
arena: SyncDroplessArena::default(),
|
arena: SyncDroplessArena::default(),
|
||||||
|
interners: None,
|
||||||
fresh_tables: None,
|
fresh_tables: None,
|
||||||
trait_object_mode: TraitObjectMode::NoSquash,
|
trait_object_mode: TraitObjectMode::NoSquash,
|
||||||
}
|
}
|
||||||
@ -531,10 +533,13 @@ pub fn enter<R>(&'tcx mut self, f: impl for<'b> FnOnce(InferCtxt<'b, 'gcx, 'tcx>
|
|||||||
global_tcx,
|
global_tcx,
|
||||||
trait_object_mode,
|
trait_object_mode,
|
||||||
ref arena,
|
ref arena,
|
||||||
|
ref mut interners,
|
||||||
ref fresh_tables,
|
ref fresh_tables,
|
||||||
} = *self;
|
} = *self;
|
||||||
let in_progress_tables = fresh_tables.as_ref();
|
let in_progress_tables = fresh_tables.as_ref();
|
||||||
global_tcx.enter_local(arena, |tcx| {
|
// Check that we haven't entered before
|
||||||
|
assert!(interners.is_none());
|
||||||
|
global_tcx.enter_local(arena, interners, |tcx| {
|
||||||
f(InferCtxt {
|
f(InferCtxt {
|
||||||
tcx,
|
tcx,
|
||||||
in_progress_tables,
|
in_progress_tables,
|
||||||
|
@ -72,6 +72,7 @@
|
|||||||
use std::iter;
|
use std::iter;
|
||||||
use std::sync::mpsc;
|
use std::sync::mpsc;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
use std::marker::PhantomData;
|
||||||
use rustc_target::spec::abi;
|
use rustc_target::spec::abi;
|
||||||
use syntax::ast::{self, NodeId};
|
use syntax::ast::{self, NodeId};
|
||||||
use syntax::attr;
|
use syntax::attr;
|
||||||
@ -86,6 +87,7 @@
|
|||||||
pub struct AllArenas<'tcx> {
|
pub struct AllArenas<'tcx> {
|
||||||
pub global: WorkerLocal<GlobalArenas<'tcx>>,
|
pub global: WorkerLocal<GlobalArenas<'tcx>>,
|
||||||
pub interner: SyncDroplessArena,
|
pub interner: SyncDroplessArena,
|
||||||
|
global_ctxt: Option<GlobalCtxt<'tcx>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> AllArenas<'tcx> {
|
impl<'tcx> AllArenas<'tcx> {
|
||||||
@ -93,6 +95,7 @@ pub fn new() -> Self {
|
|||||||
AllArenas {
|
AllArenas {
|
||||||
global: WorkerLocal::new(|_| GlobalArenas::default()),
|
global: WorkerLocal::new(|_| GlobalArenas::default()),
|
||||||
interner: SyncDroplessArena::default(),
|
interner: SyncDroplessArena::default(),
|
||||||
|
global_ctxt: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -869,12 +872,13 @@ pub struct FreeRegionInfo {
|
|||||||
/// [rustc guide]: https://rust-lang.github.io/rustc-guide/ty.html
|
/// [rustc guide]: https://rust-lang.github.io/rustc-guide/ty.html
|
||||||
#[derive(Copy, Clone)]
|
#[derive(Copy, Clone)]
|
||||||
pub struct TyCtxt<'a, 'gcx: 'tcx, 'tcx: 'a> {
|
pub struct TyCtxt<'a, 'gcx: 'tcx, 'tcx: 'a> {
|
||||||
gcx: &'a GlobalCtxt<'gcx>,
|
gcx: &'gcx GlobalCtxt<'gcx>,
|
||||||
interners: &'a CtxtInterners<'tcx>
|
interners: &'tcx CtxtInterners<'tcx>,
|
||||||
|
dummy: PhantomData<&'a ()>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, 'gcx, 'tcx> Deref for TyCtxt<'a, 'gcx, 'tcx> {
|
impl<'gcx> Deref for TyCtxt<'_, 'gcx, '_> {
|
||||||
type Target = &'a GlobalCtxt<'gcx>;
|
type Target = &'gcx GlobalCtxt<'gcx>;
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn deref(&self) -> &Self::Target {
|
fn deref(&self) -> &Self::Target {
|
||||||
&self.gcx
|
&self.gcx
|
||||||
@ -964,10 +968,11 @@ pub struct GlobalCtxt<'tcx> {
|
|||||||
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
|
||||||
/// Get the global TyCtxt.
|
/// Get the global TyCtxt.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn global_tcx(self) -> TyCtxt<'a, 'gcx, 'gcx> {
|
pub fn global_tcx(self) -> TyCtxt<'gcx, 'gcx, 'gcx> {
|
||||||
TyCtxt {
|
TyCtxt {
|
||||||
gcx: self.gcx,
|
gcx: self.gcx,
|
||||||
interners: &self.gcx.global_interners,
|
interners: &self.gcx.global_interners,
|
||||||
|
dummy: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1105,7 +1110,7 @@ pub fn create_and_enter<F, R>(s: &'tcx Session,
|
|||||||
cstore: &'tcx CrateStoreDyn,
|
cstore: &'tcx CrateStoreDyn,
|
||||||
local_providers: ty::query::Providers<'tcx>,
|
local_providers: ty::query::Providers<'tcx>,
|
||||||
extern_providers: ty::query::Providers<'tcx>,
|
extern_providers: ty::query::Providers<'tcx>,
|
||||||
arenas: &'tcx AllArenas<'tcx>,
|
arenas: &'tcx mut AllArenas<'tcx>,
|
||||||
resolutions: ty::Resolutions,
|
resolutions: ty::Resolutions,
|
||||||
hir: hir_map::Map<'tcx>,
|
hir: hir_map::Map<'tcx>,
|
||||||
on_disk_query_result_cache: query::OnDiskCache<'tcx>,
|
on_disk_query_result_cache: query::OnDiskCache<'tcx>,
|
||||||
@ -1166,7 +1171,7 @@ pub fn create_and_enter<F, R>(s: &'tcx Session,
|
|||||||
Lrc::new(StableVec::new(v)));
|
Lrc::new(StableVec::new(v)));
|
||||||
}
|
}
|
||||||
|
|
||||||
let gcx = &GlobalCtxt {
|
arenas.global_ctxt = Some(GlobalCtxt {
|
||||||
sess: s,
|
sess: s,
|
||||||
cstore,
|
cstore,
|
||||||
global_arenas: &arenas.global,
|
global_arenas: &arenas.global,
|
||||||
@ -1209,7 +1214,9 @@ pub fn create_and_enter<F, R>(s: &'tcx Session,
|
|||||||
alloc_map: Lock::new(interpret::AllocMap::new()),
|
alloc_map: Lock::new(interpret::AllocMap::new()),
|
||||||
tx_to_llvm_workers: Lock::new(tx),
|
tx_to_llvm_workers: Lock::new(tx),
|
||||||
output_filenames: Arc::new(output_filenames.clone()),
|
output_filenames: Arc::new(output_filenames.clone()),
|
||||||
};
|
});
|
||||||
|
|
||||||
|
let gcx = arenas.global_ctxt.as_ref().unwrap();
|
||||||
|
|
||||||
sync::assert_send_val(&gcx);
|
sync::assert_send_val(&gcx);
|
||||||
|
|
||||||
@ -1609,20 +1616,25 @@ pub fn encode_metadata(self)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'gcx: 'tcx, 'tcx> GlobalCtxt<'gcx> {
|
impl<'gcx> GlobalCtxt<'gcx> {
|
||||||
/// Call the closure with a local `TyCtxt` using the given arena.
|
/// Call the closure with a local `TyCtxt` using the given arena.
|
||||||
pub fn enter_local<F, R>(
|
/// `interners` is a slot passed so we can create a CtxtInterners
|
||||||
&self,
|
/// with the same lifetime as `arena`.
|
||||||
|
pub fn enter_local<'tcx, F, R>(
|
||||||
|
&'gcx self,
|
||||||
arena: &'tcx SyncDroplessArena,
|
arena: &'tcx SyncDroplessArena,
|
||||||
|
interners: &'tcx mut Option<CtxtInterners<'tcx>>,
|
||||||
f: F
|
f: F
|
||||||
) -> R
|
) -> R
|
||||||
where
|
where
|
||||||
F: for<'a> FnOnce(TyCtxt<'a, 'gcx, 'tcx>) -> R
|
F: FnOnce(TyCtxt<'tcx, 'gcx, 'tcx>) -> R,
|
||||||
|
'gcx: 'tcx,
|
||||||
{
|
{
|
||||||
let interners = CtxtInterners::new(arena);
|
*interners = Some(CtxtInterners::new(&arena));
|
||||||
let tcx = TyCtxt {
|
let tcx = TyCtxt {
|
||||||
gcx: self,
|
gcx: self,
|
||||||
interners: &interners,
|
interners: interners.as_ref().unwrap(),
|
||||||
|
dummy: PhantomData,
|
||||||
};
|
};
|
||||||
ty::tls::with_related_context(tcx.global_tcx(), |icx| {
|
ty::tls::with_related_context(tcx.global_tcx(), |icx| {
|
||||||
let new_icx = ty::tls::ImplicitCtxt {
|
let new_icx = ty::tls::ImplicitCtxt {
|
||||||
@ -1631,8 +1643,8 @@ pub fn enter_local<F, R>(
|
|||||||
layout_depth: icx.layout_depth,
|
layout_depth: icx.layout_depth,
|
||||||
task: icx.task,
|
task: icx.task,
|
||||||
};
|
};
|
||||||
ty::tls::enter_context(&new_icx, |new_icx| {
|
ty::tls::enter_context(&new_icx, |_| {
|
||||||
f(new_icx.tcx)
|
f(tcx)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -1872,6 +1884,7 @@ pub mod tls {
|
|||||||
|
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::mem;
|
use std::mem;
|
||||||
|
use std::marker::PhantomData;
|
||||||
use syntax_pos;
|
use syntax_pos;
|
||||||
use ty::query;
|
use ty::query;
|
||||||
use errors::{Diagnostic, TRACK_DIAGNOSTICS};
|
use errors::{Diagnostic, TRACK_DIAGNOSTICS};
|
||||||
@ -1891,10 +1904,10 @@ pub mod tls {
|
|||||||
/// you should also have access to an ImplicitCtxt through the functions
|
/// you should also have access to an ImplicitCtxt through the functions
|
||||||
/// in this module.
|
/// in this module.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct ImplicitCtxt<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
|
pub struct ImplicitCtxt<'a, 'gcx: 'tcx, 'tcx> {
|
||||||
/// The current TyCtxt. Initially created by `enter_global` and updated
|
/// The current TyCtxt. Initially created by `enter_global` and updated
|
||||||
/// by `enter_local` with a new local interner
|
/// by `enter_local` with a new local interner
|
||||||
pub tcx: TyCtxt<'a, 'gcx, 'tcx>,
|
pub tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
|
||||||
|
|
||||||
/// The current query job, if any. This is updated by start_job in
|
/// The current query job, if any. This is updated by start_job in
|
||||||
/// ty::query::plumbing when executing a query
|
/// ty::query::plumbing when executing a query
|
||||||
@ -2008,8 +2021,8 @@ pub fn enter_context<'a, 'gcx: 'tcx, 'tcx, F, R>(context: &ImplicitCtxt<'a, 'gcx
|
|||||||
/// creating a initial TyCtxt and ImplicitCtxt.
|
/// creating a initial TyCtxt and ImplicitCtxt.
|
||||||
/// This happens once per rustc session and TyCtxts only exists
|
/// This happens once per rustc session and TyCtxts only exists
|
||||||
/// inside the `f` function.
|
/// inside the `f` function.
|
||||||
pub fn enter_global<'gcx, F, R>(gcx: &GlobalCtxt<'gcx>, f: F) -> R
|
pub fn enter_global<'gcx, F, R>(gcx: &'gcx GlobalCtxt<'gcx>, f: F) -> R
|
||||||
where F: for<'a> FnOnce(TyCtxt<'a, 'gcx, 'gcx>) -> R
|
where F: FnOnce(TyCtxt<'gcx, 'gcx, 'gcx>) -> R
|
||||||
{
|
{
|
||||||
with_thread_locals(|| {
|
with_thread_locals(|| {
|
||||||
// Update GCX_PTR to indicate there's a GlobalCtxt available
|
// Update GCX_PTR to indicate there's a GlobalCtxt available
|
||||||
@ -2024,6 +2037,7 @@ pub fn enter_global<'gcx, F, R>(gcx: &GlobalCtxt<'gcx>, f: F) -> R
|
|||||||
let tcx = TyCtxt {
|
let tcx = TyCtxt {
|
||||||
gcx,
|
gcx,
|
||||||
interners: &gcx.global_interners,
|
interners: &gcx.global_interners,
|
||||||
|
dummy: PhantomData,
|
||||||
};
|
};
|
||||||
let icx = ImplicitCtxt {
|
let icx = ImplicitCtxt {
|
||||||
tcx,
|
tcx,
|
||||||
@ -2053,6 +2067,7 @@ pub unsafe fn with_global<F, R>(f: F) -> R
|
|||||||
let tcx = TyCtxt {
|
let tcx = TyCtxt {
|
||||||
gcx,
|
gcx,
|
||||||
interners: &gcx.global_interners,
|
interners: &gcx.global_interners,
|
||||||
|
dummy: PhantomData,
|
||||||
};
|
};
|
||||||
let icx = ImplicitCtxt {
|
let icx = ImplicitCtxt {
|
||||||
query: None,
|
query: None,
|
||||||
|
@ -82,7 +82,7 @@
|
|||||||
pub use self::binding::BindingMode::*;
|
pub use self::binding::BindingMode::*;
|
||||||
|
|
||||||
pub use self::context::{TyCtxt, FreeRegionInfo, GlobalArenas, AllArenas, tls, keep_local};
|
pub use self::context::{TyCtxt, FreeRegionInfo, GlobalArenas, AllArenas, tls, keep_local};
|
||||||
pub use self::context::{Lift, TypeckTables};
|
pub use self::context::{Lift, TypeckTables, CtxtInterners};
|
||||||
|
|
||||||
pub use self::instance::{Instance, InstanceDef};
|
pub use self::instance::{Instance, InstanceDef};
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ pub(super) fn start<'lcx, F, R>(
|
|||||||
let r = tls::with_related_context(tcx, move |current_icx| {
|
let r = tls::with_related_context(tcx, move |current_icx| {
|
||||||
// Update the ImplicitCtxt to point to our new query job
|
// Update the ImplicitCtxt to point to our new query job
|
||||||
let new_icx = tls::ImplicitCtxt {
|
let new_icx = tls::ImplicitCtxt {
|
||||||
tcx,
|
tcx: tcx.global_tcx(),
|
||||||
query: Some(self.job.clone()),
|
query: Some(self.job.clone()),
|
||||||
layout_depth: current_icx.layout_depth,
|
layout_depth: current_icx.layout_depth,
|
||||||
task: current_icx.task,
|
task: current_icx.task,
|
||||||
|
@ -246,8 +246,6 @@ macro_rules! controller_entry_point {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let arenas = AllArenas::new();
|
|
||||||
|
|
||||||
// Construct the HIR map
|
// Construct the HIR map
|
||||||
let hir_map = time(sess, "indexing hir", || {
|
let hir_map = time(sess, "indexing hir", || {
|
||||||
hir_map::map_crate(sess, cstore, &mut hir_forest, &defs)
|
hir_map::map_crate(sess, cstore, &mut hir_forest, &defs)
|
||||||
@ -263,7 +261,6 @@ macro_rules! controller_entry_point {
|
|||||||
sess,
|
sess,
|
||||||
outdir,
|
outdir,
|
||||||
output,
|
output,
|
||||||
&arenas,
|
|
||||||
&cstore,
|
&cstore,
|
||||||
&hir_map,
|
&hir_map,
|
||||||
&analysis,
|
&analysis,
|
||||||
@ -284,6 +281,8 @@ macro_rules! controller_entry_point {
|
|||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let mut arenas = AllArenas::new();
|
||||||
|
|
||||||
phase_3_run_analysis_passes(
|
phase_3_run_analysis_passes(
|
||||||
&*codegen_backend,
|
&*codegen_backend,
|
||||||
control,
|
control,
|
||||||
@ -292,7 +291,7 @@ macro_rules! controller_entry_point {
|
|||||||
hir_map,
|
hir_map,
|
||||||
analysis,
|
analysis,
|
||||||
resolutions,
|
resolutions,
|
||||||
&arenas,
|
&mut arenas,
|
||||||
&crate_name,
|
&crate_name,
|
||||||
&outputs,
|
&outputs,
|
||||||
|tcx, analysis, rx, result| {
|
|tcx, analysis, rx, result| {
|
||||||
@ -533,7 +532,6 @@ pub struct CompileState<'a, 'tcx: 'a> {
|
|||||||
pub output_filenames: Option<&'a OutputFilenames>,
|
pub output_filenames: Option<&'a OutputFilenames>,
|
||||||
pub out_dir: Option<&'a Path>,
|
pub out_dir: Option<&'a Path>,
|
||||||
pub out_file: Option<&'a Path>,
|
pub out_file: Option<&'a Path>,
|
||||||
pub arenas: Option<&'tcx AllArenas<'tcx>>,
|
|
||||||
pub expanded_crate: Option<&'a ast::Crate>,
|
pub expanded_crate: Option<&'a ast::Crate>,
|
||||||
pub hir_crate: Option<&'a hir::Crate>,
|
pub hir_crate: Option<&'a hir::Crate>,
|
||||||
pub hir_map: Option<&'a hir_map::Map<'tcx>>,
|
pub hir_map: Option<&'a hir_map::Map<'tcx>>,
|
||||||
@ -549,7 +547,6 @@ fn empty(input: &'a Input, session: &'tcx Session, out_dir: &'a Option<PathBuf>)
|
|||||||
session,
|
session,
|
||||||
out_dir: out_dir.as_ref().map(|s| &**s),
|
out_dir: out_dir.as_ref().map(|s| &**s),
|
||||||
out_file: None,
|
out_file: None,
|
||||||
arenas: None,
|
|
||||||
krate: None,
|
krate: None,
|
||||||
registry: None,
|
registry: None,
|
||||||
cstore: None,
|
cstore: None,
|
||||||
@ -605,7 +602,6 @@ fn state_after_hir_lowering(
|
|||||||
session: &'tcx Session,
|
session: &'tcx Session,
|
||||||
out_dir: &'a Option<PathBuf>,
|
out_dir: &'a Option<PathBuf>,
|
||||||
out_file: &'a Option<PathBuf>,
|
out_file: &'a Option<PathBuf>,
|
||||||
arenas: &'tcx AllArenas<'tcx>,
|
|
||||||
cstore: &'tcx CStore,
|
cstore: &'tcx CStore,
|
||||||
hir_map: &'a hir_map::Map<'tcx>,
|
hir_map: &'a hir_map::Map<'tcx>,
|
||||||
analysis: &'a ty::CrateAnalysis,
|
analysis: &'a ty::CrateAnalysis,
|
||||||
@ -617,7 +613,6 @@ fn state_after_hir_lowering(
|
|||||||
) -> Self {
|
) -> Self {
|
||||||
CompileState {
|
CompileState {
|
||||||
crate_name: Some(crate_name),
|
crate_name: Some(crate_name),
|
||||||
arenas: Some(arenas),
|
|
||||||
cstore: Some(cstore),
|
cstore: Some(cstore),
|
||||||
hir_map: Some(hir_map),
|
hir_map: Some(hir_map),
|
||||||
analysis: Some(analysis),
|
analysis: Some(analysis),
|
||||||
@ -1216,7 +1211,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(
|
|||||||
hir_map: hir_map::Map<'tcx>,
|
hir_map: hir_map::Map<'tcx>,
|
||||||
mut analysis: ty::CrateAnalysis,
|
mut analysis: ty::CrateAnalysis,
|
||||||
resolutions: Resolutions,
|
resolutions: Resolutions,
|
||||||
arenas: &'tcx AllArenas<'tcx>,
|
arenas: &'tcx mut AllArenas<'tcx>,
|
||||||
name: &str,
|
name: &str,
|
||||||
output_filenames: &OutputFilenames,
|
output_filenames: &OutputFilenames,
|
||||||
f: F,
|
f: F,
|
||||||
|
@ -911,7 +911,6 @@ fn build_controller(self: Box<Self>,
|
|||||||
&state.expanded_crate.take().unwrap(),
|
&state.expanded_crate.take().unwrap(),
|
||||||
state.crate_name.unwrap(),
|
state.crate_name.unwrap(),
|
||||||
ppm,
|
ppm,
|
||||||
state.arenas.unwrap(),
|
|
||||||
state.output_filenames.unwrap(),
|
state.output_filenames.unwrap(),
|
||||||
opt_uii.clone(),
|
opt_uii.clone(),
|
||||||
state.out_file);
|
state.out_file);
|
||||||
|
@ -202,7 +202,6 @@ fn call_with_pp_support_hir<'tcx, A, F>(
|
|||||||
hir_map: &hir_map::Map<'tcx>,
|
hir_map: &hir_map::Map<'tcx>,
|
||||||
analysis: &ty::CrateAnalysis,
|
analysis: &ty::CrateAnalysis,
|
||||||
resolutions: &Resolutions,
|
resolutions: &Resolutions,
|
||||||
arenas: &'tcx AllArenas<'tcx>,
|
|
||||||
output_filenames: &OutputFilenames,
|
output_filenames: &OutputFilenames,
|
||||||
id: &str,
|
id: &str,
|
||||||
f: F
|
f: F
|
||||||
@ -228,6 +227,7 @@ fn call_with_pp_support_hir<'tcx, A, F>(
|
|||||||
PpmTyped => {
|
PpmTyped => {
|
||||||
let control = &driver::CompileController::basic();
|
let control = &driver::CompileController::basic();
|
||||||
let codegen_backend = ::get_codegen_backend(sess);
|
let codegen_backend = ::get_codegen_backend(sess);
|
||||||
|
let mut arenas = AllArenas::new();
|
||||||
abort_on_err(driver::phase_3_run_analysis_passes(&*codegen_backend,
|
abort_on_err(driver::phase_3_run_analysis_passes(&*codegen_backend,
|
||||||
control,
|
control,
|
||||||
sess,
|
sess,
|
||||||
@ -235,7 +235,7 @@ fn call_with_pp_support_hir<'tcx, A, F>(
|
|||||||
hir_map.clone(),
|
hir_map.clone(),
|
||||||
analysis.clone(),
|
analysis.clone(),
|
||||||
resolutions.clone(),
|
resolutions.clone(),
|
||||||
arenas,
|
&mut arenas,
|
||||||
id,
|
id,
|
||||||
output_filenames,
|
output_filenames,
|
||||||
|tcx, _, _, _| {
|
|tcx, _, _, _| {
|
||||||
@ -977,7 +977,6 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
|
|||||||
krate: &ast::Crate,
|
krate: &ast::Crate,
|
||||||
crate_name: &str,
|
crate_name: &str,
|
||||||
ppm: PpMode,
|
ppm: PpMode,
|
||||||
arenas: &'tcx AllArenas<'tcx>,
|
|
||||||
output_filenames: &OutputFilenames,
|
output_filenames: &OutputFilenames,
|
||||||
opt_uii: Option<UserIdentifiedItem>,
|
opt_uii: Option<UserIdentifiedItem>,
|
||||||
ofile: Option<&Path>) {
|
ofile: Option<&Path>) {
|
||||||
@ -988,7 +987,6 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
|
|||||||
analysis,
|
analysis,
|
||||||
resolutions,
|
resolutions,
|
||||||
crate_name,
|
crate_name,
|
||||||
arenas,
|
|
||||||
output_filenames,
|
output_filenames,
|
||||||
ppm,
|
ppm,
|
||||||
opt_uii,
|
opt_uii,
|
||||||
@ -1026,7 +1024,6 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
|
|||||||
hir_map,
|
hir_map,
|
||||||
analysis,
|
analysis,
|
||||||
resolutions,
|
resolutions,
|
||||||
arenas,
|
|
||||||
output_filenames,
|
output_filenames,
|
||||||
crate_name,
|
crate_name,
|
||||||
move |annotation, krate| {
|
move |annotation, krate| {
|
||||||
@ -1050,7 +1047,6 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
|
|||||||
hir_map,
|
hir_map,
|
||||||
analysis,
|
analysis,
|
||||||
resolutions,
|
resolutions,
|
||||||
arenas,
|
|
||||||
output_filenames,
|
output_filenames,
|
||||||
crate_name,
|
crate_name,
|
||||||
move |_annotation, krate| {
|
move |_annotation, krate| {
|
||||||
@ -1066,7 +1062,6 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
|
|||||||
hir_map,
|
hir_map,
|
||||||
analysis,
|
analysis,
|
||||||
resolutions,
|
resolutions,
|
||||||
arenas,
|
|
||||||
output_filenames,
|
output_filenames,
|
||||||
crate_name,
|
crate_name,
|
||||||
move |annotation, _| {
|
move |annotation, _| {
|
||||||
@ -1100,7 +1095,6 @@ pub fn print_after_hir_lowering<'tcx, 'a: 'tcx>(sess: &'a Session,
|
|||||||
hir_map,
|
hir_map,
|
||||||
analysis,
|
analysis,
|
||||||
resolutions,
|
resolutions,
|
||||||
arenas,
|
|
||||||
output_filenames,
|
output_filenames,
|
||||||
crate_name,
|
crate_name,
|
||||||
move |_annotation, _krate| {
|
move |_annotation, _krate| {
|
||||||
@ -1130,7 +1124,6 @@ fn print_with_analysis<'tcx, 'a: 'tcx>(sess: &'a Session,
|
|||||||
analysis: &ty::CrateAnalysis,
|
analysis: &ty::CrateAnalysis,
|
||||||
resolutions: &Resolutions,
|
resolutions: &Resolutions,
|
||||||
crate_name: &str,
|
crate_name: &str,
|
||||||
arenas: &'tcx AllArenas<'tcx>,
|
|
||||||
output_filenames: &OutputFilenames,
|
output_filenames: &OutputFilenames,
|
||||||
ppm: PpMode,
|
ppm: PpMode,
|
||||||
uii: Option<UserIdentifiedItem>,
|
uii: Option<UserIdentifiedItem>,
|
||||||
@ -1147,6 +1140,7 @@ fn print_with_analysis<'tcx, 'a: 'tcx>(sess: &'a Session,
|
|||||||
|
|
||||||
let control = &driver::CompileController::basic();
|
let control = &driver::CompileController::basic();
|
||||||
let codegen_backend = ::get_codegen_backend(sess);
|
let codegen_backend = ::get_codegen_backend(sess);
|
||||||
|
let mut arenas = AllArenas::new();
|
||||||
abort_on_err(driver::phase_3_run_analysis_passes(&*codegen_backend,
|
abort_on_err(driver::phase_3_run_analysis_passes(&*codegen_backend,
|
||||||
control,
|
control,
|
||||||
sess,
|
sess,
|
||||||
@ -1154,7 +1148,7 @@ fn print_with_analysis<'tcx, 'a: 'tcx>(sess: &'a Session,
|
|||||||
hir_map.clone(),
|
hir_map.clone(),
|
||||||
analysis.clone(),
|
analysis.clone(),
|
||||||
resolutions.clone(),
|
resolutions.clone(),
|
||||||
arenas,
|
&mut arenas,
|
||||||
crate_name,
|
crate_name,
|
||||||
output_filenames,
|
output_filenames,
|
||||||
|tcx, _, _, _| {
|
|tcx, _, _, _| {
|
||||||
|
@ -151,7 +151,7 @@ fn test_env_with_pool<F>(
|
|||||||
).expect("phase 2 aborted")
|
).expect("phase 2 aborted")
|
||||||
};
|
};
|
||||||
|
|
||||||
let arenas = ty::AllArenas::new();
|
let mut arenas = ty::AllArenas::new();
|
||||||
let hir_map = hir_map::map_crate(&sess, &cstore, &mut hir_forest, &defs);
|
let hir_map = hir_map::map_crate(&sess, &cstore, &mut hir_forest, &defs);
|
||||||
|
|
||||||
// Run just enough stuff to build a tcx.
|
// Run just enough stuff to build a tcx.
|
||||||
@ -168,7 +168,7 @@ fn test_env_with_pool<F>(
|
|||||||
&cstore,
|
&cstore,
|
||||||
ty::query::Providers::default(),
|
ty::query::Providers::default(),
|
||||||
ty::query::Providers::default(),
|
ty::query::Providers::default(),
|
||||||
&arenas,
|
&mut arenas,
|
||||||
resolutions,
|
resolutions,
|
||||||
hir_map,
|
hir_map,
|
||||||
OnDiskCache::new_empty(sess.source_map()),
|
OnDiskCache::new_empty(sess.source_map()),
|
||||||
|
@ -485,7 +485,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
|
|||||||
glob_map: if resolver.make_glob_map { Some(resolver.glob_map.clone()) } else { None },
|
glob_map: if resolver.make_glob_map { Some(resolver.glob_map.clone()) } else { None },
|
||||||
};
|
};
|
||||||
|
|
||||||
let arenas = AllArenas::new();
|
let mut arenas = AllArenas::new();
|
||||||
let hir_map = hir_map::map_crate(&sess, &*cstore, &mut hir_forest, &defs);
|
let hir_map = hir_map::map_crate(&sess, &*cstore, &mut hir_forest, &defs);
|
||||||
let output_filenames = driver::build_output_filenames(&input,
|
let output_filenames = driver::build_output_filenames(&input,
|
||||||
&None,
|
&None,
|
||||||
@ -501,7 +501,7 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt
|
|||||||
hir_map,
|
hir_map,
|
||||||
analysis,
|
analysis,
|
||||||
resolutions,
|
resolutions,
|
||||||
&arenas,
|
&mut arenas,
|
||||||
&name,
|
&name,
|
||||||
&output_filenames,
|
&output_filenames,
|
||||||
|tcx, analysis, _, result| {
|
|tcx, analysis, _, result| {
|
||||||
|
Loading…
Reference in New Issue
Block a user