Auto merge of #31979 - jseyfried:rename_ctxt, r=eddyb

r? @eddyb
This commit is contained in:
bors 2016-03-03 10:22:41 +00:00
commit f6e125f04a
131 changed files with 703 additions and 706 deletions

View File

@ -10,7 +10,7 @@
use self::thread::{DepGraphThreadData, DepMessage};
use middle::def_id::DefId;
use middle::ty;
use middle::ty::TyCtxt;
use rustc_front::hir;
use rustc_front::intravisit::Visitor;
use std::rc::Rc;
@ -181,13 +181,13 @@ pub use self::query::DepGraphQuery;
/// read edge from the corresponding AST node. This is used in
/// compiler passes to automatically record the item that they are
/// working on.
pub fn visit_all_items_in_krate<'tcx,V,F>(tcx: &ty::ctxt<'tcx>,
pub fn visit_all_items_in_krate<'tcx,V,F>(tcx: &TyCtxt<'tcx>,
mut dep_node_fn: F,
visitor: &mut V)
where F: FnMut(DefId) -> DepNode, V: Visitor<'tcx>
{
struct TrackingVisitor<'visit, 'tcx: 'visit, F: 'visit, V: 'visit> {
tcx: &'visit ty::ctxt<'tcx>,
tcx: &'visit TyCtxt<'tcx>,
dep_node_fn: &'visit mut F,
visitor: &'visit mut V
}

View File

@ -27,7 +27,7 @@ use self::TargetLint::*;
use dep_graph::DepNode;
use middle::privacy::AccessLevels;
use middle::ty;
use middle::ty::TyCtxt;
use session::{config, early_error, Session};
use lint::{Level, LevelSource, Lint, LintId, LintArray, LintPass};
use lint::{EarlyLintPass, EarlyLintPassObject, LateLintPass, LateLintPassObject};
@ -298,7 +298,7 @@ impl LintStore {
/// Context for lint checking after type checking.
pub struct LateContext<'a, 'tcx: 'a> {
/// Type context we're checking in.
pub tcx: &'a ty::ctxt<'tcx>,
pub tcx: &'a TyCtxt<'tcx>,
/// The crate being checked.
pub krate: &'a hir::Crate,
@ -662,7 +662,7 @@ impl<'a> EarlyContext<'a> {
}
impl<'a, 'tcx> LateContext<'a, 'tcx> {
fn new(tcx: &'a ty::ctxt<'tcx>,
fn new(tcx: &'a TyCtxt<'tcx>,
krate: &'a hir::Crate,
access_levels: &'a AccessLevels) -> LateContext<'a, 'tcx> {
// We want to own the lint store, so move it out of the session.
@ -1249,7 +1249,7 @@ fn check_lint_name_cmdline(sess: &Session, lint_cx: &LintStore,
/// Perform lint checking on a crate.
///
/// Consumes the `lint_store` field of the `Session`.
pub fn check_crate(tcx: &ty::ctxt, access_levels: &AccessLevels) {
pub fn check_crate(tcx: &TyCtxt, access_levels: &AccessLevels) {
let _task = tcx.dep_graph.in_task(DepNode::LateLintCheck);
let krate = tcx.map.krate();

View File

@ -15,12 +15,12 @@
*/
use middle::def::Def;
use middle::ty::{self, Ty};
use middle::ty::{Ty, TyCtxt};
use syntax::codemap::Span;
use rustc_front::hir as ast;
pub fn prohibit_type_params(tcx: &ty::ctxt, segments: &[ast::PathSegment]) {
pub fn prohibit_type_params(tcx: &TyCtxt, segments: &[ast::PathSegment]) {
for segment in segments {
for typ in segment.parameters.types() {
span_err!(tcx.sess, typ.span, E0109,
@ -39,13 +39,13 @@ pub fn prohibit_type_params(tcx: &ty::ctxt, segments: &[ast::PathSegment]) {
}
}
pub fn prohibit_projection(tcx: &ty::ctxt, span: Span)
pub fn prohibit_projection(tcx: &TyCtxt, span: Span)
{
span_err!(tcx.sess, span, E0229,
"associated type bindings are not allowed here");
}
pub fn prim_ty_to_ty<'tcx>(tcx: &ty::ctxt<'tcx>,
pub fn prim_ty_to_ty<'tcx>(tcx: &TyCtxt<'tcx>,
segments: &[ast::PathSegment],
nty: ast::PrimTy)
-> Ty<'tcx> {
@ -62,7 +62,7 @@ pub fn prim_ty_to_ty<'tcx>(tcx: &ty::ctxt<'tcx>,
/// If a type in the AST is a primitive type, return the ty::Ty corresponding
/// to it.
pub fn ast_ty_to_prim_ty<'tcx>(tcx: &ty::ctxt<'tcx>, ast_ty: &ast::Ty)
pub fn ast_ty_to_prim_ty<'tcx>(tcx: &TyCtxt<'tcx>, ast_ty: &ast::Ty)
-> Option<Ty<'tcx>> {
if let ast::TyPath(None, ref path) = ast_ty.node {
let def = match tcx.def_map.borrow().get(&ast_ty.id) {

View File

@ -12,14 +12,14 @@ use rustc_data_structures::graph;
use middle::cfg::*;
use middle::def::Def;
use middle::pat_util;
use middle::ty;
use middle::ty::{self, TyCtxt};
use syntax::ast;
use syntax::ptr::P;
use rustc_front::hir::{self, PatKind};
struct CFGBuilder<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
graph: CFGGraph,
fn_exit: CFGIndex,
loop_scopes: Vec<LoopScope>,
@ -32,7 +32,7 @@ struct LoopScope {
break_index: CFGIndex, // where to go on a `break
}
pub fn construct(tcx: &ty::ctxt,
pub fn construct(tcx: &TyCtxt,
blk: &hir::Block) -> CFG {
let mut graph = graph::Graph::new();
let entry = graph.add_node(CFGNodeData::Entry);

View File

@ -12,7 +12,7 @@
//! Uses `Graph` as the underlying representation.
use rustc_data_structures::graph;
use middle::ty;
use middle::ty::TyCtxt;
use syntax::ast;
use rustc_front::hir;
@ -58,7 +58,7 @@ pub type CFGNode = graph::Node<CFGNodeData>;
pub type CFGEdge = graph::Edge<CFGEdgeData>;
impl CFG {
pub fn new(tcx: &ty::ctxt,
pub fn new(tcx: &TyCtxt,
blk: &hir::Block) -> CFG {
construct::construct(tcx, blk)
}

View File

@ -107,7 +107,7 @@ impl<'a> FromIterator<Vec<&'a Pat>> for Matrix<'a> {
//NOTE: appears to be the only place other then InferCtxt to contain a ParamEnv
pub struct MatchCheckCtxt<'a, 'tcx: 'a> {
pub tcx: &'a ty::ctxt<'tcx>,
pub tcx: &'a TyCtxt<'tcx>,
pub param_env: ParameterEnvironment<'a, 'tcx>,
}
@ -154,7 +154,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for MatchCheckCtxt<'a, 'tcx> {
}
}
pub fn check_crate(tcx: &ty::ctxt) {
pub fn check_crate(tcx: &TyCtxt) {
tcx.visit_all_items_in_krate(DepNode::MatchCheck, &mut MatchCheckCtxt {
tcx: tcx,
param_env: tcx.empty_parameter_environment(),
@ -433,13 +433,13 @@ fn const_val_to_expr(value: &ConstVal) -> P<hir::Expr> {
}
pub struct StaticInliner<'a, 'tcx: 'a> {
pub tcx: &'a ty::ctxt<'tcx>,
pub tcx: &'a TyCtxt<'tcx>,
pub failed: bool,
pub renaming_map: Option<&'a mut FnvHashMap<(NodeId, Span), NodeId>>,
}
impl<'a, 'tcx> StaticInliner<'a, 'tcx> {
pub fn new<'b>(tcx: &'b ty::ctxt<'tcx>,
pub fn new<'b>(tcx: &'b TyCtxt<'tcx>,
renaming_map: Option<&'b mut FnvHashMap<(NodeId, Span), NodeId>>)
-> StaticInliner<'b, 'tcx> {
StaticInliner {

View File

@ -22,7 +22,7 @@ use middle::def::Def;
use middle::subst::Subst;
use middle::def_id::DefId;
use middle::pat_util::def_to_path;
use middle::ty::{self, Ty};
use middle::ty::{self, Ty, TyCtxt};
use middle::astconv_util::ast_ty_to_prim_ty;
use util::num::ToPrimitive;
use util::nodemap::NodeMap;
@ -46,7 +46,7 @@ use std::mem::transmute;
use std::{i8, i16, i32, i64, u8, u16, u32, u64};
use std::rc::Rc;
fn lookup_variant_by_id<'a>(tcx: &'a ty::ctxt,
fn lookup_variant_by_id<'a>(tcx: &'a TyCtxt,
enum_def: DefId,
variant_def: DefId)
-> Option<&'a Expr> {
@ -84,7 +84,7 @@ fn lookup_variant_by_id<'a>(tcx: &'a ty::ctxt,
/// `maybe_ref_id` and `param_substs` are optional and are used for
/// finding substitutions in associated constants. This generally
/// happens in late/trans const evaluation.
pub fn lookup_const_by_id<'a, 'tcx: 'a>(tcx: &'a ty::ctxt<'tcx>,
pub fn lookup_const_by_id<'a, 'tcx: 'a>(tcx: &'a TyCtxt<'tcx>,
def_id: DefId,
maybe_ref_id: Option<ast::NodeId>,
param_substs: Option<&'tcx subst::Substs<'tcx>>)
@ -189,7 +189,7 @@ pub fn lookup_const_by_id<'a, 'tcx: 'a>(tcx: &'a ty::ctxt<'tcx>,
}
}
fn inline_const_fn_from_external_crate(tcx: &ty::ctxt, def_id: DefId)
fn inline_const_fn_from_external_crate(tcx: &TyCtxt, def_id: DefId)
-> Option<ast::NodeId> {
match tcx.extern_const_fns.borrow().get(&def_id) {
Some(&ast::DUMMY_NODE_ID) => return None,
@ -212,7 +212,7 @@ fn inline_const_fn_from_external_crate(tcx: &ty::ctxt, def_id: DefId)
fn_id
}
pub fn lookup_const_fn_by_id<'tcx>(tcx: &ty::ctxt<'tcx>, def_id: DefId)
pub fn lookup_const_fn_by_id<'tcx>(tcx: &TyCtxt<'tcx>, def_id: DefId)
-> Option<FnLikeNode<'tcx>>
{
let fn_id = if let Some(node_id) = tcx.map.as_local_node_id(def_id) {
@ -322,7 +322,7 @@ impl ConstVal {
}
}
pub fn const_expr_to_pat(tcx: &ty::ctxt, expr: &Expr, span: Span) -> P<hir::Pat> {
pub fn const_expr_to_pat(tcx: &TyCtxt, expr: &Expr, span: Span) -> P<hir::Pat> {
let pat = match expr.node {
hir::ExprTup(ref exprs) =>
PatKind::Tup(exprs.iter().map(|expr| const_expr_to_pat(tcx, &expr, span)).collect()),
@ -382,7 +382,7 @@ pub fn const_expr_to_pat(tcx: &ty::ctxt, expr: &Expr, span: Span) -> P<hir::Pat>
P(hir::Pat { id: expr.id, node: pat, span: span })
}
pub fn eval_const_expr(tcx: &ty::ctxt, e: &Expr) -> ConstVal {
pub fn eval_const_expr(tcx: &TyCtxt, e: &Expr) -> ConstVal {
match eval_const_expr_partial(tcx, e, ExprTypeChecked, None) {
Ok(r) => r,
Err(s) => tcx.sess.span_fatal(s.span, &s.description())
@ -542,7 +542,7 @@ pub enum IntTy { I8, I16, I32, I64 }
pub enum UintTy { U8, U16, U32, U64 }
impl IntTy {
pub fn from(tcx: &ty::ctxt, t: ast::IntTy) -> IntTy {
pub fn from(tcx: &TyCtxt, t: ast::IntTy) -> IntTy {
let t = if let ast::IntTy::Is = t {
tcx.sess.target.int_type
} else {
@ -559,7 +559,7 @@ impl IntTy {
}
impl UintTy {
pub fn from(tcx: &ty::ctxt, t: ast::UintTy) -> UintTy {
pub fn from(tcx: &TyCtxt, t: ast::UintTy) -> UintTy {
let t = if let ast::UintTy::Us = t {
tcx.sess.target.uint_type
} else {
@ -810,7 +810,7 @@ pub_fn_checked_op!{ const_uint_checked_shr_via_int(a: u64, b: i64,.. UintTy) {
/// guaranteed to be evaluatable. `ty_hint` is usually ExprTypeChecked,
/// but a few places need to evaluate constants during type-checking, like
/// computing the length of an array. (See also the FIXME above EvalHint.)
pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
pub fn eval_const_expr_partial<'tcx>(tcx: &TyCtxt<'tcx>,
e: &Expr,
ty_hint: EvalHint<'tcx>,
fn_args: FnArgMap) -> EvalResult {
@ -1222,7 +1222,7 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
Ok(result)
}
fn impl_or_trait_container(tcx: &ty::ctxt, def_id: DefId) -> ty::ImplOrTraitItemContainer {
fn impl_or_trait_container(tcx: &TyCtxt, def_id: DefId) -> ty::ImplOrTraitItemContainer {
// This is intended to be equivalent to tcx.impl_or_trait_item(def_id).container()
// for local def_id, but it can be called before tcx.impl_or_trait_items is complete.
if let Some(node_id) = tcx.map.as_local_node_id(def_id) {
@ -1239,7 +1239,7 @@ fn impl_or_trait_container(tcx: &ty::ctxt, def_id: DefId) -> ty::ImplOrTraitItem
panic!("{:?} is not local", def_id);
}
fn resolve_trait_associated_const<'a, 'tcx: 'a>(tcx: &'a ty::ctxt<'tcx>,
fn resolve_trait_associated_const<'a, 'tcx: 'a>(tcx: &'a TyCtxt<'tcx>,
ti: &'tcx hir::TraitItem,
trait_id: DefId,
rcvr_substs: subst::Substs<'tcx>)
@ -1289,7 +1289,7 @@ fn resolve_trait_associated_const<'a, 'tcx: 'a>(tcx: &'a ty::ctxt<'tcx>,
}
}
fn cast_const<'tcx>(tcx: &ty::ctxt<'tcx>, val: ConstVal, ty: Ty) -> CastResult {
fn cast_const<'tcx>(tcx: &TyCtxt<'tcx>, val: ConstVal, ty: Ty) -> CastResult {
macro_rules! convert_val {
($intermediate_ty:ty, $const_type:ident, $target_ty:ty) => {
match val {
@ -1385,7 +1385,7 @@ pub fn compare_const_vals(a: &ConstVal, b: &ConstVal) -> Option<Ordering> {
})
}
pub fn compare_lit_exprs<'tcx>(tcx: &ty::ctxt<'tcx>,
pub fn compare_lit_exprs<'tcx>(tcx: &TyCtxt<'tcx>,
a: &Expr,
b: &Expr) -> Option<Ordering> {
let a = match eval_const_expr_partial(tcx, a, ExprTypeChecked, None) {

View File

@ -26,7 +26,7 @@ use back::svh::Svh;
use front::map as hir_map;
use middle::def::{self, Def};
use middle::lang_items;
use middle::ty::{self, Ty, VariantKind};
use middle::ty::{self, Ty, TyCtxt, VariantKind};
use middle::def_id::{DefId, DefIndex};
use mir::repr::Mir;
use mir::mir_map::MirMap;
@ -137,49 +137,49 @@ pub trait CrateStore<'tcx> : Any {
// item info
fn stability(&self, def: DefId) -> Option<attr::Stability>;
fn deprecation(&self, def: DefId) -> Option<attr::Deprecation>;
fn closure_kind(&self, tcx: &ty::ctxt<'tcx>, def_id: DefId)
fn closure_kind(&self, tcx: &TyCtxt<'tcx>, def_id: DefId)
-> ty::ClosureKind;
fn closure_ty(&self, tcx: &ty::ctxt<'tcx>, def_id: DefId)
fn closure_ty(&self, tcx: &TyCtxt<'tcx>, def_id: DefId)
-> ty::ClosureTy<'tcx>;
fn item_variances(&self, def: DefId) -> ty::ItemVariances;
fn repr_attrs(&self, def: DefId) -> Vec<attr::ReprAttr>;
fn item_type(&self, tcx: &ty::ctxt<'tcx>, def: DefId)
fn item_type(&self, tcx: &TyCtxt<'tcx>, def: DefId)
-> ty::TypeScheme<'tcx>;
fn item_path(&self, def: DefId) -> Vec<hir_map::PathElem>;
fn extern_item_path(&self, def: DefId) -> Vec<hir_map::PathElem>;
fn item_name(&self, def: DefId) -> ast::Name;
fn item_predicates(&self, tcx: &ty::ctxt<'tcx>, def: DefId)
fn item_predicates(&self, tcx: &TyCtxt<'tcx>, def: DefId)
-> ty::GenericPredicates<'tcx>;
fn item_super_predicates(&self, tcx: &ty::ctxt<'tcx>, def: DefId)
fn item_super_predicates(&self, tcx: &TyCtxt<'tcx>, def: DefId)
-> ty::GenericPredicates<'tcx>;
fn item_attrs(&self, def_id: DefId) -> Vec<ast::Attribute>;
fn item_symbol(&self, def: DefId) -> String;
fn trait_def(&self, tcx: &ty::ctxt<'tcx>, def: DefId)-> ty::TraitDef<'tcx>;
fn adt_def(&self, tcx: &ty::ctxt<'tcx>, def: DefId) -> ty::AdtDefMaster<'tcx>;
fn trait_def(&self, tcx: &TyCtxt<'tcx>, def: DefId)-> ty::TraitDef<'tcx>;
fn adt_def(&self, tcx: &TyCtxt<'tcx>, def: DefId) -> ty::AdtDefMaster<'tcx>;
fn method_arg_names(&self, did: DefId) -> Vec<String>;
fn inherent_implementations_for_type(&self, def_id: DefId) -> Vec<DefId>;
// trait info
fn implementations_of_trait(&self, def_id: DefId) -> Vec<DefId>;
fn provided_trait_methods(&self, tcx: &ty::ctxt<'tcx>, def: DefId)
fn provided_trait_methods(&self, tcx: &TyCtxt<'tcx>, def: DefId)
-> Vec<Rc<ty::Method<'tcx>>>;
fn trait_item_def_ids(&self, def: DefId)
-> Vec<ty::ImplOrTraitItemId>;
// impl info
fn impl_items(&self, impl_def_id: DefId) -> Vec<ty::ImplOrTraitItemId>;
fn impl_trait_ref(&self, tcx: &ty::ctxt<'tcx>, def: DefId)
fn impl_trait_ref(&self, tcx: &TyCtxt<'tcx>, def: DefId)
-> Option<ty::TraitRef<'tcx>>;
fn impl_polarity(&self, def: DefId) -> Option<hir::ImplPolarity>;
fn custom_coerce_unsized_kind(&self, def: DefId)
-> Option<ty::adjustment::CustomCoerceUnsized>;
fn associated_consts(&self, tcx: &ty::ctxt<'tcx>, def: DefId)
fn associated_consts(&self, tcx: &TyCtxt<'tcx>, def: DefId)
-> Vec<Rc<ty::AssociatedConst<'tcx>>>;
// trait/impl-item info
fn trait_of_item(&self, tcx: &ty::ctxt<'tcx>, def_id: DefId)
fn trait_of_item(&self, tcx: &TyCtxt<'tcx>, def_id: DefId)
-> Option<DefId>;
fn impl_or_trait_item(&self, tcx: &ty::ctxt<'tcx>, def: DefId)
fn impl_or_trait_item(&self, tcx: &TyCtxt<'tcx>, def: DefId)
-> ty::ImplOrTraitItem<'tcx>;
// flags
@ -187,7 +187,7 @@ pub trait CrateStore<'tcx> : Any {
fn is_defaulted_trait(&self, did: DefId) -> bool;
fn is_impl(&self, did: DefId) -> bool;
fn is_default_impl(&self, impl_did: DefId) -> bool;
fn is_extern_item(&self, tcx: &ty::ctxt<'tcx>, did: DefId) -> bool;
fn is_extern_item(&self, tcx: &TyCtxt<'tcx>, did: DefId) -> bool;
fn is_static_method(&self, did: DefId) -> bool;
fn is_statically_included_foreign_item(&self, id: ast::NodeId) -> bool;
fn is_typedef(&self, did: DefId) -> bool;
@ -219,9 +219,9 @@ pub trait CrateStore<'tcx> : Any {
fn crate_top_level_items(&self, cnum: ast::CrateNum) -> Vec<ChildItem>;
// misc. metadata
fn maybe_get_item_ast(&'tcx self, tcx: &ty::ctxt<'tcx>, def: DefId)
fn maybe_get_item_ast(&'tcx self, tcx: &TyCtxt<'tcx>, def: DefId)
-> FoundAst<'tcx>;
fn maybe_get_item_mir(&self, tcx: &ty::ctxt<'tcx>, def: DefId)
fn maybe_get_item_mir(&self, tcx: &TyCtxt<'tcx>, def: DefId)
-> Option<Mir<'tcx>>;
fn is_item_mir_available(&self, def: DefId) -> bool;
@ -234,12 +234,12 @@ pub trait CrateStore<'tcx> : Any {
// utility functions
fn metadata_filename(&self) -> &str;
fn metadata_section_name(&self, target: &Target) -> &str;
fn encode_type(&self, tcx: &ty::ctxt<'tcx>, ty: Ty<'tcx>) -> Vec<u8>;
fn encode_type(&self, tcx: &TyCtxt<'tcx>, ty: Ty<'tcx>) -> Vec<u8>;
fn used_crates(&self, prefer: LinkagePreference) -> Vec<(ast::CrateNum, Option<PathBuf>)>;
fn used_crate_source(&self, cnum: ast::CrateNum) -> CrateSource;
fn extern_mod_stmt_cnum(&self, emod_id: ast::NodeId) -> Option<ast::CrateNum>;
fn encode_metadata(&self,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
reexports: &def::ExportMap,
item_symbols: &RefCell<NodeMap<String>>,
link_meta: &LinkMeta,
@ -302,33 +302,33 @@ impl<'tcx> CrateStore<'tcx> for DummyCrateStore {
// item info
fn stability(&self, def: DefId) -> Option<attr::Stability> { unimplemented!() }
fn deprecation(&self, def: DefId) -> Option<attr::Deprecation> { unimplemented!() }
fn closure_kind(&self, tcx: &ty::ctxt<'tcx>, def_id: DefId)
fn closure_kind(&self, tcx: &TyCtxt<'tcx>, def_id: DefId)
-> ty::ClosureKind { unimplemented!() }
fn closure_ty(&self, tcx: &ty::ctxt<'tcx>, def_id: DefId)
fn closure_ty(&self, tcx: &TyCtxt<'tcx>, def_id: DefId)
-> ty::ClosureTy<'tcx> { unimplemented!() }
fn item_variances(&self, def: DefId) -> ty::ItemVariances { unimplemented!() }
fn repr_attrs(&self, def: DefId) -> Vec<attr::ReprAttr> { unimplemented!() }
fn item_type(&self, tcx: &ty::ctxt<'tcx>, def: DefId)
fn item_type(&self, tcx: &TyCtxt<'tcx>, def: DefId)
-> ty::TypeScheme<'tcx> { unimplemented!() }
fn item_path(&self, def: DefId) -> Vec<hir_map::PathElem> { unimplemented!() }
fn extern_item_path(&self, def: DefId) -> Vec<hir_map::PathElem> { unimplemented!() }
fn item_name(&self, def: DefId) -> ast::Name { unimplemented!() }
fn item_predicates(&self, tcx: &ty::ctxt<'tcx>, def: DefId)
fn item_predicates(&self, tcx: &TyCtxt<'tcx>, def: DefId)
-> ty::GenericPredicates<'tcx> { unimplemented!() }
fn item_super_predicates(&self, tcx: &ty::ctxt<'tcx>, def: DefId)
fn item_super_predicates(&self, tcx: &TyCtxt<'tcx>, def: DefId)
-> ty::GenericPredicates<'tcx> { unimplemented!() }
fn item_attrs(&self, def_id: DefId) -> Vec<ast::Attribute> { unimplemented!() }
fn item_symbol(&self, def: DefId) -> String { unimplemented!() }
fn trait_def(&self, tcx: &ty::ctxt<'tcx>, def: DefId)-> ty::TraitDef<'tcx>
fn trait_def(&self, tcx: &TyCtxt<'tcx>, def: DefId)-> ty::TraitDef<'tcx>
{ unimplemented!() }
fn adt_def(&self, tcx: &ty::ctxt<'tcx>, def: DefId) -> ty::AdtDefMaster<'tcx>
fn adt_def(&self, tcx: &TyCtxt<'tcx>, def: DefId) -> ty::AdtDefMaster<'tcx>
{ unimplemented!() }
fn method_arg_names(&self, did: DefId) -> Vec<String> { unimplemented!() }
fn inherent_implementations_for_type(&self, def_id: DefId) -> Vec<DefId> { vec![] }
// trait info
fn implementations_of_trait(&self, def_id: DefId) -> Vec<DefId> { vec![] }
fn provided_trait_methods(&self, tcx: &ty::ctxt<'tcx>, def: DefId)
fn provided_trait_methods(&self, tcx: &TyCtxt<'tcx>, def: DefId)
-> Vec<Rc<ty::Method<'tcx>>> { unimplemented!() }
fn trait_item_def_ids(&self, def: DefId)
-> Vec<ty::ImplOrTraitItemId> { unimplemented!() }
@ -336,19 +336,19 @@ impl<'tcx> CrateStore<'tcx> for DummyCrateStore {
// impl info
fn impl_items(&self, impl_def_id: DefId) -> Vec<ty::ImplOrTraitItemId>
{ unimplemented!() }
fn impl_trait_ref(&self, tcx: &ty::ctxt<'tcx>, def: DefId)
fn impl_trait_ref(&self, tcx: &TyCtxt<'tcx>, def: DefId)
-> Option<ty::TraitRef<'tcx>> { unimplemented!() }
fn impl_polarity(&self, def: DefId) -> Option<hir::ImplPolarity> { unimplemented!() }
fn custom_coerce_unsized_kind(&self, def: DefId)
-> Option<ty::adjustment::CustomCoerceUnsized>
{ unimplemented!() }
fn associated_consts(&self, tcx: &ty::ctxt<'tcx>, def: DefId)
fn associated_consts(&self, tcx: &TyCtxt<'tcx>, def: DefId)
-> Vec<Rc<ty::AssociatedConst<'tcx>>> { unimplemented!() }
// trait/impl-item info
fn trait_of_item(&self, tcx: &ty::ctxt<'tcx>, def_id: DefId)
fn trait_of_item(&self, tcx: &TyCtxt<'tcx>, def_id: DefId)
-> Option<DefId> { unimplemented!() }
fn impl_or_trait_item(&self, tcx: &ty::ctxt<'tcx>, def: DefId)
fn impl_or_trait_item(&self, tcx: &TyCtxt<'tcx>, def: DefId)
-> ty::ImplOrTraitItem<'tcx> { unimplemented!() }
// flags
@ -356,7 +356,7 @@ impl<'tcx> CrateStore<'tcx> for DummyCrateStore {
fn is_defaulted_trait(&self, did: DefId) -> bool { unimplemented!() }
fn is_impl(&self, did: DefId) -> bool { unimplemented!() }
fn is_default_impl(&self, impl_did: DefId) -> bool { unimplemented!() }
fn is_extern_item(&self, tcx: &ty::ctxt<'tcx>, did: DefId) -> bool { unimplemented!() }
fn is_extern_item(&self, tcx: &TyCtxt<'tcx>, did: DefId) -> bool { unimplemented!() }
fn is_static_method(&self, did: DefId) -> bool { unimplemented!() }
fn is_statically_included_foreign_item(&self, id: ast::NodeId) -> bool { false }
fn is_typedef(&self, did: DefId) -> bool { unimplemented!() }
@ -398,9 +398,9 @@ impl<'tcx> CrateStore<'tcx> for DummyCrateStore {
{ unimplemented!() }
// misc. metadata
fn maybe_get_item_ast(&'tcx self, tcx: &ty::ctxt<'tcx>, def: DefId)
fn maybe_get_item_ast(&'tcx self, tcx: &TyCtxt<'tcx>, def: DefId)
-> FoundAst<'tcx> { unimplemented!() }
fn maybe_get_item_mir(&self, tcx: &ty::ctxt<'tcx>, def: DefId)
fn maybe_get_item_mir(&self, tcx: &TyCtxt<'tcx>, def: DefId)
-> Option<Mir<'tcx>> { unimplemented!() }
fn is_item_mir_available(&self, def: DefId) -> bool {
unimplemented!()
@ -415,14 +415,14 @@ impl<'tcx> CrateStore<'tcx> for DummyCrateStore {
// utility functions
fn metadata_filename(&self) -> &str { unimplemented!() }
fn metadata_section_name(&self, target: &Target) -> &str { unimplemented!() }
fn encode_type(&self, tcx: &ty::ctxt<'tcx>, ty: Ty<'tcx>) -> Vec<u8>
fn encode_type(&self, tcx: &TyCtxt<'tcx>, ty: Ty<'tcx>) -> Vec<u8>
{ unimplemented!() }
fn used_crates(&self, prefer: LinkagePreference) -> Vec<(ast::CrateNum, Option<PathBuf>)>
{ vec![] }
fn used_crate_source(&self, cnum: ast::CrateNum) -> CrateSource { unimplemented!() }
fn extern_mod_stmt_cnum(&self, emod_id: ast::NodeId) -> Option<ast::CrateNum> { None }
fn encode_metadata(&self,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
reexports: &def::ExportMap,
item_symbols: &RefCell<NodeMap<String>>,
link_meta: &LinkMeta,
@ -439,7 +439,7 @@ impl<'tcx> CrateStore<'tcx> for DummyCrateStore {
/// be available to them. For example, we can automatically translate def-id and
/// span information during decoding because the decoding context knows which
/// crate the data is decoded from. Or it allows to make ty::Ty decodable
/// because the context has access to the ty::ctxt that is needed for creating
/// because the context has access to the TyCtxt that is needed for creating
/// ty::Ty instances.
///
/// Note, however, that this only works for RBML-based encoding and decoding at
@ -450,12 +450,12 @@ pub mod tls {
use serialize;
use std::cell::Cell;
use std::mem;
use middle::ty::{self, Ty};
use middle::ty::{self, Ty, TyCtxt};
use middle::subst::Substs;
use middle::def_id::DefId;
pub trait EncodingContext<'tcx> {
fn tcx<'a>(&'a self) -> &'a ty::ctxt<'tcx>;
fn tcx<'a>(&'a self) -> &'a TyCtxt<'tcx>;
fn encode_ty(&self, encoder: &mut OpaqueEncoder, t: Ty<'tcx>);
fn encode_substs(&self, encoder: &mut OpaqueEncoder, substs: &Substs<'tcx>);
}
@ -522,7 +522,7 @@ pub mod tls {
}
pub trait DecodingContext<'tcx> {
fn tcx<'a>(&'a self) -> &'a ty::ctxt<'tcx>;
fn tcx<'a>(&'a self) -> &'a TyCtxt<'tcx>;
fn decode_ty(&self, decoder: &mut OpaqueDecoder) -> ty::Ty<'tcx>;
fn decode_substs(&self, decoder: &mut OpaqueDecoder) -> Substs<'tcx>;
fn translate_def_id(&self, def_id: DefId) -> DefId;

View File

@ -16,7 +16,7 @@
use middle::cfg;
use middle::cfg::CFGIndex;
use middle::ty;
use middle::ty::TyCtxt;
use std::io;
use std::mem;
use std::usize;
@ -38,7 +38,7 @@ pub enum EntryOrExit {
#[derive(Clone)]
pub struct DataFlowContext<'a, 'tcx: 'a, O> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
/// a name for the analysis using this dataflow instance
analysis_name: &'static str,
@ -223,7 +223,7 @@ pub enum KillFrom {
}
impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
pub fn new(tcx: &'a ty::ctxt<'tcx>,
pub fn new(tcx: &'a TyCtxt<'tcx>,
analysis_name: &'static str,
decl: Option<&hir::FnDecl>,
cfg: &cfg::CFG,

View File

@ -18,6 +18,7 @@ use rustc_front::hir::{self, PatKind};
use rustc_front::intravisit::{self, Visitor};
use middle::{pat_util, privacy, ty};
use middle::ty::TyCtxt;
use middle::def::Def;
use middle::def_id::{DefId};
use lint;
@ -30,7 +31,7 @@ use syntax::attr::{self, AttrMetaMethods};
// explored. For example, if it's a live NodeItem that is a
// function, then we should explore its block to check for codes that
// may need to be marked as live.
fn should_explore(tcx: &ty::ctxt, node_id: ast::NodeId) -> bool {
fn should_explore(tcx: &TyCtxt, node_id: ast::NodeId) -> bool {
match tcx.map.find(node_id) {
Some(ast_map::NodeItem(..)) |
Some(ast_map::NodeImplItem(..)) |
@ -44,7 +45,7 @@ fn should_explore(tcx: &ty::ctxt, node_id: ast::NodeId) -> bool {
struct MarkSymbolVisitor<'a, 'tcx: 'a> {
worklist: Vec<ast::NodeId>,
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
live_symbols: Box<HashSet<ast::NodeId>>,
struct_has_extern_repr: bool,
ignore_non_const_paths: bool,
@ -53,7 +54,7 @@ struct MarkSymbolVisitor<'a, 'tcx: 'a> {
}
impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
fn new(tcx: &'a ty::ctxt<'tcx>,
fn new(tcx: &'a TyCtxt<'tcx>,
worklist: Vec<ast::NodeId>) -> MarkSymbolVisitor<'a, 'tcx> {
MarkSymbolVisitor {
worklist: worklist,
@ -367,7 +368,7 @@ impl<'v> Visitor<'v> for LifeSeeder {
}
}
fn create_and_seed_worklist(tcx: &ty::ctxt,
fn create_and_seed_worklist(tcx: &TyCtxt,
access_levels: &privacy::AccessLevels,
krate: &hir::Crate) -> Vec<ast::NodeId> {
let mut worklist = Vec::new();
@ -390,7 +391,7 @@ fn create_and_seed_worklist(tcx: &ty::ctxt,
return life_seeder.worklist;
}
fn find_live(tcx: &ty::ctxt,
fn find_live(tcx: &TyCtxt,
access_levels: &privacy::AccessLevels,
krate: &hir::Crate)
-> Box<HashSet<ast::NodeId>> {
@ -410,7 +411,7 @@ fn get_struct_ctor_id(item: &hir::Item) -> Option<ast::NodeId> {
}
struct DeadVisitor<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
live_symbols: Box<HashSet<ast::NodeId>>,
}
@ -587,7 +588,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for DeadVisitor<'a, 'tcx> {
}
}
pub fn check_crate(tcx: &ty::ctxt, access_levels: &privacy::AccessLevels) {
pub fn check_crate(tcx: &TyCtxt, access_levels: &privacy::AccessLevels) {
let _task = tcx.dep_graph.in_task(DepNode::DeadCheck);
let krate = tcx.map.krate();
let live_symbols = find_live(tcx, access_levels, krate);

View File

@ -14,7 +14,7 @@ use self::RootUnsafeContext::*;
use dep_graph::DepNode;
use middle::def::Def;
use middle::ty::{self, Ty};
use middle::ty::{self, Ty, TyCtxt};
use middle::ty::MethodCall;
use syntax::ast;
@ -50,7 +50,7 @@ fn type_is_unsafe_function(ty: Ty) -> bool {
}
struct EffectCheckVisitor<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
/// Whether we're in an unsafe context.
unsafe_context: UnsafeContext,
@ -182,7 +182,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EffectCheckVisitor<'a, 'tcx> {
}
}
pub fn check_crate(tcx: &ty::ctxt) {
pub fn check_crate(tcx: &TyCtxt) {
let _task = tcx.dep_graph.in_task(DepNode::EffectCheck);
let mut visitor = EffectCheckVisitor {

View File

@ -24,8 +24,7 @@ use middle::def::Def;
use middle::def_id::{DefId};
use middle::infer;
use middle::mem_categorization as mc;
use middle::ty;
use middle::ty::adjustment;
use middle::ty::{self, TyCtxt, adjustment};
use rustc_front::hir::{self, PatKind};
@ -210,7 +209,7 @@ enum OverloadedCallType {
}
impl OverloadedCallType {
fn from_trait_id(tcx: &ty::ctxt, trait_id: DefId)
fn from_trait_id(tcx: &TyCtxt, trait_id: DefId)
-> OverloadedCallType {
for &(maybe_function_trait, overloaded_call_type) in &[
(tcx.lang_items.fn_once_trait(), FnOnceOverloadedCall),
@ -228,7 +227,7 @@ impl OverloadedCallType {
tcx.sess.bug("overloaded call didn't map to known function trait")
}
fn from_method_id(tcx: &ty::ctxt, method_id: DefId)
fn from_method_id(tcx: &TyCtxt, method_id: DefId)
-> OverloadedCallType {
let method = tcx.impl_or_trait_item(method_id);
OverloadedCallType::from_trait_id(tcx, method.container().id())
@ -307,7 +306,7 @@ impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> {
}
}
fn tcx(&self) -> &'t ty::ctxt<'tcx> {
fn tcx(&self) -> &'t TyCtxt<'tcx> {
self.typer.tcx
}

View File

@ -15,7 +15,7 @@
//! `TransitiveRelation` type and use that to decide when one free
//! region outlives another and so forth.
use middle::ty::{self, FreeRegion, Region};
use middle::ty::{self, TyCtxt, FreeRegion, Region};
use middle::ty::wf::ImpliedBound;
use rustc_data_structures::transitive_relation::TransitiveRelation;
@ -49,7 +49,7 @@ impl FreeRegionMap {
}
pub fn relate_free_regions_from_predicates<'tcx>(&mut self,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
predicates: &[ty::Predicate<'tcx>]) {
debug!("relate_free_regions_from_predicates(predicates={:?})", predicates);
for predicate in predicates {
@ -121,7 +121,7 @@ impl FreeRegionMap {
/// Determines whether one region is a subregion of another. This is intended to run *after
/// inference* and sadly the logic is somewhat duplicated with the code in infer.rs.
pub fn is_subregion_of(&self,
tcx: &ty::ctxt,
tcx: &TyCtxt,
sub_region: ty::Region,
super_region: ty::Region)
-> bool {

View File

@ -28,7 +28,7 @@
use super::combine::{self, CombineFields};
use super::type_variable::{BiTo};
use middle::ty::{self, Ty};
use middle::ty::{self, Ty, TyCtxt};
use middle::ty::TyVar;
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
@ -45,7 +45,7 @@ impl<'a, 'tcx> Bivariate<'a, 'tcx> {
impl<'a, 'tcx> TypeRelation<'a, 'tcx> for Bivariate<'a, 'tcx> {
fn tag(&self) -> &'static str { "Bivariate" }
fn tcx(&self) -> &'a ty::ctxt<'tcx> { self.fields.tcx() }
fn tcx(&self) -> &'a TyCtxt<'tcx> { self.fields.tcx() }
fn a_is_expected(&self) -> bool { self.fields.a_is_expected }

View File

@ -42,7 +42,7 @@ use super::{MiscVariable, TypeTrace};
use super::type_variable::{RelationDir, BiTo, EqTo, SubtypeOf, SupertypeOf};
use middle::ty::{IntType, UintType};
use middle::ty::{self, Ty};
use middle::ty::{self, Ty, TyCtxt};
use middle::ty::error::TypeError;
use middle::ty::fold::{TypeFolder, TypeFoldable};
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
@ -149,7 +149,7 @@ fn unify_float_variable<'a,'tcx>(infcx: &InferCtxt<'a,'tcx>,
}
impl<'a, 'tcx> CombineFields<'a, 'tcx> {
pub fn tcx(&self) -> &'a ty::ctxt<'tcx> {
pub fn tcx(&self) -> &'a TyCtxt<'tcx> {
self.infcx.tcx
}
@ -293,7 +293,7 @@ struct Generalizer<'cx, 'tcx:'cx> {
}
impl<'cx, 'tcx> ty::fold::TypeFolder<'tcx> for Generalizer<'cx, 'tcx> {
fn tcx(&self) -> &ty::ctxt<'tcx> {
fn tcx(&self) -> &TyCtxt<'tcx> {
self.infcx.tcx
}

View File

@ -13,7 +13,7 @@ use super::higher_ranked::HigherRankedRelations;
use super::{Subtype};
use super::type_variable::{EqTo};
use middle::ty::{self, Ty};
use middle::ty::{self, Ty, TyCtxt};
use middle::ty::TyVar;
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
@ -31,7 +31,7 @@ impl<'a, 'tcx> Equate<'a, 'tcx> {
impl<'a, 'tcx> TypeRelation<'a,'tcx> for Equate<'a, 'tcx> {
fn tag(&self) -> &'static str { "Equate" }
fn tcx(&self) -> &'a ty::ctxt<'tcx> { self.fields.tcx() }
fn tcx(&self) -> &'a TyCtxt<'tcx> { self.fields.tcx() }
fn a_is_expected(&self) -> bool { self.fields.a_is_expected }

View File

@ -82,7 +82,7 @@ use middle::def_id::DefId;
use middle::infer::{self, TypeOrigin};
use middle::region;
use middle::subst;
use middle::ty::{self, Ty, TypeFoldable};
use middle::ty::{self, Ty, TyCtxt, TypeFoldable};
use middle::ty::{Region, ReFree};
use middle::ty::error::TypeError;
@ -95,7 +95,7 @@ use syntax::codemap::{self, Pos, Span};
use syntax::parse::token;
use syntax::ptr::P;
impl<'tcx> ty::ctxt<'tcx> {
impl<'tcx> TyCtxt<'tcx> {
pub fn note_and_explain_region(&self,
err: &mut DiagnosticBuilder,
prefix: &str,
@ -112,7 +112,7 @@ impl<'tcx> ty::ctxt<'tcx> {
}
}
fn explain_span(tcx: &ty::ctxt, heading: &str, span: Span)
fn explain_span(tcx: &TyCtxt, heading: &str, span: Span)
-> (String, Option<Span>) {
let lo = tcx.sess.codemap().lookup_char_pos_adj(span.lo);
(format!("the {} at {}:{}", heading, lo.line, lo.col.to_usize()),
@ -419,7 +419,7 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
}
}
fn free_regions_from_same_fn(tcx: &ty::ctxt,
fn free_regions_from_same_fn(tcx: &TyCtxt,
sub: Region,
sup: Region)
-> Option<FreeRegionsFromSameFn> {
@ -1057,7 +1057,7 @@ struct RebuildPathInfo<'a> {
}
struct Rebuilder<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
fn_decl: &'a hir::FnDecl,
expl_self_opt: Option<&'a hir::ExplicitSelf_>,
generics: &'a hir::Generics,
@ -1073,7 +1073,7 @@ enum FreshOrKept {
}
impl<'a, 'tcx> Rebuilder<'a, 'tcx> {
fn new(tcx: &'a ty::ctxt<'tcx>,
fn new(tcx: &'a TyCtxt<'tcx>,
fn_decl: &'a hir::FnDecl,
expl_self_opt: Option<&'a hir::ExplicitSelf_>,
generics: &'a hir::Generics,
@ -1877,7 +1877,7 @@ impl<'tcx> Resolvable<'tcx> for ty::PolyTraitRef<'tcx> {
}
}
fn lifetimes_in_scope(tcx: &ty::ctxt,
fn lifetimes_in_scope(tcx: &TyCtxt,
scope_id: ast::NodeId)
-> Vec<hir::LifetimeDef> {
let mut taken = Vec::new();

View File

@ -30,7 +30,7 @@
//! variable only once, and it does so as soon as it can, so it is reasonable to ask what the type
//! inferencer knows "so far".
use middle::ty::{self, Ty, TypeFoldable};
use middle::ty::{self, Ty, TyCtxt, TypeFoldable};
use middle::ty::fold::TypeFolder;
use std::collections::hash_map::{self, Entry};
@ -78,7 +78,7 @@ impl<'a, 'tcx> TypeFreshener<'a, 'tcx> {
}
impl<'a, 'tcx> TypeFolder<'tcx> for TypeFreshener<'a, 'tcx> {
fn tcx<'b>(&'b self) -> &'b ty::ctxt<'tcx> {
fn tcx<'b>(&'b self) -> &'b TyCtxt<'tcx> {
self.infcx.tcx
}

View File

@ -14,7 +14,7 @@ use super::InferCtxt;
use super::lattice::{self, LatticeDir};
use super::Subtype;
use middle::ty::{self, Ty};
use middle::ty::{self, Ty, TyCtxt};
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
/// "Greatest lower bound" (common subtype)
@ -31,7 +31,7 @@ impl<'a, 'tcx> Glb<'a, 'tcx> {
impl<'a, 'tcx> TypeRelation<'a, 'tcx> for Glb<'a, 'tcx> {
fn tag(&self) -> &'static str { "Glb" }
fn tcx(&self) -> &'a ty::ctxt<'tcx> { self.fields.tcx() }
fn tcx(&self) -> &'a TyCtxt<'tcx> { self.fields.tcx() }
fn a_is_expected(&self) -> bool { self.fields.a_is_expected }

View File

@ -14,7 +14,7 @@
use super::{CombinedSnapshot, InferCtxt, HigherRankedType, SkolemizationMap};
use super::combine::CombineFields;
use middle::ty::{self, Binder, TypeFoldable};
use middle::ty::{self, TyCtxt, Binder, TypeFoldable};
use middle::ty::error::TypeError;
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
use syntax::codemap::Span;
@ -351,7 +351,7 @@ fn is_var_in_set(new_vars: &[ty::RegionVid], r: ty::Region) -> bool {
}
}
fn fold_regions_in<'tcx, T, F>(tcx: &ty::ctxt<'tcx>,
fn fold_regions_in<'tcx, T, F>(tcx: &TyCtxt<'tcx>,
unbound_value: &T,
mut fldr: F)
-> T

View File

@ -14,7 +14,7 @@ use super::InferCtxt;
use super::lattice::{self, LatticeDir};
use super::Subtype;
use middle::ty::{self, Ty};
use middle::ty::{self, Ty, TyCtxt};
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
/// "Least upper bound" (common supertype)
@ -31,7 +31,7 @@ impl<'a, 'tcx> Lub<'a, 'tcx> {
impl<'a, 'tcx> TypeRelation<'a, 'tcx> for Lub<'a, 'tcx> {
fn tag(&self) -> &'static str { "Lub" }
fn tcx(&self) -> &'a ty::ctxt<'tcx> { self.fields.tcx() }
fn tcx(&self) -> &'a TyCtxt<'tcx> { self.fields.tcx() }
fn a_is_expected(&self) -> bool { self.fields.a_is_expected }

View File

@ -30,7 +30,7 @@ use middle::subst::Subst;
use middle::traits;
use middle::ty::adjustment;
use middle::ty::{TyVid, IntVid, FloatVid};
use middle::ty::{self, Ty};
use middle::ty::{self, Ty, TyCtxt};
use middle::ty::error::{ExpectedFound, TypeError, UnconstrainedNumeric};
use middle::ty::fold::{TypeFolder, TypeFoldable};
use middle::ty::relate::{Relate, RelateResult, TypeRelation};
@ -68,7 +68,7 @@ pub type UnitResult<'tcx> = RelateResult<'tcx, ()>; // "unify result"
pub type FixupResult<T> = Result<T, FixupError>; // "fixup result"
pub struct InferCtxt<'a, 'tcx: 'a> {
pub tcx: &'a ty::ctxt<'tcx>,
pub tcx: &'a TyCtxt<'tcx>,
pub tables: &'a RefCell<ty::Tables<'tcx>>,
@ -352,7 +352,7 @@ pub fn fixup_err_to_string(f: FixupError) -> String {
}
}
pub fn new_infer_ctxt<'a, 'tcx>(tcx: &'a ty::ctxt<'tcx>,
pub fn new_infer_ctxt<'a, 'tcx>(tcx: &'a TyCtxt<'tcx>,
tables: &'a RefCell<ty::Tables<'tcx>>,
param_env: Option<ty::ParameterEnvironment<'a, 'tcx>>)
-> InferCtxt<'a, 'tcx> {
@ -370,7 +370,7 @@ pub fn new_infer_ctxt<'a, 'tcx>(tcx: &'a ty::ctxt<'tcx>,
}
}
pub fn normalizing_infer_ctxt<'a, 'tcx>(tcx: &'a ty::ctxt<'tcx>,
pub fn normalizing_infer_ctxt<'a, 'tcx>(tcx: &'a TyCtxt<'tcx>,
tables: &'a RefCell<ty::Tables<'tcx>>)
-> InferCtxt<'a, 'tcx> {
let mut infcx = new_infer_ctxt(tcx, tables, None);
@ -501,7 +501,7 @@ pub struct CombinedSnapshot {
region_vars_snapshot: RegionSnapshot,
}
pub fn normalize_associated_type<'tcx,T>(tcx: &ty::ctxt<'tcx>, value: &T) -> T
pub fn normalize_associated_type<'tcx,T>(tcx: &TyCtxt<'tcx>, value: &T) -> T
where T : TypeFoldable<'tcx>
{
debug!("normalize_associated_type(t={:?})", value);
@ -1553,7 +1553,7 @@ impl<'tcx> TypeTrace<'tcx> {
}
}
pub fn dummy(tcx: &ty::ctxt<'tcx>) -> TypeTrace<'tcx> {
pub fn dummy(tcx: &TyCtxt<'tcx>) -> TypeTrace<'tcx> {
TypeTrace {
origin: TypeOrigin::Misc(codemap::DUMMY_SP),
values: Types(ExpectedFound {

View File

@ -18,7 +18,7 @@
/// For clarity, rename the graphviz crate locally to dot.
use graphviz as dot;
use middle::ty;
use middle::ty::{self, TyCtxt};
use middle::region::CodeExtent;
use super::Constraint;
use middle::infer::SubregionOrigin;
@ -119,7 +119,7 @@ pub fn maybe_print_constraints_for<'a, 'tcx>(region_vars: &RegionVarBindings<'a,
}
struct ConstraintGraph<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
graph_name: String,
map: &'a FnvHashMap<Constraint, SubregionOrigin<'tcx>>,
node_ids: FnvHashMap<Node, usize>,
@ -139,7 +139,7 @@ enum Edge {
}
impl<'a, 'tcx> ConstraintGraph<'a, 'tcx> {
fn new(tcx: &'a ty::ctxt<'tcx>,
fn new(tcx: &'a TyCtxt<'tcx>,
name: String,
map: &'a ConstraintMap<'tcx>)
-> ConstraintGraph<'a, 'tcx> {
@ -254,7 +254,7 @@ impl<'a, 'tcx> dot::GraphWalk<'a, Node, Edge> for ConstraintGraph<'a, 'tcx> {
pub type ConstraintMap<'tcx> = FnvHashMap<Constraint, SubregionOrigin<'tcx>>;
fn dump_region_constraints_to<'a, 'tcx: 'a>(tcx: &'a ty::ctxt<'tcx>,
fn dump_region_constraints_to<'a, 'tcx: 'a>(tcx: &'a TyCtxt<'tcx>,
map: &ConstraintMap<'tcx>,
path: &str)
-> io::Result<()> {

View File

@ -23,7 +23,7 @@ use super::unify_key;
use rustc_data_structures::graph::{self, Direction, NodeIndex};
use rustc_data_structures::unify::{self, UnificationTable};
use middle::free_region::FreeRegionMap;
use middle::ty::{self, Ty};
use middle::ty::{self, Ty, TyCtxt};
use middle::ty::{BoundRegion, Region, RegionVid};
use middle::ty::{ReEmpty, ReStatic, ReFree, ReEarlyBound};
use middle::ty::{ReLateBound, ReScope, ReVar, ReSkolemized, BrFresh};
@ -187,7 +187,7 @@ impl SameRegions {
pub type CombineMap = FnvHashMap<TwoRegions, RegionVid>;
pub struct RegionVarBindings<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
var_origins: RefCell<Vec<RegionVariableOrigin>>,
// Constraints of the form `A <= B` introduced by the region
@ -250,7 +250,7 @@ pub struct RegionSnapshot {
}
impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
pub fn new(tcx: &'a ty::ctxt<'tcx>) -> RegionVarBindings<'a, 'tcx> {
pub fn new(tcx: &'a TyCtxt<'tcx>) -> RegionVarBindings<'a, 'tcx> {
RegionVarBindings {
tcx: tcx,
var_origins: RefCell::new(Vec::new()),
@ -1358,7 +1358,7 @@ impl<'tcx> fmt::Display for GenericKind<'tcx> {
}
impl<'tcx> GenericKind<'tcx> {
pub fn to_ty(&self, tcx: &ty::ctxt<'tcx>) -> Ty<'tcx> {
pub fn to_ty(&self, tcx: &TyCtxt<'tcx>) -> Ty<'tcx> {
match *self {
GenericKind::Param(ref p) => p.to_ty(tcx),
GenericKind::Projection(ref p) => tcx.mk_projection(p.trait_ref.clone(), p.item_name),
@ -1420,7 +1420,7 @@ impl VerifyBound {
}
fn is_met<'tcx>(&self,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
free_regions: &FreeRegionMap,
var_values: &Vec<VarValue>,
min: ty::Region)

View File

@ -9,7 +9,7 @@
// except according to those terms.
use super::{InferCtxt, FixupError, FixupResult};
use middle::ty::{self, Ty, TypeFoldable};
use middle::ty::{self, Ty, TyCtxt, TypeFoldable};
///////////////////////////////////////////////////////////////////////////
// OPPORTUNISTIC TYPE RESOLVER
@ -30,7 +30,7 @@ impl<'a, 'tcx> OpportunisticTypeResolver<'a, 'tcx> {
}
impl<'a, 'tcx> ty::fold::TypeFolder<'tcx> for OpportunisticTypeResolver<'a, 'tcx> {
fn tcx(&self) -> &ty::ctxt<'tcx> {
fn tcx(&self) -> &TyCtxt<'tcx> {
self.infcx.tcx
}
@ -58,7 +58,7 @@ impl<'a, 'tcx> OpportunisticTypeAndRegionResolver<'a, 'tcx> {
}
impl<'a, 'tcx> ty::fold::TypeFolder<'tcx> for OpportunisticTypeAndRegionResolver<'a, 'tcx> {
fn tcx(&self) -> &ty::ctxt<'tcx> {
fn tcx(&self) -> &TyCtxt<'tcx> {
self.infcx.tcx
}
@ -104,7 +104,7 @@ struct FullTypeResolver<'a, 'tcx:'a> {
}
impl<'a, 'tcx> ty::fold::TypeFolder<'tcx> for FullTypeResolver<'a, 'tcx> {
fn tcx(&self) -> &ty::ctxt<'tcx> {
fn tcx(&self) -> &TyCtxt<'tcx> {
self.infcx.tcx
}

View File

@ -13,7 +13,7 @@ use super::higher_ranked::HigherRankedRelations;
use super::SubregionOrigin;
use super::type_variable::{SubtypeOf, SupertypeOf};
use middle::ty::{self, Ty};
use middle::ty::{self, Ty, TyCtxt};
use middle::ty::TyVar;
use middle::ty::relate::{Cause, Relate, RelateResult, TypeRelation};
use std::mem;
@ -31,7 +31,7 @@ impl<'a, 'tcx> Sub<'a, 'tcx> {
impl<'a, 'tcx> TypeRelation<'a, 'tcx> for Sub<'a, 'tcx> {
fn tag(&self) -> &'static str { "Sub" }
fn tcx(&self) -> &'a ty::ctxt<'tcx> { self.fields.infcx.tcx }
fn tcx(&self) -> &'a TyCtxt<'tcx> { self.fields.infcx.tcx }
fn a_is_expected(&self) -> bool { self.fields.a_is_expected }
fn with_cause<F,R>(&mut self, cause: Cause, f: F) -> R

View File

@ -9,11 +9,11 @@
// except according to those terms.
use syntax::ast;
use middle::ty::{self, IntVarValue, Ty};
use middle::ty::{self, IntVarValue, Ty, TyCtxt};
use rustc_data_structures::unify::{Combine, UnifyKey};
pub trait ToType<'tcx> {
fn to_type(&self, tcx: &ty::ctxt<'tcx>) -> Ty<'tcx>;
fn to_type(&self, tcx: &TyCtxt<'tcx>) -> Ty<'tcx>;
}
impl UnifyKey for ty::IntVid {
@ -51,7 +51,7 @@ impl UnifyKey for ty::RegionVid {
}
impl<'tcx> ToType<'tcx> for IntVarValue {
fn to_type(&self, tcx: &ty::ctxt<'tcx>) -> Ty<'tcx> {
fn to_type(&self, tcx: &TyCtxt<'tcx>) -> Ty<'tcx> {
match *self {
ty::IntType(i) => tcx.mk_mach_int(i),
ty::UintType(i) => tcx.mk_mach_uint(i),
@ -69,7 +69,7 @@ impl UnifyKey for ty::FloatVid {
}
impl<'tcx> ToType<'tcx> for ast::FloatTy {
fn to_type(&self, tcx: &ty::ctxt<'tcx>) -> Ty<'tcx> {
fn to_type(&self, tcx: &TyCtxt<'tcx>) -> Ty<'tcx> {
tcx.mk_mach_float(*self)
}
}

View File

@ -12,7 +12,7 @@ use dep_graph::DepNode;
use middle::def::Def;
use middle::def_id::DefId;
use middle::subst::{Subst, Substs, EnumeratedItems};
use middle::ty::{TransmuteRestriction, ctxt, TyBareFn};
use middle::ty::{TransmuteRestriction, TyCtxt, TyBareFn};
use middle::ty::{self, Ty, TypeFoldable};
use std::fmt;
@ -23,7 +23,7 @@ use syntax::codemap::Span;
use rustc_front::intravisit::{self, Visitor, FnKind};
use rustc_front::hir;
pub fn check_crate(tcx: &ctxt) {
pub fn check_crate(tcx: &TyCtxt) {
let mut visitor = IntrinsicCheckingVisitor {
tcx: tcx,
param_envs: Vec::new(),
@ -34,7 +34,7 @@ pub fn check_crate(tcx: &ctxt) {
}
struct IntrinsicCheckingVisitor<'a, 'tcx: 'a> {
tcx: &'a ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
// As we traverse the AST, we keep a stack of the parameter
// environments for each function we encounter. When we find a

View File

@ -112,7 +112,7 @@ use self::VarKind::*;
use dep_graph::DepNode;
use middle::def::*;
use middle::pat_util;
use middle::ty;
use middle::ty::{self, TyCtxt};
use lint;
use util::nodemap::NodeMap;
@ -166,7 +166,7 @@ enum LiveNodeKind {
ExitNode
}
fn live_node_kind_to_string(lnk: LiveNodeKind, cx: &ty::ctxt) -> String {
fn live_node_kind_to_string(lnk: LiveNodeKind, cx: &TyCtxt) -> String {
let cm = cx.sess.codemap();
match lnk {
FreeVarNode(s) => {
@ -192,7 +192,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for IrMaps<'a, 'tcx> {
fn visit_arm(&mut self, a: &hir::Arm) { visit_arm(self, a); }
}
pub fn check_crate(tcx: &ty::ctxt) {
pub fn check_crate(tcx: &TyCtxt) {
let _task = tcx.dep_graph.in_task(DepNode::Liveness);
tcx.map.krate().visit_all_items(&mut IrMaps::new(tcx));
tcx.sess.abort_if_errors();
@ -260,7 +260,7 @@ enum VarKind {
}
struct IrMaps<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
num_live_nodes: usize,
num_vars: usize,
@ -272,7 +272,7 @@ struct IrMaps<'a, 'tcx: 'a> {
}
impl<'a, 'tcx> IrMaps<'a, 'tcx> {
fn new(tcx: &'a ty::ctxt<'tcx>) -> IrMaps<'a, 'tcx> {
fn new(tcx: &'a TyCtxt<'tcx>) -> IrMaps<'a, 'tcx> {
IrMaps {
tcx: tcx,
num_live_nodes: 0,

View File

@ -77,7 +77,7 @@ use middle::infer;
use middle::const_qualif::ConstQualif;
use middle::def::Def;
use middle::ty::adjustment;
use middle::ty::{self, Ty};
use middle::ty::{self, Ty, TyCtxt};
use rustc_front::hir::{MutImmutable, MutMutable, PatKind};
use rustc_front::hir;
@ -302,7 +302,7 @@ impl MutabilityCategory {
ret
}
fn from_local(tcx: &ty::ctxt, id: ast::NodeId) -> MutabilityCategory {
fn from_local(tcx: &TyCtxt, id: ast::NodeId) -> MutabilityCategory {
let ret = match tcx.map.get(id) {
ast_map::NodeLocal(p) => match p.node {
PatKind::Ident(bind_mode, _, _) => {
@ -363,7 +363,7 @@ impl<'t, 'a,'tcx> MemCategorizationContext<'t, 'a, 'tcx> {
MemCategorizationContext { typer: typer }
}
fn tcx(&self) -> &'a ty::ctxt<'tcx> {
fn tcx(&self) -> &'a TyCtxt<'tcx> {
self.typer.tcx
}
@ -1081,7 +1081,7 @@ impl<'t, 'a,'tcx> MemCategorizationContext<'t, 'a, 'tcx> {
/// In a pattern like [a, b, ..c], normally `c` has slice type, but if you have [a, b,
/// ..ref c], then the type of `ref c` will be `&&[]`, so to extract the slice details we
/// have to recurse through rptrs.
fn vec_slice_info(tcx: &ty::ctxt,
fn vec_slice_info(tcx: &TyCtxt,
pat: &hir::Pat,
slice_ty: Ty)
-> (hir::Mutability, ty::Region) {
@ -1387,7 +1387,7 @@ impl<'tcx> cmt_<'tcx> {
}
/// Returns `FreelyAliasable(_)` if this lvalue represents a freely aliasable pointer type.
pub fn freely_aliasable(&self, ctxt: &ty::ctxt<'tcx>)
pub fn freely_aliasable(&self, ctxt: &TyCtxt<'tcx>)
-> Aliasability {
// Maybe non-obvious: copied upvars can only be considered
// non-aliasable in once closures, since any other kind can be
@ -1462,7 +1462,7 @@ impl<'tcx> cmt_<'tcx> {
}
pub fn descriptive_string(&self, tcx: &ty::ctxt) -> String {
pub fn descriptive_string(&self, tcx: &TyCtxt) -> String {
match self.cat {
Categorization::StaticItem => {
"static item".to_string()

View File

@ -10,7 +10,7 @@
use middle::def::*;
use middle::def_id::DefId;
use middle::ty;
use middle::ty::TyCtxt;
use util::nodemap::FnvHashMap;
use syntax::ast;
@ -210,7 +210,7 @@ pub fn simple_name<'a>(pat: &'a hir::Pat) -> Option<ast::Name> {
}
}
pub fn def_to_path(tcx: &ty::ctxt, id: DefId) -> hir::Path {
pub fn def_to_path(tcx: &TyCtxt, id: DefId) -> hir::Path {
tcx.with_path(id, |path| hir::Path {
global: false,
segments: path.last().map(|elem| hir::PathSegment {

View File

@ -19,7 +19,7 @@ use dep_graph::DepNode;
use front::map as ast_map;
use middle::def::Def;
use middle::def_id::DefId;
use middle::ty;
use middle::ty::{self, TyCtxt};
use middle::privacy;
use session::config;
use util::nodemap::NodeSet;
@ -55,7 +55,7 @@ fn item_might_be_inlined(item: &hir::Item) -> bool {
}
}
fn method_might_be_inlined(tcx: &ty::ctxt, sig: &hir::MethodSig,
fn method_might_be_inlined(tcx: &TyCtxt, sig: &hir::MethodSig,
impl_item: &hir::ImplItem,
impl_src: DefId) -> bool {
if attr::requests_inline(&impl_item.attrs) ||
@ -77,7 +77,7 @@ fn method_might_be_inlined(tcx: &ty::ctxt, sig: &hir::MethodSig,
// Information needed while computing reachability.
struct ReachableContext<'a, 'tcx: 'a> {
// The type context.
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
// The set of items which must be exported in the linkage sense.
reachable_symbols: NodeSet,
// A worklist of item IDs. Each item ID in this worklist will be inlined
@ -143,7 +143,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for ReachableContext<'a, 'tcx> {
impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
// Creates a new reachability computation context.
fn new(tcx: &'a ty::ctxt<'tcx>) -> ReachableContext<'a, 'tcx> {
fn new(tcx: &'a TyCtxt<'tcx>) -> ReachableContext<'a, 'tcx> {
let any_library = tcx.sess.crate_types.borrow().iter().any(|ty| {
*ty != config::CrateTypeExecutable
});
@ -349,7 +349,7 @@ impl<'a, 'v> Visitor<'v> for CollectPrivateImplItemsVisitor<'a> {
}
}
pub fn find_reachable(tcx: &ty::ctxt,
pub fn find_reachable(tcx: &TyCtxt,
access_levels: &privacy::AccessLevels)
-> NodeSet {
let _task = tcx.dep_graph.in_task(DepNode::Reachability);

View File

@ -20,7 +20,7 @@ use lint;
use middle::cstore::{CrateStore, LOCAL_CRATE};
use middle::def::Def;
use middle::def_id::{CRATE_DEF_INDEX, DefId};
use middle::ty;
use middle::ty::{self, TyCtxt};
use middle::privacy::AccessLevels;
use syntax::parse::token::InternedString;
use syntax::codemap::{Span, DUMMY_SP};
@ -72,7 +72,7 @@ pub struct Index<'tcx> {
// A private tree-walker for producing an Index.
struct Annotator<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
index: &'a mut Index<'tcx>,
parent_stab: Option<&'tcx Stability>,
parent_depr: Option<Deprecation>,
@ -279,7 +279,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for Annotator<'a, 'tcx> {
impl<'tcx> Index<'tcx> {
/// Construct the stability index for a crate being compiled.
pub fn build(&mut self, tcx: &ty::ctxt<'tcx>, access_levels: &AccessLevels) {
pub fn build(&mut self, tcx: &TyCtxt<'tcx>, access_levels: &AccessLevels) {
let _task = tcx.dep_graph.in_task(DepNode::StabilityIndex);
let krate = tcx.map.krate();
let mut annotator = Annotator {
@ -319,7 +319,7 @@ impl<'tcx> Index<'tcx> {
/// Cross-references the feature names of unstable APIs with enabled
/// features and possibly prints errors. Returns a list of all
/// features used.
pub fn check_unstable_api_usage(tcx: &ty::ctxt)
pub fn check_unstable_api_usage(tcx: &TyCtxt)
-> FnvHashMap<InternedString, StabilityLevel> {
let _task = tcx.dep_graph.in_task(DepNode::StabilityCheck);
let ref active_lib_features = tcx.sess.features.borrow().declared_lib_features;
@ -339,7 +339,7 @@ pub fn check_unstable_api_usage(tcx: &ty::ctxt)
}
struct Checker<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
active_features: FnvHashSet<InternedString>,
used_features: FnvHashMap<InternedString, StabilityLevel>,
// Within a block where feature gate checking can be skipped.
@ -466,7 +466,7 @@ impl<'a, 'v, 'tcx> Visitor<'v> for Checker<'a, 'tcx> {
}
/// Helper for discovering nodes to check for stability
pub fn check_item(tcx: &ty::ctxt, item: &hir::Item, warn_about_defns: bool,
pub fn check_item(tcx: &TyCtxt, item: &hir::Item, warn_about_defns: bool,
cb: &mut FnMut(DefId, Span, &Option<&Stability>, &Option<Deprecation>)) {
match item.node {
hir::ItemExternCrate(_) => {
@ -503,7 +503,7 @@ pub fn check_item(tcx: &ty::ctxt, item: &hir::Item, warn_about_defns: bool,
}
/// Helper for discovering nodes to check for stability
pub fn check_expr(tcx: &ty::ctxt, e: &hir::Expr,
pub fn check_expr(tcx: &TyCtxt, e: &hir::Expr,
cb: &mut FnMut(DefId, Span, &Option<&Stability>, &Option<Deprecation>)) {
let span;
let id = match e.node {
@ -564,7 +564,7 @@ pub fn check_expr(tcx: &ty::ctxt, e: &hir::Expr,
maybe_do_stability_check(tcx, id, span, cb);
}
pub fn check_path(tcx: &ty::ctxt, path: &hir::Path, id: ast::NodeId,
pub fn check_path(tcx: &TyCtxt, path: &hir::Path, id: ast::NodeId,
cb: &mut FnMut(DefId, Span, &Option<&Stability>, &Option<Deprecation>)) {
match tcx.def_map.borrow().get(&id).map(|d| d.full_def()) {
Some(Def::PrimTy(..)) => {}
@ -576,7 +576,7 @@ pub fn check_path(tcx: &ty::ctxt, path: &hir::Path, id: ast::NodeId,
}
}
pub fn check_path_list_item(tcx: &ty::ctxt, item: &hir::PathListItem,
pub fn check_path_list_item(tcx: &TyCtxt, item: &hir::PathListItem,
cb: &mut FnMut(DefId, Span, &Option<&Stability>, &Option<Deprecation>)) {
match tcx.def_map.borrow().get(&item.node.id()).map(|d| d.full_def()) {
Some(Def::PrimTy(..)) => {}
@ -587,7 +587,7 @@ pub fn check_path_list_item(tcx: &ty::ctxt, item: &hir::PathListItem,
}
}
pub fn check_pat(tcx: &ty::ctxt, pat: &hir::Pat,
pub fn check_pat(tcx: &TyCtxt, pat: &hir::Pat,
cb: &mut FnMut(DefId, Span, &Option<&Stability>, &Option<Deprecation>)) {
debug!("check_pat(pat = {:?})", pat);
if is_internal(tcx, pat.span) { return; }
@ -616,7 +616,7 @@ pub fn check_pat(tcx: &ty::ctxt, pat: &hir::Pat,
}
}
fn maybe_do_stability_check(tcx: &ty::ctxt, id: DefId, span: Span,
fn maybe_do_stability_check(tcx: &TyCtxt, id: DefId, span: Span,
cb: &mut FnMut(DefId, Span,
&Option<&Stability>, &Option<Deprecation>)) {
if is_internal(tcx, span) {
@ -634,11 +634,11 @@ fn maybe_do_stability_check(tcx: &ty::ctxt, id: DefId, span: Span,
cb(id, span, &stability, &deprecation);
}
fn is_internal(tcx: &ty::ctxt, span: Span) -> bool {
fn is_internal(tcx: &TyCtxt, span: Span) -> bool {
tcx.sess.codemap().span_allows_unstable(span)
}
fn is_staged_api(tcx: &ty::ctxt, id: DefId) -> bool {
fn is_staged_api(tcx: &TyCtxt, id: DefId) -> bool {
match tcx.trait_item_of_item(id) {
Some(ty::MethodTraitItemId(trait_method_id))
if trait_method_id != id => {
@ -653,7 +653,7 @@ fn is_staged_api(tcx: &ty::ctxt, id: DefId) -> bool {
/// Lookup the stability for a node, loading external crate
/// metadata as necessary.
pub fn lookup_stability<'tcx>(tcx: &ty::ctxt<'tcx>, id: DefId) -> Option<&'tcx Stability> {
pub fn lookup_stability<'tcx>(tcx: &TyCtxt<'tcx>, id: DefId) -> Option<&'tcx Stability> {
if let Some(st) = tcx.stability.borrow().stab_map.get(&id) {
return *st;
}
@ -663,7 +663,7 @@ pub fn lookup_stability<'tcx>(tcx: &ty::ctxt<'tcx>, id: DefId) -> Option<&'tcx S
st
}
pub fn lookup_deprecation<'tcx>(tcx: &ty::ctxt<'tcx>, id: DefId) -> Option<Deprecation> {
pub fn lookup_deprecation<'tcx>(tcx: &TyCtxt<'tcx>, id: DefId) -> Option<Deprecation> {
if let Some(depr) = tcx.stability.borrow().depr_map.get(&id) {
return depr.clone();
}
@ -673,7 +673,7 @@ pub fn lookup_deprecation<'tcx>(tcx: &ty::ctxt<'tcx>, id: DefId) -> Option<Depre
depr
}
fn lookup_stability_uncached<'tcx>(tcx: &ty::ctxt<'tcx>, id: DefId) -> Option<&'tcx Stability> {
fn lookup_stability_uncached<'tcx>(tcx: &TyCtxt<'tcx>, id: DefId) -> Option<&'tcx Stability> {
debug!("lookup(id={:?})", id);
if id.is_local() {
None // The stability cache is filled partially lazily
@ -682,7 +682,7 @@ fn lookup_stability_uncached<'tcx>(tcx: &ty::ctxt<'tcx>, id: DefId) -> Option<&'
}
}
fn lookup_deprecation_uncached<'tcx>(tcx: &ty::ctxt<'tcx>, id: DefId) -> Option<Deprecation> {
fn lookup_deprecation_uncached<'tcx>(tcx: &TyCtxt<'tcx>, id: DefId) -> Option<Deprecation> {
debug!("lookup(id={:?})", id);
if id.is_local() {
None // The stability cache is filled partially lazily

View File

@ -15,7 +15,7 @@ pub use self::RegionSubsts::*;
use middle::cstore;
use middle::def_id::DefId;
use middle::ty::{self, Ty};
use middle::ty::{self, Ty, TyCtxt};
use middle::ty::fold::{TypeFoldable, TypeFolder};
use serialize::{Encodable, Encoder, Decodable, Decoder};
@ -161,7 +161,7 @@ impl<'tcx> Substs<'tcx> {
}
/// Creates a trait-ref out of this substs, ignoring the FnSpace substs
pub fn to_trait_ref(&self, tcx: &ty::ctxt<'tcx>, trait_id: DefId)
pub fn to_trait_ref(&self, tcx: &TyCtxt<'tcx>, trait_id: DefId)
-> ty::TraitRef<'tcx> {
let Substs { mut types, regions } = self.clone();
types.truncate(FnSpace, 0);
@ -589,11 +589,11 @@ impl<'a,T> IntoIterator for &'a VecPerParamSpace<T> {
// there is more information available (for better errors).
pub trait Subst<'tcx> : Sized {
fn subst(&self, tcx: &ty::ctxt<'tcx>, substs: &Substs<'tcx>) -> Self {
fn subst(&self, tcx: &TyCtxt<'tcx>, substs: &Substs<'tcx>) -> Self {
self.subst_spanned(tcx, substs, None)
}
fn subst_spanned(&self, tcx: &ty::ctxt<'tcx>,
fn subst_spanned(&self, tcx: &TyCtxt<'tcx>,
substs: &Substs<'tcx>,
span: Option<Span>)
-> Self;
@ -601,7 +601,7 @@ pub trait Subst<'tcx> : Sized {
impl<'tcx, T:TypeFoldable<'tcx>> Subst<'tcx> for T {
fn subst_spanned(&self,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
substs: &Substs<'tcx>,
span: Option<Span>)
-> T
@ -620,7 +620,7 @@ impl<'tcx, T:TypeFoldable<'tcx>> Subst<'tcx> for T {
// The actual substitution engine itself is a type folder.
struct SubstFolder<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
substs: &'a Substs<'tcx>,
// The location for which the substitution is performed, if available.
@ -637,7 +637,7 @@ struct SubstFolder<'a, 'tcx: 'a> {
}
impl<'a, 'tcx> TypeFolder<'tcx> for SubstFolder<'a, 'tcx> {
fn tcx(&self) -> &ty::ctxt<'tcx> { self.tcx }
fn tcx(&self) -> &TyCtxt<'tcx> { self.tcx }
fn enter_region_binder(&mut self) {
self.region_binders_passed += 1;

View File

@ -20,7 +20,7 @@ use super::util;
use middle::cstore::LOCAL_CRATE;
use middle::def_id::DefId;
use middle::subst::{Subst, Substs, TypeSpace};
use middle::ty::{self, Ty};
use middle::ty::{self, Ty, TyCtxt};
use middle::infer::{self, InferCtxt, TypeOrigin};
use syntax::codemap::{DUMMY_SP, Span};
@ -94,7 +94,7 @@ fn overlap<'cx, 'tcx>(selcx: &mut SelectionContext<'cx, 'tcx>,
Some(selcx.infcx().resolve_type_vars_if_possible(&a_trait_ref))
}
pub fn trait_ref_is_knowable<'tcx>(tcx: &ty::ctxt<'tcx>, trait_ref: &ty::TraitRef<'tcx>) -> bool
pub fn trait_ref_is_knowable<'tcx>(tcx: &TyCtxt<'tcx>, trait_ref: &ty::TraitRef<'tcx>) -> bool
{
debug!("trait_ref_is_knowable(trait_ref={:?})", trait_ref);
@ -174,7 +174,7 @@ pub enum OrphanCheckErr<'tcx> {
///
/// 1. All type parameters in `Self` must be "covered" by some local type constructor.
/// 2. Some local type must appear in `Self`.
pub fn orphan_check<'tcx>(tcx: &ty::ctxt<'tcx>,
pub fn orphan_check<'tcx>(tcx: &TyCtxt<'tcx>,
impl_def_id: DefId)
-> Result<(), OrphanCheckErr<'tcx>>
{
@ -195,7 +195,7 @@ pub fn orphan_check<'tcx>(tcx: &ty::ctxt<'tcx>,
orphan_check_trait_ref(tcx, &trait_ref, InferIsLocal(false))
}
fn orphan_check_trait_ref<'tcx>(tcx: &ty::ctxt<'tcx>,
fn orphan_check_trait_ref<'tcx>(tcx: &TyCtxt<'tcx>,
trait_ref: &ty::TraitRef<'tcx>,
infer_is_local: InferIsLocal)
-> Result<(), OrphanCheckErr<'tcx>>
@ -243,7 +243,7 @@ fn orphan_check_trait_ref<'tcx>(tcx: &ty::ctxt<'tcx>,
return Err(OrphanCheckErr::NoLocalInputType);
}
fn uncovered_tys<'tcx>(tcx: &ty::ctxt<'tcx>,
fn uncovered_tys<'tcx>(tcx: &TyCtxt<'tcx>,
ty: Ty<'tcx>,
infer_is_local: InferIsLocal)
-> Vec<Ty<'tcx>>
@ -267,13 +267,13 @@ fn is_type_parameter<'tcx>(ty: Ty<'tcx>) -> bool {
}
}
fn ty_is_local<'tcx>(tcx: &ty::ctxt<'tcx>, ty: Ty<'tcx>, infer_is_local: InferIsLocal) -> bool
fn ty_is_local<'tcx>(tcx: &TyCtxt<'tcx>, ty: Ty<'tcx>, infer_is_local: InferIsLocal) -> bool
{
ty_is_local_constructor(tcx, ty, infer_is_local) ||
fundamental_ty(tcx, ty) && ty.walk_shallow().any(|t| ty_is_local(tcx, t, infer_is_local))
}
fn fundamental_ty<'tcx>(tcx: &ty::ctxt<'tcx>, ty: Ty<'tcx>) -> bool
fn fundamental_ty<'tcx>(tcx: &TyCtxt<'tcx>, ty: Ty<'tcx>) -> bool
{
match ty.sty {
ty::TyBox(..) | ty::TyRef(..) =>
@ -287,7 +287,7 @@ fn fundamental_ty<'tcx>(tcx: &ty::ctxt<'tcx>, ty: Ty<'tcx>) -> bool
}
}
fn ty_is_local_constructor<'tcx>(tcx: &ty::ctxt<'tcx>,
fn ty_is_local_constructor<'tcx>(tcx: &TyCtxt<'tcx>,
ty: Ty<'tcx>,
infer_is_local: InferIsLocal)
-> bool

View File

@ -26,7 +26,7 @@ use super::{
use fmt_macros::{Parser, Piece, Position};
use middle::def_id::DefId;
use middle::infer::InferCtxt;
use middle::ty::{self, ToPredicate, ToPolyTraitRef, TraitRef, Ty, TypeFoldable};
use middle::ty::{self, ToPredicate, ToPolyTraitRef, TraitRef, Ty, TyCtxt, TypeFoldable};
use middle::ty::fast_reject;
use util::nodemap::{FnvHashMap, FnvHashSet};
@ -326,7 +326,7 @@ pub fn try_report_overflow_error_type_of_infinite_size<'a, 'tcx>(
unreachable!();
}
pub fn recursive_type_with_infinite_size_error<'tcx>(tcx: &ty::ctxt<'tcx>,
pub fn recursive_type_with_infinite_size_error<'tcx>(tcx: &TyCtxt<'tcx>,
type_def_id: DefId)
-> DiagnosticBuilder<'tcx>
{
@ -507,7 +507,7 @@ pub fn report_selection_error<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>,
}
}
pub fn report_object_safety_error<'tcx>(tcx: &ty::ctxt<'tcx>,
pub fn report_object_safety_error<'tcx>(tcx: &TyCtxt<'tcx>,
span: Span,
trait_def_id: DefId,
violations: Vec<ObjectSafetyViolation>)
@ -796,7 +796,7 @@ fn note_obligation_cause_code<'a, 'tcx, T>(infcx: &InferCtxt<'a, 'tcx>,
}
}
fn suggest_new_overflow_limit(tcx: &ty::ctxt, err:&mut DiagnosticBuilder, span: Span) {
fn suggest_new_overflow_limit(tcx: &TyCtxt, err:&mut DiagnosticBuilder, span: Span) {
let current_limit = tcx.sess.recursion_limit.get();
let suggested_limit = current_limit * 2;
err.fileline_note(

View File

@ -10,7 +10,7 @@
use dep_graph::DepGraph;
use middle::infer::InferCtxt;
use middle::ty::{self, Ty, TypeFoldable, ToPolyTraitRef};
use middle::ty::{self, Ty, TyCtxt, TypeFoldable, ToPolyTraitRef};
use rustc_data_structures::obligation_forest::{Backtrace, ObligationForest, Error};
use std::iter;
use syntax::ast;
@ -237,7 +237,7 @@ impl<'tcx> FulfillmentContext<'tcx> {
}
fn is_duplicate_or_add(&mut self,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
predicate: &ty::Predicate<'tcx>)
-> bool {
// For "global" predicates -- that is, predicates that don't

View File

@ -23,7 +23,7 @@ use super::elaborate_predicates;
use middle::def_id::DefId;
use middle::subst::{self, SelfSpace, TypeSpace};
use middle::traits;
use middle::ty::{self, ToPolyTraitRef, Ty, TypeFoldable};
use middle::ty::{self, ToPolyTraitRef, Ty, TyCtxt, TypeFoldable};
use std::rc::Rc;
use syntax::ast;
@ -53,7 +53,7 @@ pub enum MethodViolationCode {
Generic,
}
pub fn is_object_safe<'tcx>(tcx: &ty::ctxt<'tcx>,
pub fn is_object_safe<'tcx>(tcx: &TyCtxt<'tcx>,
trait_def_id: DefId)
-> bool
{
@ -80,7 +80,7 @@ pub fn is_object_safe<'tcx>(tcx: &ty::ctxt<'tcx>,
/// astconv - currently, Self in supertraits. This is needed
/// because `object_safety_violations` can't be used during
/// type collection.
pub fn astconv_object_safety_violations<'tcx>(tcx: &ty::ctxt<'tcx>,
pub fn astconv_object_safety_violations<'tcx>(tcx: &TyCtxt<'tcx>,
trait_def_id: DefId)
-> Vec<ObjectSafetyViolation<'tcx>>
{
@ -97,7 +97,7 @@ pub fn astconv_object_safety_violations<'tcx>(tcx: &ty::ctxt<'tcx>,
violations
}
pub fn object_safety_violations<'tcx>(tcx: &ty::ctxt<'tcx>,
pub fn object_safety_violations<'tcx>(tcx: &TyCtxt<'tcx>,
trait_def_id: DefId)
-> Vec<ObjectSafetyViolation<'tcx>>
{
@ -106,7 +106,7 @@ pub fn object_safety_violations<'tcx>(tcx: &ty::ctxt<'tcx>,
.collect()
}
fn object_safety_violations_for_trait<'tcx>(tcx: &ty::ctxt<'tcx>,
fn object_safety_violations_for_trait<'tcx>(tcx: &TyCtxt<'tcx>,
trait_def_id: DefId)
-> Vec<ObjectSafetyViolation<'tcx>>
{
@ -139,7 +139,7 @@ fn object_safety_violations_for_trait<'tcx>(tcx: &ty::ctxt<'tcx>,
violations
}
pub fn supertraits_reference_self<'tcx>(tcx: &ty::ctxt<'tcx>,
pub fn supertraits_reference_self<'tcx>(tcx: &TyCtxt<'tcx>,
trait_def_id: DefId)
-> bool
{
@ -172,7 +172,7 @@ pub fn supertraits_reference_self<'tcx>(tcx: &ty::ctxt<'tcx>,
})
}
fn trait_has_sized_self<'tcx>(tcx: &ty::ctxt<'tcx>,
fn trait_has_sized_self<'tcx>(tcx: &TyCtxt<'tcx>,
trait_def_id: DefId)
-> bool
{
@ -181,7 +181,7 @@ fn trait_has_sized_self<'tcx>(tcx: &ty::ctxt<'tcx>,
generics_require_sized_self(tcx, &trait_def.generics, &trait_predicates)
}
fn generics_require_sized_self<'tcx>(tcx: &ty::ctxt<'tcx>,
fn generics_require_sized_self<'tcx>(tcx: &TyCtxt<'tcx>,
generics: &ty::Generics<'tcx>,
predicates: &ty::GenericPredicates<'tcx>)
-> bool
@ -215,7 +215,7 @@ fn generics_require_sized_self<'tcx>(tcx: &ty::ctxt<'tcx>,
}
/// Returns `Some(_)` if this method makes the containing trait not object safe.
fn object_safety_violation_for_method<'tcx>(tcx: &ty::ctxt<'tcx>,
fn object_safety_violation_for_method<'tcx>(tcx: &TyCtxt<'tcx>,
trait_def_id: DefId,
method: &ty::Method<'tcx>)
-> Option<MethodViolationCode>
@ -233,7 +233,7 @@ fn object_safety_violation_for_method<'tcx>(tcx: &ty::ctxt<'tcx>,
/// object. Note that object-safe traits can have some
/// non-vtable-safe methods, so long as they require `Self:Sized` or
/// otherwise ensure that they cannot be used when `Self=Trait`.
pub fn is_vtable_safe_method<'tcx>(tcx: &ty::ctxt<'tcx>,
pub fn is_vtable_safe_method<'tcx>(tcx: &TyCtxt<'tcx>,
trait_def_id: DefId,
method: &ty::Method<'tcx>)
-> bool
@ -245,7 +245,7 @@ pub fn is_vtable_safe_method<'tcx>(tcx: &ty::ctxt<'tcx>,
/// object; this does not necessarily imply that the enclosing trait
/// is not object safe, because the method might have a where clause
/// `Self:Sized`.
fn virtual_call_violation_for_method<'tcx>(tcx: &ty::ctxt<'tcx>,
fn virtual_call_violation_for_method<'tcx>(tcx: &TyCtxt<'tcx>,
trait_def_id: DefId,
method: &ty::Method<'tcx>)
-> Option<MethodViolationCode>
@ -286,7 +286,7 @@ fn virtual_call_violation_for_method<'tcx>(tcx: &ty::ctxt<'tcx>,
None
}
fn contains_illegal_self_type_reference<'tcx>(tcx: &ty::ctxt<'tcx>,
fn contains_illegal_self_type_reference<'tcx>(tcx: &TyCtxt<'tcx>,
trait_def_id: DefId,
ty: Ty<'tcx>)
-> bool

View File

@ -23,7 +23,7 @@ use super::util;
use middle::infer::{self, TypeOrigin};
use middle::subst::Subst;
use middle::ty::{self, ToPredicate, ToPolyTraitRef, Ty};
use middle::ty::{self, ToPredicate, ToPolyTraitRef, Ty, TyCtxt};
use middle::ty::fold::{TypeFoldable, TypeFolder};
use syntax::parse::token;
use util::common::FN_OUTPUT_NAME;
@ -257,7 +257,7 @@ impl<'a,'b,'tcx> AssociatedTypeNormalizer<'a,'b,'tcx> {
}
impl<'a,'b,'tcx> TypeFolder<'tcx> for AssociatedTypeNormalizer<'a,'b,'tcx> {
fn tcx(&self) -> &ty::ctxt<'tcx> {
fn tcx(&self) -> &TyCtxt<'tcx> {
self.selcx.tcx()
}

View File

@ -39,7 +39,7 @@ use middle::def_id::DefId;
use middle::infer;
use middle::infer::{InferCtxt, TypeFreshener, TypeOrigin};
use middle::subst::{Subst, Substs, TypeSpace};
use middle::ty::{self, ToPredicate, ToPolyTraitRef, Ty, TypeFoldable};
use middle::ty::{self, ToPredicate, ToPolyTraitRef, Ty, TyCtxt, TypeFoldable};
use middle::ty::fast_reject;
use middle::ty::relate::TypeRelation;
@ -273,7 +273,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
self.infcx
}
pub fn tcx(&self) -> &'cx ty::ctxt<'tcx> {
pub fn tcx(&self) -> &'cx TyCtxt<'tcx> {
self.infcx.tcx
}

View File

@ -11,7 +11,7 @@
use middle::def_id::DefId;
use middle::infer::InferCtxt;
use middle::subst::Substs;
use middle::ty::{self, Ty, ToPredicate, ToPolyTraitRef};
use middle::ty::{self, Ty, TyCtxt, ToPredicate, ToPolyTraitRef};
use syntax::codemap::Span;
use util::common::ErrorReported;
use util::nodemap::FnvHashSet;
@ -19,12 +19,12 @@ use util::nodemap::FnvHashSet;
use super::{Obligation, ObligationCause, PredicateObligation};
struct PredicateSet<'a,'tcx:'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
set: FnvHashSet<ty::Predicate<'tcx>>,
}
impl<'a,'tcx> PredicateSet<'a,'tcx> {
fn new(tcx: &'a ty::ctxt<'tcx>) -> PredicateSet<'a,'tcx> {
fn new(tcx: &'a TyCtxt<'tcx>) -> PredicateSet<'a,'tcx> {
PredicateSet { tcx: tcx, set: FnvHashSet() }
}
@ -77,13 +77,13 @@ impl<'a,'tcx> PredicateSet<'a,'tcx> {
/// Foo : 'static`, and we know that `T : Foo`, then we know that `T :
/// 'static`.
pub struct Elaborator<'cx, 'tcx:'cx> {
tcx: &'cx ty::ctxt<'tcx>,
tcx: &'cx TyCtxt<'tcx>,
stack: Vec<ty::Predicate<'tcx>>,
visited: PredicateSet<'cx,'tcx>,
}
pub fn elaborate_trait_ref<'cx, 'tcx>(
tcx: &'cx ty::ctxt<'tcx>,
tcx: &'cx TyCtxt<'tcx>,
trait_ref: ty::PolyTraitRef<'tcx>)
-> Elaborator<'cx, 'tcx>
{
@ -91,7 +91,7 @@ pub fn elaborate_trait_ref<'cx, 'tcx>(
}
pub fn elaborate_trait_refs<'cx, 'tcx>(
tcx: &'cx ty::ctxt<'tcx>,
tcx: &'cx TyCtxt<'tcx>,
trait_refs: &[ty::PolyTraitRef<'tcx>])
-> Elaborator<'cx, 'tcx>
{
@ -102,7 +102,7 @@ pub fn elaborate_trait_refs<'cx, 'tcx>(
}
pub fn elaborate_predicates<'cx, 'tcx>(
tcx: &'cx ty::ctxt<'tcx>,
tcx: &'cx TyCtxt<'tcx>,
mut predicates: Vec<ty::Predicate<'tcx>>)
-> Elaborator<'cx, 'tcx>
{
@ -205,14 +205,14 @@ impl<'cx, 'tcx> Iterator for Elaborator<'cx, 'tcx> {
pub type Supertraits<'cx, 'tcx> = FilterToTraits<Elaborator<'cx, 'tcx>>;
pub fn supertraits<'cx, 'tcx>(tcx: &'cx ty::ctxt<'tcx>,
pub fn supertraits<'cx, 'tcx>(tcx: &'cx TyCtxt<'tcx>,
trait_ref: ty::PolyTraitRef<'tcx>)
-> Supertraits<'cx, 'tcx>
{
elaborate_trait_ref(tcx, trait_ref).filter_to_traits()
}
pub fn transitive_bounds<'cx, 'tcx>(tcx: &'cx ty::ctxt<'tcx>,
pub fn transitive_bounds<'cx, 'tcx>(tcx: &'cx TyCtxt<'tcx>,
bounds: &[ty::PolyTraitRef<'tcx>])
-> Supertraits<'cx, 'tcx>
{
@ -223,12 +223,12 @@ pub fn transitive_bounds<'cx, 'tcx>(tcx: &'cx ty::ctxt<'tcx>,
// Iterator over def-ids of supertraits
pub struct SupertraitDefIds<'cx, 'tcx:'cx> {
tcx: &'cx ty::ctxt<'tcx>,
tcx: &'cx TyCtxt<'tcx>,
stack: Vec<DefId>,
visited: FnvHashSet<DefId>,
}
pub fn supertrait_def_ids<'cx, 'tcx>(tcx: &'cx ty::ctxt<'tcx>,
pub fn supertrait_def_ids<'cx, 'tcx>(tcx: &'cx TyCtxt<'tcx>,
trait_def_id: DefId)
-> SupertraitDefIds<'cx, 'tcx>
{
@ -330,7 +330,7 @@ pub fn predicates_for_generics<'tcx>(cause: ObligationCause<'tcx>,
}
pub fn trait_ref_for_builtin_bound<'tcx>(
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
builtin_bound: ty::BuiltinBound,
param_ty: Ty<'tcx>)
-> Result<ty::TraitRef<'tcx>, ErrorReported>
@ -364,7 +364,7 @@ pub fn predicate_for_trait_ref<'tcx>(
}
pub fn predicate_for_trait_def<'tcx>(
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
cause: ObligationCause<'tcx>,
trait_def_id: DefId,
recursion_depth: usize,
@ -380,7 +380,7 @@ pub fn predicate_for_trait_def<'tcx>(
}
pub fn predicate_for_builtin_bound<'tcx>(
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
cause: ObligationCause<'tcx>,
builtin_bound: ty::BuiltinBound,
recursion_depth: usize,
@ -394,7 +394,7 @@ pub fn predicate_for_builtin_bound<'tcx>(
/// Cast a trait reference into a reference to one of its super
/// traits; returns `None` if `target_trait_def_id` is not a
/// supertrait.
pub fn upcast<'tcx>(tcx: &ty::ctxt<'tcx>,
pub fn upcast<'tcx>(tcx: &TyCtxt<'tcx>,
source_trait_ref: ty::PolyTraitRef<'tcx>,
target_trait_def_id: DefId)
-> Vec<ty::PolyTraitRef<'tcx>>
@ -411,7 +411,7 @@ pub fn upcast<'tcx>(tcx: &ty::ctxt<'tcx>,
/// Given a trait `trait_ref`, returns the number of vtable entries
/// that come from `trait_ref`, excluding its supertraits. Used in
/// computing the vtable base for an upcast trait of a trait object.
pub fn count_own_vtable_entries<'tcx>(tcx: &ty::ctxt<'tcx>,
pub fn count_own_vtable_entries<'tcx>(tcx: &TyCtxt<'tcx>,
trait_ref: ty::PolyTraitRef<'tcx>)
-> usize {
let mut entries = 0;
@ -428,7 +428,7 @@ pub fn count_own_vtable_entries<'tcx>(tcx: &ty::ctxt<'tcx>,
/// Given an upcast trait object described by `object`, returns the
/// index of the method `method_def_id` (which should be part of
/// `object.upcast_trait_ref`) within the vtable for `object`.
pub fn get_vtable_index_of_object_method<'tcx>(tcx: &ty::ctxt<'tcx>,
pub fn get_vtable_index_of_object_method<'tcx>(tcx: &TyCtxt<'tcx>,
object: &super::VtableObjectData<'tcx>,
method_def_id: DefId) -> usize {
// Count number of methods preceding the one we are selecting and
@ -457,7 +457,7 @@ pub fn get_vtable_index_of_object_method<'tcx>(tcx: &ty::ctxt<'tcx>,
pub enum TupleArgumentsFlag { Yes, No }
pub fn closure_trait_ref_and_return_type<'tcx>(
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
fn_trait_def_id: DefId,
self_ty: Ty<'tcx>,
sig: &ty::PolyFnSig<'tcx>,

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use middle::ty::{self, Ty};
use middle::ty::{self, Ty, TyCtxt};
use middle::ty::error::TypeError;
use middle::ty::relate::{self, Relate, TypeRelation, RelateResult};
@ -29,18 +29,18 @@ use middle::ty::relate::{self, Relate, TypeRelation, RelateResult};
/// important thing about the result is Ok/Err. Also, matching never
/// affects any type variables or unification state.
pub struct Match<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>
tcx: &'a TyCtxt<'tcx>
}
impl<'a, 'tcx> Match<'a, 'tcx> {
pub fn new(tcx: &'a ty::ctxt<'tcx>) -> Match<'a, 'tcx> {
pub fn new(tcx: &'a TyCtxt<'tcx>) -> Match<'a, 'tcx> {
Match { tcx: tcx }
}
}
impl<'a, 'tcx> TypeRelation<'a, 'tcx> for Match<'a, 'tcx> {
fn tag(&self) -> &'static str { "Match" }
fn tcx(&self) -> &'a ty::ctxt<'tcx> { self.tcx }
fn tcx(&self) -> &'a TyCtxt<'tcx> { self.tcx }
fn a_is_expected(&self) -> bool { true } // irrelevant
fn relate_with_variance<T:Relate<'a,'tcx>>(&mut self,

View File

@ -11,7 +11,7 @@
pub use self::AutoAdjustment::*;
pub use self::AutoRef::*;
use middle::ty::{self, Ty, TypeAndMut, TypeFoldable};
use middle::ty::{self, Ty, TyCtxt, TypeAndMut, TypeFoldable};
use middle::ty::LvaluePreference::{NoPreference};
use syntax::ast;
@ -138,7 +138,7 @@ pub enum CustomCoerceUnsized {
impl<'tcx> ty::TyS<'tcx> {
/// See `expr_ty_adjusted`
pub fn adjust<F>(&'tcx self, cx: &ty::ctxt<'tcx>,
pub fn adjust<F>(&'tcx self, cx: &TyCtxt<'tcx>,
span: Span,
expr_id: ast::NodeId,
adjustment: Option<&AutoAdjustment<'tcx>>,
@ -220,7 +220,7 @@ impl<'tcx> ty::TyS<'tcx> {
}
pub fn adjust_for_autoderef<F>(&'tcx self,
cx: &ty::ctxt<'tcx>,
cx: &TyCtxt<'tcx>,
expr_id: ast::NodeId,
expr_span: Span,
autoderef: u32, // how many autoderefs so far?
@ -249,7 +249,7 @@ impl<'tcx> ty::TyS<'tcx> {
}
}
pub fn adjust_for_autoref(&'tcx self, cx: &ty::ctxt<'tcx>,
pub fn adjust_for_autoref(&'tcx self, cx: &TyCtxt<'tcx>,
autoref: Option<AutoRef<'tcx>>)
-> Ty<'tcx> {
match autoref {

View File

@ -9,7 +9,7 @@
// except according to those terms.
use middle::def_id::{DefId};
use middle::ty::{self, Ty};
use middle::ty::{self, Ty, TyCtxt};
use util::common::MemoizationMap;
use util::nodemap::FnvHashMap;
@ -89,7 +89,7 @@ impl TypeContents {
self.intersects(TC::InteriorUnsafe)
}
pub fn needs_drop(&self, _: &ty::ctxt) -> bool {
pub fn needs_drop(&self, _: &TyCtxt) -> bool {
self.intersects(TC::NeedsDrop)
}
@ -140,10 +140,10 @@ impl fmt::Debug for TypeContents {
}
impl<'tcx> ty::TyS<'tcx> {
pub fn type_contents(&'tcx self, cx: &ty::ctxt<'tcx>) -> TypeContents {
pub fn type_contents(&'tcx self, cx: &TyCtxt<'tcx>) -> TypeContents {
return cx.tc_cache.memoize(self, || tc_ty(cx, self, &mut FnvHashMap()));
fn tc_ty<'tcx>(cx: &ty::ctxt<'tcx>,
fn tc_ty<'tcx>(cx: &TyCtxt<'tcx>,
ty: Ty<'tcx>,
cache: &mut FnvHashMap<Ty<'tcx>, TypeContents>) -> TypeContents
{
@ -255,7 +255,7 @@ impl<'tcx> ty::TyS<'tcx> {
result
}
fn apply_lang_items(cx: &ty::ctxt, did: DefId, tc: TypeContents)
fn apply_lang_items(cx: &TyCtxt, did: DefId, tc: TypeContents)
-> TypeContents {
if Some(did) == cx.lang_items.unsafe_cell_type() {
tc | TC::InteriorUnsafe

View File

@ -10,9 +10,6 @@
//! type context book-keeping
// FIXME: (@jroesch) @eddyb should remove this when he renames ctxt
#![allow(non_camel_case_types)]
use dep_graph::{DepGraph, DepTrackingMap};
use front::map as ast_map;
use session::Session;
@ -155,7 +152,7 @@ impl<'tcx> Tables<'tcx> {
}
pub fn closure_kind(this: &RefCell<Self>,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
def_id: DefId)
-> ty::ClosureKind {
// If this is a local def-id, it should be inserted into the
@ -171,7 +168,7 @@ impl<'tcx> Tables<'tcx> {
}
pub fn closure_type(this: &RefCell<Self>,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
def_id: DefId,
substs: &ClosureSubsts<'tcx>)
-> ty::ClosureTy<'tcx>
@ -194,7 +191,7 @@ impl<'tcx> CommonTypes<'tcx> {
interner: &RefCell<FnvHashMap<InternedTy<'tcx>, Ty<'tcx>>>)
-> CommonTypes<'tcx>
{
let mk = |sty| ctxt::intern_ty(arena, interner, sty);
let mk = |sty| TyCtxt::intern_ty(arena, interner, sty);
CommonTypes {
bool: mk(TyBool),
char: mk(TyChar),
@ -218,7 +215,7 @@ impl<'tcx> CommonTypes<'tcx> {
/// The data structure to keep track of all the information that typechecker
/// generates so that so that it can be reused and doesn't have to be redone
/// later on.
pub struct ctxt<'tcx> {
pub struct TyCtxt<'tcx> {
/// The arenas that types etc are allocated from.
arenas: &'tcx CtxtArenas<'tcx>,
@ -417,7 +414,7 @@ pub struct ctxt<'tcx> {
pub fragment_infos: RefCell<DefIdMap<Vec<ty::FragmentInfo>>>,
}
impl<'tcx> ctxt<'tcx> {
impl<'tcx> TyCtxt<'tcx> {
pub fn type_parameter_def(&self,
node_id: NodeId)
-> ty::TypeParameterDef<'tcx>
@ -498,7 +495,7 @@ impl<'tcx> ctxt<'tcx> {
value.lift_to_tcx(self)
}
/// Create a type context and call the closure with a `&ty::ctxt` reference
/// Create a type context and call the closure with a `&TyCtxt` reference
/// to the context. The closure enforces that the type context and any interned
/// value (types, substs, etc.) can only be used while `ty::tls` has a valid
/// reference to the context, to allow formatting values that need it.
@ -512,13 +509,13 @@ impl<'tcx> ctxt<'tcx> {
lang_items: middle::lang_items::LanguageItems,
stability: stability::Index<'tcx>,
f: F) -> R
where F: FnOnce(&ctxt<'tcx>) -> R
where F: FnOnce(&TyCtxt<'tcx>) -> R
{
let interner = RefCell::new(FnvHashMap());
let common_types = CommonTypes::new(&arenas.type_, &interner);
let dep_graph = map.dep_graph.clone();
let fulfilled_predicates = traits::GlobalFulfilledPredicates::new(dep_graph.clone());
tls::enter(ctxt {
tls::enter(TyCtxt {
arenas: arenas,
interner: interner,
substs_interner: RefCell::new(FnvHashMap()),
@ -577,7 +574,7 @@ impl<'tcx> ctxt<'tcx> {
/// A trait implemented for all X<'a> types which can be safely and
/// efficiently converted to X<'tcx> as long as they are part of the
/// provided ty::ctxt<'tcx>.
/// provided TyCtxt<'tcx>.
/// This can be done, for example, for Ty<'tcx> or &'tcx Substs<'tcx>
/// by looking them up in their respective interners.
/// None is returned if the value or one of the components is not part
@ -588,12 +585,12 @@ impl<'tcx> ctxt<'tcx> {
/// e.g. `()` or `u8`, was interned in a different context.
pub trait Lift<'tcx> {
type Lifted;
fn lift_to_tcx(&self, tcx: &ctxt<'tcx>) -> Option<Self::Lifted>;
fn lift_to_tcx(&self, tcx: &TyCtxt<'tcx>) -> Option<Self::Lifted>;
}
impl<'a, 'tcx> Lift<'tcx> for Ty<'a> {
type Lifted = Ty<'tcx>;
fn lift_to_tcx(&self, tcx: &ctxt<'tcx>) -> Option<Ty<'tcx>> {
fn lift_to_tcx(&self, tcx: &TyCtxt<'tcx>) -> Option<Ty<'tcx>> {
if let Some(&ty) = tcx.interner.borrow().get(&self.sty) {
if *self as *const _ == ty as *const _ {
return Some(ty);
@ -605,7 +602,7 @@ impl<'a, 'tcx> Lift<'tcx> for Ty<'a> {
impl<'a, 'tcx> Lift<'tcx> for &'a Substs<'a> {
type Lifted = &'tcx Substs<'tcx>;
fn lift_to_tcx(&self, tcx: &ctxt<'tcx>) -> Option<&'tcx Substs<'tcx>> {
fn lift_to_tcx(&self, tcx: &TyCtxt<'tcx>) -> Option<&'tcx Substs<'tcx>> {
if let Some(&substs) = tcx.substs_interner.borrow().get(*self) {
if *self as *const _ == substs as *const _ {
return Some(substs);
@ -617,7 +614,7 @@ impl<'a, 'tcx> Lift<'tcx> for &'a Substs<'a> {
pub mod tls {
use middle::ty;
use middle::ty::TyCtxt;
use std::cell::Cell;
use std::fmt;
@ -638,7 +635,7 @@ pub mod tls {
})
}
pub fn enter<'tcx, F: FnOnce(&ty::ctxt<'tcx>) -> R, R>(tcx: ty::ctxt<'tcx>, f: F) -> R {
pub fn enter<'tcx, F: FnOnce(&TyCtxt<'tcx>) -> R, R>(tcx: TyCtxt<'tcx>, f: F) -> R {
codemap::SPAN_DEBUG.with(|span_dbg| {
let original_span_debug = span_dbg.get();
span_dbg.set(span_debug);
@ -655,14 +652,14 @@ pub mod tls {
})
}
pub fn with<F: FnOnce(&ty::ctxt) -> R, R>(f: F) -> R {
pub fn with<F: FnOnce(&TyCtxt) -> R, R>(f: F) -> R {
TLS_TCX.with(|tcx| {
let tcx = tcx.get().unwrap();
f(unsafe { &*(tcx as *const ty::ctxt) })
f(unsafe { &*(tcx as *const TyCtxt) })
})
}
pub fn with_opt<F: FnOnce(Option<&ty::ctxt>) -> R, R>(f: F) -> R {
pub fn with_opt<F: FnOnce(Option<&TyCtxt>) -> R, R>(f: F) -> R {
if TLS_TCX.with(|tcx| tcx.get().is_some()) {
with(|v| f(Some(v)))
} else {
@ -677,7 +674,7 @@ macro_rules! sty_debug_print {
// variable names.
#[allow(non_snake_case)]
mod inner {
use middle::ty;
use middle::ty::{self, TyCtxt};
#[derive(Copy, Clone)]
struct DebugStat {
total: usize,
@ -686,7 +683,7 @@ macro_rules! sty_debug_print {
both_infer: usize,
}
pub fn go(tcx: &ty::ctxt) {
pub fn go(tcx: &TyCtxt) {
let mut total = DebugStat {
total: 0,
region_infer: 0, ty_infer: 0, both_infer: 0,
@ -733,7 +730,7 @@ macro_rules! sty_debug_print {
}}
}
impl<'tcx> ctxt<'tcx> {
impl<'tcx> TyCtxt<'tcx> {
pub fn print_debug_stats(&self) {
sty_debug_print!(
self,
@ -780,7 +777,7 @@ fn bound_list_is_sorted(bounds: &[ty::PolyProjectionPredicate]) -> bool {
|(index, bound)| bounds[index].sort_key() <= bound.sort_key())
}
impl<'tcx> ctxt<'tcx> {
impl<'tcx> TyCtxt<'tcx> {
// Type constructors
pub fn mk_substs(&self, substs: Substs<'tcx>) -> &'tcx Substs<'tcx> {
if let Some(substs) = self.substs_interner.borrow().get(&substs) {
@ -854,7 +851,7 @@ impl<'tcx> ctxt<'tcx> {
// Interns a type/name combination, stores the resulting box in cx.interner,
// and returns the box as cast to an unsafe ptr (see comments for Ty above).
pub fn mk_ty(&self, st: TypeVariants<'tcx>) -> Ty<'tcx> {
ctxt::intern_ty(&self.arenas.type_, &self.interner, st)
TyCtxt::intern_ty(&self.arenas.type_, &self.interner, st)
}
pub fn mk_mach_int(&self, tm: ast::IntTy) -> Ty<'tcx> {

View File

@ -11,7 +11,7 @@
use middle::def_id::DefId;
use middle::subst;
use middle::infer::type_variable;
use middle::ty::{self, BoundRegion, Region, Ty};
use middle::ty::{self, BoundRegion, Region, Ty, TyCtxt};
use std::fmt;
use syntax::abi;
@ -211,7 +211,7 @@ impl<'tcx> fmt::Display for TypeError<'tcx> {
}
impl<'tcx> ty::TyS<'tcx> {
fn sort_string(&self, cx: &ty::ctxt) -> String {
fn sort_string(&self, cx: &TyCtxt) -> String {
match self.sty {
ty::TyBool | ty::TyChar | ty::TyInt(_) |
ty::TyUint(_) | ty::TyFloat(_) | ty::TyStr => self.to_string(),
@ -252,7 +252,7 @@ impl<'tcx> ty::TyS<'tcx> {
}
}
impl<'tcx> ty::ctxt<'tcx> {
impl<'tcx> TyCtxt<'tcx> {
pub fn note_and_explain_type_err(&self,
db: &mut DiagnosticBuilder,
err: &TypeError<'tcx>,

View File

@ -9,7 +9,7 @@
// except according to those terms.
use middle::def_id::DefId;
use middle::ty::{self, Ty};
use middle::ty::{self, Ty, TyCtxt};
use syntax::ast;
use self::SimplifiedType::*;
@ -43,7 +43,7 @@ pub enum SimplifiedType {
/// then we can't say much about whether two types would unify. Put another way,
/// `can_simplify_params` should be true if type parameters appear free in `ty` and `false` if they
/// are to be considered bound.
pub fn simplify_type(tcx: &ty::ctxt,
pub fn simplify_type(tcx: &TyCtxt,
ty: Ty,
can_simplify_params: bool)
-> Option<SimplifiedType>

View File

@ -42,7 +42,7 @@
use middle::region;
use middle::subst;
use middle::ty::adjustment;
use middle::ty::{self, Binder, Ty, TypeFlags};
use middle::ty::{self, Binder, Ty, TyCtxt, TypeFlags};
use std::fmt;
use util::nodemap::{FnvHashMap, FnvHashSet};
@ -114,7 +114,7 @@ pub trait TypeFoldable<'tcx>: fmt::Debug + Clone {
/// identity fold, it should invoke `foo.fold_with(self)` to fold each
/// sub-item.
pub trait TypeFolder<'tcx> : Sized {
fn tcx<'a>(&'a self) -> &'a ty::ctxt<'tcx>;
fn tcx<'a>(&'a self) -> &'a TyCtxt<'tcx>;
/// Invoked by the `super_*` routines when we enter a region
/// binding level (for example, when entering a function
@ -209,14 +209,14 @@ pub trait TypeVisitor<'tcx> : Sized {
// Some sample folders
pub struct BottomUpFolder<'a, 'tcx: 'a, F> where F: FnMut(Ty<'tcx>) -> Ty<'tcx> {
pub tcx: &'a ty::ctxt<'tcx>,
pub tcx: &'a TyCtxt<'tcx>,
pub fldop: F,
}
impl<'a, 'tcx, F> TypeFolder<'tcx> for BottomUpFolder<'a, 'tcx, F> where
F: FnMut(Ty<'tcx>) -> Ty<'tcx>,
{
fn tcx(&self) -> &ty::ctxt<'tcx> { self.tcx }
fn tcx(&self) -> &TyCtxt<'tcx> { self.tcx }
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
let t1 = ty.super_fold_with(self);
@ -227,7 +227,7 @@ impl<'a, 'tcx, F> TypeFolder<'tcx> for BottomUpFolder<'a, 'tcx, F> where
///////////////////////////////////////////////////////////////////////////
// Region folder
impl<'tcx> ty::ctxt<'tcx> {
impl<'tcx> TyCtxt<'tcx> {
/// Collects the free and escaping regions in `value` into `region_set`. Returns
/// whether any late-bound regions were skipped
pub fn collect_regions<T>(&self,
@ -267,14 +267,14 @@ impl<'tcx> ty::ctxt<'tcx> {
/// visited by `fld_r`.
pub struct RegionFolder<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
skipped_regions: &'a mut bool,
current_depth: u32,
fld_r: &'a mut (FnMut(ty::Region, u32) -> ty::Region + 'a),
}
impl<'a, 'tcx> RegionFolder<'a, 'tcx> {
pub fn new<F>(tcx: &'a ty::ctxt<'tcx>,
pub fn new<F>(tcx: &'a TyCtxt<'tcx>,
skipped_regions: &'a mut bool,
fld_r: &'a mut F) -> RegionFolder<'a, 'tcx>
where F : FnMut(ty::Region, u32) -> ty::Region
@ -290,7 +290,7 @@ impl<'a, 'tcx> RegionFolder<'a, 'tcx> {
impl<'a, 'tcx> TypeFolder<'tcx> for RegionFolder<'a, 'tcx>
{
fn tcx(&self) -> &ty::ctxt<'tcx> { self.tcx }
fn tcx(&self) -> &TyCtxt<'tcx> { self.tcx }
fn enter_region_binder(&mut self) {
self.current_depth += 1;
@ -323,13 +323,13 @@ impl<'a, 'tcx> TypeFolder<'tcx> for RegionFolder<'a, 'tcx>
// Replaces the escaping regions in a type.
struct RegionReplacer<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
current_depth: u32,
fld_r: &'a mut (FnMut(ty::BoundRegion) -> ty::Region + 'a),
map: FnvHashMap<ty::BoundRegion, ty::Region>
}
impl<'tcx> ty::ctxt<'tcx> {
impl<'tcx> TyCtxt<'tcx> {
pub fn replace_late_bound_regions<T,F>(&self,
value: &Binder<T>,
mut f: F)
@ -418,7 +418,7 @@ impl<'tcx> ty::ctxt<'tcx> {
}
impl<'a, 'tcx> RegionReplacer<'a, 'tcx> {
fn new<F>(tcx: &'a ty::ctxt<'tcx>, fld_r: &'a mut F) -> RegionReplacer<'a, 'tcx>
fn new<F>(tcx: &'a TyCtxt<'tcx>, fld_r: &'a mut F) -> RegionReplacer<'a, 'tcx>
where F : FnMut(ty::BoundRegion) -> ty::Region
{
RegionReplacer {
@ -432,7 +432,7 @@ impl<'a, 'tcx> RegionReplacer<'a, 'tcx> {
impl<'a, 'tcx> TypeFolder<'tcx> for RegionReplacer<'a, 'tcx>
{
fn tcx(&self) -> &ty::ctxt<'tcx> { self.tcx }
fn tcx(&self) -> &TyCtxt<'tcx> { self.tcx }
fn enter_region_binder(&mut self) {
self.current_depth += 1;
@ -475,7 +475,7 @@ impl<'a, 'tcx> TypeFolder<'tcx> for RegionReplacer<'a, 'tcx>
///////////////////////////////////////////////////////////////////////////
// Region eraser
impl<'tcx> ty::ctxt<'tcx> {
impl<'tcx> TyCtxt<'tcx> {
/// Returns an equivalent value with all free regions removed (note
/// that late-bound regions remain, because they are important for
/// subtyping, but they are anonymized and normalized as well)..
@ -487,10 +487,10 @@ impl<'tcx> ty::ctxt<'tcx> {
value, value1);
return value1;
struct RegionEraser<'a, 'tcx: 'a>(&'a ty::ctxt<'tcx>);
struct RegionEraser<'a, 'tcx: 'a>(&'a TyCtxt<'tcx>);
impl<'a, 'tcx> TypeFolder<'tcx> for RegionEraser<'a, 'tcx> {
fn tcx(&self) -> &ty::ctxt<'tcx> { self.0 }
fn tcx(&self) -> &TyCtxt<'tcx> { self.0 }
fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> {
match self.tcx().normalized_cache.borrow().get(&ty).cloned() {
@ -555,7 +555,7 @@ pub fn shift_region(region: ty::Region, amount: u32) -> ty::Region {
}
}
pub fn shift_regions<'tcx, T:TypeFoldable<'tcx>>(tcx: &ty::ctxt<'tcx>,
pub fn shift_regions<'tcx, T:TypeFoldable<'tcx>>(tcx: &TyCtxt<'tcx>,
amount: u32, value: &T) -> T {
debug!("shift_regions(value={:?}, amount={})",
value, amount);

View File

@ -75,7 +75,7 @@ pub use self::sty::BuiltinBound::Copy as BoundCopy;
pub use self::sty::BuiltinBound::Sync as BoundSync;
pub use self::contents::TypeContents;
pub use self::context::{ctxt, tls};
pub use self::context::{TyCtxt, tls};
pub use self::context::{CtxtArenas, Lift, Tables};
pub use self::trait_def::{TraitDef, TraitFlags};
@ -699,7 +699,7 @@ impl<'tcx> GenericPredicates<'tcx> {
}
}
pub fn instantiate(&self, tcx: &ctxt<'tcx>, substs: &Substs<'tcx>)
pub fn instantiate(&self, tcx: &TyCtxt<'tcx>, substs: &Substs<'tcx>)
-> InstantiatedPredicates<'tcx> {
InstantiatedPredicates {
predicates: self.predicates.subst(tcx, substs),
@ -707,7 +707,7 @@ impl<'tcx> GenericPredicates<'tcx> {
}
pub fn instantiate_supertrait(&self,
tcx: &ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
poly_trait_ref: &ty::PolyTraitRef<'tcx>)
-> InstantiatedPredicates<'tcx>
{
@ -751,7 +751,7 @@ impl<'tcx> Predicate<'tcx> {
/// substitution in terms of what happens with bound regions. See
/// lengthy comment below for details.
pub fn subst_supertrait(&self,
tcx: &ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
trait_ref: &ty::PolyTraitRef<'tcx>)
-> ty::Predicate<'tcx>
{
@ -1111,7 +1111,7 @@ impl<'tcx> TraitRef<'tcx> {
/// more distinctions clearer.
#[derive(Clone)]
pub struct ParameterEnvironment<'a, 'tcx:'a> {
pub tcx: &'a ctxt<'tcx>,
pub tcx: &'a TyCtxt<'tcx>,
/// See `construct_free_substs` for details.
pub free_substs: Substs<'tcx>,
@ -1160,7 +1160,7 @@ impl<'a, 'tcx> ParameterEnvironment<'a, 'tcx> {
}
}
pub fn for_item(cx: &'a ctxt<'tcx>, id: NodeId) -> ParameterEnvironment<'a, 'tcx> {
pub fn for_item(cx: &'a TyCtxt<'tcx>, id: NodeId) -> ParameterEnvironment<'a, 'tcx> {
match cx.map.find(id) {
Some(ast_map::NodeImplItem(ref impl_item)) => {
match impl_item.node {
@ -1460,7 +1460,7 @@ impl VariantKind {
}
impl<'tcx, 'container> AdtDefData<'tcx, 'container> {
fn new(tcx: &ctxt<'tcx>,
fn new(tcx: &TyCtxt<'tcx>,
did: DefId,
kind: AdtKind,
variants: Vec<VariantDefData<'tcx, 'container>>) -> Self {
@ -1489,7 +1489,7 @@ impl<'tcx, 'container> AdtDefData<'tcx, 'container> {
}
}
fn calculate_dtorck(&'tcx self, tcx: &ctxt<'tcx>) {
fn calculate_dtorck(&'tcx self, tcx: &TyCtxt<'tcx>) {
if tcx.is_adt_dtorck(self) {
self.flags.set(self.flags.get() | AdtFlags::IS_DTORCK);
}
@ -1510,7 +1510,7 @@ impl<'tcx, 'container> AdtDefData<'tcx, 'container> {
/// true, this type being safe for destruction requires it to be
/// alive; Otherwise, only the contents are required to be.
#[inline]
pub fn is_dtorck(&'tcx self, tcx: &ctxt<'tcx>) -> bool {
pub fn is_dtorck(&'tcx self, tcx: &TyCtxt<'tcx>) -> bool {
if !self.flags.get().intersects(AdtFlags::IS_DTORCK_VALID) {
self.calculate_dtorck(tcx)
}
@ -1551,12 +1551,12 @@ impl<'tcx, 'container> AdtDefData<'tcx, 'container> {
}
#[inline]
pub fn type_scheme(&self, tcx: &ctxt<'tcx>) -> TypeScheme<'tcx> {
pub fn type_scheme(&self, tcx: &TyCtxt<'tcx>) -> TypeScheme<'tcx> {
tcx.lookup_item_type(self.did)
}
#[inline]
pub fn predicates(&self, tcx: &ctxt<'tcx>) -> GenericPredicates<'tcx> {
pub fn predicates(&self, tcx: &TyCtxt<'tcx>) -> GenericPredicates<'tcx> {
tcx.lookup_predicates(self.did)
}
@ -1674,7 +1674,7 @@ impl<'tcx, 'container> FieldDefData<'tcx, 'container> {
}
}
pub fn ty(&self, tcx: &ctxt<'tcx>, subst: &Substs<'tcx>) -> Ty<'tcx> {
pub fn ty(&self, tcx: &TyCtxt<'tcx>, subst: &Substs<'tcx>) -> Ty<'tcx> {
self.unsubst_ty().subst(tcx, subst)
}
@ -1705,7 +1705,7 @@ pub enum ClosureKind {
}
impl ClosureKind {
pub fn trait_did(&self, cx: &ctxt) -> DefId {
pub fn trait_did(&self, cx: &TyCtxt) -> DefId {
let result = match *self {
FnClosureKind => cx.lang_items.require(FnTraitLangItem),
FnMutClosureKind => {
@ -1855,7 +1855,7 @@ impl BorrowKind {
}
}
impl<'tcx> ctxt<'tcx> {
impl<'tcx> TyCtxt<'tcx> {
pub fn node_id_to_type(&self, id: NodeId) -> Ty<'tcx> {
match self.node_id_to_type_opt(id) {
Some(ty) => ty,
@ -2666,7 +2666,7 @@ pub type TraitMap = NodeMap<Vec<DefId>>;
// imported.
pub type GlobMap = HashMap<NodeId, HashSet<Name>>;
impl<'tcx> ctxt<'tcx> {
impl<'tcx> TyCtxt<'tcx> {
pub fn with_freevars<T, F>(&self, fid: NodeId, f: F) -> T where
F: FnOnce(&[Freevar]) -> T,
{

View File

@ -15,7 +15,7 @@
use middle::def_id::DefId;
use middle::subst::{ErasedRegions, NonerasedRegions, ParamSpace, Substs};
use middle::ty::{self, Ty, TypeFoldable};
use middle::ty::{self, Ty, TyCtxt, TypeFoldable};
use middle::ty::error::{ExpectedFound, TypeError};
use std::rc::Rc;
use syntax::abi;
@ -29,7 +29,7 @@ pub enum Cause {
}
pub trait TypeRelation<'a,'tcx> : Sized {
fn tcx(&self) -> &'a ty::ctxt<'tcx>;
fn tcx(&self) -> &'a TyCtxt<'tcx>;
/// Returns a static string we can use for printouts.
fn tag(&self) -> &'static str;

View File

@ -10,7 +10,7 @@
use middle::subst::{self, VecPerParamSpace};
use middle::traits;
use middle::ty::{self, Lift, TraitRef, Ty};
use middle::ty::{self, Lift, TraitRef, Ty, TyCtxt};
use middle::ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};
use std::rc::Rc;
@ -24,14 +24,14 @@ use rustc_front::hir;
impl<'tcx, A: Lift<'tcx>, B: Lift<'tcx>> Lift<'tcx> for (A, B) {
type Lifted = (A::Lifted, B::Lifted);
fn lift_to_tcx(&self, tcx: &ty::ctxt<'tcx>) -> Option<Self::Lifted> {
fn lift_to_tcx(&self, tcx: &TyCtxt<'tcx>) -> Option<Self::Lifted> {
tcx.lift(&self.0).and_then(|a| tcx.lift(&self.1).map(|b| (a, b)))
}
}
impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for [T] {
type Lifted = Vec<T::Lifted>;
fn lift_to_tcx(&self, tcx: &ty::ctxt<'tcx>) -> Option<Self::Lifted> {
fn lift_to_tcx(&self, tcx: &TyCtxt<'tcx>) -> Option<Self::Lifted> {
// type annotation needed to inform `projection_must_outlive`
let mut result : Vec<<T as Lift<'tcx>>::Lifted>
= Vec::with_capacity(self.len());
@ -48,14 +48,14 @@ impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for [T] {
impl<'tcx> Lift<'tcx> for ty::Region {
type Lifted = Self;
fn lift_to_tcx(&self, _: &ty::ctxt<'tcx>) -> Option<ty::Region> {
fn lift_to_tcx(&self, _: &TyCtxt<'tcx>) -> Option<ty::Region> {
Some(*self)
}
}
impl<'a, 'tcx> Lift<'tcx> for TraitRef<'a> {
type Lifted = TraitRef<'tcx>;
fn lift_to_tcx(&self, tcx: &ty::ctxt<'tcx>) -> Option<TraitRef<'tcx>> {
fn lift_to_tcx(&self, tcx: &TyCtxt<'tcx>) -> Option<TraitRef<'tcx>> {
tcx.lift(&self.substs).map(|substs| TraitRef {
def_id: self.def_id,
substs: substs
@ -65,7 +65,7 @@ impl<'a, 'tcx> Lift<'tcx> for TraitRef<'a> {
impl<'a, 'tcx> Lift<'tcx> for ty::TraitPredicate<'a> {
type Lifted = ty::TraitPredicate<'tcx>;
fn lift_to_tcx(&self, tcx: &ty::ctxt<'tcx>) -> Option<ty::TraitPredicate<'tcx>> {
fn lift_to_tcx(&self, tcx: &TyCtxt<'tcx>) -> Option<ty::TraitPredicate<'tcx>> {
tcx.lift(&self.trait_ref).map(|trait_ref| ty::TraitPredicate {
trait_ref: trait_ref
})
@ -74,21 +74,21 @@ impl<'a, 'tcx> Lift<'tcx> for ty::TraitPredicate<'a> {
impl<'a, 'tcx> Lift<'tcx> for ty::EquatePredicate<'a> {
type Lifted = ty::EquatePredicate<'tcx>;
fn lift_to_tcx(&self, tcx: &ty::ctxt<'tcx>) -> Option<ty::EquatePredicate<'tcx>> {
fn lift_to_tcx(&self, tcx: &TyCtxt<'tcx>) -> Option<ty::EquatePredicate<'tcx>> {
tcx.lift(&(self.0, self.1)).map(|(a, b)| ty::EquatePredicate(a, b))
}
}
impl<'tcx, A: Copy+Lift<'tcx>, B: Copy+Lift<'tcx>> Lift<'tcx> for ty::OutlivesPredicate<A, B> {
type Lifted = ty::OutlivesPredicate<A::Lifted, B::Lifted>;
fn lift_to_tcx(&self, tcx: &ty::ctxt<'tcx>) -> Option<Self::Lifted> {
fn lift_to_tcx(&self, tcx: &TyCtxt<'tcx>) -> Option<Self::Lifted> {
tcx.lift(&(self.0, self.1)).map(|(a, b)| ty::OutlivesPredicate(a, b))
}
}
impl<'a, 'tcx> Lift<'tcx> for ty::ProjectionPredicate<'a> {
type Lifted = ty::ProjectionPredicate<'tcx>;
fn lift_to_tcx(&self, tcx: &ty::ctxt<'tcx>) -> Option<ty::ProjectionPredicate<'tcx>> {
fn lift_to_tcx(&self, tcx: &TyCtxt<'tcx>) -> Option<ty::ProjectionPredicate<'tcx>> {
tcx.lift(&(self.projection_ty.trait_ref, self.ty)).map(|(trait_ref, ty)| {
ty::ProjectionPredicate {
projection_ty: ty::ProjectionTy {
@ -103,7 +103,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ProjectionPredicate<'a> {
impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for ty::Binder<T> {
type Lifted = ty::Binder<T::Lifted>;
fn lift_to_tcx(&self, tcx: &ty::ctxt<'tcx>) -> Option<Self::Lifted> {
fn lift_to_tcx(&self, tcx: &TyCtxt<'tcx>) -> Option<Self::Lifted> {
tcx.lift(&self.0).map(|x| ty::Binder(x))
}
}

View File

@ -15,7 +15,7 @@ use middle::def_id::DefId;
use middle::region;
use middle::subst::{self, Substs};
use middle::traits;
use middle::ty::{self, AdtDef, ToPredicate, TypeFlags, Ty, TyS, TypeFoldable};
use middle::ty::{self, AdtDef, ToPredicate, TypeFlags, Ty, TyCtxt, TyS, TypeFoldable};
use util::common::ErrorReported;
use collections::enum_set::{self, EnumSet, CLike};
@ -281,7 +281,7 @@ impl<'tcx> TraitTy<'tcx> {
/// you must give *some* self-type. A common choice is `mk_err()`
/// or some skolemized type.
pub fn principal_trait_ref_with_self_ty(&self,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
self_ty: Ty<'tcx>)
-> ty::PolyTraitRef<'tcx>
{
@ -295,7 +295,7 @@ impl<'tcx> TraitTy<'tcx> {
}
pub fn projection_bounds_with_self_ty(&self,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
self_ty: Ty<'tcx>)
-> Vec<ty::PolyProjectionPredicate<'tcx>>
{
@ -540,7 +540,7 @@ impl ParamTy {
ParamTy::new(def.space, def.index, def.name)
}
pub fn to_ty<'tcx>(self, tcx: &ty::ctxt<'tcx>) -> Ty<'tcx> {
pub fn to_ty<'tcx>(self, tcx: &TyCtxt<'tcx>) -> Ty<'tcx> {
tcx.mk_param(self.space, self.idx, self.name)
}
@ -775,7 +775,7 @@ impl BuiltinBounds {
}
pub fn to_predicates<'tcx>(&self,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
self_ty: Ty<'tcx>) -> Vec<ty::Predicate<'tcx>> {
self.iter().filter_map(|builtin_bound|
match traits::trait_ref_for_builtin_bound(tcx, builtin_bound, self_ty) {
@ -822,7 +822,7 @@ impl CLike for BuiltinBound {
}
}
impl<'tcx> ty::ctxt<'tcx> {
impl<'tcx> TyCtxt<'tcx> {
pub fn try_add_builtin_trait(&self,
trait_def_id: DefId,
builtin_bounds: &mut EnumSet<BuiltinBound>)
@ -902,7 +902,7 @@ impl<'tcx> TyS<'tcx> {
}
}
pub fn is_empty(&self, _cx: &ty::ctxt) -> bool {
pub fn is_empty(&self, _cx: &TyCtxt) -> bool {
// FIXME(#24885): be smarter here
match self.sty {
TyEnum(def, _) | TyStruct(def, _) => def.is_empty(),
@ -974,7 +974,7 @@ impl<'tcx> TyS<'tcx> {
}
}
pub fn sequence_element_type(&self, cx: &ty::ctxt<'tcx>) -> Ty<'tcx> {
pub fn sequence_element_type(&self, cx: &TyCtxt<'tcx>) -> Ty<'tcx> {
match self.sty {
TyArray(ty, _) | TySlice(ty) => ty,
TyStr => cx.mk_mach_uint(ast::UintTy::U8),
@ -983,7 +983,7 @@ impl<'tcx> TyS<'tcx> {
}
}
pub fn simd_type(&self, cx: &ty::ctxt<'tcx>) -> Ty<'tcx> {
pub fn simd_type(&self, cx: &TyCtxt<'tcx>) -> Ty<'tcx> {
match self.sty {
TyStruct(def, substs) => {
def.struct_variant().fields[0].ty(cx, substs)
@ -992,7 +992,7 @@ impl<'tcx> TyS<'tcx> {
}
}
pub fn simd_size(&self, _cx: &ty::ctxt) -> usize {
pub fn simd_size(&self, _cx: &TyCtxt) -> usize {
match self.sty {
TyStruct(def, _) => def.struct_variant().fields.len(),
_ => panic!("simd_size called on invalid type")

View File

@ -12,7 +12,7 @@ use dep_graph::DepNode;
use middle::def_id::DefId;
use middle::ty;
use middle::ty::fast_reject;
use middle::ty::Ty;
use middle::ty::{Ty, TyCtxt};
use std::borrow::{Borrow};
use std::cell::{Cell, Ref, RefCell};
use syntax::ast::Name;
@ -106,17 +106,17 @@ impl<'tcx> TraitDef<'tcx> {
);
}
fn write_trait_impls(&self, tcx: &ty::ctxt<'tcx>) {
fn write_trait_impls(&self, tcx: &TyCtxt<'tcx>) {
tcx.dep_graph.write(DepNode::TraitImpls(self.trait_ref.def_id));
}
fn read_trait_impls(&self, tcx: &ty::ctxt<'tcx>) {
fn read_trait_impls(&self, tcx: &TyCtxt<'tcx>) {
tcx.dep_graph.read(DepNode::TraitImpls(self.trait_ref.def_id));
}
/// Records a trait-to-implementation mapping.
pub fn record_impl(&self,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
impl_def_id: DefId,
impl_trait_ref: ty::TraitRef<'tcx>) {
debug!("TraitDef::record_impl for {:?}, from {:?}",
@ -147,7 +147,7 @@ impl<'tcx> TraitDef<'tcx> {
}
}
pub fn for_each_impl<F: FnMut(DefId)>(&self, tcx: &ty::ctxt<'tcx>, mut f: F) {
pub fn for_each_impl<F: FnMut(DefId)>(&self, tcx: &TyCtxt<'tcx>, mut f: F) {
self.read_trait_impls(tcx);
tcx.populate_implementations_for_trait_if_necessary(self.trait_ref.def_id);
@ -166,7 +166,7 @@ impl<'tcx> TraitDef<'tcx> {
/// Iterate over every impl that could possibly match the
/// self-type `self_ty`.
pub fn for_each_relevant_impl<F: FnMut(DefId)>(&self,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
self_ty: Ty<'tcx>,
mut f: F)
{
@ -205,7 +205,7 @@ impl<'tcx> TraitDef<'tcx> {
}
}
pub fn borrow_impl_lists<'s>(&'s self, tcx: &ty::ctxt<'tcx>)
pub fn borrow_impl_lists<'s>(&'s self, tcx: &TyCtxt<'tcx>)
-> (Ref<'s, Vec<DefId>>,
Ref<'s, FnvHashMap<fast_reject::SimplifiedType, Vec<DefId>>>) {
self.read_trait_impls(tcx);

View File

@ -18,7 +18,7 @@ use middle::subst::{self, Subst, Substs};
use middle::infer;
use middle::pat_util;
use middle::traits;
use middle::ty::{self, Ty, TypeAndMut, TypeFlags, TypeFoldable};
use middle::ty::{self, Ty, TyCtxt, TypeAndMut, TypeFlags, TypeFoldable};
use middle::ty::{Disr, ParameterEnvironment};
use middle::ty::TypeVariants::*;
use util::num::ToPrimitive;
@ -33,7 +33,7 @@ use syntax::codemap::Span;
use rustc_front::hir;
pub trait IntTypeExt {
fn to_ty<'tcx>(&self, cx: &ty::ctxt<'tcx>) -> Ty<'tcx>;
fn to_ty<'tcx>(&self, cx: &TyCtxt<'tcx>) -> Ty<'tcx>;
fn i64_to_disr(&self, val: i64) -> Option<Disr>;
fn u64_to_disr(&self, val: u64) -> Option<Disr>;
fn disr_incr(&self, val: Disr) -> Option<Disr>;
@ -42,7 +42,7 @@ pub trait IntTypeExt {
}
impl IntTypeExt for attr::IntType {
fn to_ty<'tcx>(&self, cx: &ty::ctxt<'tcx>) -> Ty<'tcx> {
fn to_ty<'tcx>(&self, cx: &TyCtxt<'tcx>) -> Ty<'tcx> {
match *self {
SignedInt(ast::IntTy::I8) => cx.types.i8,
SignedInt(ast::IntTy::I16) => cx.types.i16,
@ -218,7 +218,7 @@ impl<'a, 'tcx> ParameterEnvironment<'a, 'tcx> {
}
}
impl<'tcx> ty::ctxt<'tcx> {
impl<'tcx> TyCtxt<'tcx> {
pub fn pat_contains_ref_binding(&self, pat: &hir::Pat) -> Option<hir::Mutability> {
pat_util::pat_contains_ref_binding(&self.def_map, pat)
}
@ -430,7 +430,7 @@ impl<'tcx> ty::ctxt<'tcx> {
helper(self, ty, svh, &mut state);
return state.finish();
fn helper<'tcx>(tcx: &ty::ctxt<'tcx>, ty: Ty<'tcx>, svh: &Svh,
fn helper<'tcx>(tcx: &TyCtxt<'tcx>, ty: Ty<'tcx>, svh: &Svh,
state: &mut SipHasher) {
macro_rules! byte { ($b:expr) => { ($b as u8).hash(state) } }
macro_rules! hash { ($e:expr) => { $e.hash(state) } }
@ -603,7 +603,7 @@ pub struct ImplMethod<'tcx> {
pub is_provided: bool
}
impl<'tcx> ty::ctxt<'tcx> {
impl<'tcx> TyCtxt<'tcx> {
pub fn get_impl_method(&self,
impl_def_id: DefId,
substs: Substs<'tcx>,
@ -742,10 +742,10 @@ impl<'tcx> ty::TyS<'tcx> {
/// Check whether a type is representable. This means it cannot contain unboxed
/// structural recursion. This check is needed for structs and enums.
pub fn is_representable(&'tcx self, cx: &ty::ctxt<'tcx>, sp: Span) -> Representability {
pub fn is_representable(&'tcx self, cx: &TyCtxt<'tcx>, sp: Span) -> Representability {
// Iterate until something non-representable is found
fn find_nonrepresentable<'tcx, It: Iterator<Item=Ty<'tcx>>>(cx: &ty::ctxt<'tcx>,
fn find_nonrepresentable<'tcx, It: Iterator<Item=Ty<'tcx>>>(cx: &TyCtxt<'tcx>,
sp: Span,
seen: &mut Vec<Ty<'tcx>>,
iter: It)
@ -754,7 +754,7 @@ impl<'tcx> ty::TyS<'tcx> {
|r, ty| cmp::max(r, is_type_structurally_recursive(cx, sp, seen, ty)))
}
fn are_inner_types_recursive<'tcx>(cx: &ty::ctxt<'tcx>, sp: Span,
fn are_inner_types_recursive<'tcx>(cx: &TyCtxt<'tcx>, sp: Span,
seen: &mut Vec<Ty<'tcx>>, ty: Ty<'tcx>)
-> Representability {
match ty.sty {
@ -813,7 +813,7 @@ impl<'tcx> ty::TyS<'tcx> {
// Does the type `ty` directly (without indirection through a pointer)
// contain any types on stack `seen`?
fn is_type_structurally_recursive<'tcx>(cx: &ty::ctxt<'tcx>,
fn is_type_structurally_recursive<'tcx>(cx: &TyCtxt<'tcx>,
sp: Span,
seen: &mut Vec<Ty<'tcx>>,
ty: Ty<'tcx>) -> Representability {

View File

@ -13,7 +13,7 @@ use middle::infer::InferCtxt;
use middle::ty::outlives::{self, Component};
use middle::subst::Substs;
use middle::traits;
use middle::ty::{self, ToPredicate, Ty, TypeFoldable};
use middle::ty::{self, ToPredicate, Ty, TyCtxt, TypeFoldable};
use std::iter::once;
use syntax::ast;
use syntax::codemap::Span;
@ -487,7 +487,7 @@ impl<'a,'tcx> WfPredicates<'a,'tcx> {
/// `'static` would appear in the list. The hard work is done by
/// `ty::required_region_bounds`, see that for more information.
pub fn object_region_bounds<'tcx>(
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
principal: &ty::PolyTraitRef<'tcx>,
others: ty::BuiltinBounds)
-> Vec<ty::Region>

View File

@ -12,7 +12,7 @@ use dep_graph::DepNode;
use util::nodemap::NodeMap;
use mir::repr::Mir;
use mir::transform::MirPass;
use middle::ty;
use middle::ty::{self, TyCtxt};
use middle::infer;
pub struct MirMap<'tcx> {
@ -20,7 +20,7 @@ pub struct MirMap<'tcx> {
}
impl<'tcx> MirMap<'tcx> {
pub fn run_passes(&mut self, passes: &mut [Box<MirPass>], tcx: &ty::ctxt<'tcx>) {
pub fn run_passes(&mut self, passes: &mut [Box<MirPass>], tcx: &TyCtxt<'tcx>) {
if passes.is_empty() { return; }
for (&id, mir) in &mut self.map {

View File

@ -16,7 +16,7 @@
use mir::repr::*;
use middle::const_eval::ConstVal;
use middle::subst::{Subst, Substs};
use middle::ty::{self, AdtDef, Ty};
use middle::ty::{self, AdtDef, Ty, TyCtxt};
use rustc_front::hir;
#[derive(Copy, Clone, Debug)]
@ -35,7 +35,7 @@ impl<'tcx> LvalueTy<'tcx> {
LvalueTy::Ty { ty: ty }
}
pub fn to_ty(&self, tcx: &ty::ctxt<'tcx>) -> Ty<'tcx> {
pub fn to_ty(&self, tcx: &TyCtxt<'tcx>) -> Ty<'tcx> {
match *self {
LvalueTy::Ty { ty } =>
ty,
@ -45,7 +45,7 @@ impl<'tcx> LvalueTy<'tcx> {
}
pub fn projection_ty(self,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
elem: &LvalueElem<'tcx>)
-> LvalueTy<'tcx>
{
@ -80,7 +80,7 @@ impl<'tcx> LvalueTy<'tcx> {
impl<'tcx> Mir<'tcx> {
pub fn operand_ty(&self,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
operand: &Operand<'tcx>)
-> Ty<'tcx>
{
@ -91,7 +91,7 @@ impl<'tcx> Mir<'tcx> {
}
pub fn binop_ty(&self,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
op: BinOp,
lhs_ty: Ty<'tcx>,
rhs_ty: Ty<'tcx>)
@ -116,7 +116,7 @@ impl<'tcx> Mir<'tcx> {
}
pub fn lvalue_ty(&self,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
lvalue: &Lvalue<'tcx>)
-> LvalueTy<'tcx>
{
@ -137,7 +137,7 @@ impl<'tcx> Mir<'tcx> {
}
pub fn rvalue_ty(&self,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
rvalue: &Rvalue<'tcx>)
-> Option<Ty<'tcx>>
{

View File

@ -17,7 +17,7 @@ use middle::ty::{TyError, TyStr, TyArray, TySlice, TyFloat, TyBareFn};
use middle::ty::{TyParam, TyRawPtr, TyRef, TyTuple};
use middle::ty::TyClosure;
use middle::ty::{TyBox, TyTrait, TyInt, TyUint, TyInfer};
use middle::ty::{self, Ty, TypeFoldable};
use middle::ty::{self, Ty, TyCtxt, TypeFoldable};
use std::fmt;
use syntax::abi::Abi;
@ -66,7 +66,7 @@ fn parameterized<GG>(f: &mut fmt::Formatter,
projections: &[ty::ProjectionPredicate],
get_generics: GG)
-> fmt::Result
where GG: for<'tcx> FnOnce(&ty::ctxt<'tcx>) -> ty::Generics<'tcx>
where GG: for<'tcx> FnOnce(&TyCtxt<'tcx>) -> ty::Generics<'tcx>
{
let (fn_trait_kind, verbose) = try!(ty::tls::with(|tcx| {
try!(write!(f, "{}", tcx.item_path_str(did)));
@ -189,7 +189,7 @@ fn parameterized<GG>(f: &mut fmt::Formatter,
}
fn in_binder<'tcx, T, U>(f: &mut fmt::Formatter,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
original: &ty::Binder<T>,
lifted: Option<ty::Binder<U>>) -> fmt::Result
where T: fmt::Display, U: fmt::Display + TypeFoldable<'tcx>

View File

@ -26,7 +26,7 @@ use rustc::middle::infer;
use rustc::middle::mem_categorization as mc;
use rustc::middle::mem_categorization::Categorization;
use rustc::middle::region;
use rustc::middle::ty;
use rustc::middle::ty::{self, TyCtxt};
use syntax::ast;
use syntax::codemap::Span;
use rustc_front::hir;
@ -231,7 +231,7 @@ fn compatible_borrow_kinds(borrow_kind1: ty::BorrowKind,
}
impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
pub fn tcx(&self) -> &'a ty::ctxt<'tcx> { self.bccx.tcx }
pub fn tcx(&self) -> &'a TyCtxt<'tcx> { self.bccx.tcx }
pub fn each_issued_loan<F>(&self, node: ast::NodeId, mut op: F) -> bool where
F: FnMut(&Loan<'tcx>) -> bool,

View File

@ -21,7 +21,7 @@ use borrowck::LoanPathElem::{LpDeref, LpInterior};
use borrowck::move_data::InvalidMovePathIndex;
use borrowck::move_data::{MoveData, MovePathIndex};
use rustc::middle::def_id::{DefId};
use rustc::middle::ty;
use rustc::middle::ty::{self, TyCtxt};
use rustc::middle::mem_categorization as mc;
use std::mem;
@ -200,7 +200,7 @@ impl FragmentSets {
}
pub fn instrument_move_fragments<'tcx>(this: &MoveData<'tcx>,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
sp: Span,
id: ast::NodeId) {
let span_err = tcx.map.attrs(id).iter()
@ -245,7 +245,7 @@ pub fn instrument_move_fragments<'tcx>(this: &MoveData<'tcx>,
///
/// Note: "left-over fragments" means paths that were not directly referenced in moves nor
/// assignments, but must nonetheless be tracked as potential drop obligations.
pub fn fixup_fragment_sets<'tcx>(this: &MoveData<'tcx>, tcx: &ty::ctxt<'tcx>) {
pub fn fixup_fragment_sets<'tcx>(this: &MoveData<'tcx>, tcx: &TyCtxt<'tcx>) {
let mut fragments = this.fragments.borrow_mut();
@ -347,7 +347,7 @@ pub fn fixup_fragment_sets<'tcx>(this: &MoveData<'tcx>, tcx: &ty::ctxt<'tcx>) {
/// example, if `lp` represents `s.x.j`, then adds moves paths for `s.x.i` and `s.x.k`, the
/// siblings of `s.x.j`.
fn add_fragment_siblings<'tcx>(this: &MoveData<'tcx>,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
gathered_fragments: &mut Vec<Fragment>,
lp: Rc<LoanPath<'tcx>>,
origin_id: Option<ast::NodeId>) {
@ -406,7 +406,7 @@ fn add_fragment_siblings<'tcx>(this: &MoveData<'tcx>,
/// We have determined that `origin_lp` destructures to LpExtend(parent, original_field_name).
/// Based on this, add move paths for all of the siblings of `origin_lp`.
fn add_fragment_siblings_for_extension<'tcx>(this: &MoveData<'tcx>,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
gathered_fragments: &mut Vec<Fragment>,
parent_lp: &Rc<LoanPath<'tcx>>,
mc: mc::MutabilityCategory,
@ -504,7 +504,7 @@ fn add_fragment_siblings_for_extension<'tcx>(this: &MoveData<'tcx>,
/// Adds the single sibling `LpExtend(parent, new_field_name)` of `origin_lp` (the original
/// loan-path).
fn add_fragment_sibling_core<'tcx>(this: &MoveData<'tcx>,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
gathered_fragments: &mut Vec<Fragment>,
parent: Rc<LoanPath<'tcx>>,
mc: mc::MutabilityCategory,

View File

@ -23,7 +23,7 @@ use rustc::middle::infer;
use rustc::middle::mem_categorization as mc;
use rustc::middle::mem_categorization::Categorization;
use rustc::middle::region;
use rustc::middle::ty;
use rustc::middle::ty::{self, TyCtxt};
use syntax::ast;
use syntax::codemap::Span;
@ -253,7 +253,7 @@ fn check_mutability<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
}
impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> {
pub fn tcx(&self) -> &'a ty::ctxt<'tcx> { self.bccx.tcx }
pub fn tcx(&self) -> &'a TyCtxt<'tcx> { self.bccx.tcx }
/// Guarantees that `cmt` is assignable, or reports an error.
fn guarantee_assignment_valid(&mut self,

View File

@ -34,7 +34,7 @@ use rustc::middle::free_region::FreeRegionMap;
use rustc::middle::mem_categorization as mc;
use rustc::middle::mem_categorization::Categorization;
use rustc::middle::region;
use rustc::middle::ty::{self, Ty};
use rustc::middle::ty::{self, Ty, TyCtxt};
use std::fmt;
use std::mem;
@ -98,7 +98,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for BorrowckCtxt<'a, 'tcx> {
}
}
pub fn check_crate(tcx: &ty::ctxt) {
pub fn check_crate(tcx: &TyCtxt) {
let mut bccx = BorrowckCtxt {
tcx: tcx,
free_region_map: FreeRegionMap::new(),
@ -232,7 +232,7 @@ fn build_borrowck_dataflow_data<'a, 'tcx>(this: &mut BorrowckCtxt<'a, 'tcx>,
/// Accessor for introspective clients inspecting `AnalysisData` and
/// the `BorrowckCtxt` itself , e.g. the flowgraph visualizer.
pub fn build_borrowck_dataflow_data_for_fn<'a, 'tcx>(
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
fn_parts: FnParts<'a>,
cfg: &cfg::CFG)
-> (BorrowckCtxt<'a, 'tcx>, AnalysisData<'a, 'tcx>)
@ -264,7 +264,7 @@ pub fn build_borrowck_dataflow_data_for_fn<'a, 'tcx>(
// Type definitions
pub struct BorrowckCtxt<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
// Hacky. As we visit various fns, we have to load up the
// free-region map for each one. This map is computed by during
@ -394,7 +394,7 @@ pub enum LoanPathElem {
}
pub fn closure_to_block(closure_id: ast::NodeId,
tcx: &ty::ctxt) -> ast::NodeId {
tcx: &TyCtxt) -> ast::NodeId {
match tcx.map.get(closure_id) {
hir_map::NodeExpr(expr) => match expr.node {
hir::ExprClosure(_, _, ref block) => {
@ -409,7 +409,7 @@ pub fn closure_to_block(closure_id: ast::NodeId,
}
impl<'tcx> LoanPath<'tcx> {
pub fn kill_scope(&self, tcx: &ty::ctxt<'tcx>) -> region::CodeExtent {
pub fn kill_scope(&self, tcx: &TyCtxt<'tcx>) -> region::CodeExtent {
match self.kind {
LpVar(local_id) => tcx.region_maps.var_scope(local_id),
LpUpvar(upvar_id) => {
@ -1157,7 +1157,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
}
}
fn statement_scope_span(tcx: &ty::ctxt, region: ty::Region) -> Option<Span> {
fn statement_scope_span(tcx: &TyCtxt, region: ty::Region) -> Option<Span> {
match region {
ty::ReScope(scope) => {
match tcx.map.find(scope.node_id(&tcx.region_maps)) {

View File

@ -21,7 +21,7 @@ use rustc::middle::dataflow::DataFlowOperator;
use rustc::middle::dataflow::KillFrom;
use rustc::middle::expr_use_visitor as euv;
use rustc::middle::expr_use_visitor::MutateMode;
use rustc::middle::ty;
use rustc::middle::ty::TyCtxt;
use rustc::util::nodemap::{FnvHashMap, NodeSet};
use std::cell::RefCell;
@ -273,7 +273,7 @@ impl<'tcx> MoveData<'tcx> {
/// Returns the existing move path index for `lp`, if any, and otherwise adds a new index for
/// `lp` and any of its base paths that do not yet have an index.
pub fn move_path(&self,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
lp: Rc<LoanPath<'tcx>>) -> MovePathIndex {
match self.path_map.borrow().get(&lp) {
Some(&index) => {
@ -365,7 +365,7 @@ impl<'tcx> MoveData<'tcx> {
/// Adds a new move entry for a move of `lp` that occurs at location `id` with kind `kind`.
pub fn add_move(&self,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
lp: Rc<LoanPath<'tcx>>,
id: ast::NodeId,
kind: MoveKind) {
@ -393,7 +393,7 @@ impl<'tcx> MoveData<'tcx> {
/// Adds a new record for an assignment to `lp` that occurs at location `id` with the given
/// `span`.
pub fn add_assignment(&self,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
lp: Rc<LoanPath<'tcx>>,
assign_id: ast::NodeId,
span: Span,
@ -438,7 +438,7 @@ impl<'tcx> MoveData<'tcx> {
/// should be able to recover the span info from the
/// `pattern_id` and the ast_map, I think.)
pub fn add_variant_match(&self,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
lp: Rc<LoanPath<'tcx>>,
pattern_id: ast::NodeId,
base_lp: Rc<LoanPath<'tcx>>,
@ -461,7 +461,7 @@ impl<'tcx> MoveData<'tcx> {
self.variant_matches.borrow_mut().push(variant_match);
}
fn fixup_fragment_sets(&self, tcx: &ty::ctxt<'tcx>) {
fn fixup_fragment_sets(&self, tcx: &TyCtxt<'tcx>) {
fragments::fixup_fragment_sets(self, tcx)
}
@ -471,7 +471,7 @@ impl<'tcx> MoveData<'tcx> {
/// scoping. Assignments are generated by assignment to variables and
/// killed by scoping. See `README.md` for more details.
fn add_gen_kills(&self,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
dfcx_moves: &mut MoveDataFlow,
dfcx_assign: &mut AssignDataFlow) {
for (i, the_move) in self.moves.borrow().iter().enumerate() {
@ -600,7 +600,7 @@ impl<'tcx> MoveData<'tcx> {
impl<'a, 'tcx> FlowedMoveData<'a, 'tcx> {
pub fn new(move_data: MoveData<'tcx>,
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
cfg: &cfg::CFG,
id_range: ast_util::IdRange,
decl: &hir::FnDecl,

View File

@ -17,9 +17,9 @@ use rustc::session::{Session, CompileResult, compile_result_from_err_count};
use rustc::session::config::{self, Input, OutputFilenames, OutputType};
use rustc::session::search_paths::PathKind;
use rustc::lint;
use rustc::middle::{dependency_format, stability, ty, reachable};
use rustc::middle::{self, dependency_format, stability, ty, reachable};
use rustc::middle::privacy::AccessLevels;
use rustc::middle;
use rustc::middle::ty::TyCtxt;
use rustc::util::common::time;
use rustc::util::nodemap::NodeSet;
use rustc_borrowck as borrowck;
@ -313,7 +313,7 @@ pub struct CompileState<'a, 'ast: 'a, 'tcx: 'a> {
pub ast_map: Option<&'a hir_map::Map<'ast>>,
pub mir_map: Option<&'a MirMap<'tcx>>,
pub analysis: Option<&'a ty::CrateAnalysis<'a>>,
pub tcx: Option<&'a ty::ctxt<'tcx>>,
pub tcx: Option<&'a TyCtxt<'tcx>>,
pub lcx: Option<&'a LoweringContext<'a>>,
pub trans: Option<&'a trans::CrateTranslation>,
}
@ -389,7 +389,7 @@ impl<'a, 'ast, 'tcx> CompileState<'a, 'ast, 'tcx> {
hir_crate: &'a hir::Crate,
analysis: &'a ty::CrateAnalysis,
mir_map: Option<&'a MirMap<'tcx>>,
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
lcx: &'a LoweringContext<'a>,
crate_name: &'a str)
-> CompileState<'a, 'ast, 'tcx> {
@ -730,7 +730,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
make_glob_map: resolve::MakeGlobMap,
f: F)
-> Result<R, usize>
where F: FnOnce(&ty::ctxt<'tcx>, Option<MirMap<'tcx>>, ty::CrateAnalysis, CompileResult) -> R
where F: FnOnce(&TyCtxt<'tcx>, Option<MirMap<'tcx>>, ty::CrateAnalysis, CompileResult) -> R
{
macro_rules! try_with_f {
($e: expr, ($t: expr, $m: expr, $a: expr)) => {
@ -803,7 +803,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
let index = stability::Index::new(&hir_map);
ty::ctxt::create_and_enter(sess,
TyCtxt::create_and_enter(sess,
arenas,
def_map,
named_region_map,
@ -913,7 +913,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
/// be discarded.
pub fn phase_4_translate_to_llvm<'tcx>(tcx: &ty::ctxt<'tcx>,
pub fn phase_4_translate_to_llvm<'tcx>(tcx: &TyCtxt<'tcx>,
mut mir_map: MirMap<'tcx>,
analysis: ty::CrateAnalysis)
-> trans::CrateTranslation {

View File

@ -20,7 +20,7 @@ use rustc_trans::back::link;
use {driver, abort_on_err};
use rustc::dep_graph::DepGraph;
use rustc::middle::ty;
use rustc::middle::ty::{self, TyCtxt};
use rustc::middle::cfg;
use rustc::middle::cfg::graphviz::LabelledCFG;
use rustc::session::Session;
@ -431,7 +431,7 @@ impl<'ast> pprust::PpAnn for HygieneAnnotation<'ast> {
struct TypedAnnotation<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
}
impl<'b, 'tcx> HirPrinterSupport<'tcx> for TypedAnnotation<'b, 'tcx> {
@ -913,7 +913,7 @@ pub fn pretty_print_input(sess: Session,
}
fn print_flowgraph<W: Write>(variants: Vec<borrowck_dot::Variant>,
tcx: &ty::ctxt,
tcx: &TyCtxt,
code: blocks::Code,
mode: PpFlowGraphMode,
mut out: W)

View File

@ -22,7 +22,7 @@ use rustc_typeck::middle::resolve_lifetime;
use rustc_typeck::middle::stability;
use rustc_typeck::middle::subst;
use rustc_typeck::middle::subst::Subst;
use rustc_typeck::middle::ty::{self, Ty, TypeFoldable};
use rustc_typeck::middle::ty::{self, Ty, TyCtxt, TypeFoldable};
use rustc_typeck::middle::ty::relate::TypeRelation;
use rustc_typeck::middle::infer::{self, TypeOrigin};
use rustc_typeck::middle::infer::lub::Lub;
@ -133,7 +133,7 @@ fn test_env<F>(source_string: &str,
let named_region_map = resolve_lifetime::krate(&sess, &ast_map, &def_map.borrow());
let region_map = region::resolve_crate(&sess, &ast_map);
let index = stability::Index::new(&ast_map);
ty::ctxt::create_and_enter(&sess,
TyCtxt::create_and_enter(&sess,
&arenas,
def_map,
named_region_map.unwrap(),
@ -153,7 +153,7 @@ fn test_env<F>(source_string: &str,
}
impl<'a, 'tcx> Env<'a, 'tcx> {
pub fn tcx(&self) -> &ty::ctxt<'tcx> {
pub fn tcx(&self) -> &TyCtxt<'tcx> {
self.infcx.tcx
}

View File

@ -33,7 +33,7 @@ use middle::def::Def;
use middle::cstore::CrateStore;
use middle::def_id::DefId;
use middle::subst::Substs;
use middle::ty::{self, Ty};
use middle::ty::{self, Ty, TyCtxt};
use middle::ty::adjustment;
use rustc::front::map as hir_map;
use util::nodemap::{NodeSet};
@ -774,7 +774,7 @@ impl LateLintPass for UnconditionalRecursion {
// Functions for identifying if the given Expr NodeId `id`
// represents a call to the function `fn_id`/method `method`.
fn expr_refers_to_this_fn(tcx: &ty::ctxt,
fn expr_refers_to_this_fn(tcx: &TyCtxt,
fn_id: ast::NodeId,
id: ast::NodeId) -> bool {
match tcx.map.get(id) {
@ -790,7 +790,7 @@ impl LateLintPass for UnconditionalRecursion {
}
// Check if the expression `id` performs a call to `method`.
fn expr_refers_to_this_method(tcx: &ty::ctxt,
fn expr_refers_to_this_method(tcx: &TyCtxt,
method: &ty::Method,
id: ast::NodeId) -> bool {
// Check for method calls and overloaded operators.
@ -838,7 +838,7 @@ impl LateLintPass for UnconditionalRecursion {
// Check if the method call to the method with the ID `callee_id`
// and instantiated with `callee_substs` refers to method `method`.
fn method_call_refers_to_method<'tcx>(tcx: &ty::ctxt<'tcx>,
fn method_call_refers_to_method<'tcx>(tcx: &TyCtxt<'tcx>,
method: &ty::Method,
callee_id: DefId,
callee_substs: &Substs<'tcx>,

View File

@ -13,7 +13,7 @@
use middle::{infer};
use middle::def_id::DefId;
use middle::subst::Substs;
use middle::ty::{self, Ty};
use middle::ty::{self, Ty, TyCtxt};
use middle::const_eval::{eval_const_expr_partial, ConstVal};
use middle::const_eval::EvalHint::ExprTypeChecked;
use util::nodemap::{FnvHashSet};
@ -293,7 +293,7 @@ impl LateLintPass for TypeLimits {
}
}
fn check_limits(tcx: &ty::ctxt, binop: hir::BinOp,
fn check_limits(tcx: &TyCtxt, binop: hir::BinOp,
l: &hir::Expr, r: &hir::Expr) -> bool {
let (lit, expr, swap) = match (&l.node, &r.node) {
(&hir::ExprLit(_), _) => (l, r, true),
@ -374,7 +374,7 @@ enum FfiResult {
/// to function pointers and references, but could be
/// expanded to cover NonZero raw pointers and newtypes.
/// FIXME: This duplicates code in trans.
fn is_repr_nullable_ptr<'tcx>(tcx: &ty::ctxt<'tcx>,
fn is_repr_nullable_ptr<'tcx>(tcx: &TyCtxt<'tcx>,
def: ty::AdtDef<'tcx>,
substs: &Substs<'tcx>)
-> bool {
@ -400,7 +400,7 @@ fn is_repr_nullable_ptr<'tcx>(tcx: &ty::ctxt<'tcx>,
false
}
fn ast_ty_to_normalized<'tcx>(tcx: &ty::ctxt<'tcx>,
fn ast_ty_to_normalized<'tcx>(tcx: &TyCtxt<'tcx>,
id: ast::NodeId)
-> Ty<'tcx> {
let tty = match tcx.ast_ty_to_ty_cache.borrow().get(&id) {

View File

@ -34,7 +34,7 @@ use middle::def::{self, Def};
use middle::def_id::DefId;
use middle::region;
use middle::subst;
use middle::ty::{self, Ty};
use middle::ty::{self, Ty, TyCtxt};
use syntax::{ast, ast_util, codemap};
use syntax::ast::NodeIdAssigner;
@ -59,7 +59,7 @@ use serialize::EncoderHelpers;
#[cfg(test)] use rustc_front::lowering::{lower_item, LoweringContext};
struct DecodeContext<'a, 'b, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
cdata: &'b cstore::crate_metadata,
from_id_range: ast_util::IdRange,
to_id_range: ast_util::IdRange,
@ -122,7 +122,7 @@ impl<'a, 'b, 'c, 'tcx> ast_map::FoldOps for &'a DecodeContext<'b, 'c, 'tcx> {
/// Decodes an item from its AST in the cdata's metadata and adds it to the
/// ast-map.
pub fn decode_inlined_item<'tcx>(cdata: &cstore::crate_metadata,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
parent_path: Vec<ast_map::PathElem>,
parent_def_path: ast_map::DefPath,
par_doc: rbml::Doc,
@ -878,18 +878,18 @@ trait rbml_decoder_decoder_helpers<'tcx> {
// Versions of the type reading functions that don't need the full
// DecodeContext.
fn read_ty_nodcx(&mut self,
tcx: &ty::ctxt<'tcx>, cdata: &cstore::crate_metadata) -> Ty<'tcx>;
tcx: &TyCtxt<'tcx>, cdata: &cstore::crate_metadata) -> Ty<'tcx>;
fn read_tys_nodcx(&mut self,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
cdata: &cstore::crate_metadata) -> Vec<Ty<'tcx>>;
fn read_substs_nodcx(&mut self, tcx: &ty::ctxt<'tcx>,
fn read_substs_nodcx(&mut self, tcx: &TyCtxt<'tcx>,
cdata: &cstore::crate_metadata)
-> subst::Substs<'tcx>;
}
impl<'a, 'tcx> rbml_decoder_decoder_helpers<'tcx> for reader::Decoder<'a> {
fn read_ty_nodcx(&mut self,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
cdata: &cstore::crate_metadata)
-> Ty<'tcx> {
self.read_opaque(|_, doc| {
@ -901,7 +901,7 @@ impl<'a, 'tcx> rbml_decoder_decoder_helpers<'tcx> for reader::Decoder<'a> {
}
fn read_tys_nodcx(&mut self,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
cdata: &cstore::crate_metadata) -> Vec<Ty<'tcx>> {
self.read_to_vec(|this| Ok(this.read_ty_nodcx(tcx, cdata)) )
.unwrap()
@ -910,7 +910,7 @@ impl<'a, 'tcx> rbml_decoder_decoder_helpers<'tcx> for reader::Decoder<'a> {
}
fn read_substs_nodcx(&mut self,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
cdata: &cstore::crate_metadata)
-> subst::Substs<'tcx>
{

View File

@ -18,7 +18,7 @@ use middle::cstore::{CrateStore, CrateSource, ChildItem, FoundAst};
use middle::cstore::{NativeLibraryKind, LinkMeta, LinkagePreference};
use middle::def;
use middle::lang_items;
use middle::ty::{self, Ty, VariantKind};
use middle::ty::{self, Ty, TyCtxt, VariantKind};
use middle::def_id::{DefId, DefIndex};
use rustc::front::map as hir_map;
@ -49,14 +49,14 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
decoder::get_deprecation(&cdata, def.index)
}
fn closure_kind(&self, _tcx: &ty::ctxt<'tcx>, def_id: DefId) -> ty::ClosureKind
fn closure_kind(&self, _tcx: &TyCtxt<'tcx>, def_id: DefId) -> ty::ClosureKind
{
assert!(!def_id.is_local());
let cdata = self.get_crate_data(def_id.krate);
decoder::closure_kind(&cdata, def_id.index)
}
fn closure_ty(&self, tcx: &ty::ctxt<'tcx>, def_id: DefId) -> ty::ClosureTy<'tcx>
fn closure_ty(&self, tcx: &TyCtxt<'tcx>, def_id: DefId) -> ty::ClosureTy<'tcx>
{
assert!(!def_id.is_local());
let cdata = self.get_crate_data(def_id.krate);
@ -73,21 +73,21 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
decoder::get_repr_attrs(&cdata, def.index)
}
fn item_type(&self, tcx: &ty::ctxt<'tcx>, def: DefId)
fn item_type(&self, tcx: &TyCtxt<'tcx>, def: DefId)
-> ty::TypeScheme<'tcx>
{
let cdata = self.get_crate_data(def.krate);
decoder::get_type(&cdata, def.index, tcx)
}
fn item_predicates(&self, tcx: &ty::ctxt<'tcx>, def: DefId)
fn item_predicates(&self, tcx: &TyCtxt<'tcx>, def: DefId)
-> ty::GenericPredicates<'tcx>
{
let cdata = self.get_crate_data(def.krate);
decoder::get_predicates(&cdata, def.index, tcx)
}
fn item_super_predicates(&self, tcx: &ty::ctxt<'tcx>, def: DefId)
fn item_super_predicates(&self, tcx: &TyCtxt<'tcx>, def: DefId)
-> ty::GenericPredicates<'tcx>
{
let cdata = self.get_crate_data(def.krate);
@ -106,13 +106,13 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
decoder::get_symbol(&cdata, def.index)
}
fn trait_def(&self, tcx: &ty::ctxt<'tcx>, def: DefId) -> ty::TraitDef<'tcx>
fn trait_def(&self, tcx: &TyCtxt<'tcx>, def: DefId) -> ty::TraitDef<'tcx>
{
let cdata = self.get_crate_data(def.krate);
decoder::get_trait_def(&cdata, def.index, tcx)
}
fn adt_def(&self, tcx: &ty::ctxt<'tcx>, def: DefId) -> ty::AdtDefMaster<'tcx>
fn adt_def(&self, tcx: &TyCtxt<'tcx>, def: DefId) -> ty::AdtDefMaster<'tcx>
{
let cdata = self.get_crate_data(def.krate);
decoder::get_adt_def(&self.intr, &cdata, def.index, tcx)
@ -173,7 +173,7 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
result
}
fn provided_trait_methods(&self, tcx: &ty::ctxt<'tcx>, def: DefId)
fn provided_trait_methods(&self, tcx: &TyCtxt<'tcx>, def: DefId)
-> Vec<Rc<ty::Method<'tcx>>>
{
let cdata = self.get_crate_data(def.krate);
@ -199,7 +199,7 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
decoder::get_impl_polarity(&cdata, def.index)
}
fn impl_trait_ref(&self, tcx: &ty::ctxt<'tcx>, def: DefId)
fn impl_trait_ref(&self, tcx: &TyCtxt<'tcx>, def: DefId)
-> Option<ty::TraitRef<'tcx>>
{
let cdata = self.get_crate_data(def.krate);
@ -214,19 +214,19 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
}
// FIXME: killme
fn associated_consts(&self, tcx: &ty::ctxt<'tcx>, def: DefId)
fn associated_consts(&self, tcx: &TyCtxt<'tcx>, def: DefId)
-> Vec<Rc<ty::AssociatedConst<'tcx>>> {
let cdata = self.get_crate_data(def.krate);
decoder::get_associated_consts(self.intr.clone(), &cdata, def.index, tcx)
}
fn trait_of_item(&self, tcx: &ty::ctxt<'tcx>, def_id: DefId) -> Option<DefId>
fn trait_of_item(&self, tcx: &TyCtxt<'tcx>, def_id: DefId) -> Option<DefId>
{
let cdata = self.get_crate_data(def_id.krate);
decoder::get_trait_of_item(&cdata, def_id.index, tcx)
}
fn impl_or_trait_item(&self, tcx: &ty::ctxt<'tcx>, def: DefId)
fn impl_or_trait_item(&self, tcx: &TyCtxt<'tcx>, def: DefId)
-> ty::ImplOrTraitItem<'tcx>
{
let cdata = self.get_crate_data(def.krate);
@ -260,7 +260,7 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
decoder::is_default_impl(&cdata, impl_did.index)
}
fn is_extern_item(&self, tcx: &ty::ctxt<'tcx>, did: DefId) -> bool {
fn is_extern_item(&self, tcx: &TyCtxt<'tcx>, did: DefId) -> bool {
let cdata = self.get_crate_data(did.krate);
decoder::is_extern_item(&cdata, did.index, tcx)
}
@ -425,7 +425,7 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
result
}
fn maybe_get_item_ast(&'tcx self, tcx: &ty::ctxt<'tcx>, def: DefId)
fn maybe_get_item_ast(&'tcx self, tcx: &TyCtxt<'tcx>, def: DefId)
-> FoundAst<'tcx>
{
let cdata = self.get_crate_data(def.krate);
@ -433,7 +433,7 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
decoder::maybe_get_item_ast(&cdata, tcx, def.index, decode_inlined_item)
}
fn maybe_get_item_mir(&self, tcx: &ty::ctxt<'tcx>, def: DefId)
fn maybe_get_item_mir(&self, tcx: &TyCtxt<'tcx>, def: DefId)
-> Option<Mir<'tcx>> {
let cdata = self.get_crate_data(def.krate);
decoder::maybe_get_item_mir(&cdata, tcx, def.index)
@ -470,7 +470,7 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
{
loader::meta_section_name(target)
}
fn encode_type(&self, tcx: &ty::ctxt<'tcx>, ty: Ty<'tcx>) -> Vec<u8>
fn encode_type(&self, tcx: &TyCtxt<'tcx>, ty: Ty<'tcx>) -> Vec<u8>
{
encoder::encoded_ty(tcx, ty)
}
@ -491,7 +491,7 @@ impl<'tcx> CrateStore<'tcx> for cstore::CStore {
}
fn encode_metadata(&self,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
reexports: &def::ExportMap,
item_symbols: &RefCell<NodeMap<String>>,
link_meta: &LinkMeta,

View File

@ -33,7 +33,7 @@ use middle::def_id::{DefId, DefIndex};
use middle::lang_items;
use middle::subst;
use middle::ty::{ImplContainer, TraitContainer};
use middle::ty::{self, Ty, TypeFoldable, VariantKind};
use middle::ty::{self, Ty, TyCtxt, TypeFoldable, VariantKind};
use rustc::mir;
use rustc::mir::visit::MutVisitor;
@ -206,14 +206,14 @@ fn variant_disr_val(d: rbml::Doc) -> Option<ty::Disr> {
})
}
fn doc_type<'tcx>(doc: rbml::Doc, tcx: &ty::ctxt<'tcx>, cdata: Cmd) -> Ty<'tcx> {
fn doc_type<'tcx>(doc: rbml::Doc, tcx: &TyCtxt<'tcx>, cdata: Cmd) -> Ty<'tcx> {
let tp = reader::get_doc(doc, tag_items_data_item_type);
TyDecoder::with_doc(tcx, cdata.cnum, tp,
&mut |did| translate_def_id(cdata, did))
.parse_ty()
}
fn maybe_doc_type<'tcx>(doc: rbml::Doc, tcx: &ty::ctxt<'tcx>, cdata: Cmd) -> Option<Ty<'tcx>> {
fn maybe_doc_type<'tcx>(doc: rbml::Doc, tcx: &TyCtxt<'tcx>, cdata: Cmd) -> Option<Ty<'tcx>> {
reader::maybe_get_doc(doc, tag_items_data_item_type).map(|tp| {
TyDecoder::with_doc(tcx, cdata.cnum, tp,
&mut |did| translate_def_id(cdata, did))
@ -222,18 +222,18 @@ fn maybe_doc_type<'tcx>(doc: rbml::Doc, tcx: &ty::ctxt<'tcx>, cdata: Cmd) -> Opt
}
pub fn item_type<'tcx>(_item_id: DefId, item: rbml::Doc,
tcx: &ty::ctxt<'tcx>, cdata: Cmd) -> Ty<'tcx> {
tcx: &TyCtxt<'tcx>, cdata: Cmd) -> Ty<'tcx> {
doc_type(item, tcx, cdata)
}
fn doc_trait_ref<'tcx>(doc: rbml::Doc, tcx: &ty::ctxt<'tcx>, cdata: Cmd)
fn doc_trait_ref<'tcx>(doc: rbml::Doc, tcx: &TyCtxt<'tcx>, cdata: Cmd)
-> ty::TraitRef<'tcx> {
TyDecoder::with_doc(tcx, cdata.cnum, doc,
&mut |did| translate_def_id(cdata, did))
.parse_trait_ref()
}
fn item_trait_ref<'tcx>(doc: rbml::Doc, tcx: &ty::ctxt<'tcx>, cdata: Cmd)
fn item_trait_ref<'tcx>(doc: rbml::Doc, tcx: &TyCtxt<'tcx>, cdata: Cmd)
-> ty::TraitRef<'tcx> {
let tp = reader::get_doc(doc, tag_item_trait_ref);
doc_trait_ref(tp, tcx, cdata)
@ -351,7 +351,7 @@ fn parse_associated_type_names(item_doc: rbml::Doc) -> Vec<ast::Name> {
pub fn get_trait_def<'tcx>(cdata: Cmd,
item_id: DefIndex,
tcx: &ty::ctxt<'tcx>) -> ty::TraitDef<'tcx>
tcx: &TyCtxt<'tcx>) -> ty::TraitDef<'tcx>
{
let item_doc = cdata.lookup_item(item_id);
let generics = doc_generics(item_doc, tcx, cdata, tag_item_generics);
@ -369,9 +369,9 @@ pub fn get_trait_def<'tcx>(cdata: Cmd,
pub fn get_adt_def<'tcx>(intr: &IdentInterner,
cdata: Cmd,
item_id: DefIndex,
tcx: &ty::ctxt<'tcx>) -> ty::AdtDefMaster<'tcx>
tcx: &TyCtxt<'tcx>) -> ty::AdtDefMaster<'tcx>
{
fn expect_variant_kind<'tcx>(family: Family, tcx: &ty::ctxt<'tcx>) -> ty::VariantKind {
fn expect_variant_kind<'tcx>(family: Family, tcx: &TyCtxt<'tcx>) -> ty::VariantKind {
match family_to_variant_kind(family) {
Some(kind) => kind,
_ => tcx.sess.bug(&format!("unexpected family: {:?}", family)),
@ -380,7 +380,7 @@ pub fn get_adt_def<'tcx>(intr: &IdentInterner,
fn get_enum_variants<'tcx>(intr: &IdentInterner,
cdata: Cmd,
doc: rbml::Doc,
tcx: &ty::ctxt<'tcx>) -> Vec<ty::VariantDefData<'tcx, 'tcx>> {
tcx: &TyCtxt<'tcx>) -> Vec<ty::VariantDefData<'tcx, 'tcx>> {
let mut disr_val = 0;
reader::tagged_docs(doc, tag_items_data_item_variant).map(|p| {
let did = translated_def_id(cdata, p);
@ -404,7 +404,7 @@ pub fn get_adt_def<'tcx>(intr: &IdentInterner,
fn get_variant_fields<'tcx>(intr: &IdentInterner,
cdata: Cmd,
doc: rbml::Doc,
tcx: &ty::ctxt<'tcx>) -> Vec<ty::FieldDefData<'tcx, 'tcx>> {
tcx: &TyCtxt<'tcx>) -> Vec<ty::FieldDefData<'tcx, 'tcx>> {
let mut index = 0;
reader::tagged_docs(doc, tag_item_field).map(|f| {
let ff = item_family(f);
@ -427,7 +427,7 @@ pub fn get_adt_def<'tcx>(intr: &IdentInterner,
cdata: Cmd,
doc: rbml::Doc,
did: DefId,
tcx: &ty::ctxt<'tcx>) -> ty::VariantDefData<'tcx, 'tcx> {
tcx: &TyCtxt<'tcx>) -> ty::VariantDefData<'tcx, 'tcx> {
ty::VariantDefData {
did: did,
name: item_name(intr, doc),
@ -500,7 +500,7 @@ pub fn get_adt_def<'tcx>(intr: &IdentInterner,
pub fn get_predicates<'tcx>(cdata: Cmd,
item_id: DefIndex,
tcx: &ty::ctxt<'tcx>)
tcx: &TyCtxt<'tcx>)
-> ty::GenericPredicates<'tcx>
{
let item_doc = cdata.lookup_item(item_id);
@ -509,14 +509,14 @@ pub fn get_predicates<'tcx>(cdata: Cmd,
pub fn get_super_predicates<'tcx>(cdata: Cmd,
item_id: DefIndex,
tcx: &ty::ctxt<'tcx>)
tcx: &TyCtxt<'tcx>)
-> ty::GenericPredicates<'tcx>
{
let item_doc = cdata.lookup_item(item_id);
doc_predicates(item_doc, tcx, cdata, tag_item_super_predicates)
}
pub fn get_type<'tcx>(cdata: Cmd, id: DefIndex, tcx: &ty::ctxt<'tcx>)
pub fn get_type<'tcx>(cdata: Cmd, id: DefIndex, tcx: &TyCtxt<'tcx>)
-> ty::TypeScheme<'tcx>
{
let item_doc = cdata.lookup_item(id);
@ -584,7 +584,7 @@ pub fn get_custom_coerce_unsized_kind<'tcx>(
pub fn get_impl_trait<'tcx>(cdata: Cmd,
id: DefIndex,
tcx: &ty::ctxt<'tcx>)
tcx: &TyCtxt<'tcx>)
-> Option<ty::TraitRef<'tcx>>
{
let item_doc = cdata.lookup_item(id);
@ -773,7 +773,7 @@ pub fn get_item_name(intr: &IdentInterner, cdata: Cmd, id: DefIndex) -> ast::Nam
pub type DecodeInlinedItem<'a> =
Box<for<'tcx> FnMut(Cmd,
&ty::ctxt<'tcx>,
&TyCtxt<'tcx>,
Vec<hir_map::PathElem>, // parent_path
hir_map::DefPath, // parent_def_path
rbml::Doc,
@ -782,7 +782,7 @@ pub type DecodeInlinedItem<'a> =
hir_map::DefPath)> + 'a>;
pub fn maybe_get_item_ast<'tcx>(cdata: Cmd,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
id: DefIndex,
mut decode_inlined_item: DecodeInlinedItem)
-> FoundAst<'tcx> {
@ -840,7 +840,7 @@ pub fn is_item_mir_available<'tcx>(cdata: Cmd, id: DefIndex) -> bool {
}
pub fn maybe_get_item_mir<'tcx>(cdata: Cmd,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
id: DefIndex)
-> Option<mir::repr::Mir<'tcx>> {
let item_doc = cdata.lookup_item(id);
@ -955,7 +955,7 @@ pub fn is_static_method(cdata: Cmd, id: DefIndex) -> bool {
pub fn get_impl_or_trait_item<'tcx>(intr: Rc<IdentInterner>,
cdata: Cmd,
id: DefIndex,
tcx: &ty::ctxt<'tcx>)
tcx: &TyCtxt<'tcx>)
-> ty::ImplOrTraitItem<'tcx> {
let item_doc = cdata.lookup_item(id);
@ -1042,7 +1042,7 @@ pub fn get_item_variances(cdata: Cmd, id: DefIndex) -> ty::ItemVariances {
pub fn get_provided_trait_methods<'tcx>(intr: Rc<IdentInterner>,
cdata: Cmd,
id: DefIndex,
tcx: &ty::ctxt<'tcx>)
tcx: &TyCtxt<'tcx>)
-> Vec<Rc<ty::Method<'tcx>>> {
let item = cdata.lookup_item(id);
@ -1069,7 +1069,7 @@ pub fn get_provided_trait_methods<'tcx>(intr: Rc<IdentInterner>,
pub fn get_associated_consts<'tcx>(intr: Rc<IdentInterner>,
cdata: Cmd,
id: DefIndex,
tcx: &ty::ctxt<'tcx>)
tcx: &TyCtxt<'tcx>)
-> Vec<Rc<ty::AssociatedConst<'tcx>>> {
let item = cdata.lookup_item(id);
@ -1436,7 +1436,7 @@ pub fn each_implementation_for_trait<F>(cdata: Cmd,
}
}
pub fn get_trait_of_item(cdata: Cmd, id: DefIndex, tcx: &ty::ctxt)
pub fn get_trait_of_item(cdata: Cmd, id: DefIndex, tcx: &TyCtxt)
-> Option<DefId> {
let item_doc = cdata.lookup_item(id);
let parent_item_id = match item_parent_item(cdata, item_doc) {
@ -1571,7 +1571,7 @@ pub fn is_const_fn(cdata: Cmd, id: DefIndex) -> bool {
}
}
pub fn is_extern_item(cdata: Cmd, id: DefIndex, tcx: &ty::ctxt) -> bool {
pub fn is_extern_item(cdata: Cmd, id: DefIndex, tcx: &TyCtxt) -> bool {
let item_doc = match cdata.get_item(id) {
Some(doc) => doc,
None => return false,
@ -1606,7 +1606,7 @@ pub fn is_impl(cdata: Cmd, id: DefIndex) -> bool {
}
fn doc_generics<'tcx>(base_doc: rbml::Doc,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
cdata: Cmd,
tag: usize)
-> ty::Generics<'tcx>
@ -1655,7 +1655,7 @@ fn doc_generics<'tcx>(base_doc: rbml::Doc,
fn doc_predicate<'tcx>(cdata: Cmd,
doc: rbml::Doc,
tcx: &ty::ctxt<'tcx>)
tcx: &TyCtxt<'tcx>)
-> ty::Predicate<'tcx>
{
let predicate_pos = cdata.xref_index.lookup(
@ -1667,7 +1667,7 @@ fn doc_predicate<'tcx>(cdata: Cmd,
}
fn doc_predicates<'tcx>(base_doc: rbml::Doc,
tcx: &ty::ctxt<'tcx>,
tcx: &TyCtxt<'tcx>,
cdata: Cmd,
tag: usize)
-> ty::GenericPredicates<'tcx>
@ -1722,7 +1722,7 @@ pub fn closure_kind(cdata: Cmd, closure_id: DefIndex) -> ty::ClosureKind {
ty::ClosureKind::decode(&mut decoder).unwrap()
}
pub fn closure_ty<'tcx>(cdata: Cmd, closure_id: DefIndex, tcx: &ty::ctxt<'tcx>)
pub fn closure_ty<'tcx>(cdata: Cmd, closure_id: DefIndex, tcx: &TyCtxt<'tcx>)
-> ty::ClosureTy<'tcx> {
let closure_doc = cdata.lookup_item(closure_id);
let closure_ty_doc = reader::get_doc(closure_doc, tag_items_closure_ty);

View File

@ -25,7 +25,7 @@ use middle::def_id::{CRATE_DEF_INDEX, DefId};
use middle::dependency_format::Linkage;
use middle::stability;
use middle::subst;
use middle::ty::{self, Ty};
use middle::ty::{self, Ty, TyCtxt};
use rustc::back::svh::Svh;
use rustc::front::map::{LinkedPath, PathElem, PathElems};
@ -58,7 +58,7 @@ pub type EncodeInlinedItem<'a> =
pub struct EncodeParams<'a, 'tcx: 'a> {
pub diag: &'a Handler,
pub tcx: &'a ty::ctxt<'tcx>,
pub tcx: &'a TyCtxt<'tcx>,
pub reexports: &'a def::ExportMap,
pub item_symbols: &'a RefCell<NodeMap<String>>,
pub link_meta: &'a LinkMeta,
@ -70,7 +70,7 @@ pub struct EncodeParams<'a, 'tcx: 'a> {
pub struct EncodeContext<'a, 'tcx: 'a> {
pub diag: &'a Handler,
pub tcx: &'a ty::ctxt<'tcx>,
pub tcx: &'a TyCtxt<'tcx>,
pub reexports: &'a def::ExportMap,
pub item_symbols: &'a RefCell<NodeMap<String>>,
pub link_meta: &'a LinkMeta,
@ -1766,7 +1766,7 @@ fn encode_struct_field_attrs(ecx: &EncodeContext,
struct ImplVisitor<'a, 'tcx:'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
impls: FnvHashMap<DefId, Vec<DefId>>
}
@ -2093,7 +2093,7 @@ fn encode_metadata_inner(rbml_w: &mut Encoder,
}
// Get the encoded string for a type
pub fn encoded_ty<'tcx>(tcx: &ty::ctxt<'tcx>, t: Ty<'tcx>) -> Vec<u8> {
pub fn encoded_ty<'tcx>(tcx: &TyCtxt<'tcx>, t: Ty<'tcx>) -> Vec<u8> {
let mut wr = Cursor::new(Vec::new());
tyencode::enc_ty(&mut wr, &tyencode::ctxt {
diag: tcx.sess.diagnostic(),

View File

@ -16,7 +16,7 @@ use rbml::opaque::Decoder as OpaqueDecoder;
use rustc::middle::cstore::tls;
use rustc::middle::def_id::DefId;
use rustc::middle::subst::Substs;
use rustc::middle::ty;
use rustc::middle::ty::{self, TyCtxt};
use decoder::{self, Cmd};
use encoder;
@ -25,7 +25,7 @@ use tyencode;
impl<'a, 'tcx: 'a> tls::EncodingContext<'tcx> for encoder::EncodeContext<'a, 'tcx> {
fn tcx<'s>(&'s self) -> &'s ty::ctxt<'tcx> {
fn tcx<'s>(&'s self) -> &'s TyCtxt<'tcx> {
&self.tcx
}
@ -40,12 +40,12 @@ impl<'a, 'tcx: 'a> tls::EncodingContext<'tcx> for encoder::EncodeContext<'a, 'tc
pub struct DecodingContext<'a, 'tcx: 'a> {
pub crate_metadata: Cmd<'a>,
pub tcx: &'a ty::ctxt<'tcx>,
pub tcx: &'a TyCtxt<'tcx>,
}
impl<'a, 'tcx: 'a> tls::DecodingContext<'tcx> for DecodingContext<'a, 'tcx> {
fn tcx<'s>(&'s self) -> &'s ty::ctxt<'tcx> {
fn tcx<'s>(&'s self) -> &'s TyCtxt<'tcx> {
&self.tcx
}

View File

@ -22,7 +22,7 @@ use middle::def_id::{DefId, DefIndex};
use middle::region;
use middle::subst;
use middle::subst::VecPerParamSpace;
use middle::ty::{self, ToPredicate, Ty, TypeFoldable};
use middle::ty::{self, ToPredicate, Ty, TyCtxt, TypeFoldable};
use rbml;
use rbml::leb128;
@ -41,12 +41,12 @@ pub struct TyDecoder<'a, 'tcx: 'a> {
data: &'a [u8],
krate: ast::CrateNum,
pos: usize,
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
conv_def_id: DefIdConvert<'a>,
}
impl<'a,'tcx> TyDecoder<'a,'tcx> {
pub fn with_doc(tcx: &'a ty::ctxt<'tcx>,
pub fn with_doc(tcx: &'a TyCtxt<'tcx>,
crate_num: ast::CrateNum,
doc: rbml::Doc<'a>,
conv: DefIdConvert<'a>)
@ -57,7 +57,7 @@ impl<'a,'tcx> TyDecoder<'a,'tcx> {
pub fn new(data: &'a [u8],
crate_num: ast::CrateNum,
pos: usize,
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
conv: DefIdConvert<'a>)
-> TyDecoder<'a, 'tcx> {
TyDecoder {

View File

@ -22,7 +22,7 @@ use middle::region;
use middle::subst;
use middle::subst::VecPerParamSpace;
use middle::ty::ParamTy;
use middle::ty::{self, Ty};
use middle::ty::{self, Ty, TyCtxt};
use rustc::util::nodemap::FnvHashMap;
use rustc_front::hir;
@ -39,7 +39,7 @@ pub struct ctxt<'a, 'tcx: 'a> {
// Def -> str Callback:
pub ds: fn(DefId) -> String,
// The type context.
pub tcx: &'a ty::ctxt<'tcx>,
pub tcx: &'a TyCtxt<'tcx>,
pub abbrevs: &'a abbrev_map<'tcx>
}

View File

@ -90,7 +90,7 @@ use build::{BlockAnd, BlockAndExtension, Builder, CFG};
use rustc::middle::region::CodeExtent;
use rustc::middle::lang_items;
use rustc::middle::subst::{Substs, Subst, VecPerParamSpace};
use rustc::middle::ty::{self, Ty};
use rustc::middle::ty::{self, Ty, TyCtxt};
use rustc::mir::repr::*;
use syntax::codemap::{Span, DUMMY_SP};
use syntax::parse::token::intern_and_get_ident;
@ -551,7 +551,7 @@ fn build_scope_drops<'tcx>(cfg: &mut CFG<'tcx>,
block.unit()
}
fn build_diverge_scope<'tcx>(tcx: &ty::ctxt<'tcx>,
fn build_diverge_scope<'tcx>(tcx: &TyCtxt<'tcx>,
cfg: &mut CFG<'tcx>,
unit_temp: Lvalue<'tcx>,
scope: &mut Scope<'tcx>,
@ -625,7 +625,7 @@ fn build_diverge_scope<'tcx>(tcx: &ty::ctxt<'tcx>,
}
}
fn build_free<'tcx>(tcx: &ty::ctxt<'tcx>,
fn build_free<'tcx>(tcx: &TyCtxt<'tcx>,
unit_temp: Lvalue<'tcx>,
data: &FreeData<'tcx>,
target: BasicBlock) -> Terminator<'tcx> {

View File

@ -20,14 +20,14 @@ use rustc::mir::repr::*;
use rustc::middle::const_eval::{self, ConstVal};
use rustc::middle::infer::InferCtxt;
use rustc::middle::ty::{self, Ty};
use rustc::middle::ty::{self, Ty, TyCtxt};
use syntax::codemap::Span;
use syntax::parse::token;
use rustc_front::hir;
#[derive(Copy, Clone)]
pub struct Cx<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
infcx: &'a InferCtxt<'a, 'tcx>,
}
@ -103,7 +103,7 @@ impl<'a,'tcx:'a> Cx<'a, 'tcx> {
self.tcx.sess.span_bug(span, message)
}
pub fn tcx(&self) -> &'a ty::ctxt<'tcx> {
pub fn tcx(&self) -> &'a TyCtxt<'tcx> {
self.tcx
}
}

View File

@ -33,7 +33,7 @@ use rustc::mir::transform::MirPass;
use rustc::mir::mir_map::MirMap;
use rustc::middle::infer;
use rustc::middle::region::CodeExtentData;
use rustc::middle::ty::{self, Ty};
use rustc::middle::ty::{self, Ty, TyCtxt};
use rustc::util::common::ErrorReported;
use rustc::util::nodemap::NodeMap;
use rustc_front::hir;
@ -42,7 +42,7 @@ use syntax::ast;
use syntax::attr::AttrMetaMethods;
use syntax::codemap::Span;
pub fn build_mir_for_crate<'tcx>(tcx: &ty::ctxt<'tcx>) -> MirMap<'tcx> {
pub fn build_mir_for_crate<'tcx>(tcx: &TyCtxt<'tcx>) -> MirMap<'tcx> {
let mut map = MirMap {
map: NodeMap(),
};
@ -60,7 +60,7 @@ pub fn build_mir_for_crate<'tcx>(tcx: &ty::ctxt<'tcx>) -> MirMap<'tcx> {
// OuterDump -- walks a crate, looking for fn items and methods to build MIR from
struct OuterDump<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
map: &'a mut MirMap<'tcx>,
}
@ -116,7 +116,7 @@ impl<'a, 'tcx> Visitor<'tcx> for OuterDump<'a, 'tcx> {
// InnerDump -- dumps MIR for a single fn and its contained closures
struct InnerDump<'a, 'm, 'tcx: 'a + 'm> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
map: &'m mut MirMap<'tcx>,
attr: Option<&'a ast::Attribute>,
}
@ -236,7 +236,7 @@ fn build_mir<'a,'tcx:'a>(cx: Cx<'a,'tcx>,
body))
}
fn closure_self_ty<'a, 'tcx>(tcx: &ty::ctxt<'tcx>,
fn closure_self_ty<'a, 'tcx>(tcx: &TyCtxt<'tcx>,
closure_expr_id: ast::NodeId,
body_id: ast::NodeId)
-> Ty<'tcx> {

View File

@ -12,23 +12,23 @@
//! We want to do this once just before trans, so trans does not have to take
//! care erasing regions all over the place.
use rustc::middle::ty;
use rustc::middle::ty::{self, TyCtxt};
use rustc::mir::repr::*;
use rustc::mir::visit::MutVisitor;
use rustc::mir::mir_map::MirMap;
pub fn erase_regions<'tcx>(tcx: &ty::ctxt<'tcx>, mir_map: &mut MirMap<'tcx>) {
pub fn erase_regions<'tcx>(tcx: &TyCtxt<'tcx>, mir_map: &mut MirMap<'tcx>) {
for (_, mir) in &mut mir_map.map {
EraseRegionsVisitor::new(tcx).visit_mir(mir);
}
}
struct EraseRegionsVisitor<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
}
impl<'a, 'tcx> EraseRegionsVisitor<'a, 'tcx> {
pub fn new(tcx: &'a ty::ctxt<'tcx>) -> Self {
pub fn new(tcx: &'a TyCtxt<'tcx>) -> Self {
EraseRegionsVisitor {
tcx: tcx
}

View File

@ -13,7 +13,7 @@
use rustc::middle::infer::{self, InferCtxt};
use rustc::middle::traits;
use rustc::middle::ty::{self, Ty};
use rustc::middle::ty::{self, Ty, TyCtxt};
use rustc::middle::ty::fold::TypeFoldable;
use rustc::mir::repr::*;
use rustc::mir::tcx::LvalueTy;
@ -113,7 +113,7 @@ impl<'a, 'b, 'tcx> TypeVerifier<'a, 'b, 'tcx> {
}
}
fn tcx(&self) -> &'a ty::ctxt<'tcx> {
fn tcx(&self) -> &'a TyCtxt<'tcx> {
self.cx.infcx.tcx
}
@ -346,7 +346,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
a, b)
}
fn tcx(&self) -> &'a ty::ctxt<'tcx> {
fn tcx(&self) -> &'a TyCtxt<'tcx> {
self.infcx.tcx
}

View File

@ -36,7 +36,7 @@ use rustc::middle::infer;
use rustc::middle::mem_categorization as mc;
use rustc::middle::mem_categorization::Categorization;
use rustc::middle::traits;
use rustc::middle::ty::{self, Ty};
use rustc::middle::ty::{self, Ty, TyCtxt};
use rustc::util::nodemap::NodeMap;
use rustc::middle::const_qualif::ConstQualif;
use rustc::lint::builtin::CONST_ERR;
@ -65,7 +65,7 @@ enum Mode {
}
struct CheckCrateVisitor<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
mode: Mode,
qualif: ConstQualif,
rvalue_borrows: NodeMap<hir::Mutability>
@ -788,7 +788,7 @@ fn check_adjustments<'a, 'tcx>(v: &mut CheckCrateVisitor<'a, 'tcx>, e: &hir::Exp
}
}
pub fn check_crate(tcx: &ty::ctxt) {
pub fn check_crate(tcx: &TyCtxt) {
tcx.visit_all_items_in_krate(DepNode::CheckConst, &mut CheckCrateVisitor {
tcx: tcx,
mode: Mode::Var,

View File

@ -15,20 +15,20 @@ use rustc::dep_graph::DepNode;
use rustc::middle::expr_use_visitor as euv;
use rustc::middle::infer;
use rustc::middle::mem_categorization as mc;
use rustc::middle::ty::{self, ParameterEnvironment};
use rustc::middle::ty::{self, TyCtxt, ParameterEnvironment};
use rustc_front::hir;
use rustc_front::intravisit;
use syntax::ast;
use syntax::codemap::Span;
pub fn check_crate(tcx: &ty::ctxt) {
pub fn check_crate(tcx: &TyCtxt) {
let mut rvcx = RvalueContext { tcx: tcx };
tcx.visit_all_items_in_krate(DepNode::RvalueCheck, &mut rvcx);
}
struct RvalueContext<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
}
impl<'a, 'tcx, 'v> intravisit::Visitor<'v> for RvalueContext<'a, 'tcx> {
@ -53,7 +53,7 @@ impl<'a, 'tcx, 'v> intravisit::Visitor<'v> for RvalueContext<'a, 'tcx> {
}
struct RvalueContextDelegate<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
param_env: &'a ty::ParameterEnvironment<'a,'tcx>,
}

View File

@ -15,12 +15,12 @@
use {Intrinsic, i, i_, u, u_, f, v, v_, agg, p, void};
use IntrinsicDef::Named;
use rustc::middle::ty;
use rustc::middle::ty::TyCtxt;
// The default inlining settings trigger a pathological behaviour in
// LLVM, which causes makes compilation very slow. See #28273.
#[inline(never)]
pub fn find<'tcx>(_tcx: &ty::ctxt<'tcx>, name: &str) -> Option<Intrinsic> {
pub fn find<'tcx>(_tcx: &TyCtxt<'tcx>, name: &str) -> Option<Intrinsic> {
if !name.starts_with("aarch64_v") { return None }
Some(match &name["aarch64_v".len()..] {
"hadd_s8" => Intrinsic {

View File

@ -15,12 +15,12 @@
use {Intrinsic, i, i_, u, u_, f, v, v_, agg, p, void};
use IntrinsicDef::Named;
use rustc::middle::ty;
use rustc::middle::ty::TyCtxt;
// The default inlining settings trigger a pathological behaviour in
// LLVM, which causes makes compilation very slow. See #28273.
#[inline(never)]
pub fn find<'tcx>(_tcx: &ty::ctxt<'tcx>, name: &str) -> Option<Intrinsic> {
pub fn find<'tcx>(_tcx: &TyCtxt<'tcx>, name: &str) -> Option<Intrinsic> {
if !name.starts_with("arm_v") { return None }
Some(match &name["arm_v".len()..] {
"hadd_s8" => Intrinsic {

View File

@ -18,7 +18,7 @@
extern crate rustc_llvm as llvm;
extern crate rustc;
use rustc::middle::ty;
use rustc::middle::ty::TyCtxt;
pub struct Intrinsic {
pub inputs: Vec<Type>,
@ -66,7 +66,7 @@ mod arm;
mod aarch64;
impl Intrinsic {
pub fn find<'tcx>(tcx: &ty::ctxt<'tcx>, name: &str) -> Option<Intrinsic> {
pub fn find<'tcx>(tcx: &TyCtxt<'tcx>, name: &str) -> Option<Intrinsic> {
if name.starts_with("x86_") {
x86::find(tcx, name)
} else if name.starts_with("arm_") {

View File

@ -15,12 +15,12 @@
use {Intrinsic, i, i_, u, u_, f, v, v_, agg, p, void};
use IntrinsicDef::Named;
use rustc::middle::ty;
use rustc::middle::ty::TyCtxt;
// The default inlining settings trigger a pathological behaviour in
// LLVM, which causes makes compilation very slow. See #28273.
#[inline(never)]
pub fn find<'tcx>(_tcx: &ty::ctxt<'tcx>, name: &str) -> Option<Intrinsic> {
pub fn find<'tcx>(_tcx: &TyCtxt<'tcx>, name: &str) -> Option<Intrinsic> {
if !name.starts_with("x86_mm") { return None }
Some(match &name["x86_mm".len()..] {
"_movemask_ps" => Intrinsic {

View File

@ -42,7 +42,7 @@ use rustc::middle::def::{self, Def};
use rustc::middle::def_id::DefId;
use rustc::middle::privacy::{AccessLevel, AccessLevels};
use rustc::middle::privacy::ExternalExports;
use rustc::middle::ty;
use rustc::middle::ty::{self, TyCtxt};
use rustc::util::nodemap::{NodeMap, NodeSet};
use rustc::front::map as ast_map;
@ -63,7 +63,7 @@ type CheckResult = Option<(Span, String, Option<(Span, String)>)>;
////////////////////////////////////////////////////////////////////////////////
struct ParentVisitor<'a, 'tcx:'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
parents: NodeMap<ast::NodeId>,
curparent: ast::NodeId,
}
@ -155,7 +155,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for ParentVisitor<'a, 'tcx> {
////////////////////////////////////////////////////////////////////////////////
struct EmbargoVisitor<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
export_map: &'a def::ExportMap,
// Accessibility levels for reachable nodes
@ -472,7 +472,7 @@ impl<'b, 'a, 'tcx: 'a, 'v> Visitor<'v> for ReachEverythingInTheInterfaceVisitor<
////////////////////////////////////////////////////////////////////////////////
struct PrivacyVisitor<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
curitem: ast::NodeId,
in_foreign: bool,
parents: NodeMap<ast::NodeId>,
@ -972,7 +972,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for PrivacyVisitor<'a, 'tcx> {
////////////////////////////////////////////////////////////////////////////////
struct SanePrivacyVisitor<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
}
impl<'a, 'tcx, 'v> Visitor<'v> for SanePrivacyVisitor<'a, 'tcx> {
@ -1043,7 +1043,7 @@ impl<'a, 'tcx> SanePrivacyVisitor<'a, 'tcx> {
///////////////////////////////////////////////////////////////////////////////
struct ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
access_levels: &'a AccessLevels,
in_variant: bool,
// set of errors produced by this obsolete visitor
@ -1382,7 +1382,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx>
///////////////////////////////////////////////////////////////////////////////
struct SearchInterfaceForPrivateItemsVisitor<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
// Do not report an error when a private type is found
is_quiet: bool,
// Is private component found?
@ -1513,7 +1513,7 @@ impl<'a, 'tcx: 'a, 'v> Visitor<'v> for SearchInterfaceForPrivateItemsVisitor<'a,
}
struct PrivateItemsInPublicInterfacesVisitor<'a, 'tcx: 'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
old_error_set: &'a NodeSet,
}
@ -1603,7 +1603,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for PrivateItemsInPublicInterfacesVisitor<'a, 'tc
}
}
pub fn check_crate(tcx: &ty::ctxt,
pub fn check_crate(tcx: &TyCtxt,
export_map: &def::ExportMap,
external_exports: ExternalExports)
-> AccessLevels {

View File

@ -23,7 +23,7 @@ use session::Session;
use middle::cstore::{self, CrateStore, LinkMeta};
use middle::cstore::{LinkagePreference, NativeLibraryKind};
use middle::dependency_format::Linkage;
use middle::ty::{self, Ty};
use middle::ty::{Ty, TyCtxt};
use rustc::front::map::DefPath;
use trans::{CrateContext, CrateTranslation, gensym_name};
use util::common::time;
@ -202,7 +202,7 @@ fn truncated_hash_result(symbol_hasher: &mut Sha256) -> String {
// This calculates STH for a symbol, as defined above
fn symbol_hash<'tcx>(tcx: &ty::ctxt<'tcx>,
fn symbol_hash<'tcx>(tcx: &TyCtxt<'tcx>,
symbol_hasher: &mut Sha256,
t: Ty<'tcx>,
link_meta: &LinkMeta)

View File

@ -34,7 +34,7 @@ use session::Session;
use middle::def::Def;
use middle::def_id::DefId;
use middle::ty;
use middle::ty::{self, TyCtxt};
use std::fs::File;
use std::hash::*;
@ -65,7 +65,7 @@ macro_rules! down_cast_data {
pub struct DumpCsvVisitor<'l, 'tcx: 'l> {
save_ctxt: SaveContext<'l, 'tcx>,
sess: &'l Session,
tcx: &'l ty::ctxt<'tcx>,
tcx: &'l TyCtxt<'tcx>,
analysis: &'l ty::CrateAnalysis<'l>,
span: SpanUtils<'l>,
@ -83,7 +83,7 @@ pub struct DumpCsvVisitor<'l, 'tcx: 'l> {
}
impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
pub fn new(tcx: &'l ty::ctxt<'tcx>,
pub fn new(tcx: &'l TyCtxt<'tcx>,
lcx: &'l LoweringContext<'l>,
analysis: &'l ty::CrateAnalysis<'l>,
output_file: Box<File>)

View File

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use middle::ty;
use middle::ty::{self, TyCtxt};
use middle::def::Def;
use middle::def_id::DefId;
@ -37,7 +37,7 @@ pub mod recorder;
mod dump_csv;
pub struct SaveContext<'l, 'tcx: 'l> {
tcx: &'l ty::ctxt<'tcx>,
tcx: &'l TyCtxt<'tcx>,
lcx: &'l lowering::LoweringContext<'l>,
span_utils: SpanUtils<'l>,
}
@ -195,14 +195,14 @@ macro_rules! option_try(
impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
pub fn new(tcx: &'l ty::ctxt<'tcx>,
pub fn new(tcx: &'l TyCtxt<'tcx>,
lcx: &'l lowering::LoweringContext<'l>)
-> SaveContext<'l, 'tcx> {
let span_utils = SpanUtils::new(&tcx.sess);
SaveContext::from_span_utils(tcx, lcx, span_utils)
}
pub fn from_span_utils(tcx: &'l ty::ctxt<'tcx>,
pub fn from_span_utils(tcx: &'l TyCtxt<'tcx>,
lcx: &'l lowering::LoweringContext<'l>,
span_utils: SpanUtils<'l>)
-> SaveContext<'l, 'tcx> {
@ -790,7 +790,7 @@ impl<'v> Visitor<'v> for PathCollector {
}
}
pub fn process_crate<'l, 'tcx>(tcx: &'l ty::ctxt<'tcx>,
pub fn process_crate<'l, 'tcx>(tcx: &'l TyCtxt<'tcx>,
lcx: &'l lowering::LoweringContext<'l>,
krate: &ast::Crate,
analysis: &ty::CrateAnalysis,

View File

@ -15,7 +15,7 @@ use super::span_utils::SpanUtils;
use middle::cstore::LOCAL_CRATE;
use middle::def_id::{CRATE_DEF_INDEX, DefId};
use middle::ty;
use middle::ty::TyCtxt;
use std::io::Write;
@ -55,7 +55,7 @@ impl Recorder {
pub struct FmtStrs<'a, 'tcx: 'a> {
pub recorder: Box<Recorder>,
span: SpanUtils<'a>,
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
}
macro_rules! s { ($e:expr) => { format!("{}", $e) }}
@ -103,7 +103,7 @@ pub enum Row {
impl<'a, 'tcx: 'a> FmtStrs<'a, 'tcx> {
pub fn new(rec: Box<Recorder>,
span: SpanUtils<'a>,
tcx: &'a ty::ctxt<'tcx>)
tcx: &'a TyCtxt<'tcx>)
-> FmtStrs<'a, 'tcx> {
FmtStrs {
recorder: rec,

View File

@ -216,7 +216,7 @@ use trans::monomorphize;
use trans::tvec;
use trans::type_of;
use trans::Disr;
use middle::ty::{self, Ty};
use middle::ty::{self, Ty, TyCtxt};
use session::config::NoDebugInfo;
use util::common::indenter;
use util::nodemap::FnvHashMap;
@ -237,7 +237,7 @@ use syntax::ptr::P;
struct ConstantExpr<'a>(&'a hir::Expr);
impl<'a> ConstantExpr<'a> {
fn eq(self, other: ConstantExpr<'a>, tcx: &ty::ctxt) -> bool {
fn eq(self, other: ConstantExpr<'a>, tcx: &TyCtxt) -> bool {
match const_eval::compare_lit_exprs(tcx, self.0, other.0) {
Some(result) => result == Ordering::Equal,
None => panic!("compare_list_exprs: type mismatch"),
@ -258,7 +258,7 @@ enum Opt<'a, 'tcx> {
}
impl<'a, 'tcx> Opt<'a, 'tcx> {
fn eq(&self, other: &Opt<'a, 'tcx>, tcx: &ty::ctxt<'tcx>) -> bool {
fn eq(&self, other: &Opt<'a, 'tcx>, tcx: &TyCtxt<'tcx>) -> bool {
match (self, other) {
(&ConstantValue(a, _), &ConstantValue(b, _)) => a.eq(b, tcx),
(&ConstantRange(a1, a2, _), &ConstantRange(b1, b2, _)) => {
@ -794,7 +794,7 @@ fn any_region_pat(m: &[Match], col: usize) -> bool {
any_pat!(m, col, PatKind::Ref(..))
}
fn any_irrefutable_adt_pat(tcx: &ty::ctxt, m: &[Match], col: usize) -> bool {
fn any_irrefutable_adt_pat(tcx: &TyCtxt, m: &[Match], col: usize) -> bool {
m.iter().any(|br| {
let pat = br.pats[col];
match pat.node {

View File

@ -50,7 +50,7 @@ use std::rc::Rc;
use llvm::{ValueRef, True, IntEQ, IntNE};
use back::abi::FAT_PTR_ADDR;
use middle::subst;
use middle::ty::{self, Ty};
use middle::ty::{self, Ty, TyCtxt};
use syntax::ast;
use syntax::attr;
use syntax::attr::IntType;
@ -241,7 +241,7 @@ fn dtor_to_init_u8(dtor: bool) -> u8 {
}
pub trait GetDtorType<'tcx> { fn dtor_type(&self) -> Ty<'tcx>; }
impl<'tcx> GetDtorType<'tcx> for ty::ctxt<'tcx> {
impl<'tcx> GetDtorType<'tcx> for TyCtxt<'tcx> {
fn dtor_type(&self) -> Ty<'tcx> { self.types.u8 }
}
@ -438,7 +438,7 @@ struct Case<'tcx> {
/// This represents the (GEP) indices to follow to get to the discriminant field
pub type DiscrField = Vec<usize>;
fn find_discr_field_candidate<'tcx>(tcx: &ty::ctxt<'tcx>,
fn find_discr_field_candidate<'tcx>(tcx: &TyCtxt<'tcx>,
ty: Ty<'tcx>,
mut path: DiscrField) -> Option<DiscrField> {
match ty.sty {
@ -540,7 +540,7 @@ impl<'tcx> Case<'tcx> {
}
}
fn get_cases<'tcx>(tcx: &ty::ctxt<'tcx>,
fn get_cases<'tcx>(tcx: &TyCtxt<'tcx>,
adt: ty::AdtDef<'tcx>,
substs: &subst::Substs<'tcx>)
-> Vec<Case<'tcx>> {
@ -664,7 +664,7 @@ fn bounds_usable(cx: &CrateContext, ity: IntType, bounds: &IntBounds) -> bool {
}
}
pub fn ty_of_inttype<'tcx>(tcx: &ty::ctxt<'tcx>, ity: IntType) -> Ty<'tcx> {
pub fn ty_of_inttype<'tcx>(tcx: &TyCtxt<'tcx>, ity: IntType) -> Ty<'tcx> {
match ity {
attr::SignedInt(t) => tcx.mk_mach_int(t),
attr::UnsignedInt(t) => tcx.mk_mach_uint(t)

View File

@ -40,7 +40,7 @@
use graphviz as dot;
use rustc::dep_graph::{DepGraphQuery, DepNode};
use rustc::middle::def_id::DefId;
use rustc::middle::ty;
use rustc::middle::ty::TyCtxt;
use rustc_data_structures::fnv::{FnvHashMap, FnvHashSet};
use rustc_data_structures::graph::{Direction, INCOMING, OUTGOING, NodeIndex};
use rustc_front::hir;
@ -58,7 +58,7 @@ const IF_THIS_CHANGED: &'static str = "rustc_if_this_changed";
const THEN_THIS_WOULD_NEED: &'static str = "rustc_then_this_would_need";
const ID: &'static str = "id";
pub fn assert_dep_graph(tcx: &ty::ctxt) {
pub fn assert_dep_graph(tcx: &TyCtxt) {
let _ignore = tcx.dep_graph.in_ignore();
if tcx.sess.opts.dump_dep_graph {
@ -84,7 +84,7 @@ type TargetHashMap = FnvHashMap<InternedString,
FnvHashSet<(Span, InternedString, ast::NodeId, DepNode)>>;
struct IfThisChanged<'a, 'tcx:'a> {
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
if_this_changed: SourceHashMap,
then_this_would_need: TargetHashMap,
}
@ -171,7 +171,7 @@ impl<'a, 'tcx> Visitor<'tcx> for IfThisChanged<'a, 'tcx> {
}
}
fn check_paths(tcx: &ty::ctxt,
fn check_paths(tcx: &TyCtxt,
if_this_changed: &SourceHashMap,
then_this_would_need: &TargetHashMap)
{
@ -212,7 +212,7 @@ fn check_paths(tcx: &ty::ctxt,
}
}
fn dump_graph(tcx: &ty::ctxt) {
fn dump_graph(tcx: &TyCtxt) {
let path: String = env::var("RUST_DEP_GRAPH").unwrap_or_else(|_| format!("dep_graph"));
let query = tcx.dep_graph.query();

View File

@ -43,7 +43,7 @@ use middle::weak_lang_items;
use middle::pat_util::simple_name;
use middle::subst::{self, Substs};
use middle::traits;
use middle::ty::{self, Ty, TypeFoldable};
use middle::ty::{self, Ty, TyCtxt, TypeFoldable};
use middle::ty::adjustment::CustomCoerceUnsized;
use rustc::dep_graph::DepNode;
use rustc::front::map as hir_map;
@ -1471,7 +1471,7 @@ impl<'v> Visitor<'v> for FindNestedReturn {
}
}
fn build_cfg(tcx: &ty::ctxt, id: ast::NodeId) -> (ast::NodeId, Option<cfg::CFG>) {
fn build_cfg(tcx: &TyCtxt, id: ast::NodeId) -> (ast::NodeId, Option<cfg::CFG>) {
let blk = match tcx.map.find(id) {
Some(hir_map::NodeItem(i)) => {
match i.node {
@ -1527,7 +1527,7 @@ fn build_cfg(tcx: &ty::ctxt, id: ast::NodeId) -> (ast::NodeId, Option<cfg::CFG>)
// part of a larger expression that may have already partially-filled the
// return slot alloca. This can cause errors related to clean-up due to
// the clobbering of the existing value in the return slot.
fn has_nested_returns(tcx: &ty::ctxt, cfg: &cfg::CFG, blk_id: ast::NodeId) -> bool {
fn has_nested_returns(tcx: &TyCtxt, cfg: &cfg::CFG, blk_id: ast::NodeId) -> bool {
for index in cfg.graph.depth_traverse(cfg.entry) {
let n = cfg.graph.node_data(index);
match tcx.map.find(n.id()) {
@ -3137,7 +3137,7 @@ pub fn filter_reachable_ids(ccx: &SharedCrateContext) -> NodeSet {
}).collect()
}
pub fn trans_crate<'tcx>(tcx: &ty::ctxt<'tcx>,
pub fn trans_crate<'tcx>(tcx: &TyCtxt<'tcx>,
mir_map: &MirMap<'tcx>,
analysis: ty::CrateAnalysis)
-> CrateTranslation {

View File

@ -51,7 +51,7 @@ use trans::monomorphize;
use trans::type_::Type;
use trans::type_of;
use trans::Disr;
use middle::ty::{self, Ty, TypeFoldable};
use middle::ty::{self, Ty, TyCtxt, TypeFoldable};
use middle::ty::MethodCall;
use rustc_front::hir;
@ -408,7 +408,7 @@ pub fn trans_fn_ref_with_substs<'a, 'tcx>(
// def_id to the local id of the inlined copy.
let def_id = inline::maybe_instantiate_inline(ccx, def_id);
fn is_named_tuple_constructor(tcx: &ty::ctxt, def_id: DefId) -> bool {
fn is_named_tuple_constructor(tcx: &TyCtxt, def_id: DefId) -> bool {
let node_id = match tcx.map.as_local_node_id(def_id) {
Some(n) => n,
None => { return false; }

View File

@ -129,7 +129,7 @@ use trans::debuginfo::{DebugLoc, ToDebugLoc};
use trans::glue;
use middle::region;
use trans::type_::Type;
use middle::ty::{self, Ty};
use middle::ty::{Ty, TyCtxt};
use std::fmt;
use syntax::ast;
@ -1180,7 +1180,7 @@ impl<'tcx> Cleanup<'tcx> for LifetimeEnd {
}
}
pub fn temporary_scope(tcx: &ty::ctxt,
pub fn temporary_scope(tcx: &TyCtxt,
id: ast::NodeId)
-> ScopeId {
match tcx.region_maps.temporary_scope(id) {
@ -1196,7 +1196,7 @@ pub fn temporary_scope(tcx: &ty::ctxt,
}
}
pub fn var_scope(tcx: &ty::ctxt,
pub fn var_scope(tcx: &TyCtxt,
id: ast::NodeId)
-> ScopeId {
let r = AstScope(tcx.region_maps.var_scope(id).node_id(&tcx.region_maps));

View File

@ -38,7 +38,7 @@ use trans::monomorphize;
use trans::type_::Type;
use trans::type_of;
use middle::traits;
use middle::ty::{self, Ty};
use middle::ty::{self, Ty, TyCtxt};
use middle::ty::fold::{TypeFolder, TypeFoldable};
use rustc_front::hir;
use rustc::mir::repr::Mir;
@ -58,11 +58,11 @@ use syntax::parse::token;
pub use trans::context::CrateContext;
/// Is the type's representation size known at compile time?
pub fn type_is_sized<'tcx>(tcx: &ty::ctxt<'tcx>, ty: Ty<'tcx>) -> bool {
pub fn type_is_sized<'tcx>(tcx: &TyCtxt<'tcx>, ty: Ty<'tcx>) -> bool {
ty.is_sized(&tcx.empty_parameter_environment(), DUMMY_SP)
}
pub fn type_is_fat_ptr<'tcx>(cx: &ty::ctxt<'tcx>, ty: Ty<'tcx>) -> bool {
pub fn type_is_fat_ptr<'tcx>(cx: &TyCtxt<'tcx>, ty: Ty<'tcx>) -> bool {
match ty.sty {
ty::TyRawPtr(ty::TypeAndMut{ty, ..}) |
ty::TyRef(_, ty::TypeAndMut{ty, ..}) |
@ -184,7 +184,7 @@ pub struct VariantInfo<'tcx> {
}
impl<'tcx> VariantInfo<'tcx> {
pub fn from_ty(tcx: &ty::ctxt<'tcx>,
pub fn from_ty(tcx: &TyCtxt<'tcx>,
ty: Ty<'tcx>,
opt_def: Option<Def>)
-> Self
@ -222,7 +222,7 @@ impl<'tcx> VariantInfo<'tcx> {
}
/// Return the variant corresponding to a given node (e.g. expr)
pub fn of_node(tcx: &ty::ctxt<'tcx>, ty: Ty<'tcx>, id: ast::NodeId) -> Self {
pub fn of_node(tcx: &TyCtxt<'tcx>, ty: Ty<'tcx>, id: ast::NodeId) -> Self {
let node_def = tcx.def_map.borrow().get(&id).map(|v| v.full_def());
Self::from_ty(tcx, ty, node_def)
}
@ -621,7 +621,7 @@ impl<'blk, 'tcx> BlockS<'blk, 'tcx> {
pub fn fcx(&self) -> &'blk FunctionContext<'blk, 'tcx> {
self.fcx
}
pub fn tcx(&self) -> &'blk ty::ctxt<'tcx> {
pub fn tcx(&self) -> &'blk TyCtxt<'tcx> {
self.fcx.ccx.tcx()
}
pub fn sess(&self) -> &'blk Session { self.fcx.ccx.sess() }
@ -752,7 +752,7 @@ impl<'blk, 'tcx> BlockAndBuilder<'blk, 'tcx> {
pub fn fcx(&self) -> &'blk FunctionContext<'blk, 'tcx> {
self.bcx.fcx()
}
pub fn tcx(&self) -> &'blk ty::ctxt<'tcx> {
pub fn tcx(&self) -> &'blk TyCtxt<'tcx> {
self.bcx.tcx()
}
pub fn sess(&self) -> &'blk Session {

View File

@ -27,7 +27,7 @@ use trans::monomorphize::MonoId;
use trans::collector::{TransItem, TransItemState};
use trans::type_::{Type, TypeNames};
use middle::subst::Substs;
use middle::ty::{self, Ty};
use middle::ty::{self, Ty, TyCtxt};
use session::config::NoDebugInfo;
use session::Session;
use util::sha2::Sha256;
@ -70,7 +70,7 @@ pub struct SharedCrateContext<'a, 'tcx: 'a> {
item_symbols: RefCell<NodeMap<String>>,
link_meta: LinkMeta,
symbol_hasher: RefCell<Sha256>,
tcx: &'a ty::ctxt<'tcx>,
tcx: &'a TyCtxt<'tcx>,
stats: Stats,
check_overflow: bool,
check_drop_flag_for_sanity: bool,
@ -271,7 +271,7 @@ unsafe fn create_context_and_module(sess: &Session, mod_name: &str) -> (ContextR
impl<'b, 'tcx> SharedCrateContext<'b, 'tcx> {
pub fn new(crate_name: &str,
local_count: usize,
tcx: &'b ty::ctxt<'tcx>,
tcx: &'b TyCtxt<'tcx>,
mir_map: &'b MirMap<'tcx>,
export_map: ExportMap,
symbol_hasher: Sha256,
@ -430,7 +430,7 @@ impl<'b, 'tcx> SharedCrateContext<'b, 'tcx> {
&self.link_meta
}
pub fn tcx<'a>(&'a self) -> &'a ty::ctxt<'tcx> {
pub fn tcx<'a>(&'a self) -> &'a TyCtxt<'tcx> {
self.tcx
}
@ -574,7 +574,7 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> {
}
pub fn tcx<'a>(&'a self) -> &'a ty::ctxt<'tcx> {
pub fn tcx<'a>(&'a self) -> &'a TyCtxt<'tcx> {
self.shared.tcx
}

View File

@ -73,7 +73,7 @@ use trans::Disr;
use middle::ty::adjustment::{AdjustDerefRef, AdjustReifyFnPointer};
use middle::ty::adjustment::{AdjustUnsafeFnPointer, AdjustMutToConstPointer};
use middle::ty::adjustment::CustomCoerceUnsized;
use middle::ty::{self, Ty};
use middle::ty::{self, Ty, TyCtxt};
use middle::ty::MethodCall;
use middle::ty::cast::{CastKind, CastTy};
use util::common::indenter;
@ -723,7 +723,7 @@ fn trans_field<'blk, 'tcx, F>(bcx: Block<'blk, 'tcx>,
base: &hir::Expr,
get_idx: F)
-> DatumBlock<'blk, 'tcx, Expr> where
F: FnOnce(&'blk ty::ctxt<'tcx>, &VariantInfo<'tcx>) -> usize,
F: FnOnce(&'blk TyCtxt<'tcx>, &VariantInfo<'tcx>) -> usize,
{
let mut bcx = bcx;
let _icx = push_ctxt("trans_rec_field");
@ -1998,7 +1998,7 @@ fn trans_overloaded_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
bcx
}
pub fn cast_is_noop<'tcx>(tcx: &ty::ctxt<'tcx>,
pub fn cast_is_noop<'tcx>(tcx: &TyCtxt<'tcx>,
expr: &hir::Expr,
t_in: Ty<'tcx>,
t_out: Ty<'tcx>)
@ -2365,7 +2365,7 @@ impl OverflowOpViaIntrinsic {
let name = self.to_intrinsic_name(bcx.tcx(), lhs_ty);
bcx.ccx().get_intrinsic(&name)
}
fn to_intrinsic_name(&self, tcx: &ty::ctxt, ty: Ty) -> &'static str {
fn to_intrinsic_name(&self, tcx: &TyCtxt, ty: Ty) -> &'static str {
use syntax::ast::IntTy::*;
use syntax::ast::UintTy::*;
use middle::ty::{TyInt, TyUint};
@ -2557,7 +2557,7 @@ enum ExprKind {
RvalueStmt
}
fn expr_kind(tcx: &ty::ctxt, expr: &hir::Expr) -> ExprKind {
fn expr_kind(tcx: &TyCtxt, expr: &hir::Expr) -> ExprKind {
if tcx.is_method_call(expr.id) {
// Overloaded operations are generally calls, and hence they are
// generated via DPS, but there are a few exceptions:

Some files were not shown because too many files have changed in this diff Show More