Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename middle::ty::ctxt to TyCtxt #31979

Merged
merged 1 commit into from
Mar 3, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/librustc/dep_graph/mod.rs
Original file line number Diff line number Diff line change
@@ -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
}
8 changes: 4 additions & 4 deletions src/librustc/lint/context.rs
Original file line number Diff line number Diff line change
@@ -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();
10 changes: 5 additions & 5 deletions src/librustc/middle/astconv_util.rs
Original file line number Diff line number Diff line change
@@ -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) {
6 changes: 3 additions & 3 deletions src/librustc/middle/cfg/construct.rs
Original file line number Diff line number Diff line change
@@ -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);
4 changes: 2 additions & 2 deletions src/librustc/middle/cfg/mod.rs
Original file line number Diff line number Diff line change
@@ -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)
}
8 changes: 4 additions & 4 deletions src/librustc/middle/check_match.rs
Original file line number Diff line number Diff line change
@@ -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 {
28 changes: 14 additions & 14 deletions src/librustc/middle/const_eval.rs
Original file line number Diff line number Diff line change
@@ -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) {
Loading