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;
/// 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,
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();
}
#[inline]
- pub fn tcx(&self) -> ty::TyCtxt<'a, 'gcx, 'tcx> {
+ pub fn tcx(&self) -> TyCtxt<'a, 'gcx, 'tcx> {
self.tcx
}
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)
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;
}
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 {
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,
}
}
- 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,
use schema::*;
use rustc::hir;
-use rustc::ty;
+use rustc::ty::{self, TyCtxt};
#[derive(RustcEncodable, RustcDecodable)]
pub struct Ast<'tcx> {
}
struct NestedBodyCollector<'a, 'tcx: 'a> {
- tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
+ tcx: TyCtxt<'a, 'tcx, 'tcx>,
bodies_found: Vec<&'tcx hir::Body>,
}
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> {
}
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) {
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};
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>
{
.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>
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>,
}
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 {
}
/// 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>
}
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>>,
}
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);
///
/// 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,
self.ctxt.mir
}
- fn tcx(&self) -> ty::TyCtxt<'a, 'tcx, 'tcx> {
+ fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> {
self.ctxt.tcx
}
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;
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;
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()
}
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;
}
}
-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)
}
// 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;
}
}
-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>)
/// 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>)