rustc: Split 'tcx into 'gcx and 'tcx for InferCtxt and its users.
This commit is contained in:
parent
166dbc3273
commit
76affa5d6f
160 changed files with 1296 additions and 1189 deletions
|
|
@ -367,7 +367,7 @@ pub struct CompileState<'a, 'b, 'ast: 'a, 'tcx: 'b> where 'ast: 'tcx {
|
|||
pub resolutions: Option<&'a Resolutions>,
|
||||
pub mir_map: Option<&'b MirMap<'tcx>>,
|
||||
pub analysis: Option<&'a ty::CrateAnalysis<'a>>,
|
||||
pub tcx: Option<TyCtxt<'b, 'tcx>>,
|
||||
pub tcx: Option<TyCtxt<'b, 'tcx, 'tcx>>,
|
||||
pub trans: Option<&'a trans::CrateTranslation>,
|
||||
}
|
||||
|
||||
|
|
@ -464,7 +464,7 @@ impl<'a, 'b, 'ast, 'tcx> CompileState<'a, 'b, 'ast, 'tcx> {
|
|||
hir_crate: &'a hir::Crate,
|
||||
analysis: &'a ty::CrateAnalysis<'a>,
|
||||
mir_map: Option<&'b MirMap<'tcx>>,
|
||||
tcx: TyCtxt<'b, 'tcx>,
|
||||
tcx: TyCtxt<'b, 'tcx, 'tcx>,
|
||||
crate_name: &'a str)
|
||||
-> CompileState<'a, 'b, 'ast, 'tcx> {
|
||||
CompileState {
|
||||
|
|
@ -817,7 +817,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
|
|||
name: &str,
|
||||
f: F)
|
||||
-> Result<R, usize>
|
||||
where F: for<'a> FnOnce(TyCtxt<'a, 'tcx>,
|
||||
where F: for<'a> FnOnce(TyCtxt<'a, 'tcx, 'tcx>,
|
||||
Option<MirMap<'tcx>>,
|
||||
ty::CrateAnalysis,
|
||||
CompileResult) -> R
|
||||
|
|
@ -992,7 +992,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
|
|||
}
|
||||
|
||||
/// Run the translation phase to LLVM, after which the AST and analysis can
|
||||
pub fn phase_4_translate_to_llvm<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx>,
|
||||
pub fn phase_4_translate_to_llvm<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
mut mir_map: MirMap<'tcx>,
|
||||
analysis: ty::CrateAnalysis)
|
||||
-> trans::CrateTranslation {
|
||||
|
|
|
|||
|
|
@ -469,7 +469,7 @@ impl<'ast> pprust::PpAnn for HygieneAnnotation<'ast> {
|
|||
|
||||
|
||||
struct TypedAnnotation<'a, 'tcx: 'a> {
|
||||
tcx: TyCtxt<'a, 'tcx>,
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
}
|
||||
|
||||
impl<'b, 'tcx> HirPrinterSupport<'tcx> for TypedAnnotation<'b, 'tcx> {
|
||||
|
|
@ -690,7 +690,7 @@ impl fold::Folder for ReplaceBodyWithLoop {
|
|||
}
|
||||
|
||||
fn print_flowgraph<'a, 'tcx, W: Write>(variants: Vec<borrowck_dot::Variant>,
|
||||
tcx: TyCtxt<'a, 'tcx>,
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
mir_map: Option<&MirMap<'tcx>>,
|
||||
code: blocks::Code,
|
||||
mode: PpFlowGraphMode,
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ use syntax::feature_gate::UnstableFeatures;
|
|||
use rustc::hir;
|
||||
|
||||
struct Env<'a, 'tcx: 'a> {
|
||||
infcx: &'a infer::InferCtxt<'a, 'tcx>,
|
||||
infcx: &'a infer::InferCtxt<'a, 'tcx, 'tcx>,
|
||||
}
|
||||
|
||||
struct RH<'a> {
|
||||
|
|
@ -160,7 +160,7 @@ fn test_env<F>(source_string: &str,
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> Env<'a, 'tcx> {
|
||||
pub fn tcx(&self) -> TyCtxt<'a, 'tcx> {
|
||||
pub fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> {
|
||||
self.infcx.tcx
|
||||
}
|
||||
|
||||
|
|
@ -354,25 +354,25 @@ impl<'a, 'tcx> Env<'a, 'tcx> {
|
|||
infer::TypeTrace::dummy(self.tcx())
|
||||
}
|
||||
|
||||
pub fn sub(&self, t1: &Ty<'tcx>, t2: &Ty<'tcx>) -> InferResult<'tcx, Ty<'tcx>> {
|
||||
pub fn sub(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) -> InferResult<'tcx, Ty<'tcx>> {
|
||||
let trace = self.dummy_type_trace();
|
||||
self.infcx.sub(true, trace, t1, t2)
|
||||
self.infcx.sub(true, trace, &t1, &t2)
|
||||
}
|
||||
|
||||
pub fn lub(&self, t1: &Ty<'tcx>, t2: &Ty<'tcx>) -> InferResult<'tcx, Ty<'tcx>> {
|
||||
pub fn lub(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) -> InferResult<'tcx, Ty<'tcx>> {
|
||||
let trace = self.dummy_type_trace();
|
||||
self.infcx.lub(true, trace, t1, t2)
|
||||
self.infcx.lub(true, trace, &t1, &t2)
|
||||
}
|
||||
|
||||
pub fn glb(&self, t1: &Ty<'tcx>, t2: &Ty<'tcx>) -> InferResult<'tcx, Ty<'tcx>> {
|
||||
pub fn glb(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) -> InferResult<'tcx, Ty<'tcx>> {
|
||||
let trace = self.dummy_type_trace();
|
||||
self.infcx.glb(true, trace, t1, t2)
|
||||
self.infcx.glb(true, trace, &t1, &t2)
|
||||
}
|
||||
|
||||
/// Checks that `t1 <: t2` is true (this may register additional
|
||||
/// region checks).
|
||||
pub fn check_sub(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) {
|
||||
match self.sub(&t1, &t2) {
|
||||
match self.sub(t1, t2) {
|
||||
Ok(InferOk { obligations, .. }) => {
|
||||
// FIXME(#32730) once obligations are being propagated, assert the right thing.
|
||||
assert!(obligations.is_empty());
|
||||
|
|
@ -386,7 +386,7 @@ impl<'a, 'tcx> Env<'a, 'tcx> {
|
|||
/// Checks that `t1 <: t2` is false (this may register additional
|
||||
/// region checks).
|
||||
pub fn check_not_sub(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) {
|
||||
match self.sub(&t1, &t2) {
|
||||
match self.sub(t1, t2) {
|
||||
Err(_) => {}
|
||||
Ok(_) => {
|
||||
panic!("unexpected success computing sub({:?},{:?})", t1, t2);
|
||||
|
|
@ -396,7 +396,7 @@ impl<'a, 'tcx> Env<'a, 'tcx> {
|
|||
|
||||
/// Checks that `LUB(t1,t2) == t_lub`
|
||||
pub fn check_lub(&self, t1: Ty<'tcx>, t2: Ty<'tcx>, t_lub: Ty<'tcx>) {
|
||||
match self.lub(&t1, &t2) {
|
||||
match self.lub(t1, t2) {
|
||||
Ok(InferOk { obligations, value: t }) => {
|
||||
// FIXME(#32730) once obligations are being propagated, assert the right thing.
|
||||
assert!(obligations.is_empty());
|
||||
|
|
@ -412,7 +412,7 @@ impl<'a, 'tcx> Env<'a, 'tcx> {
|
|||
/// Checks that `GLB(t1,t2) == t_glb`
|
||||
pub fn check_glb(&self, t1: Ty<'tcx>, t2: Ty<'tcx>, t_glb: Ty<'tcx>) {
|
||||
debug!("check_glb(t1={}, t2={}, t_glb={})", t1, t2, t_glb);
|
||||
match self.glb(&t1, &t2) {
|
||||
match self.glb(t1, t2) {
|
||||
Err(e) => {
|
||||
panic!("unexpected error computing LUB: {:?}", e)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue