diff --git a/src/librustc/ich/impls_ty.rs b/src/librustc/ich/impls_ty.rs index a64d8c2967f63..7e40d634def20 100644 --- a/src/librustc/ich/impls_ty.rs +++ b/src/librustc/ich/impls_ty.rs @@ -797,12 +797,12 @@ impl_stable_hash_for!(enum ty::BoundRegion { }); impl<'a, 'gcx> HashStable> -for ty::TypeVariants<'gcx> +for ty::TyKind<'gcx> { fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) { - use ty::TypeVariants::*; + use ty::TyKind::*; mem::discriminant(self).hash_stable(hcx, hasher); match *self { @@ -905,7 +905,7 @@ for ty::TyVid _hasher: &mut StableHasher) { // TyVid values are confined to an inference context and hence // should not be hashed. - bug!("ty::TypeVariants::hash_stable() - can't hash a TyVid {:?}.", *self) + bug!("ty::TyKind::hash_stable() - can't hash a TyVid {:?}.", *self) } } @@ -917,7 +917,7 @@ for ty::IntVid _hasher: &mut StableHasher) { // IntVid values are confined to an inference context and hence // should not be hashed. - bug!("ty::TypeVariants::hash_stable() - can't hash an IntVid {:?}.", *self) + bug!("ty::TyKind::hash_stable() - can't hash an IntVid {:?}.", *self) } } @@ -929,7 +929,7 @@ for ty::FloatVid _hasher: &mut StableHasher) { // FloatVid values are confined to an inference context and hence // should not be hashed. - bug!("ty::TypeVariants::hash_stable() - can't hash a FloatVid {:?}.", *self) + bug!("ty::TyKind::hash_stable() - can't hash a FloatVid {:?}.", *self) } } diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs index d458d62e738c3..b9b48505efbea 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, subst::Subst, Region, Ty, TyCtxt, TypeFoldable, TypeVariants}; +use ty::{self, subst::Subst, Region, Ty, TyCtxt, TypeFoldable, TyKind}; use ty::error::TypeError; use syntax::ast::DUMMY_NODE_ID; use syntax_pos::{Pos, Span}; @@ -979,14 +979,14 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { (_, false, _) => { if let Some(exp_found) = exp_found { let (def_id, ret_ty) = match exp_found.found.sty { - TypeVariants::TyFnDef(def, _) => { + TyKind::TyFnDef(def, _) => { (Some(def), Some(self.tcx.fn_sig(def).output())) } _ => (None, None), }; let exp_is_struct = match exp_found.expected.sty { - TypeVariants::TyAdt(def, _) => def.is_struct(), + TyKind::TyAdt(def, _) => def.is_struct(), _ => false, }; diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs index 8c4c54ec954d0..a85170c1edf67 100644 --- a/src/librustc/middle/dead.rs +++ b/src/librustc/middle/dead.rs @@ -236,7 +236,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> { self.handle_field_access(&lhs, expr.id); } hir::ExprKind::Struct(_, ref fields, _) => { - if let ty::TypeVariants::TyAdt(ref adt, _) = self.tables.expr_ty(expr).sty { + if let ty::TyKind::TyAdt(ref adt, _) = self.tables.expr_ty(expr).sty { self.mark_as_used_if_union(adt, fields); } } diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index e958ca9b9bb02..dc491db9eeca6 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -2221,7 +2221,7 @@ impl<'tcx> Debug for Constant<'tcx> { /// Write a `ConstValue` in a way closer to the original source code than the `Debug` output. pub fn fmt_const_val(f: &mut impl Write, const_val: &ty::Const) -> fmt::Result { - use ty::TypeVariants::*; + use ty::TyKind::*; let value = const_val.val; let ty = const_val.ty; // print some primitives diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index fb09551704018..961a66b229f56 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -802,7 +802,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { let expected = match expected_trait_ref.skip_binder().substs.type_at(1).sty { ty::TyTuple(ref tys) => tys.iter() .map(|t| match t.sty { - ty::TypeVariants::TyTuple(ref tys) => ArgKind::Tuple( + ty::TyKind::TyTuple(ref tys) => ArgKind::Tuple( Some(span), tys.iter() .map(|ty| ("_".to_owned(), ty.sty.to_string())) @@ -899,7 +899,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { let mut trait_type = trait_ref.self_ty(); for refs_remaining in 0..refs_number { - if let ty::TypeVariants::TyRef(_, t_type, _) = trait_type.sty { + if let ty::TyKind::TyRef(_, t_type, _) = trait_type.sty { trait_type = t_type; let substs = self.tcx.mk_substs_trait(trait_type, &[]); diff --git a/src/librustc/ty/codec.rs b/src/librustc/ty/codec.rs index c343ded765786..cc3e8a458a01f 100644 --- a/src/librustc/ty/codec.rs +++ b/src/librustc/ty/codec.rs @@ -37,7 +37,7 @@ pub trait EncodableWithShorthand: Clone + Eq + Hash { } impl<'tcx> EncodableWithShorthand for Ty<'tcx> { - type Variant = ty::TypeVariants<'tcx>; + type Variant = ty::TyKind<'tcx>; fn variant(&self) -> &Self::Variant { &self.sty } @@ -164,7 +164,7 @@ pub fn decode_ty<'a, 'tcx, D>(decoder: &mut D) -> Result, D::Error> }) } else { let tcx = decoder.tcx(); - Ok(tcx.mk_ty(ty::TypeVariants::decode(decoder)?)) + Ok(tcx.mk_ty(ty::TyKind::decode(decoder)?)) } } diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index ba274236eb903..099c05a61ef19 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -38,12 +38,12 @@ use ty::ReprOptions; use traits; use traits::{Clause, Clauses, Goal, Goals}; use ty::{self, Ty, TypeAndMut}; -use ty::{TyS, TypeVariants, List}; +use ty::{TyS, TyKind, List}; use ty::{AdtKind, AdtDef, ClosureSubsts, GeneratorSubsts, Region, Const}; use ty::{PolyFnSig, InferTy, ParamTy, ProjectionTy, ExistentialPredicate, Predicate}; use ty::RegionKind; use ty::{TyVar, TyVid, IntVar, IntVid, FloatVar, FloatVid}; -use ty::TypeVariants::*; +use ty::TyKind::*; use ty::GenericParamDefKind; use ty::layout::{LayoutDetails, TargetDataLayout}; use ty::query; @@ -167,7 +167,7 @@ impl<'gcx: 'tcx, 'tcx> CtxtInterners<'tcx> { fn intern_ty( local: &CtxtInterners<'tcx>, global: &CtxtInterners<'gcx>, - st: TypeVariants<'tcx> + st: TyKind<'tcx> ) -> Ty<'tcx> { let flags = super::flags::FlagComputation::for_sty(&st); @@ -803,7 +803,7 @@ impl<'tcx> CommonTypes<'tcx> { fn new(interners: &CtxtInterners<'tcx>) -> CommonTypes<'tcx> { // Ensure our type representation does not grow #[cfg(target_pointer_width = "64")] - assert!(mem::size_of::() <= 24); + assert!(mem::size_of::() <= 24); #[cfg(target_pointer_width = "64")] assert!(mem::size_of::() <= 32); @@ -1540,7 +1540,7 @@ impl<'gcx: 'tcx, 'tcx> GlobalCtxt<'gcx> { /// None is returned if the value or one of the components is not part /// of the provided context. /// For Ty, None can be returned if either the type interner doesn't -/// contain the TypeVariants key or if the address of the interned +/// contain the TyKind key or if the address of the interned /// pointer differs. The latter case is possible if a primitive type, /// e.g. `()` or `u8`, was interned in a different context. pub trait Lift<'tcx>: fmt::Debug { @@ -2107,8 +2107,8 @@ impl<'tcx> Hash for Interned<'tcx, TyS<'tcx>> { } } -impl<'tcx: 'lcx, 'lcx> Borrow> for Interned<'tcx, TyS<'tcx>> { - fn borrow<'a>(&'a self) -> &'a TypeVariants<'lcx> { +impl<'tcx: 'lcx, 'lcx> Borrow> for Interned<'tcx, TyS<'tcx>> { + fn borrow<'a>(&'a self) -> &'a TyKind<'lcx> { &self.0.sty } } @@ -2340,7 +2340,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { self.mk_fn_ptr(converted_sig) } - pub fn mk_ty(&self, st: TypeVariants<'tcx>) -> Ty<'tcx> { + pub fn mk_ty(&self, st: TyKind<'tcx>) -> Ty<'tcx> { CtxtInterners::intern_ty(&self.interners, &self.global_interners, st) } diff --git a/src/librustc/ty/flags.rs b/src/librustc/ty/flags.rs index 3718c436b3a00..7dbd509f4f2ad 100644 --- a/src/librustc/ty/flags.rs +++ b/src/librustc/ty/flags.rs @@ -28,7 +28,7 @@ impl FlagComputation { } } - pub fn for_sty(st: &ty::TypeVariants) -> FlagComputation { + pub fn for_sty(st: &ty::TyKind) -> FlagComputation { let mut result = FlagComputation::new(); result.add_sty(st); result @@ -67,7 +67,7 @@ impl FlagComputation { } } - fn add_sty(&mut self, st: &ty::TypeVariants) { + fn add_sty(&mut self, st: &ty::TyKind) { match st { &ty::TyBool | &ty::TyChar | diff --git a/src/librustc/ty/inhabitedness/mod.rs b/src/librustc/ty/inhabitedness/mod.rs index 0ace44dca77b4..f8b0b1cc88713 100644 --- a/src/librustc/ty/inhabitedness/mod.rs +++ b/src/librustc/ty/inhabitedness/mod.rs @@ -13,7 +13,7 @@ use ty::context::TyCtxt; use ty::{AdtDef, VariantDef, FieldDef, Ty, TyS}; use ty::{DefId, Substs}; use ty::{AdtKind, Visibility}; -use ty::TypeVariants::*; +use ty::TyKind::*; pub use self::def_id_forest::DefIdForest; diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 46fbedb5a2641..74c09c25f4e21 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -65,7 +65,7 @@ pub use self::sty::{Binder, CanonicalVar, DebruijnIndex, INNERMOST}; pub use self::sty::{FnSig, GenSig, PolyFnSig, PolyGenSig}; pub use self::sty::{InferTy, ParamTy, ProjectionTy, ExistentialPredicate}; pub use self::sty::{ClosureSubsts, GeneratorSubsts, UpvarSubsts, TypeAndMut}; -pub use self::sty::{TraitRef, TypeVariants, PolyTraitRef}; +pub use self::sty::{TraitRef, TyKind, PolyTraitRef}; pub use self::sty::{ExistentialTraitRef, PolyExistentialTraitRef}; pub use self::sty::{ExistentialProjection, PolyExistentialProjection, Const}; pub use self::sty::{BoundRegion, EarlyBoundRegion, FreeRegion, Region}; @@ -74,7 +74,7 @@ pub use self::sty::{TyVid, IntVid, FloatVid, RegionVid}; pub use self::sty::BoundRegion::*; pub use self::sty::InferTy::*; pub use self::sty::RegionKind::*; -pub use self::sty::TypeVariants::*; +pub use self::sty::TyKind::*; pub use self::binding::BindingMode; pub use self::binding::BindingMode::*; @@ -490,7 +490,7 @@ bitflags! { } pub struct TyS<'tcx> { - pub sty: TypeVariants<'tcx>, + pub sty: TyKind<'tcx>, pub flags: TypeFlags, /// This is a kind of confusing thing: it stores the smallest @@ -542,29 +542,29 @@ impl<'tcx> Hash for TyS<'tcx> { impl<'tcx> TyS<'tcx> { pub fn is_primitive_ty(&self) -> bool { match self.sty { - TypeVariants::TyBool | - TypeVariants::TyChar | - TypeVariants::TyInt(_) | - TypeVariants::TyUint(_) | - TypeVariants::TyFloat(_) | - TypeVariants::TyInfer(InferTy::IntVar(_)) | - TypeVariants::TyInfer(InferTy::FloatVar(_)) | - TypeVariants::TyInfer(InferTy::FreshIntTy(_)) | - TypeVariants::TyInfer(InferTy::FreshFloatTy(_)) => true, - TypeVariants::TyRef(_, x, _) => x.is_primitive_ty(), + TyKind::TyBool | + TyKind::TyChar | + TyKind::TyInt(_) | + TyKind::TyUint(_) | + TyKind::TyFloat(_) | + TyKind::TyInfer(InferTy::IntVar(_)) | + TyKind::TyInfer(InferTy::FloatVar(_)) | + TyKind::TyInfer(InferTy::FreshIntTy(_)) | + TyKind::TyInfer(InferTy::FreshFloatTy(_)) => true, + TyKind::TyRef(_, x, _) => x.is_primitive_ty(), _ => false, } } pub fn is_suggestable(&self) -> bool { match self.sty { - TypeVariants::TyAnon(..) | - TypeVariants::TyFnDef(..) | - TypeVariants::TyFnPtr(..) | - TypeVariants::TyDynamic(..) | - TypeVariants::TyClosure(..) | - TypeVariants::TyInfer(..) | - TypeVariants::TyProjection(..) => false, + TyKind::TyAnon(..) | + TyKind::TyFnDef(..) | + TyKind::TyFnPtr(..) | + TyKind::TyDynamic(..) | + TyKind::TyClosure(..) | + TyKind::TyInfer(..) | + TyKind::TyProjection(..) => false, _ => true, } } diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index c0c435ae80a06..144abf2d7bd59 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -//! This module contains TypeVariants and its major components +//! This module contains TyKind and its major components use hir::def_id::DefId; @@ -33,7 +33,7 @@ use serialize; use hir; use self::InferTy::*; -use self::TypeVariants::*; +use self::TyKind::*; #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)] pub struct TypeAndMut<'tcx> { @@ -82,7 +82,7 @@ impl BoundRegion { /// NB: If you change this, you'll probably want to change the corresponding /// AST structure in libsyntax/ast.rs as well. #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)] -pub enum TypeVariants<'tcx> { +pub enum TyKind<'tcx> { /// The primitive boolean type. Written as `bool`. TyBool, diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs index 95caa0c185be1..ea0b00483620b 100644 --- a/src/librustc/ty/util.rs +++ b/src/librustc/ty/util.rs @@ -19,7 +19,7 @@ use traits::{self, ObligationCause}; use ty::{self, Ty, TyCtxt, GenericParamDefKind, TypeFoldable}; use ty::subst::{Substs, UnpackedKind}; use ty::query::TyCtxtAt; -use ty::TypeVariants::*; +use ty::TyKind::*; use ty::layout::{Integer, IntegerExt}; use util::common::ErrorReported; use middle::lang_items; @@ -503,7 +503,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { !impl_generics.region_param(ebr, self).pure_wrt_drop } UnpackedKind::Type(&ty::TyS { - sty: ty::TypeVariants::TyParam(ref pt), .. + sty: ty::TyKind::TyParam(ref pt), .. }) => { !impl_generics.type_param(pt, self).pure_wrt_drop } diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 964a65065bc2c..9be3dd731cd83 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -1029,7 +1029,7 @@ define_print! { } define_print! { - ('tcx) ty::TypeVariants<'tcx>, (self, f, cx) { + ('tcx) ty::TyKind<'tcx>, (self, f, cx) { display { match *self { TyBool => write!(f, "bool"), diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs index 7208e1ca36299..869ac44a856a8 100644 --- a/src/librustc_borrowck/borrowck/mod.rs +++ b/src/librustc_borrowck/borrowck/mod.rs @@ -697,7 +697,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> { Some(nl.to_string()), Origin::Ast); let need_note = match lp.ty.sty { - ty::TypeVariants::TyClosure(id, _) => { + ty::TyKind::TyClosure(id, _) => { let node_id = self.tcx.hir.as_local_node_id(id).unwrap(); let hir_id = self.tcx.hir.node_to_hir_id(node_id); if let Some((span, name)) = self.tables.closure_kind_origins().get(hir_id) { diff --git a/src/librustc_codegen_llvm/intrinsic.rs b/src/librustc_codegen_llvm/intrinsic.rs index be3e0d9d4b1ed..2fbae59a51589 100644 --- a/src/librustc_codegen_llvm/intrinsic.rs +++ b/src/librustc_codegen_llvm/intrinsic.rs @@ -1801,7 +1801,7 @@ fn int_type_width_signed(ty: Ty, cx: &CodegenCx) -> Option<(u64, bool)> { // Returns the width of a float TypeVariant // Returns None if the type is not a float -fn float_type_width<'tcx>(sty: &ty::TypeVariants<'tcx>) -> Option { +fn float_type_width<'tcx>(sty: &ty::TyKind<'tcx>) -> Option { match *sty { ty::TyFloat(t) => Some(t.bit_width() as u64), _ => None, diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 681e919580567..b501afbc1bd30 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -1332,7 +1332,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MutableTransmutes { fn get_transmute_from_to<'a, 'tcx> (cx: &LateContext<'a, 'tcx>, expr: &hir::Expr) - -> Option<(&'tcx ty::TypeVariants<'tcx>, &'tcx ty::TypeVariants<'tcx>)> { + -> Option<(&'tcx ty::TyKind<'tcx>, &'tcx ty::TyKind<'tcx>)> { let def = if let hir::ExprKind::Path(ref qpath) = expr.node { cx.tables.qpath_def(qpath, expr.hir_id) } else { diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index a37b2eb5fd449..f56bbc9764f64 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -321,7 +321,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits { // // No suggestion for: `isize`, `usize`. fn get_type_suggestion<'a>( - t: &ty::TypeVariants, + t: &ty::TyKind, val: u128, negative: bool, ) -> Option { @@ -367,7 +367,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits { fn report_bin_hex_error( cx: &LateContext, expr: &hir::Expr, - ty: ty::TypeVariants, + ty: ty::TyKind, repr_str: String, val: u128, negative: bool, diff --git a/src/librustc_mir/borrow_check/error_reporting.rs b/src/librustc_mir/borrow_check/error_reporting.rs index 2ae06375af13c..15226a944afa1 100644 --- a/src/librustc_mir/borrow_check/error_reporting.rs +++ b/src/librustc_mir/borrow_check/error_reporting.rs @@ -134,7 +134,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { if let Some(ty) = self.retrieve_type_for_place(place) { let needs_note = match ty.sty { - ty::TypeVariants::TyClosure(id, _) => { + ty::TyKind::TyClosure(id, _) => { let tables = self.tcx.typeck_tables_of(id); let node_id = self.tcx.hir.as_local_node_id(id).unwrap(); let hir_id = self.tcx.hir.node_to_hir_id(node_id); diff --git a/src/librustc_mir/borrow_check/nll/type_check/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/mod.rs index 2a78feed84915..4b8effbc2d62b 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs @@ -37,7 +37,7 @@ use rustc::mir::*; use rustc::traits::query::type_op; use rustc::traits::query::{Fallible, NoSolution}; use rustc::ty::fold::TypeFoldable; -use rustc::ty::{self, CanonicalTy, RegionVid, ToPolyTraitRef, Ty, TyCtxt, TypeVariants}; +use rustc::ty::{self, CanonicalTy, RegionVid, ToPolyTraitRef, Ty, TyCtxt, TyKind}; use rustc_errors::Diagnostic; use std::fmt; use std::rc::Rc; @@ -917,7 +917,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { } => { let place_type = place.ty(mir, tcx).to_ty(tcx); let adt = match place_type.sty { - TypeVariants::TyAdt(adt, _) if adt.is_enum() => adt, + TyKind::TyAdt(adt, _) if adt.is_enum() => adt, _ => { span_bug!( stmt.source_info.span, diff --git a/src/librustc_mir/interpret/cast.rs b/src/librustc_mir/interpret/cast.rs index b4d36afa0f80d..577d55f05d1f7 100644 --- a/src/librustc_mir/interpret/cast.rs +++ b/src/librustc_mir/interpret/cast.rs @@ -141,7 +141,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> { src_layout: TyLayout<'tcx>, dest_layout: TyLayout<'tcx>, ) -> EvalResult<'tcx, Scalar> { - use rustc::ty::TypeVariants::*; + use rustc::ty::TyKind::*; trace!("Casting {:?}: {:?} to {:?}", val, src_layout.ty, dest_layout.ty); match val { @@ -184,7 +184,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> { v }; trace!("cast_from_int: {}, {}, {}", v, src_layout.ty, dest_layout.ty); - use rustc::ty::TypeVariants::*; + use rustc::ty::TyKind::*; match dest_layout.ty.sty { TyInt(_) | TyUint(_) => { let v = self.truncate(v, dest_layout); @@ -230,7 +230,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> { } fn cast_from_float(&self, bits: u128, fty: FloatTy, dest_ty: Ty<'tcx>) -> EvalResult<'tcx, Scalar> { - use rustc::ty::TypeVariants::*; + use rustc::ty::TyKind::*; use rustc_apfloat::FloatConvert; match dest_ty.sty { // float -> uint @@ -290,7 +290,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> { } fn cast_from_ptr(&self, ptr: Pointer, ty: Ty<'tcx>) -> EvalResult<'tcx, Scalar> { - use rustc::ty::TypeVariants::*; + use rustc::ty::TyKind::*; match ty.sty { // Casting to a reference or fn pointer is not permitted by rustc, no need to support it here. TyRawPtr(_) | diff --git a/src/librustc_mir/transform/instcombine.rs b/src/librustc_mir/transform/instcombine.rs index 6e06beb30419d..eef5246476e36 100644 --- a/src/librustc_mir/transform/instcombine.rs +++ b/src/librustc_mir/transform/instcombine.rs @@ -12,7 +12,7 @@ use rustc::mir::{Constant, Location, Place, Mir, Operand, ProjectionElem, Rvalue, Local}; use rustc::mir::visit::{MutVisitor, Visitor}; -use rustc::ty::{TyCtxt, TypeVariants}; +use rustc::ty::{TyCtxt, TyKind}; use rustc::util::nodemap::{FxHashMap, FxHashSet}; use rustc_data_structures::indexed_vec::Idx; use std::mem; @@ -100,7 +100,7 @@ impl<'b, 'a, 'tcx> Visitor<'tcx> for OptimizationFinder<'b, 'a, 'tcx> { if let Rvalue::Len(ref place) = *rvalue { let place_ty = place.ty(&self.mir.local_decls, self.tcx).to_ty(self.tcx); - if let TypeVariants::TyArray(_, len) = place_ty.sty { + if let TyKind::TyArray(_, len) = place_ty.sty { let span = self.mir.source_info(location).span; let ty = self.tcx.types.usize; let constant = Constant { span, ty, literal: len }; diff --git a/src/librustc_mir/transform/lower_128bit.rs b/src/librustc_mir/transform/lower_128bit.rs index acad0a1fa2c4e..6eb8f1cefb02b 100644 --- a/src/librustc_mir/transform/lower_128bit.rs +++ b/src/librustc_mir/transform/lower_128bit.rs @@ -13,7 +13,7 @@ use rustc::hir::def_id::DefId; use rustc::middle::lang_items::LangItem; use rustc::mir::*; -use rustc::ty::{List, Ty, TyCtxt, TypeVariants}; +use rustc::ty::{List, Ty, TyCtxt, TyKind}; use rustc_data_structures::indexed_vec::{Idx}; use transform::{MirPass, MirSource}; use syntax; @@ -190,8 +190,8 @@ impl RhsKind { fn sign_of_128bit(ty: Ty) -> Option { match ty.sty { - TypeVariants::TyInt(syntax::ast::IntTy::I128) => Some(true), - TypeVariants::TyUint(syntax::ast::UintTy::U128) => Some(false), + TyKind::TyInt(syntax::ast::IntTy::I128) => Some(true), + TyKind::TyUint(syntax::ast::UintTy::U128) => Some(false), _ => None, } } diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 9624fc36e0ead..6088a80922e57 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -108,7 +108,7 @@ struct GenericArgMismatchErrorCode { /// Dummy type used for the `Self` of a `TraitRef` created for converting /// a trait object, and which gets removed in `ExistentialTraitRef`. /// This type must not appear anywhere in other converted types. -const TRAIT_OBJECT_DUMMY_SELF: ty::TypeVariants<'static> = ty::TyInfer(ty::FreshTy(0)); +const TRAIT_OBJECT_DUMMY_SELF: ty::TyKind<'static> = ty::TyInfer(ty::FreshTy(0)); impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o { pub fn ast_region_to_region(&self, diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs index c14a07b7cf5d0..c961bcd1e5913 100644 --- a/src/librustc_typeck/check/_match.rs +++ b/src/librustc_typeck/check/_match.rs @@ -53,7 +53,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { PatKind::Lit(ref lt) => { let ty = self.check_expr(lt); match ty.sty { - ty::TypeVariants::TyRef(..) => false, + ty::TyKind::TyRef(..) => false, _ => true, } } @@ -84,7 +84,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { expected = loop { debug!("inspecting {:?} with type {:?}", exp_ty, exp_ty.sty); match exp_ty.sty { - ty::TypeVariants::TyRef(_, inner_ty, inner_mutability) => { + ty::TyKind::TyRef(_, inner_ty, inner_mutability) => { debug!("current discriminant is TyRef, inserting implicit deref"); // Preserve the reference type. We'll need it later during HAIR lowering. pat_adjustments.push(exp_ty); diff --git a/src/librustc_typeck/check/cast.rs b/src/librustc_typeck/check/cast.rs index 29d2fe2c7b63e..3415ad2742a2c 100644 --- a/src/librustc_typeck/check/cast.rs +++ b/src/librustc_typeck/check/cast.rs @@ -477,12 +477,12 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> { (RPtr(p), Int(_)) | (RPtr(p), Float) => { match p.ty.sty { - ty::TypeVariants::TyInt(_) | - ty::TypeVariants::TyUint(_) | - ty::TypeVariants::TyFloat(_) => { + ty::TyKind::TyInt(_) | + ty::TyKind::TyUint(_) | + ty::TyKind::TyFloat(_) => { Err(CastError::NeedDeref) } - ty::TypeVariants::TyInfer(t) => { + ty::TyKind::TyInfer(t) => { match t { ty::InferTy::IntVar(_) | ty::InferTy::FloatVar(_) => Err(CastError::NeedDeref), diff --git a/src/librustc_typeck/check/op.rs b/src/librustc_typeck/check/op.rs index de211d2209c9a..b5e8fe2cd0b50 100644 --- a/src/librustc_typeck/check/op.rs +++ b/src/librustc_typeck/check/op.rs @@ -13,7 +13,7 @@ use super::{FnCtxt, Needs}; use super::method::MethodCallee; use rustc::ty::{self, Ty, TypeFoldable}; -use rustc::ty::TypeVariants::{TyRef, TyAdt, TyStr, TyUint, TyNever, TyTuple, TyChar, TyArray}; +use rustc::ty::TyKind::{TyRef, TyAdt, TyStr, TyUint, TyNever, TyTuple, TyChar, TyArray}; use rustc::ty::adjustment::{Adjustment, Adjust, AllowTwoPhase, AutoBorrow, AutoBorrowMutability}; use rustc::infer::type_variable::TypeVariableOrigin; use errors; diff --git a/src/librustdoc/clean/blanket_impl.rs b/src/librustdoc/clean/blanket_impl.rs index b95b3ca8e1138..7cc15d67b95dd 100644 --- a/src/librustdoc/clean/blanket_impl.rs +++ b/src/librustdoc/clean/blanket_impl.rs @@ -83,7 +83,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> BlanketImplFinder <'a, 'tcx, 'rcx, 'cstore> { .expect("Cannot get impl trait"); match trait_ref.self_ty().sty { - ty::TypeVariants::TyParam(_) => {}, + ty::TyParam(_) => {}, _ => return, }