bring TyCtxt into scope
This commit is contained in:
parent
d3bbce79d0
commit
2bde6949f9
11 changed files with 31 additions and 31 deletions
|
@ -13,7 +13,7 @@ use hir::def_id::DefId;
|
|||
use hir::map::DefPathHash;
|
||||
use ich::{self, CachingCodemapView};
|
||||
use session::config::DebugInfoLevel::NoDebugInfo;
|
||||
use ty;
|
||||
use ty::TyCtxt;
|
||||
use util::nodemap::{NodeMap, ItemLocalMap};
|
||||
|
||||
use std::hash as std_hash;
|
||||
|
@ -34,7 +34,7 @@ use rustc_data_structures::accumulate_vec::AccumulateVec;
|
|||
/// a reference to the TyCtxt) and it holds a few caches for speeding up various
|
||||
/// things (e.g. each DefId/DefPath is only hashed once).
|
||||
pub struct StableHashingContext<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
|
||||
tcx: ty::TyCtxt<'a, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'a, 'gcx, 'tcx>,
|
||||
codemap: CachingCodemapView<'gcx>,
|
||||
hash_spans: bool,
|
||||
hash_bodies: bool,
|
||||
|
@ -53,7 +53,7 @@ pub enum NodeIdHashingMode {
|
|||
|
||||
impl<'a, 'gcx, 'tcx> StableHashingContext<'a, 'gcx, 'tcx> {
|
||||
|
||||
pub fn new(tcx: ty::TyCtxt<'a, 'gcx, 'tcx>) -> Self {
|
||||
pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Self {
|
||||
let hash_spans_initial = tcx.sess.opts.debuginfo != NoDebugInfo;
|
||||
let check_overflow_initial = tcx.sess.overflow_checks();
|
||||
|
||||
|
@ -111,7 +111,7 @@ impl<'a, 'gcx, 'tcx> StableHashingContext<'a, 'gcx, 'tcx> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
pub fn tcx(&self) -> ty::TyCtxt<'a, 'gcx, 'tcx> {
|
||||
pub fn tcx(&self) -> TyCtxt<'a, 'gcx, 'tcx> {
|
||||
self.tcx
|
||||
}
|
||||
|
||||
|
|
|
@ -340,7 +340,7 @@ language_item_table! {
|
|||
DebugTraitLangItem, "debug_trait", debug_trait;
|
||||
}
|
||||
|
||||
impl<'a, 'tcx, 'gcx> ty::TyCtxt<'a, 'tcx, 'gcx> {
|
||||
impl<'a, 'tcx, 'gcx> TyCtxt<'a, 'tcx, 'gcx> {
|
||||
pub fn require_lang_item(&self, lang_item: LangItem) -> DefId {
|
||||
self.lang_items().require(lang_item).unwrap_or_else(|msg| {
|
||||
self.sess.fatal(&msg)
|
||||
|
|
|
@ -21,7 +21,7 @@ use rustc_data_structures::control_flow_graph::ControlFlowGraph;
|
|||
use hir::def::CtorKind;
|
||||
use hir::def_id::DefId;
|
||||
use ty::subst::{Subst, Substs};
|
||||
use ty::{self, AdtDef, ClosureSubsts, Region, Ty, GeneratorInterior};
|
||||
use ty::{self, AdtDef, ClosureSubsts, Region, Ty, TyCtxt, GeneratorInterior};
|
||||
use ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};
|
||||
use util::ppaux;
|
||||
use rustc_back::slice;
|
||||
|
@ -644,7 +644,7 @@ impl<'tcx> Terminator<'tcx> {
|
|||
}
|
||||
|
||||
impl<'tcx> TerminatorKind<'tcx> {
|
||||
pub fn if_<'a, 'gcx>(tcx: ty::TyCtxt<'a, 'gcx, 'tcx>, cond: Operand<'tcx>,
|
||||
pub fn if_<'a, 'gcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, cond: Operand<'tcx>,
|
||||
t: BasicBlock, f: BasicBlock) -> TerminatorKind<'tcx> {
|
||||
static BOOL_SWITCH_FALSE: &'static [ConstInt] = &[ConstInt::U8(0)];
|
||||
TerminatorKind::SwitchInt {
|
||||
|
@ -1182,7 +1182,7 @@ impl<'tcx> Debug for Operand<'tcx> {
|
|||
|
||||
impl<'tcx> Operand<'tcx> {
|
||||
pub fn function_handle<'a>(
|
||||
tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
def_id: DefId,
|
||||
substs: &'tcx Substs<'tcx>,
|
||||
span: Span,
|
||||
|
|
|
@ -386,7 +386,7 @@ impl Integer {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn to_ty<'a, 'tcx>(&self, tcx: &ty::TyCtxt<'a, 'tcx, 'tcx>,
|
||||
pub fn to_ty<'a, 'tcx>(&self, tcx: &TyCtxt<'a, 'tcx, 'tcx>,
|
||||
signed: bool) -> Ty<'tcx> {
|
||||
match (*self, signed) {
|
||||
(I1, false) => tcx.types.u8,
|
||||
|
|
|
@ -14,7 +14,7 @@ use isolated_encoder::IsolatedEncoder;
|
|||
use schema::*;
|
||||
|
||||
use rustc::hir;
|
||||
use rustc::ty;
|
||||
use rustc::ty::{self, TyCtxt};
|
||||
|
||||
#[derive(RustcEncodable, RustcDecodable)]
|
||||
pub struct Ast<'tcx> {
|
||||
|
@ -59,7 +59,7 @@ impl<'a, 'b, 'tcx> IsolatedEncoder<'a, 'b, 'tcx> {
|
|||
}
|
||||
|
||||
struct NestedBodyCollector<'a, 'tcx: 'a> {
|
||||
tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
bodies_found: Vec<&'tcx hir::Body>,
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
use build::CFG;
|
||||
use rustc::middle::region;
|
||||
use rustc::mir::*;
|
||||
use rustc::ty;
|
||||
use rustc::ty::TyCtxt;
|
||||
|
||||
impl<'tcx> CFG<'tcx> {
|
||||
pub fn block_data(&self, blk: BasicBlock) -> &BasicBlockData<'tcx> {
|
||||
|
@ -46,7 +46,7 @@ impl<'tcx> CFG<'tcx> {
|
|||
}
|
||||
|
||||
pub fn push_end_region<'a, 'gcx:'a+'tcx>(&mut self,
|
||||
tcx: ty::TyCtxt<'a, 'gcx, 'tcx>,
|
||||
tcx: TyCtxt<'a, 'gcx, 'tcx>,
|
||||
block: BasicBlock,
|
||||
source_info: SourceInfo,
|
||||
region_scope: region::Scope) {
|
||||
|
|
|
@ -14,7 +14,7 @@ use rustc::infer;
|
|||
use rustc::middle::const_val::ConstVal;
|
||||
use rustc::mir::*;
|
||||
use rustc::mir::transform::MirSource;
|
||||
use rustc::ty::{self, Ty};
|
||||
use rustc::ty::{self, Ty, TyCtxt};
|
||||
use rustc::ty::subst::{Kind, Subst, Substs};
|
||||
use rustc::ty::maps::Providers;
|
||||
use rustc_const_math::{ConstInt, ConstUsize};
|
||||
|
@ -36,7 +36,7 @@ pub fn provide(providers: &mut Providers) {
|
|||
providers.mir_shims = make_shim;
|
||||
}
|
||||
|
||||
fn make_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
|
||||
fn make_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
instance: ty::InstanceDef<'tcx>)
|
||||
-> &'tcx Mir<'tcx>
|
||||
{
|
||||
|
@ -154,7 +154,7 @@ fn local_decls_for_sig<'tcx>(sig: &ty::FnSig<'tcx>, span: Span)
|
|||
.collect()
|
||||
}
|
||||
|
||||
fn build_drop_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
|
||||
fn build_drop_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
def_id: DefId,
|
||||
ty: Option<Ty<'tcx>>)
|
||||
-> Mir<'tcx>
|
||||
|
@ -235,7 +235,7 @@ fn build_drop_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
|
|||
pub struct DropShimElaborator<'a, 'tcx: 'a> {
|
||||
pub mir: &'a Mir<'tcx>,
|
||||
pub patch: MirPatch<'tcx>,
|
||||
pub tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
|
||||
pub tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
pub param_env: ty::ParamEnv<'tcx>,
|
||||
}
|
||||
|
||||
|
@ -250,7 +250,7 @@ impl<'a, 'tcx> DropElaborator<'a, 'tcx> for DropShimElaborator<'a, 'tcx> {
|
|||
|
||||
fn patch(&mut self) -> &mut MirPatch<'tcx> { &mut self.patch }
|
||||
fn mir(&self) -> &'a Mir<'tcx> { self.mir }
|
||||
fn tcx(&self) -> ty::TyCtxt<'a, 'tcx, 'tcx> { self.tcx }
|
||||
fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> { self.tcx }
|
||||
fn param_env(&self) -> ty::ParamEnv<'tcx> { self.param_env }
|
||||
|
||||
fn drop_style(&self, _path: Self::Path, mode: DropFlagMode) -> DropStyle {
|
||||
|
@ -280,7 +280,7 @@ impl<'a, 'tcx> DropElaborator<'a, 'tcx> for DropShimElaborator<'a, 'tcx> {
|
|||
}
|
||||
|
||||
/// Build a `Clone::clone` shim for `self_ty`. Here, `def_id` is `Clone::clone`.
|
||||
fn build_clone_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
|
||||
fn build_clone_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
def_id: DefId,
|
||||
self_ty: ty::Ty<'tcx>)
|
||||
-> Mir<'tcx>
|
||||
|
@ -306,7 +306,7 @@ fn build_clone_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
|
|||
}
|
||||
|
||||
struct CloneShimBuilder<'a, 'tcx: 'a> {
|
||||
tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
def_id: DefId,
|
||||
local_decls: IndexVec<Local, LocalDecl<'tcx>>,
|
||||
blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>,
|
||||
|
@ -315,7 +315,7 @@ struct CloneShimBuilder<'a, 'tcx: 'a> {
|
|||
}
|
||||
|
||||
impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> {
|
||||
fn new(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Self {
|
||||
fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Self {
|
||||
let sig = tcx.fn_sig(def_id);
|
||||
let sig = tcx.erase_late_bound_regions(&sig);
|
||||
let span = tcx.def_span(def_id);
|
||||
|
@ -666,7 +666,7 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> {
|
|||
///
|
||||
/// If `untuple_args` is a vec of types, the second argument of the
|
||||
/// function will be untupled as these types.
|
||||
fn build_call_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
|
||||
fn build_call_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
def_id: DefId,
|
||||
rcvr_adjustment: Adjustment,
|
||||
call_kind: CallKind,
|
||||
|
|
|
@ -192,7 +192,7 @@ impl<'a, 'b, 'tcx> DropElaborator<'a, 'tcx> for Elaborator<'a, 'b, 'tcx> {
|
|||
self.ctxt.mir
|
||||
}
|
||||
|
||||
fn tcx(&self) -> ty::TyCtxt<'a, 'tcx, 'tcx> {
|
||||
fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> {
|
||||
self.ctxt.tcx
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ use rustc::hir;
|
|||
use rustc::mir::*;
|
||||
use rustc::middle::const_val::{ConstInt, ConstVal};
|
||||
use rustc::middle::lang_items;
|
||||
use rustc::ty::{self, Ty};
|
||||
use rustc::ty::{self, Ty, TyCtxt};
|
||||
use rustc::ty::subst::{Kind, Substs};
|
||||
use rustc::ty::util::IntTypeExt;
|
||||
use rustc_data_structures::indexed_vec::Idx;
|
||||
|
@ -84,7 +84,7 @@ pub trait DropElaborator<'a, 'tcx: 'a> : fmt::Debug {
|
|||
|
||||
fn patch(&mut self) -> &mut MirPatch<'tcx>;
|
||||
fn mir(&self) -> &'a Mir<'tcx>;
|
||||
fn tcx(&self) -> ty::TyCtxt<'a, 'tcx, 'tcx>;
|
||||
fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx>;
|
||||
fn param_env(&self) -> ty::ParamEnv<'tcx>;
|
||||
|
||||
fn drop_style(&self, path: Self::Path, mode: DropFlagMode) -> DropStyle;
|
||||
|
@ -133,7 +133,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
|
|||
lvalue.ty(self.elaborator.mir(), self.tcx()).to_ty(self.tcx())
|
||||
}
|
||||
|
||||
fn tcx(&self) -> ty::TyCtxt<'b, 'tcx, 'tcx> {
|
||||
fn tcx(&self) -> TyCtxt<'b, 'tcx, 'tcx> {
|
||||
self.elaborator.tcx()
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ use super::FnCtxt;
|
|||
use middle::expr_use_visitor as euv;
|
||||
use middle::mem_categorization as mc;
|
||||
use middle::mem_categorization::Categorization;
|
||||
use rustc::ty::{self, Ty};
|
||||
use rustc::ty::{self, Ty, TyCtxt};
|
||||
use rustc::infer::UpvarRegion;
|
||||
use syntax::ast;
|
||||
use syntax_pos::Span;
|
||||
|
@ -586,7 +586,7 @@ impl<'a, 'gcx, 'tcx> euv::Delegate<'tcx> for InferBorrowKind<'a, 'gcx, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
fn var_name(tcx: ty::TyCtxt, var_hir_id: hir::HirId) -> ast::Name {
|
||||
fn var_name(tcx: TyCtxt, var_hir_id: hir::HirId) -> ast::Name {
|
||||
let var_node_id = tcx.hir.hir_to_node_id(var_hir_id);
|
||||
tcx.hir.name(var_node_id)
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use rustc::ty::{self, Ty};
|
||||
use rustc::ty::{self, Ty, TyCtxt};
|
||||
use rustc::ty::fold::{TypeFoldable, TypeVisitor};
|
||||
use rustc::util::nodemap::FxHashSet;
|
||||
|
||||
|
@ -86,7 +86,7 @@ impl<'tcx> TypeVisitor<'tcx> for ParameterCollector {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn identify_constrained_type_params<'tcx>(tcx: ty::TyCtxt,
|
||||
pub fn identify_constrained_type_params<'tcx>(tcx: TyCtxt,
|
||||
predicates: &[ty::Predicate<'tcx>],
|
||||
impl_trait_ref: Option<ty::TraitRef<'tcx>>,
|
||||
input_parameters: &mut FxHashSet<Parameter>)
|
||||
|
@ -136,7 +136,7 @@ pub fn identify_constrained_type_params<'tcx>(tcx: ty::TyCtxt,
|
|||
/// which is determined by 1, which requires `U`, that is determined
|
||||
/// by 0. I should probably pick a less tangled example, but I can't
|
||||
/// think of any.
|
||||
pub fn setup_constraining_predicates<'tcx>(tcx: ty::TyCtxt,
|
||||
pub fn setup_constraining_predicates<'tcx>(tcx: TyCtxt,
|
||||
predicates: &mut [ty::Predicate<'tcx>],
|
||||
impl_trait_ref: Option<ty::TraitRef<'tcx>>,
|
||||
input_parameters: &mut FxHashSet<Parameter>)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue