1
Fork 0

Rename ty::TyVariants to ty::TyKind

This commit is contained in:
varkor 2018-08-22 01:34:12 +01:00
parent 87c7e57020
commit d37cee3b0e
27 changed files with 77 additions and 77 deletions

View file

@ -797,12 +797,12 @@ impl_stable_hash_for!(enum ty::BoundRegion {
}); });
impl<'a, 'gcx> HashStable<StableHashingContext<'a>> impl<'a, 'gcx> HashStable<StableHashingContext<'a>>
for ty::TypeVariants<'gcx> for ty::TyKind<'gcx>
{ {
fn hash_stable<W: StableHasherResult>(&self, fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a>, hcx: &mut StableHashingContext<'a>,
hasher: &mut StableHasher<W>) { hasher: &mut StableHasher<W>) {
use ty::TypeVariants::*; use ty::TyKind::*;
mem::discriminant(self).hash_stable(hcx, hasher); mem::discriminant(self).hash_stable(hcx, hasher);
match *self { match *self {
@ -905,7 +905,7 @@ for ty::TyVid
_hasher: &mut StableHasher<W>) { _hasher: &mut StableHasher<W>) {
// TyVid values are confined to an inference context and hence // TyVid values are confined to an inference context and hence
// should not be hashed. // 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<W>) { _hasher: &mut StableHasher<W>) {
// IntVid values are confined to an inference context and hence // IntVid values are confined to an inference context and hence
// should not be hashed. // 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<W>) { _hasher: &mut StableHasher<W>) {
// FloatVid values are confined to an inference context and hence // FloatVid values are confined to an inference context and hence
// should not be hashed. // 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)
} }
} }

View file

@ -66,7 +66,7 @@ use hir::map as hir_map;
use hir::def_id::DefId; use hir::def_id::DefId;
use middle::region; use middle::region;
use traits::{ObligationCause, ObligationCauseCode}; 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 ty::error::TypeError;
use syntax::ast::DUMMY_NODE_ID; use syntax::ast::DUMMY_NODE_ID;
use syntax_pos::{Pos, Span}; use syntax_pos::{Pos, Span};
@ -979,14 +979,14 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
(_, false, _) => { (_, false, _) => {
if let Some(exp_found) = exp_found { if let Some(exp_found) = exp_found {
let (def_id, ret_ty) = match exp_found.found.sty { 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())) (Some(def), Some(self.tcx.fn_sig(def).output()))
} }
_ => (None, None), _ => (None, None),
}; };
let exp_is_struct = match exp_found.expected.sty { let exp_is_struct = match exp_found.expected.sty {
TypeVariants::TyAdt(def, _) => def.is_struct(), TyKind::TyAdt(def, _) => def.is_struct(),
_ => false, _ => false,
}; };

View file

@ -236,7 +236,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
self.handle_field_access(&lhs, expr.id); self.handle_field_access(&lhs, expr.id);
} }
hir::ExprKind::Struct(_, ref fields, _) => { 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); self.mark_as_used_if_union(adt, fields);
} }
} }

View file

@ -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. /// 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 { 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 value = const_val.val;
let ty = const_val.ty; let ty = const_val.ty;
// print some primitives // print some primitives

View file

@ -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 { let expected = match expected_trait_ref.skip_binder().substs.type_at(1).sty {
ty::TyTuple(ref tys) => tys.iter() ty::TyTuple(ref tys) => tys.iter()
.map(|t| match t.sty { .map(|t| match t.sty {
ty::TypeVariants::TyTuple(ref tys) => ArgKind::Tuple( ty::TyKind::TyTuple(ref tys) => ArgKind::Tuple(
Some(span), Some(span),
tys.iter() tys.iter()
.map(|ty| ("_".to_owned(), ty.sty.to_string())) .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(); let mut trait_type = trait_ref.self_ty();
for refs_remaining in 0..refs_number { 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; trait_type = t_type;
let substs = self.tcx.mk_substs_trait(trait_type, &[]); let substs = self.tcx.mk_substs_trait(trait_type, &[]);

View file

@ -37,7 +37,7 @@ pub trait EncodableWithShorthand: Clone + Eq + Hash {
} }
impl<'tcx> EncodableWithShorthand for Ty<'tcx> { impl<'tcx> EncodableWithShorthand for Ty<'tcx> {
type Variant = ty::TypeVariants<'tcx>; type Variant = ty::TyKind<'tcx>;
fn variant(&self) -> &Self::Variant { fn variant(&self) -> &Self::Variant {
&self.sty &self.sty
} }
@ -164,7 +164,7 @@ pub fn decode_ty<'a, 'tcx, D>(decoder: &mut D) -> Result<Ty<'tcx>, D::Error>
}) })
} else { } else {
let tcx = decoder.tcx(); let tcx = decoder.tcx();
Ok(tcx.mk_ty(ty::TypeVariants::decode(decoder)?)) Ok(tcx.mk_ty(ty::TyKind::decode(decoder)?))
} }
} }

View file

@ -38,12 +38,12 @@ use ty::ReprOptions;
use traits; use traits;
use traits::{Clause, Clauses, Goal, Goals}; use traits::{Clause, Clauses, Goal, Goals};
use ty::{self, Ty, TypeAndMut}; 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::{AdtKind, AdtDef, ClosureSubsts, GeneratorSubsts, Region, Const};
use ty::{PolyFnSig, InferTy, ParamTy, ProjectionTy, ExistentialPredicate, Predicate}; use ty::{PolyFnSig, InferTy, ParamTy, ProjectionTy, ExistentialPredicate, Predicate};
use ty::RegionKind; use ty::RegionKind;
use ty::{TyVar, TyVid, IntVar, IntVid, FloatVar, FloatVid}; use ty::{TyVar, TyVid, IntVar, IntVid, FloatVar, FloatVid};
use ty::TypeVariants::*; use ty::TyKind::*;
use ty::GenericParamDefKind; use ty::GenericParamDefKind;
use ty::layout::{LayoutDetails, TargetDataLayout}; use ty::layout::{LayoutDetails, TargetDataLayout};
use ty::query; use ty::query;
@ -167,7 +167,7 @@ impl<'gcx: 'tcx, 'tcx> CtxtInterners<'tcx> {
fn intern_ty( fn intern_ty(
local: &CtxtInterners<'tcx>, local: &CtxtInterners<'tcx>,
global: &CtxtInterners<'gcx>, global: &CtxtInterners<'gcx>,
st: TypeVariants<'tcx> st: TyKind<'tcx>
) -> Ty<'tcx> { ) -> Ty<'tcx> {
let flags = super::flags::FlagComputation::for_sty(&st); let flags = super::flags::FlagComputation::for_sty(&st);
@ -803,7 +803,7 @@ impl<'tcx> CommonTypes<'tcx> {
fn new(interners: &CtxtInterners<'tcx>) -> CommonTypes<'tcx> { fn new(interners: &CtxtInterners<'tcx>) -> CommonTypes<'tcx> {
// Ensure our type representation does not grow // Ensure our type representation does not grow
#[cfg(target_pointer_width = "64")] #[cfg(target_pointer_width = "64")]
assert!(mem::size_of::<ty::TypeVariants>() <= 24); assert!(mem::size_of::<ty::TyKind>() <= 24);
#[cfg(target_pointer_width = "64")] #[cfg(target_pointer_width = "64")]
assert!(mem::size_of::<ty::TyS>() <= 32); assert!(mem::size_of::<ty::TyS>() <= 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 /// None is returned if the value or one of the components is not part
/// of the provided context. /// of the provided context.
/// For Ty, None can be returned if either the type interner doesn't /// 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, /// pointer differs. The latter case is possible if a primitive type,
/// e.g. `()` or `u8`, was interned in a different context. /// e.g. `()` or `u8`, was interned in a different context.
pub trait Lift<'tcx>: fmt::Debug { pub trait Lift<'tcx>: fmt::Debug {
@ -2107,8 +2107,8 @@ impl<'tcx> Hash for Interned<'tcx, TyS<'tcx>> {
} }
} }
impl<'tcx: 'lcx, 'lcx> Borrow<TypeVariants<'lcx>> for Interned<'tcx, TyS<'tcx>> { impl<'tcx: 'lcx, 'lcx> Borrow<TyKind<'lcx>> for Interned<'tcx, TyS<'tcx>> {
fn borrow<'a>(&'a self) -> &'a TypeVariants<'lcx> { fn borrow<'a>(&'a self) -> &'a TyKind<'lcx> {
&self.0.sty &self.0.sty
} }
} }
@ -2340,7 +2340,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
self.mk_fn_ptr(converted_sig) 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) CtxtInterners::intern_ty(&self.interners, &self.global_interners, st)
} }

View file

@ -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(); let mut result = FlagComputation::new();
result.add_sty(st); result.add_sty(st);
result 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 { match st {
&ty::TyBool | &ty::TyBool |
&ty::TyChar | &ty::TyChar |

View file

@ -13,7 +13,7 @@ use ty::context::TyCtxt;
use ty::{AdtDef, VariantDef, FieldDef, Ty, TyS}; use ty::{AdtDef, VariantDef, FieldDef, Ty, TyS};
use ty::{DefId, Substs}; use ty::{DefId, Substs};
use ty::{AdtKind, Visibility}; use ty::{AdtKind, Visibility};
use ty::TypeVariants::*; use ty::TyKind::*;
pub use self::def_id_forest::DefIdForest; pub use self::def_id_forest::DefIdForest;

View file

@ -65,7 +65,7 @@ pub use self::sty::{Binder, CanonicalVar, DebruijnIndex, INNERMOST};
pub use self::sty::{FnSig, GenSig, PolyFnSig, PolyGenSig}; pub use self::sty::{FnSig, GenSig, PolyFnSig, PolyGenSig};
pub use self::sty::{InferTy, ParamTy, ProjectionTy, ExistentialPredicate}; pub use self::sty::{InferTy, ParamTy, ProjectionTy, ExistentialPredicate};
pub use self::sty::{ClosureSubsts, GeneratorSubsts, UpvarSubsts, TypeAndMut}; 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::{ExistentialTraitRef, PolyExistentialTraitRef};
pub use self::sty::{ExistentialProjection, PolyExistentialProjection, Const}; pub use self::sty::{ExistentialProjection, PolyExistentialProjection, Const};
pub use self::sty::{BoundRegion, EarlyBoundRegion, FreeRegion, Region}; 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::BoundRegion::*;
pub use self::sty::InferTy::*; pub use self::sty::InferTy::*;
pub use self::sty::RegionKind::*; 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;
pub use self::binding::BindingMode::*; pub use self::binding::BindingMode::*;
@ -490,7 +490,7 @@ bitflags! {
} }
pub struct TyS<'tcx> { pub struct TyS<'tcx> {
pub sty: TypeVariants<'tcx>, pub sty: TyKind<'tcx>,
pub flags: TypeFlags, pub flags: TypeFlags,
/// This is a kind of confusing thing: it stores the smallest /// 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> { impl<'tcx> TyS<'tcx> {
pub fn is_primitive_ty(&self) -> bool { pub fn is_primitive_ty(&self) -> bool {
match self.sty { match self.sty {
TypeVariants::TyBool | TyKind::TyBool |
TypeVariants::TyChar | TyKind::TyChar |
TypeVariants::TyInt(_) | TyKind::TyInt(_) |
TypeVariants::TyUint(_) | TyKind::TyUint(_) |
TypeVariants::TyFloat(_) | TyKind::TyFloat(_) |
TypeVariants::TyInfer(InferTy::IntVar(_)) | TyKind::TyInfer(InferTy::IntVar(_)) |
TypeVariants::TyInfer(InferTy::FloatVar(_)) | TyKind::TyInfer(InferTy::FloatVar(_)) |
TypeVariants::TyInfer(InferTy::FreshIntTy(_)) | TyKind::TyInfer(InferTy::FreshIntTy(_)) |
TypeVariants::TyInfer(InferTy::FreshFloatTy(_)) => true, TyKind::TyInfer(InferTy::FreshFloatTy(_)) => true,
TypeVariants::TyRef(_, x, _) => x.is_primitive_ty(), TyKind::TyRef(_, x, _) => x.is_primitive_ty(),
_ => false, _ => false,
} }
} }
pub fn is_suggestable(&self) -> bool { pub fn is_suggestable(&self) -> bool {
match self.sty { match self.sty {
TypeVariants::TyAnon(..) | TyKind::TyAnon(..) |
TypeVariants::TyFnDef(..) | TyKind::TyFnDef(..) |
TypeVariants::TyFnPtr(..) | TyKind::TyFnPtr(..) |
TypeVariants::TyDynamic(..) | TyKind::TyDynamic(..) |
TypeVariants::TyClosure(..) | TyKind::TyClosure(..) |
TypeVariants::TyInfer(..) | TyKind::TyInfer(..) |
TypeVariants::TyProjection(..) => false, TyKind::TyProjection(..) => false,
_ => true, _ => true,
} }
} }

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed // option. This file may not be copied, modified, or distributed
// except according to those terms. // 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; use hir::def_id::DefId;
@ -33,7 +33,7 @@ use serialize;
use hir; use hir;
use self::InferTy::*; use self::InferTy::*;
use self::TypeVariants::*; use self::TyKind::*;
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)]
pub struct TypeAndMut<'tcx> { pub struct TypeAndMut<'tcx> {
@ -82,7 +82,7 @@ impl BoundRegion {
/// NB: If you change this, you'll probably want to change the corresponding /// NB: If you change this, you'll probably want to change the corresponding
/// AST structure in libsyntax/ast.rs as well. /// AST structure in libsyntax/ast.rs as well.
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)] #[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`. /// The primitive boolean type. Written as `bool`.
TyBool, TyBool,

View file

@ -19,7 +19,7 @@ use traits::{self, ObligationCause};
use ty::{self, Ty, TyCtxt, GenericParamDefKind, TypeFoldable}; use ty::{self, Ty, TyCtxt, GenericParamDefKind, TypeFoldable};
use ty::subst::{Substs, UnpackedKind}; use ty::subst::{Substs, UnpackedKind};
use ty::query::TyCtxtAt; use ty::query::TyCtxtAt;
use ty::TypeVariants::*; use ty::TyKind::*;
use ty::layout::{Integer, IntegerExt}; use ty::layout::{Integer, IntegerExt};
use util::common::ErrorReported; use util::common::ErrorReported;
use middle::lang_items; 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 !impl_generics.region_param(ebr, self).pure_wrt_drop
} }
UnpackedKind::Type(&ty::TyS { 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 !impl_generics.type_param(pt, self).pure_wrt_drop
} }

View file

@ -1029,7 +1029,7 @@ define_print! {
} }
define_print! { define_print! {
('tcx) ty::TypeVariants<'tcx>, (self, f, cx) { ('tcx) ty::TyKind<'tcx>, (self, f, cx) {
display { display {
match *self { match *self {
TyBool => write!(f, "bool"), TyBool => write!(f, "bool"),

View file

@ -697,7 +697,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
Some(nl.to_string()), Some(nl.to_string()),
Origin::Ast); Origin::Ast);
let need_note = match lp.ty.sty { 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 node_id = self.tcx.hir.as_local_node_id(id).unwrap();
let hir_id = self.tcx.hir.node_to_hir_id(node_id); 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) { if let Some((span, name)) = self.tables.closure_kind_origins().get(hir_id) {

View file

@ -1801,7 +1801,7 @@ fn int_type_width_signed(ty: Ty, cx: &CodegenCx) -> Option<(u64, bool)> {
// Returns the width of a float TypeVariant // Returns the width of a float TypeVariant
// Returns None if the type is not a float // Returns None if the type is not a float
fn float_type_width<'tcx>(sty: &ty::TypeVariants<'tcx>) -> Option<u64> { fn float_type_width<'tcx>(sty: &ty::TyKind<'tcx>) -> Option<u64> {
match *sty { match *sty {
ty::TyFloat(t) => Some(t.bit_width() as u64), ty::TyFloat(t) => Some(t.bit_width() as u64),
_ => None, _ => None,

View file

@ -1332,7 +1332,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MutableTransmutes {
fn get_transmute_from_to<'a, 'tcx> fn get_transmute_from_to<'a, 'tcx>
(cx: &LateContext<'a, 'tcx>, (cx: &LateContext<'a, 'tcx>,
expr: &hir::Expr) 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 { let def = if let hir::ExprKind::Path(ref qpath) = expr.node {
cx.tables.qpath_def(qpath, expr.hir_id) cx.tables.qpath_def(qpath, expr.hir_id)
} else { } else {

View file

@ -321,7 +321,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits {
// //
// No suggestion for: `isize`, `usize`. // No suggestion for: `isize`, `usize`.
fn get_type_suggestion<'a>( fn get_type_suggestion<'a>(
t: &ty::TypeVariants, t: &ty::TyKind,
val: u128, val: u128,
negative: bool, negative: bool,
) -> Option<String> { ) -> Option<String> {
@ -367,7 +367,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits {
fn report_bin_hex_error( fn report_bin_hex_error(
cx: &LateContext, cx: &LateContext,
expr: &hir::Expr, expr: &hir::Expr,
ty: ty::TypeVariants, ty: ty::TyKind,
repr_str: String, repr_str: String,
val: u128, val: u128,
negative: bool, negative: bool,

View file

@ -134,7 +134,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
if let Some(ty) = self.retrieve_type_for_place(place) { if let Some(ty) = self.retrieve_type_for_place(place) {
let needs_note = match ty.sty { let needs_note = match ty.sty {
ty::TypeVariants::TyClosure(id, _) => { ty::TyKind::TyClosure(id, _) => {
let tables = self.tcx.typeck_tables_of(id); let tables = self.tcx.typeck_tables_of(id);
let node_id = self.tcx.hir.as_local_node_id(id).unwrap(); let node_id = self.tcx.hir.as_local_node_id(id).unwrap();
let hir_id = self.tcx.hir.node_to_hir_id(node_id); let hir_id = self.tcx.hir.node_to_hir_id(node_id);

View file

@ -37,7 +37,7 @@ use rustc::mir::*;
use rustc::traits::query::type_op; use rustc::traits::query::type_op;
use rustc::traits::query::{Fallible, NoSolution}; use rustc::traits::query::{Fallible, NoSolution};
use rustc::ty::fold::TypeFoldable; 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 rustc_errors::Diagnostic;
use std::fmt; use std::fmt;
use std::rc::Rc; 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 place_type = place.ty(mir, tcx).to_ty(tcx);
let adt = match place_type.sty { let adt = match place_type.sty {
TypeVariants::TyAdt(adt, _) if adt.is_enum() => adt, TyKind::TyAdt(adt, _) if adt.is_enum() => adt,
_ => { _ => {
span_bug!( span_bug!(
stmt.source_info.span, stmt.source_info.span,

View file

@ -141,7 +141,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> {
src_layout: TyLayout<'tcx>, src_layout: TyLayout<'tcx>,
dest_layout: TyLayout<'tcx>, dest_layout: TyLayout<'tcx>,
) -> EvalResult<'tcx, Scalar> { ) -> EvalResult<'tcx, Scalar> {
use rustc::ty::TypeVariants::*; use rustc::ty::TyKind::*;
trace!("Casting {:?}: {:?} to {:?}", val, src_layout.ty, dest_layout.ty); trace!("Casting {:?}: {:?} to {:?}", val, src_layout.ty, dest_layout.ty);
match val { match val {
@ -184,7 +184,7 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> {
v v
}; };
trace!("cast_from_int: {}, {}, {}", v, src_layout.ty, dest_layout.ty); trace!("cast_from_int: {}, {}, {}", v, src_layout.ty, dest_layout.ty);
use rustc::ty::TypeVariants::*; use rustc::ty::TyKind::*;
match dest_layout.ty.sty { match dest_layout.ty.sty {
TyInt(_) | TyUint(_) => { TyInt(_) | TyUint(_) => {
let v = self.truncate(v, dest_layout); 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> { 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; use rustc_apfloat::FloatConvert;
match dest_ty.sty { match dest_ty.sty {
// float -> uint // 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> { fn cast_from_ptr(&self, ptr: Pointer, ty: Ty<'tcx>) -> EvalResult<'tcx, Scalar> {
use rustc::ty::TypeVariants::*; use rustc::ty::TyKind::*;
match ty.sty { match ty.sty {
// Casting to a reference or fn pointer is not permitted by rustc, no need to support it here. // Casting to a reference or fn pointer is not permitted by rustc, no need to support it here.
TyRawPtr(_) | TyRawPtr(_) |

View file

@ -12,7 +12,7 @@
use rustc::mir::{Constant, Location, Place, Mir, Operand, ProjectionElem, Rvalue, Local}; use rustc::mir::{Constant, Location, Place, Mir, Operand, ProjectionElem, Rvalue, Local};
use rustc::mir::visit::{MutVisitor, Visitor}; use rustc::mir::visit::{MutVisitor, Visitor};
use rustc::ty::{TyCtxt, TypeVariants}; use rustc::ty::{TyCtxt, TyKind};
use rustc::util::nodemap::{FxHashMap, FxHashSet}; use rustc::util::nodemap::{FxHashMap, FxHashSet};
use rustc_data_structures::indexed_vec::Idx; use rustc_data_structures::indexed_vec::Idx;
use std::mem; 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 { if let Rvalue::Len(ref place) = *rvalue {
let place_ty = place.ty(&self.mir.local_decls, self.tcx).to_ty(self.tcx); 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 span = self.mir.source_info(location).span;
let ty = self.tcx.types.usize; let ty = self.tcx.types.usize;
let constant = Constant { span, ty, literal: len }; let constant = Constant { span, ty, literal: len };

View file

@ -13,7 +13,7 @@
use rustc::hir::def_id::DefId; use rustc::hir::def_id::DefId;
use rustc::middle::lang_items::LangItem; use rustc::middle::lang_items::LangItem;
use rustc::mir::*; 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 rustc_data_structures::indexed_vec::{Idx};
use transform::{MirPass, MirSource}; use transform::{MirPass, MirSource};
use syntax; use syntax;
@ -190,8 +190,8 @@ impl RhsKind {
fn sign_of_128bit(ty: Ty) -> Option<bool> { fn sign_of_128bit(ty: Ty) -> Option<bool> {
match ty.sty { match ty.sty {
TypeVariants::TyInt(syntax::ast::IntTy::I128) => Some(true), TyKind::TyInt(syntax::ast::IntTy::I128) => Some(true),
TypeVariants::TyUint(syntax::ast::UintTy::U128) => Some(false), TyKind::TyUint(syntax::ast::UintTy::U128) => Some(false),
_ => None, _ => None,
} }
} }

View file

@ -108,7 +108,7 @@ struct GenericArgMismatchErrorCode {
/// Dummy type used for the `Self` of a `TraitRef` created for converting /// Dummy type used for the `Self` of a `TraitRef` created for converting
/// a trait object, and which gets removed in `ExistentialTraitRef`. /// a trait object, and which gets removed in `ExistentialTraitRef`.
/// This type must not appear anywhere in other converted types. /// 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 { impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
pub fn ast_region_to_region(&self, pub fn ast_region_to_region(&self,

View file

@ -53,7 +53,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
PatKind::Lit(ref lt) => { PatKind::Lit(ref lt) => {
let ty = self.check_expr(lt); let ty = self.check_expr(lt);
match ty.sty { match ty.sty {
ty::TypeVariants::TyRef(..) => false, ty::TyKind::TyRef(..) => false,
_ => true, _ => true,
} }
} }
@ -84,7 +84,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
expected = loop { expected = loop {
debug!("inspecting {:?} with type {:?}", exp_ty, exp_ty.sty); debug!("inspecting {:?} with type {:?}", exp_ty, exp_ty.sty);
match 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"); debug!("current discriminant is TyRef, inserting implicit deref");
// Preserve the reference type. We'll need it later during HAIR lowering. // Preserve the reference type. We'll need it later during HAIR lowering.
pat_adjustments.push(exp_ty); pat_adjustments.push(exp_ty);

View file

@ -477,12 +477,12 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> {
(RPtr(p), Int(_)) | (RPtr(p), Int(_)) |
(RPtr(p), Float) => { (RPtr(p), Float) => {
match p.ty.sty { match p.ty.sty {
ty::TypeVariants::TyInt(_) | ty::TyKind::TyInt(_) |
ty::TypeVariants::TyUint(_) | ty::TyKind::TyUint(_) |
ty::TypeVariants::TyFloat(_) => { ty::TyKind::TyFloat(_) => {
Err(CastError::NeedDeref) Err(CastError::NeedDeref)
} }
ty::TypeVariants::TyInfer(t) => { ty::TyKind::TyInfer(t) => {
match t { match t {
ty::InferTy::IntVar(_) | ty::InferTy::IntVar(_) |
ty::InferTy::FloatVar(_) => Err(CastError::NeedDeref), ty::InferTy::FloatVar(_) => Err(CastError::NeedDeref),

View file

@ -13,7 +13,7 @@
use super::{FnCtxt, Needs}; use super::{FnCtxt, Needs};
use super::method::MethodCallee; use super::method::MethodCallee;
use rustc::ty::{self, Ty, TypeFoldable}; 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::ty::adjustment::{Adjustment, Adjust, AllowTwoPhase, AutoBorrow, AutoBorrowMutability};
use rustc::infer::type_variable::TypeVariableOrigin; use rustc::infer::type_variable::TypeVariableOrigin;
use errors; use errors;

View file

@ -83,7 +83,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> BlanketImplFinder <'a, 'tcx, 'rcx, 'cstore> {
.expect("Cannot get impl trait"); .expect("Cannot get impl trait");
match trait_ref.self_ty().sty { match trait_ref.self_ty().sty {
ty::TypeVariants::TyParam(_) => {}, ty::TyParam(_) => {},
_ => return, _ => return,
} }