Skip to content

Commit 2bde694

Browse files
committed
bring TyCtxt into scope
1 parent d3bbce7 commit 2bde694

File tree

11 files changed

+31
-31
lines changed

11 files changed

+31
-31
lines changed

src/librustc/ich/hcx.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use hir::def_id::DefId;
1313
use hir::map::DefPathHash;
1414
use ich::{self, CachingCodemapView};
1515
use session::config::DebugInfoLevel::NoDebugInfo;
16-
use ty;
16+
use ty::TyCtxt;
1717
use util::nodemap::{NodeMap, ItemLocalMap};
1818

1919
use std::hash as std_hash;
@@ -34,7 +34,7 @@ use rustc_data_structures::accumulate_vec::AccumulateVec;
3434
/// a reference to the TyCtxt) and it holds a few caches for speeding up various
3535
/// things (e.g. each DefId/DefPath is only hashed once).
3636
pub struct StableHashingContext<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
37-
tcx: ty::TyCtxt<'a, 'gcx, 'tcx>,
37+
tcx: TyCtxt<'a, 'gcx, 'tcx>,
3838
codemap: CachingCodemapView<'gcx>,
3939
hash_spans: bool,
4040
hash_bodies: bool,
@@ -53,7 +53,7 @@ pub enum NodeIdHashingMode {
5353

5454
impl<'a, 'gcx, 'tcx> StableHashingContext<'a, 'gcx, 'tcx> {
5555

56-
pub fn new(tcx: ty::TyCtxt<'a, 'gcx, 'tcx>) -> Self {
56+
pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Self {
5757
let hash_spans_initial = tcx.sess.opts.debuginfo != NoDebugInfo;
5858
let check_overflow_initial = tcx.sess.overflow_checks();
5959

@@ -111,7 +111,7 @@ impl<'a, 'gcx, 'tcx> StableHashingContext<'a, 'gcx, 'tcx> {
111111
}
112112

113113
#[inline]
114-
pub fn tcx(&self) -> ty::TyCtxt<'a, 'gcx, 'tcx> {
114+
pub fn tcx(&self) -> TyCtxt<'a, 'gcx, 'tcx> {
115115
self.tcx
116116
}
117117

src/librustc/middle/lang_items.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ language_item_table! {
340340
DebugTraitLangItem, "debug_trait", debug_trait;
341341
}
342342

343-
impl<'a, 'tcx, 'gcx> ty::TyCtxt<'a, 'tcx, 'gcx> {
343+
impl<'a, 'tcx, 'gcx> TyCtxt<'a, 'tcx, 'gcx> {
344344
pub fn require_lang_item(&self, lang_item: LangItem) -> DefId {
345345
self.lang_items().require(lang_item).unwrap_or_else(|msg| {
346346
self.sess.fatal(&msg)

src/librustc/mir/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use rustc_data_structures::control_flow_graph::ControlFlowGraph;
2121
use hir::def::CtorKind;
2222
use hir::def_id::DefId;
2323
use ty::subst::{Subst, Substs};
24-
use ty::{self, AdtDef, ClosureSubsts, Region, Ty, GeneratorInterior};
24+
use ty::{self, AdtDef, ClosureSubsts, Region, Ty, TyCtxt, GeneratorInterior};
2525
use ty::fold::{TypeFoldable, TypeFolder, TypeVisitor};
2626
use util::ppaux;
2727
use rustc_back::slice;
@@ -644,7 +644,7 @@ impl<'tcx> Terminator<'tcx> {
644644
}
645645

646646
impl<'tcx> TerminatorKind<'tcx> {
647-
pub fn if_<'a, 'gcx>(tcx: ty::TyCtxt<'a, 'gcx, 'tcx>, cond: Operand<'tcx>,
647+
pub fn if_<'a, 'gcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, cond: Operand<'tcx>,
648648
t: BasicBlock, f: BasicBlock) -> TerminatorKind<'tcx> {
649649
static BOOL_SWITCH_FALSE: &'static [ConstInt] = &[ConstInt::U8(0)];
650650
TerminatorKind::SwitchInt {
@@ -1182,7 +1182,7 @@ impl<'tcx> Debug for Operand<'tcx> {
11821182

11831183
impl<'tcx> Operand<'tcx> {
11841184
pub fn function_handle<'a>(
1185-
tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
1185+
tcx: TyCtxt<'a, 'tcx, 'tcx>,
11861186
def_id: DefId,
11871187
substs: &'tcx Substs<'tcx>,
11881188
span: Span,

src/librustc/ty/layout.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ impl Integer {
386386
}
387387
}
388388

389-
pub fn to_ty<'a, 'tcx>(&self, tcx: &ty::TyCtxt<'a, 'tcx, 'tcx>,
389+
pub fn to_ty<'a, 'tcx>(&self, tcx: &TyCtxt<'a, 'tcx, 'tcx>,
390390
signed: bool) -> Ty<'tcx> {
391391
match (*self, signed) {
392392
(I1, false) => tcx.types.u8,

src/librustc_metadata/astencode.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use isolated_encoder::IsolatedEncoder;
1414
use schema::*;
1515

1616
use rustc::hir;
17-
use rustc::ty;
17+
use rustc::ty::{self, TyCtxt};
1818

1919
#[derive(RustcEncodable, RustcDecodable)]
2020
pub struct Ast<'tcx> {
@@ -59,7 +59,7 @@ impl<'a, 'b, 'tcx> IsolatedEncoder<'a, 'b, 'tcx> {
5959
}
6060

6161
struct NestedBodyCollector<'a, 'tcx: 'a> {
62-
tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
62+
tcx: TyCtxt<'a, 'tcx, 'tcx>,
6363
bodies_found: Vec<&'tcx hir::Body>,
6464
}
6565

src/librustc_mir/build/cfg.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use build::CFG;
1717
use rustc::middle::region;
1818
use rustc::mir::*;
19-
use rustc::ty;
19+
use rustc::ty::TyCtxt;
2020

2121
impl<'tcx> CFG<'tcx> {
2222
pub fn block_data(&self, blk: BasicBlock) -> &BasicBlockData<'tcx> {
@@ -46,7 +46,7 @@ impl<'tcx> CFG<'tcx> {
4646
}
4747

4848
pub fn push_end_region<'a, 'gcx:'a+'tcx>(&mut self,
49-
tcx: ty::TyCtxt<'a, 'gcx, 'tcx>,
49+
tcx: TyCtxt<'a, 'gcx, 'tcx>,
5050
block: BasicBlock,
5151
source_info: SourceInfo,
5252
region_scope: region::Scope) {

src/librustc_mir/shim.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use rustc::infer;
1414
use rustc::middle::const_val::ConstVal;
1515
use rustc::mir::*;
1616
use rustc::mir::transform::MirSource;
17-
use rustc::ty::{self, Ty};
17+
use rustc::ty::{self, Ty, TyCtxt};
1818
use rustc::ty::subst::{Kind, Subst, Substs};
1919
use rustc::ty::maps::Providers;
2020
use rustc_const_math::{ConstInt, ConstUsize};
@@ -36,7 +36,7 @@ pub fn provide(providers: &mut Providers) {
3636
providers.mir_shims = make_shim;
3737
}
3838

39-
fn make_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
39+
fn make_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
4040
instance: ty::InstanceDef<'tcx>)
4141
-> &'tcx Mir<'tcx>
4242
{
@@ -154,7 +154,7 @@ fn local_decls_for_sig<'tcx>(sig: &ty::FnSig<'tcx>, span: Span)
154154
.collect()
155155
}
156156

157-
fn build_drop_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
157+
fn build_drop_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
158158
def_id: DefId,
159159
ty: Option<Ty<'tcx>>)
160160
-> Mir<'tcx>
@@ -235,7 +235,7 @@ fn build_drop_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
235235
pub struct DropShimElaborator<'a, 'tcx: 'a> {
236236
pub mir: &'a Mir<'tcx>,
237237
pub patch: MirPatch<'tcx>,
238-
pub tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
238+
pub tcx: TyCtxt<'a, 'tcx, 'tcx>,
239239
pub param_env: ty::ParamEnv<'tcx>,
240240
}
241241

@@ -250,7 +250,7 @@ impl<'a, 'tcx> DropElaborator<'a, 'tcx> for DropShimElaborator<'a, 'tcx> {
250250

251251
fn patch(&mut self) -> &mut MirPatch<'tcx> { &mut self.patch }
252252
fn mir(&self) -> &'a Mir<'tcx> { self.mir }
253-
fn tcx(&self) -> ty::TyCtxt<'a, 'tcx, 'tcx> { self.tcx }
253+
fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> { self.tcx }
254254
fn param_env(&self) -> ty::ParamEnv<'tcx> { self.param_env }
255255

256256
fn drop_style(&self, _path: Self::Path, mode: DropFlagMode) -> DropStyle {
@@ -280,7 +280,7 @@ impl<'a, 'tcx> DropElaborator<'a, 'tcx> for DropShimElaborator<'a, 'tcx> {
280280
}
281281

282282
/// Build a `Clone::clone` shim for `self_ty`. Here, `def_id` is `Clone::clone`.
283-
fn build_clone_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
283+
fn build_clone_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
284284
def_id: DefId,
285285
self_ty: ty::Ty<'tcx>)
286286
-> Mir<'tcx>
@@ -306,7 +306,7 @@ fn build_clone_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
306306
}
307307

308308
struct CloneShimBuilder<'a, 'tcx: 'a> {
309-
tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
309+
tcx: TyCtxt<'a, 'tcx, 'tcx>,
310310
def_id: DefId,
311311
local_decls: IndexVec<Local, LocalDecl<'tcx>>,
312312
blocks: IndexVec<BasicBlock, BasicBlockData<'tcx>>,
@@ -315,7 +315,7 @@ struct CloneShimBuilder<'a, 'tcx: 'a> {
315315
}
316316

317317
impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> {
318-
fn new(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Self {
318+
fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Self {
319319
let sig = tcx.fn_sig(def_id);
320320
let sig = tcx.erase_late_bound_regions(&sig);
321321
let span = tcx.def_span(def_id);
@@ -666,7 +666,7 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> {
666666
///
667667
/// If `untuple_args` is a vec of types, the second argument of the
668668
/// function will be untupled as these types.
669-
fn build_call_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>,
669+
fn build_call_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
670670
def_id: DefId,
671671
rcvr_adjustment: Adjustment,
672672
call_kind: CallKind,

src/librustc_mir/transform/elaborate_drops.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ impl<'a, 'b, 'tcx> DropElaborator<'a, 'tcx> for Elaborator<'a, 'b, 'tcx> {
192192
self.ctxt.mir
193193
}
194194

195-
fn tcx(&self) -> ty::TyCtxt<'a, 'tcx, 'tcx> {
195+
fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> {
196196
self.ctxt.tcx
197197
}
198198

src/librustc_mir/util/elaborate_drops.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use rustc::hir;
1313
use rustc::mir::*;
1414
use rustc::middle::const_val::{ConstInt, ConstVal};
1515
use rustc::middle::lang_items;
16-
use rustc::ty::{self, Ty};
16+
use rustc::ty::{self, Ty, TyCtxt};
1717
use rustc::ty::subst::{Kind, Substs};
1818
use rustc::ty::util::IntTypeExt;
1919
use rustc_data_structures::indexed_vec::Idx;
@@ -84,7 +84,7 @@ pub trait DropElaborator<'a, 'tcx: 'a> : fmt::Debug {
8484

8585
fn patch(&mut self) -> &mut MirPatch<'tcx>;
8686
fn mir(&self) -> &'a Mir<'tcx>;
87-
fn tcx(&self) -> ty::TyCtxt<'a, 'tcx, 'tcx>;
87+
fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx>;
8888
fn param_env(&self) -> ty::ParamEnv<'tcx>;
8989

9090
fn drop_style(&self, path: Self::Path, mode: DropFlagMode) -> DropStyle;
@@ -133,7 +133,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D>
133133
lvalue.ty(self.elaborator.mir(), self.tcx()).to_ty(self.tcx())
134134
}
135135

136-
fn tcx(&self) -> ty::TyCtxt<'b, 'tcx, 'tcx> {
136+
fn tcx(&self) -> TyCtxt<'b, 'tcx, 'tcx> {
137137
self.elaborator.tcx()
138138
}
139139

src/librustc_typeck/check/upvar.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ use super::FnCtxt;
4545
use middle::expr_use_visitor as euv;
4646
use middle::mem_categorization as mc;
4747
use middle::mem_categorization::Categorization;
48-
use rustc::ty::{self, Ty};
48+
use rustc::ty::{self, Ty, TyCtxt};
4949
use rustc::infer::UpvarRegion;
5050
use syntax::ast;
5151
use syntax_pos::Span;
@@ -586,7 +586,7 @@ impl<'a, 'gcx, 'tcx> euv::Delegate<'tcx> for InferBorrowKind<'a, 'gcx, 'tcx> {
586586
}
587587
}
588588

589-
fn var_name(tcx: ty::TyCtxt, var_hir_id: hir::HirId) -> ast::Name {
589+
fn var_name(tcx: TyCtxt, var_hir_id: hir::HirId) -> ast::Name {
590590
let var_node_id = tcx.hir.hir_to_node_id(var_hir_id);
591591
tcx.hir.name(var_node_id)
592592
}

src/librustc_typeck/constrained_type_params.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use rustc::ty::{self, Ty};
11+
use rustc::ty::{self, Ty, TyCtxt};
1212
use rustc::ty::fold::{TypeFoldable, TypeVisitor};
1313
use rustc::util::nodemap::FxHashSet;
1414

@@ -86,7 +86,7 @@ impl<'tcx> TypeVisitor<'tcx> for ParameterCollector {
8686
}
8787
}
8888

89-
pub fn identify_constrained_type_params<'tcx>(tcx: ty::TyCtxt,
89+
pub fn identify_constrained_type_params<'tcx>(tcx: TyCtxt,
9090
predicates: &[ty::Predicate<'tcx>],
9191
impl_trait_ref: Option<ty::TraitRef<'tcx>>,
9292
input_parameters: &mut FxHashSet<Parameter>)
@@ -136,7 +136,7 @@ pub fn identify_constrained_type_params<'tcx>(tcx: ty::TyCtxt,
136136
/// which is determined by 1, which requires `U`, that is determined
137137
/// by 0. I should probably pick a less tangled example, but I can't
138138
/// think of any.
139-
pub fn setup_constraining_predicates<'tcx>(tcx: ty::TyCtxt,
139+
pub fn setup_constraining_predicates<'tcx>(tcx: TyCtxt,
140140
predicates: &mut [ty::Predicate<'tcx>],
141141
impl_trait_ref: Option<ty::TraitRef<'tcx>>,
142142
input_parameters: &mut FxHashSet<Parameter>)

0 commit comments

Comments
 (0)