Skip to content

Commit f6e125f

Browse files
committed
Auto merge of #31979 - jseyfried:rename_ctxt, r=eddyb
r? @eddyb
2 parents 4aa913c + 37ba66a commit f6e125f

File tree

131 files changed

+703
-706
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+703
-706
lines changed

src/librustc/dep_graph/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use self::thread::{DepGraphThreadData, DepMessage};
1212
use middle::def_id::DefId;
13-
use middle::ty;
13+
use middle::ty::TyCtxt;
1414
use rustc_front::hir;
1515
use rustc_front::intravisit::Visitor;
1616
use std::rc::Rc;
@@ -181,13 +181,13 @@ pub use self::query::DepGraphQuery;
181181
/// read edge from the corresponding AST node. This is used in
182182
/// compiler passes to automatically record the item that they are
183183
/// working on.
184-
pub fn visit_all_items_in_krate<'tcx,V,F>(tcx: &ty::ctxt<'tcx>,
184+
pub fn visit_all_items_in_krate<'tcx,V,F>(tcx: &TyCtxt<'tcx>,
185185
mut dep_node_fn: F,
186186
visitor: &mut V)
187187
where F: FnMut(DefId) -> DepNode, V: Visitor<'tcx>
188188
{
189189
struct TrackingVisitor<'visit, 'tcx: 'visit, F: 'visit, V: 'visit> {
190-
tcx: &'visit ty::ctxt<'tcx>,
190+
tcx: &'visit TyCtxt<'tcx>,
191191
dep_node_fn: &'visit mut F,
192192
visitor: &'visit mut V
193193
}

src/librustc/lint/context.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use self::TargetLint::*;
2727

2828
use dep_graph::DepNode;
2929
use middle::privacy::AccessLevels;
30-
use middle::ty;
30+
use middle::ty::TyCtxt;
3131
use session::{config, early_error, Session};
3232
use lint::{Level, LevelSource, Lint, LintId, LintArray, LintPass};
3333
use lint::{EarlyLintPass, EarlyLintPassObject, LateLintPass, LateLintPassObject};
@@ -298,7 +298,7 @@ impl LintStore {
298298
/// Context for lint checking after type checking.
299299
pub struct LateContext<'a, 'tcx: 'a> {
300300
/// Type context we're checking in.
301-
pub tcx: &'a ty::ctxt<'tcx>,
301+
pub tcx: &'a TyCtxt<'tcx>,
302302

303303
/// The crate being checked.
304304
pub krate: &'a hir::Crate,
@@ -662,7 +662,7 @@ impl<'a> EarlyContext<'a> {
662662
}
663663

664664
impl<'a, 'tcx> LateContext<'a, 'tcx> {
665-
fn new(tcx: &'a ty::ctxt<'tcx>,
665+
fn new(tcx: &'a TyCtxt<'tcx>,
666666
krate: &'a hir::Crate,
667667
access_levels: &'a AccessLevels) -> LateContext<'a, 'tcx> {
668668
// 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,
12491249
/// Perform lint checking on a crate.
12501250
///
12511251
/// Consumes the `lint_store` field of the `Session`.
1252-
pub fn check_crate(tcx: &ty::ctxt, access_levels: &AccessLevels) {
1252+
pub fn check_crate(tcx: &TyCtxt, access_levels: &AccessLevels) {
12531253
let _task = tcx.dep_graph.in_task(DepNode::LateLintCheck);
12541254

12551255
let krate = tcx.map.krate();

src/librustc/middle/astconv_util.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
*/
1616

1717
use middle::def::Def;
18-
use middle::ty::{self, Ty};
18+
use middle::ty::{Ty, TyCtxt};
1919

2020
use syntax::codemap::Span;
2121
use rustc_front::hir as ast;
2222

23-
pub fn prohibit_type_params(tcx: &ty::ctxt, segments: &[ast::PathSegment]) {
23+
pub fn prohibit_type_params(tcx: &TyCtxt, segments: &[ast::PathSegment]) {
2424
for segment in segments {
2525
for typ in segment.parameters.types() {
2626
span_err!(tcx.sess, typ.span, E0109,
@@ -39,13 +39,13 @@ pub fn prohibit_type_params(tcx: &ty::ctxt, segments: &[ast::PathSegment]) {
3939
}
4040
}
4141

42-
pub fn prohibit_projection(tcx: &ty::ctxt, span: Span)
42+
pub fn prohibit_projection(tcx: &TyCtxt, span: Span)
4343
{
4444
span_err!(tcx.sess, span, E0229,
4545
"associated type bindings are not allowed here");
4646
}
4747

48-
pub fn prim_ty_to_ty<'tcx>(tcx: &ty::ctxt<'tcx>,
48+
pub fn prim_ty_to_ty<'tcx>(tcx: &TyCtxt<'tcx>,
4949
segments: &[ast::PathSegment],
5050
nty: ast::PrimTy)
5151
-> Ty<'tcx> {
@@ -62,7 +62,7 @@ pub fn prim_ty_to_ty<'tcx>(tcx: &ty::ctxt<'tcx>,
6262

6363
/// If a type in the AST is a primitive type, return the ty::Ty corresponding
6464
/// to it.
65-
pub fn ast_ty_to_prim_ty<'tcx>(tcx: &ty::ctxt<'tcx>, ast_ty: &ast::Ty)
65+
pub fn ast_ty_to_prim_ty<'tcx>(tcx: &TyCtxt<'tcx>, ast_ty: &ast::Ty)
6666
-> Option<Ty<'tcx>> {
6767
if let ast::TyPath(None, ref path) = ast_ty.node {
6868
let def = match tcx.def_map.borrow().get(&ast_ty.id) {

src/librustc/middle/cfg/construct.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ use rustc_data_structures::graph;
1212
use middle::cfg::*;
1313
use middle::def::Def;
1414
use middle::pat_util;
15-
use middle::ty;
15+
use middle::ty::{self, TyCtxt};
1616
use syntax::ast;
1717
use syntax::ptr::P;
1818

1919
use rustc_front::hir::{self, PatKind};
2020

2121
struct CFGBuilder<'a, 'tcx: 'a> {
22-
tcx: &'a ty::ctxt<'tcx>,
22+
tcx: &'a TyCtxt<'tcx>,
2323
graph: CFGGraph,
2424
fn_exit: CFGIndex,
2525
loop_scopes: Vec<LoopScope>,
@@ -32,7 +32,7 @@ struct LoopScope {
3232
break_index: CFGIndex, // where to go on a `break
3333
}
3434

35-
pub fn construct(tcx: &ty::ctxt,
35+
pub fn construct(tcx: &TyCtxt,
3636
blk: &hir::Block) -> CFG {
3737
let mut graph = graph::Graph::new();
3838
let entry = graph.add_node(CFGNodeData::Entry);

src/librustc/middle/cfg/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
//! Uses `Graph` as the underlying representation.
1313
1414
use rustc_data_structures::graph;
15-
use middle::ty;
15+
use middle::ty::TyCtxt;
1616
use syntax::ast;
1717
use rustc_front::hir;
1818

@@ -58,7 +58,7 @@ pub type CFGNode = graph::Node<CFGNodeData>;
5858
pub type CFGEdge = graph::Edge<CFGEdgeData>;
5959

6060
impl CFG {
61-
pub fn new(tcx: &ty::ctxt,
61+
pub fn new(tcx: &TyCtxt,
6262
blk: &hir::Block) -> CFG {
6363
construct::construct(tcx, blk)
6464
}

src/librustc/middle/check_match.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ impl<'a> FromIterator<Vec<&'a Pat>> for Matrix<'a> {
107107

108108
//NOTE: appears to be the only place other then InferCtxt to contain a ParamEnv
109109
pub struct MatchCheckCtxt<'a, 'tcx: 'a> {
110-
pub tcx: &'a ty::ctxt<'tcx>,
110+
pub tcx: &'a TyCtxt<'tcx>,
111111
pub param_env: ParameterEnvironment<'a, 'tcx>,
112112
}
113113

@@ -154,7 +154,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for MatchCheckCtxt<'a, 'tcx> {
154154
}
155155
}
156156

157-
pub fn check_crate(tcx: &ty::ctxt) {
157+
pub fn check_crate(tcx: &TyCtxt) {
158158
tcx.visit_all_items_in_krate(DepNode::MatchCheck, &mut MatchCheckCtxt {
159159
tcx: tcx,
160160
param_env: tcx.empty_parameter_environment(),
@@ -433,13 +433,13 @@ fn const_val_to_expr(value: &ConstVal) -> P<hir::Expr> {
433433
}
434434

435435
pub struct StaticInliner<'a, 'tcx: 'a> {
436-
pub tcx: &'a ty::ctxt<'tcx>,
436+
pub tcx: &'a TyCtxt<'tcx>,
437437
pub failed: bool,
438438
pub renaming_map: Option<&'a mut FnvHashMap<(NodeId, Span), NodeId>>,
439439
}
440440

441441
impl<'a, 'tcx> StaticInliner<'a, 'tcx> {
442-
pub fn new<'b>(tcx: &'b ty::ctxt<'tcx>,
442+
pub fn new<'b>(tcx: &'b TyCtxt<'tcx>,
443443
renaming_map: Option<&'b mut FnvHashMap<(NodeId, Span), NodeId>>)
444444
-> StaticInliner<'b, 'tcx> {
445445
StaticInliner {

src/librustc/middle/const_eval.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use middle::def::Def;
2222
use middle::subst::Subst;
2323
use middle::def_id::DefId;
2424
use middle::pat_util::def_to_path;
25-
use middle::ty::{self, Ty};
25+
use middle::ty::{self, Ty, TyCtxt};
2626
use middle::astconv_util::ast_ty_to_prim_ty;
2727
use util::num::ToPrimitive;
2828
use util::nodemap::NodeMap;
@@ -46,7 +46,7 @@ use std::mem::transmute;
4646
use std::{i8, i16, i32, i64, u8, u16, u32, u64};
4747
use std::rc::Rc;
4848

49-
fn lookup_variant_by_id<'a>(tcx: &'a ty::ctxt,
49+
fn lookup_variant_by_id<'a>(tcx: &'a TyCtxt,
5050
enum_def: DefId,
5151
variant_def: DefId)
5252
-> Option<&'a Expr> {
@@ -84,7 +84,7 @@ fn lookup_variant_by_id<'a>(tcx: &'a ty::ctxt,
8484
/// `maybe_ref_id` and `param_substs` are optional and are used for
8585
/// finding substitutions in associated constants. This generally
8686
/// happens in late/trans const evaluation.
87-
pub fn lookup_const_by_id<'a, 'tcx: 'a>(tcx: &'a ty::ctxt<'tcx>,
87+
pub fn lookup_const_by_id<'a, 'tcx: 'a>(tcx: &'a TyCtxt<'tcx>,
8888
def_id: DefId,
8989
maybe_ref_id: Option<ast::NodeId>,
9090
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>,
189189
}
190190
}
191191

192-
fn inline_const_fn_from_external_crate(tcx: &ty::ctxt, def_id: DefId)
192+
fn inline_const_fn_from_external_crate(tcx: &TyCtxt, def_id: DefId)
193193
-> Option<ast::NodeId> {
194194
match tcx.extern_const_fns.borrow().get(&def_id) {
195195
Some(&ast::DUMMY_NODE_ID) => return None,
@@ -212,7 +212,7 @@ fn inline_const_fn_from_external_crate(tcx: &ty::ctxt, def_id: DefId)
212212
fn_id
213213
}
214214

215-
pub fn lookup_const_fn_by_id<'tcx>(tcx: &ty::ctxt<'tcx>, def_id: DefId)
215+
pub fn lookup_const_fn_by_id<'tcx>(tcx: &TyCtxt<'tcx>, def_id: DefId)
216216
-> Option<FnLikeNode<'tcx>>
217217
{
218218
let fn_id = if let Some(node_id) = tcx.map.as_local_node_id(def_id) {
@@ -322,7 +322,7 @@ impl ConstVal {
322322
}
323323
}
324324

325-
pub fn const_expr_to_pat(tcx: &ty::ctxt, expr: &Expr, span: Span) -> P<hir::Pat> {
325+
pub fn const_expr_to_pat(tcx: &TyCtxt, expr: &Expr, span: Span) -> P<hir::Pat> {
326326
let pat = match expr.node {
327327
hir::ExprTup(ref exprs) =>
328328
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>
382382
P(hir::Pat { id: expr.id, node: pat, span: span })
383383
}
384384

385-
pub fn eval_const_expr(tcx: &ty::ctxt, e: &Expr) -> ConstVal {
385+
pub fn eval_const_expr(tcx: &TyCtxt, e: &Expr) -> ConstVal {
386386
match eval_const_expr_partial(tcx, e, ExprTypeChecked, None) {
387387
Ok(r) => r,
388388
Err(s) => tcx.sess.span_fatal(s.span, &s.description())
@@ -542,7 +542,7 @@ pub enum IntTy { I8, I16, I32, I64 }
542542
pub enum UintTy { U8, U16, U32, U64 }
543543

544544
impl IntTy {
545-
pub fn from(tcx: &ty::ctxt, t: ast::IntTy) -> IntTy {
545+
pub fn from(tcx: &TyCtxt, t: ast::IntTy) -> IntTy {
546546
let t = if let ast::IntTy::Is = t {
547547
tcx.sess.target.int_type
548548
} else {
@@ -559,7 +559,7 @@ impl IntTy {
559559
}
560560

561561
impl UintTy {
562-
pub fn from(tcx: &ty::ctxt, t: ast::UintTy) -> UintTy {
562+
pub fn from(tcx: &TyCtxt, t: ast::UintTy) -> UintTy {
563563
let t = if let ast::UintTy::Us = t {
564564
tcx.sess.target.uint_type
565565
} else {
@@ -810,7 +810,7 @@ pub_fn_checked_op!{ const_uint_checked_shr_via_int(a: u64, b: i64,.. UintTy) {
810810
/// guaranteed to be evaluatable. `ty_hint` is usually ExprTypeChecked,
811811
/// but a few places need to evaluate constants during type-checking, like
812812
/// computing the length of an array. (See also the FIXME above EvalHint.)
813-
pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
813+
pub fn eval_const_expr_partial<'tcx>(tcx: &TyCtxt<'tcx>,
814814
e: &Expr,
815815
ty_hint: EvalHint<'tcx>,
816816
fn_args: FnArgMap) -> EvalResult {
@@ -1222,7 +1222,7 @@ pub fn eval_const_expr_partial<'tcx>(tcx: &ty::ctxt<'tcx>,
12221222
Ok(result)
12231223
}
12241224

1225-
fn impl_or_trait_container(tcx: &ty::ctxt, def_id: DefId) -> ty::ImplOrTraitItemContainer {
1225+
fn impl_or_trait_container(tcx: &TyCtxt, def_id: DefId) -> ty::ImplOrTraitItemContainer {
12261226
// This is intended to be equivalent to tcx.impl_or_trait_item(def_id).container()
12271227
// for local def_id, but it can be called before tcx.impl_or_trait_items is complete.
12281228
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
12391239
panic!("{:?} is not local", def_id);
12401240
}
12411241

1242-
fn resolve_trait_associated_const<'a, 'tcx: 'a>(tcx: &'a ty::ctxt<'tcx>,
1242+
fn resolve_trait_associated_const<'a, 'tcx: 'a>(tcx: &'a TyCtxt<'tcx>,
12431243
ti: &'tcx hir::TraitItem,
12441244
trait_id: DefId,
12451245
rcvr_substs: subst::Substs<'tcx>)
@@ -1289,7 +1289,7 @@ fn resolve_trait_associated_const<'a, 'tcx: 'a>(tcx: &'a ty::ctxt<'tcx>,
12891289
}
12901290
}
12911291

1292-
fn cast_const<'tcx>(tcx: &ty::ctxt<'tcx>, val: ConstVal, ty: Ty) -> CastResult {
1292+
fn cast_const<'tcx>(tcx: &TyCtxt<'tcx>, val: ConstVal, ty: Ty) -> CastResult {
12931293
macro_rules! convert_val {
12941294
($intermediate_ty:ty, $const_type:ident, $target_ty:ty) => {
12951295
match val {
@@ -1385,7 +1385,7 @@ pub fn compare_const_vals(a: &ConstVal, b: &ConstVal) -> Option<Ordering> {
13851385
})
13861386
}
13871387

1388-
pub fn compare_lit_exprs<'tcx>(tcx: &ty::ctxt<'tcx>,
1388+
pub fn compare_lit_exprs<'tcx>(tcx: &TyCtxt<'tcx>,
13891389
a: &Expr,
13901390
b: &Expr) -> Option<Ordering> {
13911391
let a = match eval_const_expr_partial(tcx, a, ExprTypeChecked, None) {

0 commit comments

Comments
 (0)