diff --git a/src/librustc/ich/hcx.rs b/src/librustc/ich/hcx.rs index 81cf20cfc77..5c011042dee 100644 --- a/src/librustc/ich/hcx.rs +++ b/src/librustc/ich/hcx.rs @@ -13,7 +13,7 @@ use hir::def_id::DefId; use hir::map::DefPathHash; use ich::{self, CachingCodemapView}; use session::config::DebugInfoLevel::NoDebugInfo; -use ty; +use ty::TyCtxt; use util::nodemap::{NodeMap, ItemLocalMap}; use std::hash as std_hash; @@ -34,7 +34,7 @@ use rustc_data_structures::accumulate_vec::AccumulateVec; /// a reference to the TyCtxt) and it holds a few caches for speeding up various /// things (e.g. each DefId/DefPath is only hashed once). pub struct StableHashingContext<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { - tcx: ty::TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'a, 'gcx, 'tcx>, codemap: CachingCodemapView<'gcx>, hash_spans: bool, hash_bodies: bool, @@ -53,7 +53,7 @@ pub enum NodeIdHashingMode { impl<'a, 'gcx, 'tcx> StableHashingContext<'a, 'gcx, 'tcx> { - pub fn new(tcx: ty::TyCtxt<'a, 'gcx, 'tcx>) -> Self { + pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Self { let hash_spans_initial = tcx.sess.opts.debuginfo != NoDebugInfo; let check_overflow_initial = tcx.sess.overflow_checks(); @@ -111,7 +111,7 @@ impl<'a, 'gcx, 'tcx> StableHashingContext<'a, 'gcx, 'tcx> { } #[inline] - pub fn tcx(&self) -> ty::TyCtxt<'a, 'gcx, 'tcx> { + pub fn tcx(&self) -> TyCtxt<'a, 'gcx, 'tcx> { self.tcx } diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs index 6fc76a1d090..a88e90caee3 100644 --- a/src/librustc/infer/error_reporting/mod.rs +++ b/src/librustc/infer/error_reporting/mod.rs @@ -66,7 +66,7 @@ use hir::map as hir_map; use hir::def_id::DefId; use middle::region; use traits::{ObligationCause, ObligationCauseCode}; -use ty::{self, Region, TyCtxt, TypeFoldable}; +use ty::{self, Region, Ty, TyCtxt, TypeFoldable}; use ty::error::TypeError; use syntax::ast::DUMMY_NODE_ID; use syntax_pos::{Pos, Span}; @@ -418,7 +418,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { name: String, sub: &ty::subst::Substs<'tcx>, pos: usize, - other_ty: &ty::Ty<'tcx>) { + other_ty: &Ty<'tcx>) { // `value` and `other_value` hold two incomplete type representation for display. // `name` is the path of both types being compared. `sub` value.push_highlighted(name); @@ -491,7 +491,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { path: String, sub: &ty::subst::Substs<'tcx>, other_path: String, - other_ty: &ty::Ty<'tcx>) -> Option<()> { + other_ty: &Ty<'tcx>) -> Option<()> { for (i, ta) in sub.types().enumerate() { if &ta == other_ty { self.highlight_outer(&mut t1_out, &mut t2_out, path, sub, i, &other_ty); @@ -522,7 +522,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { /// Compare two given types, eliding parts that are the same between them and highlighting /// relevant differences, and return two representation of those types for highlighted printing. - fn cmp(&self, t1: ty::Ty<'tcx>, t2: ty::Ty<'tcx>) + fn cmp(&self, t1: Ty<'tcx>, t2: Ty<'tcx>) -> (DiagnosticStyledString, DiagnosticStyledString) { match (&t1.sty, &t2.sty) { @@ -743,7 +743,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } fn expected_found_str_ty(&self, - exp_found: &ty::error::ExpectedFound>) + exp_found: &ty::error::ExpectedFound>) -> Option<(DiagnosticStyledString, DiagnosticStyledString)> { let exp_found = self.resolve_type_vars_if_possible(exp_found); if exp_found.references_error() { diff --git a/src/librustc/infer/error_reporting/util.rs b/src/librustc/infer/error_reporting/util.rs index b58fa6b0e7c..94faec464b2 100644 --- a/src/librustc/infer/error_reporting/util.rs +++ b/src/librustc/infer/error_reporting/util.rs @@ -12,7 +12,7 @@ //! anonymous regions. use hir; use infer::InferCtxt; -use ty::{self, Region}; +use ty::{self, Region, Ty}; use hir::def_id::DefId; use hir::map as hir_map; @@ -35,7 +35,7 @@ pub struct AnonymousArgInfo<'tcx> { // the argument corresponding to the anonymous region pub arg: &'tcx hir::Arg, // the type corresponding to the anonymopus region argument - pub arg_ty: ty::Ty<'tcx>, + pub arg_ty: Ty<'tcx>, // the ty::BoundRegion corresponding to the anonymous region pub bound_region: ty::BoundRegion, // corresponds to id the argument is the first parameter diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs index 6ccf7e42fd5..39bcd703574 100644 --- a/src/librustc/infer/mod.rs +++ b/src/librustc/infer/mod.rs @@ -644,7 +644,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } } - pub fn unsolved_variables(&self) -> Vec> { + pub fn unsolved_variables(&self) -> Vec> { let mut variables = Vec::new(); let unbound_ty_vars = self.type_variables diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index da9f9128cf4..7a6f4fdbb03 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -315,7 +315,7 @@ language_item_table! { DebugTraitLangItem, "debug_trait", debug_trait; } -impl<'a, 'tcx, 'gcx> ty::TyCtxt<'a, 'tcx, 'gcx> { +impl<'a, 'tcx, 'gcx> TyCtxt<'a, 'tcx, 'gcx> { pub fn require_lang_item(&self, lang_item: LangItem) -> DefId { self.lang_items().require(lang_item).unwrap_or_else(|msg| { self.sess.fatal(&msg) diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 38dfe010c15..d43504b77ba 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -21,7 +21,7 @@ use rustc_data_structures::control_flow_graph::ControlFlowGraph; use hir::def::CtorKind; use hir::def_id::DefId; use ty::subst::{Subst, Substs}; -use ty::{self, AdtDef, ClosureSubsts, Region, Ty, GeneratorInterior}; +use ty::{self, AdtDef, ClosureSubsts, Region, Ty, TyCtxt, GeneratorInterior}; use ty::fold::{TypeFoldable, TypeFolder, TypeVisitor}; use util::ppaux; use rustc_back::slice; @@ -644,7 +644,7 @@ impl<'tcx> Terminator<'tcx> { } impl<'tcx> TerminatorKind<'tcx> { - pub fn if_<'a, 'gcx>(tcx: ty::TyCtxt<'a, 'gcx, 'tcx>, cond: Operand<'tcx>, + pub fn if_<'a, 'gcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, cond: Operand<'tcx>, t: BasicBlock, f: BasicBlock) -> TerminatorKind<'tcx> { static BOOL_SWITCH_FALSE: &'static [ConstInt] = &[ConstInt::U8(0)]; TerminatorKind::SwitchInt { @@ -1182,7 +1182,7 @@ impl<'tcx> Debug for Operand<'tcx> { impl<'tcx> Operand<'tcx> { pub fn function_handle<'a>( - tcx: ty::TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, substs: &'tcx Substs<'tcx>, span: Span, diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs index fb71d9cc49b..a1817f18106 100644 --- a/src/librustc/traits/mod.rs +++ b/src/librustc/traits/mod.rs @@ -381,7 +381,7 @@ pub struct VtableObjectData<'tcx, N> { #[derive(Clone, PartialEq, Eq)] pub struct VtableFnPointerData<'tcx, N> { - pub fn_ty: ty::Ty<'tcx>, + pub fn_ty: Ty<'tcx>, pub nested: Vec } diff --git a/src/librustc/ty/instance.rs b/src/librustc/ty/instance.rs index 7d543f689c2..d9c6843fad7 100644 --- a/src/librustc/ty/instance.rs +++ b/src/librustc/ty/instance.rs @@ -9,7 +9,7 @@ // except according to those terms. use hir::def_id::DefId; -use ty::{self, Ty, TypeFoldable, Substs}; +use ty::{self, Ty, TypeFoldable, Substs, TyCtxt}; use util::ppaux; use std::fmt; @@ -57,12 +57,12 @@ impl<'tcx> InstanceDef<'tcx> { } #[inline] - pub fn def_ty<'a>(&self, tcx: ty::TyCtxt<'a, 'tcx, 'tcx>) -> Ty<'tcx> { + pub fn def_ty<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Ty<'tcx> { tcx.type_of(self.def_id()) } #[inline] - pub fn attrs<'a>(&self, tcx: ty::TyCtxt<'a, 'tcx, 'tcx>) -> ty::Attributes<'tcx> { + pub fn attrs<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> ty::Attributes<'tcx> { tcx.get_attrs(self.def_id()) } } @@ -103,7 +103,7 @@ impl<'a, 'b, 'tcx> Instance<'tcx> { Instance { def: InstanceDef::Item(def_id), substs: substs } } - pub fn mono(tcx: ty::TyCtxt<'a, 'tcx, 'b>, def_id: DefId) -> Instance<'tcx> { + pub fn mono(tcx: TyCtxt<'a, 'tcx, 'b>, def_id: DefId) -> Instance<'tcx> { Instance::new(def_id, tcx.global_tcx().empty_substs_for_def_id(def_id)) } diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs index 0106d98b641..84d7745a64f 100644 --- a/src/librustc/ty/layout.rs +++ b/src/librustc/ty/layout.rs @@ -386,7 +386,7 @@ impl Integer { } } - pub fn to_ty<'a, 'tcx>(&self, tcx: &ty::TyCtxt<'a, 'tcx, 'tcx>, + pub fn to_ty<'a, 'tcx>(&self, tcx: &TyCtxt<'a, 'tcx, 'tcx>, signed: bool) -> Ty<'tcx> { match (*self, signed) { (I1, false) => tcx.types.u8, diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs index 6527ac0e927..6fb49a0908f 100644 --- a/src/librustc_borrowck/borrowck/mod.rs +++ b/src/librustc_borrowck/borrowck/mod.rs @@ -34,7 +34,7 @@ use rustc::middle::mem_categorization::Categorization; use rustc::middle::mem_categorization::ImmutabilityBlame; use rustc::middle::region; use rustc::middle::free_region::RegionRelations; -use rustc::ty::{self, TyCtxt}; +use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::maps::Providers; use rustc_mir::util::borrowck_errors::{BorrowckErrors, Origin}; @@ -275,7 +275,7 @@ impl<'tcx> Loan<'tcx> { #[derive(Eq)] pub struct LoanPath<'tcx> { kind: LoanPathKind<'tcx>, - ty: ty::Ty<'tcx>, + ty: Ty<'tcx>, } impl<'tcx> PartialEq for LoanPath<'tcx> { @@ -299,11 +299,11 @@ pub enum LoanPathKind<'tcx> { } impl<'tcx> LoanPath<'tcx> { - fn new(kind: LoanPathKind<'tcx>, ty: ty::Ty<'tcx>) -> LoanPath<'tcx> { + fn new(kind: LoanPathKind<'tcx>, ty: Ty<'tcx>) -> LoanPath<'tcx> { LoanPath { kind: kind, ty: ty } } - fn to_type(&self) -> ty::Ty<'tcx> { self.ty } + fn to_type(&self) -> Ty<'tcx> { self.ty } } // FIXME (pnkfelix): See discussion here diff --git a/src/librustc_metadata/astencode.rs b/src/librustc_metadata/astencode.rs index b1b3e92347a..ade2612855e 100644 --- a/src/librustc_metadata/astencode.rs +++ b/src/librustc_metadata/astencode.rs @@ -14,7 +14,7 @@ use isolated_encoder::IsolatedEncoder; use schema::*; use rustc::hir; -use rustc::ty; +use rustc::ty::{self, TyCtxt}; #[derive(RustcEncodable, RustcDecodable)] pub struct Ast<'tcx> { @@ -59,7 +59,7 @@ impl<'a, 'b, 'tcx> IsolatedEncoder<'a, 'b, 'tcx> { } struct NestedBodyCollector<'a, 'tcx: 'a> { - tcx: ty::TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'a, 'tcx, 'tcx>, bodies_found: Vec<&'tcx hir::Body>, } diff --git a/src/librustc_mir/build/cfg.rs b/src/librustc_mir/build/cfg.rs index a6e31bcddd2..dfddbfe485d 100644 --- a/src/librustc_mir/build/cfg.rs +++ b/src/librustc_mir/build/cfg.rs @@ -16,7 +16,7 @@ use build::CFG; use rustc::middle::region; use rustc::mir::*; -use rustc::ty; +use rustc::ty::TyCtxt; impl<'tcx> CFG<'tcx> { pub fn block_data(&self, blk: BasicBlock) -> &BasicBlockData<'tcx> { @@ -46,7 +46,7 @@ impl<'tcx> CFG<'tcx> { } pub fn push_end_region<'a, 'gcx:'a+'tcx>(&mut self, - tcx: ty::TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'a, 'gcx, 'tcx>, block: BasicBlock, source_info: SourceInfo, region_scope: region::Scope) { diff --git a/src/librustc_mir/build/expr/as_rvalue.rs b/src/librustc_mir/build/expr/as_rvalue.rs index eeae4bce335..f0b6a4fcfd9 100644 --- a/src/librustc_mir/build/expr/as_rvalue.rs +++ b/src/librustc_mir/build/expr/as_rvalue.rs @@ -22,7 +22,7 @@ use hair::*; use rustc_const_math::{ConstInt, ConstIsize}; use rustc::middle::const_val::ConstVal; use rustc::middle::region; -use rustc::ty; +use rustc::ty::{self, Ty}; use rustc::mir::*; use syntax::ast; use syntax_pos::Span; @@ -291,7 +291,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { } pub fn build_binary_op(&mut self, mut block: BasicBlock, - op: BinOp, span: Span, ty: ty::Ty<'tcx>, + op: BinOp, span: Span, ty: Ty<'tcx>, lhs: Operand<'tcx>, rhs: Operand<'tcx>) -> BlockAnd> { let source_info = self.source_info(span); let bool_ty = self.hir.bool_ty(); @@ -378,7 +378,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { } // Helper to get a `-1` value of the appropriate type - fn neg_1_literal(&mut self, span: Span, ty: ty::Ty<'tcx>) -> Operand<'tcx> { + fn neg_1_literal(&mut self, span: Span, ty: Ty<'tcx>) -> Operand<'tcx> { let literal = match ty.sty { ty::TyInt(ity) => { let val = match ity { @@ -410,7 +410,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { } // Helper to get the minimum value of the appropriate type - fn minval_literal(&mut self, span: Span, ty: ty::Ty<'tcx>) -> Operand<'tcx> { + fn minval_literal(&mut self, span: Span, ty: Ty<'tcx>) -> Operand<'tcx> { let literal = match ty.sty { ty::TyInt(ity) => { let val = match ity { diff --git a/src/librustc_mir/hair/mod.rs b/src/librustc_mir/hair/mod.rs index 067bd458d97..3162242de66 100644 --- a/src/librustc_mir/hair/mod.rs +++ b/src/librustc_mir/hair/mod.rs @@ -19,7 +19,7 @@ use rustc::mir::{BinOp, BorrowKind, Field, Literal, UnOp}; use rustc::hir::def_id::DefId; use rustc::middle::region; use rustc::ty::subst::Substs; -use rustc::ty::{self, AdtDef, ClosureSubsts, Region, Ty, GeneratorInterior}; +use rustc::ty::{AdtDef, ClosureSubsts, Region, Ty, GeneratorInterior}; use rustc::hir; use syntax::ast; use syntax_pos::Span; @@ -117,7 +117,7 @@ pub enum ExprKind<'tcx> { value: ExprRef<'tcx>, }, Call { - ty: ty::Ty<'tcx>, + ty: Ty<'tcx>, fun: ExprRef<'tcx>, args: Vec>, }, diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index 00ee417e02b..3c9d95ca215 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -14,7 +14,7 @@ use rustc::infer; use rustc::middle::const_val::ConstVal; use rustc::mir::*; use rustc::mir::transform::MirSource; -use rustc::ty::{self, Ty}; +use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::subst::{Kind, Subst, Substs}; use rustc::ty::maps::Providers; use rustc_const_math::{ConstInt, ConstUsize}; @@ -36,7 +36,7 @@ pub fn provide(providers: &mut Providers) { providers.mir_shims = make_shim; } -fn make_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>, +fn make_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: ty::InstanceDef<'tcx>) -> &'tcx Mir<'tcx> { @@ -154,7 +154,7 @@ fn local_decls_for_sig<'tcx>(sig: &ty::FnSig<'tcx>, span: Span) .collect() } -fn build_drop_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>, +fn build_drop_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, ty: Option>) -> Mir<'tcx> @@ -235,7 +235,7 @@ fn build_drop_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>, pub struct DropShimElaborator<'a, 'tcx: 'a> { pub mir: &'a Mir<'tcx>, pub patch: MirPatch<'tcx>, - pub tcx: ty::TyCtxt<'a, 'tcx, 'tcx>, + pub tcx: TyCtxt<'a, 'tcx, 'tcx>, pub param_env: ty::ParamEnv<'tcx>, } @@ -250,7 +250,7 @@ impl<'a, 'tcx> DropElaborator<'a, 'tcx> for DropShimElaborator<'a, 'tcx> { fn patch(&mut self) -> &mut MirPatch<'tcx> { &mut self.patch } fn mir(&self) -> &'a Mir<'tcx> { self.mir } - fn tcx(&self) -> ty::TyCtxt<'a, 'tcx, 'tcx> { self.tcx } + fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> { self.tcx } fn param_env(&self) -> ty::ParamEnv<'tcx> { self.param_env } fn drop_style(&self, _path: Self::Path, mode: DropFlagMode) -> DropStyle { @@ -280,9 +280,9 @@ impl<'a, 'tcx> DropElaborator<'a, 'tcx> for DropShimElaborator<'a, 'tcx> { } /// Build a `Clone::clone` shim for `self_ty`. Here, `def_id` is `Clone::clone`. -fn build_clone_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>, +fn build_clone_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, - self_ty: ty::Ty<'tcx>) + self_ty: Ty<'tcx>) -> Mir<'tcx> { debug!("build_clone_shim(def_id={:?})", def_id); @@ -306,7 +306,7 @@ fn build_clone_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>, } struct CloneShimBuilder<'a, 'tcx: 'a> { - tcx: ty::TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, local_decls: IndexVec>, blocks: IndexVec>, @@ -315,7 +315,7 @@ struct CloneShimBuilder<'a, 'tcx: 'a> { } impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { - fn new(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Self { + fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Self { let sig = tcx.fn_sig(def_id); let sig = tcx.erase_late_bound_regions(&sig); let span = tcx.def_span(def_id); @@ -382,7 +382,7 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { self.block(vec![ret_statement], TerminatorKind::Return, false); } - fn make_lvalue(&mut self, mutability: Mutability, ty: ty::Ty<'tcx>) -> Lvalue<'tcx> { + fn make_lvalue(&mut self, mutability: Mutability, ty: Ty<'tcx>) -> Lvalue<'tcx> { let span = self.span; Lvalue::Local( self.local_decls.push(temp_decl(mutability, ty, span)) @@ -391,7 +391,7 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { fn make_clone_call( &mut self, - ty: ty::Ty<'tcx>, + ty: Ty<'tcx>, rcvr_field: Lvalue<'tcx>, next: BasicBlock, cleanup: BasicBlock @@ -487,7 +487,7 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { } } - fn array_shim(&mut self, ty: ty::Ty<'tcx>, len: u64) { + fn array_shim(&mut self, ty: Ty<'tcx>, len: u64) { let tcx = self.tcx; let span = self.span; let rcvr = Lvalue::Local(Local::new(1+0)).deref(); @@ -613,7 +613,7 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { self.block(vec![], TerminatorKind::Resume, true); } - fn tuple_shim(&mut self, tys: &ty::Slice>) { + fn tuple_shim(&mut self, tys: &ty::Slice>) { let rcvr = Lvalue::Local(Local::new(1+0)).deref(); let mut returns = Vec::new(); @@ -666,7 +666,7 @@ impl<'a, 'tcx> CloneShimBuilder<'a, 'tcx> { /// /// If `untuple_args` is a vec of types, the second argument of the /// function will be untupled as these types. -fn build_call_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>, +fn build_call_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, rcvr_adjustment: Adjustment, call_kind: CallKind, diff --git a/src/librustc_mir/transform/elaborate_drops.rs b/src/librustc_mir/transform/elaborate_drops.rs index 1077f3b0146..c833904adba 100644 --- a/src/librustc_mir/transform/elaborate_drops.rs +++ b/src/librustc_mir/transform/elaborate_drops.rs @@ -192,7 +192,7 @@ impl<'a, 'b, 'tcx> DropElaborator<'a, 'tcx> for Elaborator<'a, 'b, 'tcx> { self.ctxt.mir } - fn tcx(&self) -> ty::TyCtxt<'a, 'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx> { self.ctxt.tcx } diff --git a/src/librustc_mir/util/elaborate_drops.rs b/src/librustc_mir/util/elaborate_drops.rs index 4a11ac11680..3b9772079ad 100644 --- a/src/librustc_mir/util/elaborate_drops.rs +++ b/src/librustc_mir/util/elaborate_drops.rs @@ -13,7 +13,7 @@ use rustc::hir; use rustc::mir::*; use rustc::middle::const_val::{ConstInt, ConstVal}; use rustc::middle::lang_items; -use rustc::ty::{self, Ty}; +use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::subst::{Kind, Substs}; use rustc::ty::util::IntTypeExt; use rustc_data_structures::indexed_vec::Idx; @@ -84,7 +84,7 @@ pub trait DropElaborator<'a, 'tcx: 'a> : fmt::Debug { fn patch(&mut self) -> &mut MirPatch<'tcx>; fn mir(&self) -> &'a Mir<'tcx>; - fn tcx(&self) -> ty::TyCtxt<'a, 'tcx, 'tcx>; + fn tcx(&self) -> TyCtxt<'a, 'tcx, 'tcx>; fn param_env(&self) -> ty::ParamEnv<'tcx>; fn drop_style(&self, path: Self::Path, mode: DropFlagMode) -> DropStyle; @@ -133,7 +133,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> lvalue.ty(self.elaborator.mir(), self.tcx()).to_ty(self.tcx()) } - fn tcx(&self) -> ty::TyCtxt<'b, 'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'b, 'tcx, 'tcx> { self.elaborator.tcx() } diff --git a/src/librustc_trans/collector.rs b/src/librustc_trans/collector.rs index 3bf709ff7ba..f0d8c7e9bfb 100644 --- a/src/librustc_trans/collector.rs +++ b/src/librustc_trans/collector.rs @@ -197,7 +197,7 @@ use rustc::middle::const_val::ConstVal; use rustc::middle::lang_items::{ExchangeMallocFnLangItem}; use rustc::traits; use rustc::ty::subst::Substs; -use rustc::ty::{self, TypeFoldable, TyCtxt}; +use rustc::ty::{self, TypeFoldable, Ty, TyCtxt}; use rustc::ty::adjustment::CustomCoerceUnsized; use rustc::mir::{self, Location}; use rustc::mir::visit::Visitor as MirVisitor; @@ -648,7 +648,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> { } fn visit_drop_use<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>, - ty: ty::Ty<'tcx>, + ty: Ty<'tcx>, is_direct_call: bool, output: &mut Vec>) { @@ -657,7 +657,7 @@ fn visit_drop_use<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>, } fn visit_fn_use<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>, - ty: ty::Ty<'tcx>, + ty: Ty<'tcx>, is_direct_call: bool, output: &mut Vec>) { @@ -776,10 +776,10 @@ fn should_trans_locally<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: &Instan /// Finally, there is also the case of custom unsizing coercions, e.g. for /// smart pointers such as `Rc` and `Arc`. fn find_vtable_types_for_unsizing<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>, - source_ty: ty::Ty<'tcx>, - target_ty: ty::Ty<'tcx>) - -> (ty::Ty<'tcx>, ty::Ty<'tcx>) { - let ptr_vtable = |inner_source: ty::Ty<'tcx>, inner_target: ty::Ty<'tcx>| { + source_ty: Ty<'tcx>, + target_ty: Ty<'tcx>) + -> (Ty<'tcx>, Ty<'tcx>) { + let ptr_vtable = |inner_source: Ty<'tcx>, inner_target: Ty<'tcx>| { if !scx.type_is_sized(inner_source) { (inner_source, inner_target) } else { @@ -836,8 +836,8 @@ fn create_fn_trans_item<'a, 'tcx>(instance: Instance<'tcx>) -> TransItem<'tcx> { /// Creates a `TransItem` for each method that is referenced by the vtable for /// the given trait/impl pair. fn create_trans_items_for_vtable_methods<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>, - trait_ty: ty::Ty<'tcx>, - impl_ty: ty::Ty<'tcx>, + trait_ty: Ty<'tcx>, + impl_ty: Ty<'tcx>, output: &mut Vec>) { assert!(!trait_ty.needs_subst() && !trait_ty.has_escaping_regions() && !impl_ty.needs_subst() && !impl_ty.has_escaping_regions()); diff --git a/src/librustc_trans/context.rs b/src/librustc_trans/context.rs index 77bddc7731b..4211be362ef 100644 --- a/src/librustc_trans/context.rs +++ b/src/librustc_trans/context.rs @@ -104,7 +104,7 @@ pub struct LocalCrateContext<'a, 'tcx: 'a> { /// Cache instances of monomorphic and polymorphic items instances: RefCell, ValueRef>>, /// Cache generated vtables - vtables: RefCell, + vtables: RefCell, Option>), ValueRef>>, /// Cache of constant strings, const_cstr_cache: RefCell>, @@ -512,7 +512,7 @@ impl<'b, 'tcx> CrateContext<'b, 'tcx> { } pub fn vtables<'a>(&'a self) - -> &'a RefCell, + -> &'a RefCell, Option>), ValueRef>> { &self.local().vtables } diff --git a/src/librustc_trans/declare.rs b/src/librustc_trans/declare.rs index 8f9146283ef..3c8ff454997 100644 --- a/src/librustc_trans/declare.rs +++ b/src/librustc_trans/declare.rs @@ -22,7 +22,7 @@ use llvm::{self, ValueRef}; use llvm::AttributePlace::Function; -use rustc::ty; +use rustc::ty::Ty; use rustc::session::config::Sanitizer; use abi::{Abi, FnType}; use attributes; @@ -119,7 +119,7 @@ pub fn declare_cfn(ccx: &CrateContext, name: &str, fn_type: Type) -> ValueRef { /// If there’s a value with the same name already declared, the function will /// update the declaration and return existing ValueRef instead. pub fn declare_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, name: &str, - fn_type: ty::Ty<'tcx>) -> ValueRef { + fn_type: Ty<'tcx>) -> ValueRef { debug!("declare_rust_fn(name={:?}, fn_type={:?})", name, fn_type); let sig = common::ty_fn_sig(ccx, fn_type); let sig = ccx.tcx().erase_late_bound_regions_and_normalize(&sig); @@ -164,7 +164,7 @@ pub fn define_global(ccx: &CrateContext, name: &str, ty: Type) -> Option(ccx: &CrateContext<'a, 'tcx>, name: &str, - fn_type: ty::Ty<'tcx>) -> ValueRef { + fn_type: Ty<'tcx>) -> ValueRef { if get_defined_value(ccx, name).is_some() { ccx.sess().fatal(&format!("symbol `{}` already defined", name)) } else { @@ -179,7 +179,7 @@ pub fn define_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, /// can happen with #[no_mangle] or #[export_name], for example. pub fn define_internal_fn<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, name: &str, - fn_type: ty::Ty<'tcx>) -> ValueRef { + fn_type: Ty<'tcx>) -> ValueRef { let llfn = define_fn(ccx, name, fn_type); unsafe { llvm::LLVMRustSetLinkage(llfn, llvm::Linkage::InternalLinkage) }; llfn diff --git a/src/librustc_trans/meth.rs b/src/librustc_trans/meth.rs index 6eedd53974e..9abfbb3279c 100644 --- a/src/librustc_trans/meth.rs +++ b/src/librustc_trans/meth.rs @@ -18,7 +18,7 @@ use machine; use monomorphize; use type_::Type; use value::Value; -use rustc::ty; +use rustc::ty::{self, Ty}; #[derive(Copy, Clone, Debug)] pub struct VirtualIndex(usize); @@ -63,7 +63,7 @@ impl<'a, 'tcx> VirtualIndex { /// making an object `Foo` from a value of type `Foo`, then /// `trait_ref` would map `T:Trait`. pub fn get_vtable<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, - ty: ty::Ty<'tcx>, + ty: Ty<'tcx>, trait_ref: Option>) -> ValueRef { diff --git a/src/librustc_trans/mir/block.rs b/src/librustc_trans/mir/block.rs index 3e802c8be5b..1105da43618 100644 --- a/src/librustc_trans/mir/block.rs +++ b/src/librustc_trans/mir/block.rs @@ -11,7 +11,7 @@ use llvm::{self, ValueRef, BasicBlockRef}; use rustc::middle::lang_items; use rustc::middle::const_val::{ConstEvalErr, ConstInt, ErrKind}; -use rustc::ty::{self, TypeFoldable}; +use rustc::ty::{self, Ty, TypeFoldable}; use rustc::ty::layout::{self, LayoutTyper}; use rustc::mir; use abi::{Abi, FnType, ArgType}; @@ -119,7 +119,7 @@ impl<'a, 'tcx> MirContext<'a, 'tcx> { fn_ty: FnType<'tcx>, fn_ptr: ValueRef, llargs: &[ValueRef], - destination: Option<(ReturnDest, ty::Ty<'tcx>, mir::BasicBlock)>, + destination: Option<(ReturnDest, Ty<'tcx>, mir::BasicBlock)>, cleanup: Option | { if let Some(cleanup) = cleanup { diff --git a/src/librustc_typeck/check/dropck.rs b/src/librustc_typeck/check/dropck.rs index 9bee26a52c0..610d07efa35 100644 --- a/src/librustc_typeck/check/dropck.rs +++ b/src/librustc_typeck/check/dropck.rs @@ -268,7 +268,7 @@ fn ensure_drop_predicates_are_implied_by_item_defn<'a, 'tcx>( /// pub fn check_safety_of_destructor_if_necessary<'a, 'gcx, 'tcx>( rcx: &mut RegionCtxt<'a, 'gcx, 'tcx>, - ty: ty::Ty<'tcx>, + ty: Ty<'tcx>, span: Span, scope: region::Scope) -> Result<(), ErrorReported> diff --git a/src/librustc_typeck/check/intrinsic.rs b/src/librustc_typeck/check/intrinsic.rs index fa8d3b9bcc1..3861a358b23 100644 --- a/src/librustc_typeck/check/intrinsic.rs +++ b/src/librustc_typeck/check/intrinsic.rs @@ -423,8 +423,8 @@ fn match_intrinsic_type_to_type<'a, 'tcx>( tcx: TyCtxt<'a, 'tcx, 'tcx>, position: &str, span: Span, - structural_to_nominal: &mut FxHashMap<&'a intrinsics::Type, ty::Ty<'tcx>>, - expected: &'a intrinsics::Type, t: ty::Ty<'tcx>) + structural_to_nominal: &mut FxHashMap<&'a intrinsics::Type, Ty<'tcx>>, + expected: &'a intrinsics::Type, t: Ty<'tcx>) { use intrinsics::Type::*; diff --git a/src/librustc_typeck/check/method/mod.rs b/src/librustc_typeck/check/method/mod.rs index 31ceed5b965..0afc482cb79 100644 --- a/src/librustc_typeck/check/method/mod.rs +++ b/src/librustc_typeck/check/method/mod.rs @@ -15,7 +15,7 @@ use hir::def::Def; use hir::def_id::DefId; use rustc::ty::subst::Substs; use rustc::traits; -use rustc::ty::{self, ToPredicate, ToPolyTraitRef, TraitRef, TypeFoldable}; +use rustc::ty::{self, Ty, ToPredicate, ToPolyTraitRef, TraitRef, TypeFoldable}; use rustc::ty::subst::Subst; use rustc::infer::{self, InferOk}; @@ -102,7 +102,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { pub fn method_exists(&self, span: Span, method_name: ast::Name, - self_ty: ty::Ty<'tcx>, + self_ty: Ty<'tcx>, call_expr_id: ast::NodeId, allow_private: bool) -> bool { @@ -136,7 +136,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { /// * `supplied_method_types`: the explicit method type parameters, if any (`T1..Tn`) /// * `self_expr`: the self expression (`foo`) pub fn lookup_method(&self, - self_ty: ty::Ty<'tcx>, + self_ty: Ty<'tcx>, segment: &hir::PathSegment, span: Span, call_expr: &'gcx hir::Expr, @@ -206,7 +206,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { fn lookup_probe(&self, span: Span, method_name: ast::Name, - self_ty: ty::Ty<'tcx>, + self_ty: Ty<'tcx>, call_expr: &'gcx hir::Expr, scope: ProbeScope) -> probe::PickResult<'tcx> { @@ -229,8 +229,8 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { span: Span, m_name: ast::Name, trait_def_id: DefId, - self_ty: ty::Ty<'tcx>, - opt_input_types: Option<&[ty::Ty<'tcx>]>) + self_ty: Ty<'tcx>, + opt_input_types: Option<&[Ty<'tcx>]>) -> Option>> { debug!("lookup_in_trait_adjusted(self_ty={:?}, \ m_name={}, trait_def_id={:?})", @@ -347,7 +347,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { pub fn resolve_ufcs(&self, span: Span, method_name: ast::Name, - self_ty: ty::Ty<'tcx>, + self_ty: Ty<'tcx>, expr_id: ast::NodeId) -> Result> { let mode = probe::Mode::Path; diff --git a/src/librustc_typeck/check/upvar.rs b/src/librustc_typeck/check/upvar.rs index acdd58f4ecf..d179b390a29 100644 --- a/src/librustc_typeck/check/upvar.rs +++ b/src/librustc_typeck/check/upvar.rs @@ -45,7 +45,7 @@ use super::FnCtxt; use middle::expr_use_visitor as euv; use middle::mem_categorization as mc; use middle::mem_categorization::Categorization; -use rustc::ty::{self, Ty}; +use rustc::ty::{self, Ty, TyCtxt}; use rustc::infer::UpvarRegion; use syntax::ast; use syntax_pos::Span; @@ -586,7 +586,7 @@ impl<'a, 'gcx, 'tcx> euv::Delegate<'tcx> for InferBorrowKind<'a, 'gcx, 'tcx> { } } -fn var_name(tcx: ty::TyCtxt, var_hir_id: hir::HirId) -> ast::Name { +fn var_name(tcx: TyCtxt, var_hir_id: hir::HirId) -> ast::Name { let var_node_id = tcx.hir.hir_to_node_id(var_hir_id); tcx.hir.name(var_node_id) } diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 9c19aef5992..f17df8b22f3 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -449,7 +449,7 @@ impl<'a, 'gcx> CheckTypeWellFormedVisitor<'a, 'gcx> { fcx: &FnCtxt<'fcx, 'gcx, 'tcx>, method_sig: &hir::MethodSig, method: &ty::AssociatedItem, - self_ty: ty::Ty<'tcx>) + self_ty: Ty<'tcx>) { // check that the type of the method's receiver matches the // method's first parameter. diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 1735ec7cc69..b0f3ff3ef35 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -1580,7 +1580,7 @@ pub enum SizedByDefault { Yes, No, } /// a region) to ty's notion of ty param bounds, which can either be user-defined traits, or the /// built-in trait (formerly known as kind): Send. pub fn compute_bounds<'gcx: 'tcx, 'tcx>(astconv: &AstConv<'gcx, 'tcx>, - param_ty: ty::Ty<'tcx>, + param_ty: Ty<'tcx>, ast_bounds: &[hir::TyParamBound], sized_by_default: SizedByDefault, span: Span) @@ -1673,7 +1673,7 @@ fn compute_sig_of_foreign_fn_decl<'a, 'tcx>( // ABIs are handled at all correctly. if abi != abi::Abi::RustIntrinsic && abi != abi::Abi::PlatformIntrinsic && !tcx.sess.features.borrow().simd_ffi { - let check = |ast_ty: &hir::Ty, ty: ty::Ty| { + let check = |ast_ty: &hir::Ty, ty: Ty| { if ty.is_simd() { tcx.sess.struct_span_err(ast_ty.span, &format!("use of SIMD type `{}` in FFI is highly experimental and \ diff --git a/src/librustc_typeck/constrained_type_params.rs b/src/librustc_typeck/constrained_type_params.rs index 09c7487e635..5f55b9b06ef 100644 --- a/src/librustc_typeck/constrained_type_params.rs +++ b/src/librustc_typeck/constrained_type_params.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use rustc::ty::{self, Ty}; +use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::fold::{TypeFoldable, TypeVisitor}; use rustc::util::nodemap::FxHashSet; @@ -86,7 +86,7 @@ impl<'tcx> TypeVisitor<'tcx> for ParameterCollector { } } -pub fn identify_constrained_type_params<'tcx>(tcx: ty::TyCtxt, +pub fn identify_constrained_type_params<'tcx>(tcx: TyCtxt, predicates: &[ty::Predicate<'tcx>], impl_trait_ref: Option>, input_parameters: &mut FxHashSet) @@ -136,7 +136,7 @@ pub fn identify_constrained_type_params<'tcx>(tcx: ty::TyCtxt, /// which is determined by 1, which requires `U`, that is determined /// by 0. I should probably pick a less tangled example, but I can't /// think of any. -pub fn setup_constraining_predicates<'tcx>(tcx: ty::TyCtxt, +pub fn setup_constraining_predicates<'tcx>(tcx: TyCtxt, predicates: &mut [ty::Predicate<'tcx>], impl_trait_ref: Option>, input_parameters: &mut FxHashSet) diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index ce3bf896256..658b42da953 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -35,7 +35,7 @@ use rustc::hir::def::{Def, CtorKind}; use rustc::hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; use rustc::traits::Reveal; use rustc::ty::subst::Substs; -use rustc::ty::{self, AdtKind}; +use rustc::ty::{self, Ty, AdtKind}; use rustc::middle::stability; use rustc::util::nodemap::{FxHashMap, FxHashSet}; use rustc_typeck::hir_ty_to_ty; @@ -978,7 +978,7 @@ impl<'tcx> Clean for ty::OutlivesPredicate, ty: } } -impl<'tcx> Clean for ty::OutlivesPredicate, ty::Region<'tcx>> { +impl<'tcx> Clean for ty::OutlivesPredicate, ty::Region<'tcx>> { fn clean(&self, cx: &DocContext) -> WherePredicate { let ty::OutlivesPredicate(ref ty, ref lt) = *self; @@ -1895,7 +1895,7 @@ impl Clean for hir::Ty { } } -impl<'tcx> Clean for ty::Ty<'tcx> { +impl<'tcx> Clean for Ty<'tcx> { fn clean(&self, cx: &DocContext) -> Type { match self.sty { ty::TyNever => Never,