Skip to content

Commit d37cee3

Browse files
committed
Rename ty::TyVariants to ty::TyKind
1 parent 87c7e57 commit d37cee3

File tree

27 files changed

+77
-77
lines changed

27 files changed

+77
-77
lines changed

src/librustc/ich/impls_ty.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -797,12 +797,12 @@ impl_stable_hash_for!(enum ty::BoundRegion {
797797
});
798798

799799
impl<'a, 'gcx> HashStable<StableHashingContext<'a>>
800-
for ty::TypeVariants<'gcx>
800+
for ty::TyKind<'gcx>
801801
{
802802
fn hash_stable<W: StableHasherResult>(&self,
803803
hcx: &mut StableHashingContext<'a>,
804804
hasher: &mut StableHasher<W>) {
805-
use ty::TypeVariants::*;
805+
use ty::TyKind::*;
806806

807807
mem::discriminant(self).hash_stable(hcx, hasher);
808808
match *self {
@@ -905,7 +905,7 @@ for ty::TyVid
905905
_hasher: &mut StableHasher<W>) {
906906
// TyVid values are confined to an inference context and hence
907907
// should not be hashed.
908-
bug!("ty::TypeVariants::hash_stable() - can't hash a TyVid {:?}.", *self)
908+
bug!("ty::TyKind::hash_stable() - can't hash a TyVid {:?}.", *self)
909909
}
910910
}
911911

@@ -917,7 +917,7 @@ for ty::IntVid
917917
_hasher: &mut StableHasher<W>) {
918918
// IntVid values are confined to an inference context and hence
919919
// should not be hashed.
920-
bug!("ty::TypeVariants::hash_stable() - can't hash an IntVid {:?}.", *self)
920+
bug!("ty::TyKind::hash_stable() - can't hash an IntVid {:?}.", *self)
921921
}
922922
}
923923

@@ -929,7 +929,7 @@ for ty::FloatVid
929929
_hasher: &mut StableHasher<W>) {
930930
// FloatVid values are confined to an inference context and hence
931931
// should not be hashed.
932-
bug!("ty::TypeVariants::hash_stable() - can't hash a FloatVid {:?}.", *self)
932+
bug!("ty::TyKind::hash_stable() - can't hash a FloatVid {:?}.", *self)
933933
}
934934
}
935935

src/librustc/infer/error_reporting/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ use hir::map as hir_map;
6666
use hir::def_id::DefId;
6767
use middle::region;
6868
use traits::{ObligationCause, ObligationCauseCode};
69-
use ty::{self, subst::Subst, Region, Ty, TyCtxt, TypeFoldable, TypeVariants};
69+
use ty::{self, subst::Subst, Region, Ty, TyCtxt, TypeFoldable, TyKind};
7070
use ty::error::TypeError;
7171
use syntax::ast::DUMMY_NODE_ID;
7272
use syntax_pos::{Pos, Span};
@@ -979,14 +979,14 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
979979
(_, false, _) => {
980980
if let Some(exp_found) = exp_found {
981981
let (def_id, ret_ty) = match exp_found.found.sty {
982-
TypeVariants::TyFnDef(def, _) => {
982+
TyKind::TyFnDef(def, _) => {
983983
(Some(def), Some(self.tcx.fn_sig(def).output()))
984984
}
985985
_ => (None, None),
986986
};
987987

988988
let exp_is_struct = match exp_found.expected.sty {
989-
TypeVariants::TyAdt(def, _) => def.is_struct(),
989+
TyKind::TyAdt(def, _) => def.is_struct(),
990990
_ => false,
991991
};
992992

src/librustc/middle/dead.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
236236
self.handle_field_access(&lhs, expr.id);
237237
}
238238
hir::ExprKind::Struct(_, ref fields, _) => {
239-
if let ty::TypeVariants::TyAdt(ref adt, _) = self.tables.expr_ty(expr).sty {
239+
if let ty::TyKind::TyAdt(ref adt, _) = self.tables.expr_ty(expr).sty {
240240
self.mark_as_used_if_union(adt, fields);
241241
}
242242
}

src/librustc/mir/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2221,7 +2221,7 @@ impl<'tcx> Debug for Constant<'tcx> {
22212221

22222222
/// Write a `ConstValue` in a way closer to the original source code than the `Debug` output.
22232223
pub fn fmt_const_val(f: &mut impl Write, const_val: &ty::Const) -> fmt::Result {
2224-
use ty::TypeVariants::*;
2224+
use ty::TyKind::*;
22252225
let value = const_val.val;
22262226
let ty = const_val.ty;
22272227
// print some primitives

src/librustc/traits/error_reporting.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
802802
let expected = match expected_trait_ref.skip_binder().substs.type_at(1).sty {
803803
ty::TyTuple(ref tys) => tys.iter()
804804
.map(|t| match t.sty {
805-
ty::TypeVariants::TyTuple(ref tys) => ArgKind::Tuple(
805+
ty::TyKind::TyTuple(ref tys) => ArgKind::Tuple(
806806
Some(span),
807807
tys.iter()
808808
.map(|ty| ("_".to_owned(), ty.sty.to_string()))
@@ -899,7 +899,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
899899
let mut trait_type = trait_ref.self_ty();
900900

901901
for refs_remaining in 0..refs_number {
902-
if let ty::TypeVariants::TyRef(_, t_type, _) = trait_type.sty {
902+
if let ty::TyKind::TyRef(_, t_type, _) = trait_type.sty {
903903
trait_type = t_type;
904904

905905
let substs = self.tcx.mk_substs_trait(trait_type, &[]);

src/librustc/ty/codec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub trait EncodableWithShorthand: Clone + Eq + Hash {
3737
}
3838

3939
impl<'tcx> EncodableWithShorthand for Ty<'tcx> {
40-
type Variant = ty::TypeVariants<'tcx>;
40+
type Variant = ty::TyKind<'tcx>;
4141
fn variant(&self) -> &Self::Variant {
4242
&self.sty
4343
}
@@ -164,7 +164,7 @@ pub fn decode_ty<'a, 'tcx, D>(decoder: &mut D) -> Result<Ty<'tcx>, D::Error>
164164
})
165165
} else {
166166
let tcx = decoder.tcx();
167-
Ok(tcx.mk_ty(ty::TypeVariants::decode(decoder)?))
167+
Ok(tcx.mk_ty(ty::TyKind::decode(decoder)?))
168168
}
169169
}
170170

src/librustc/ty/context.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ use ty::ReprOptions;
3838
use traits;
3939
use traits::{Clause, Clauses, Goal, Goals};
4040
use ty::{self, Ty, TypeAndMut};
41-
use ty::{TyS, TypeVariants, List};
41+
use ty::{TyS, TyKind, List};
4242
use ty::{AdtKind, AdtDef, ClosureSubsts, GeneratorSubsts, Region, Const};
4343
use ty::{PolyFnSig, InferTy, ParamTy, ProjectionTy, ExistentialPredicate, Predicate};
4444
use ty::RegionKind;
4545
use ty::{TyVar, TyVid, IntVar, IntVid, FloatVar, FloatVid};
46-
use ty::TypeVariants::*;
46+
use ty::TyKind::*;
4747
use ty::GenericParamDefKind;
4848
use ty::layout::{LayoutDetails, TargetDataLayout};
4949
use ty::query;
@@ -167,7 +167,7 @@ impl<'gcx: 'tcx, 'tcx> CtxtInterners<'tcx> {
167167
fn intern_ty(
168168
local: &CtxtInterners<'tcx>,
169169
global: &CtxtInterners<'gcx>,
170-
st: TypeVariants<'tcx>
170+
st: TyKind<'tcx>
171171
) -> Ty<'tcx> {
172172
let flags = super::flags::FlagComputation::for_sty(&st);
173173

@@ -803,7 +803,7 @@ impl<'tcx> CommonTypes<'tcx> {
803803
fn new(interners: &CtxtInterners<'tcx>) -> CommonTypes<'tcx> {
804804
// Ensure our type representation does not grow
805805
#[cfg(target_pointer_width = "64")]
806-
assert!(mem::size_of::<ty::TypeVariants>() <= 24);
806+
assert!(mem::size_of::<ty::TyKind>() <= 24);
807807
#[cfg(target_pointer_width = "64")]
808808
assert!(mem::size_of::<ty::TyS>() <= 32);
809809

@@ -1540,7 +1540,7 @@ impl<'gcx: 'tcx, 'tcx> GlobalCtxt<'gcx> {
15401540
/// None is returned if the value or one of the components is not part
15411541
/// of the provided context.
15421542
/// For Ty, None can be returned if either the type interner doesn't
1543-
/// contain the TypeVariants key or if the address of the interned
1543+
/// contain the TyKind key or if the address of the interned
15441544
/// pointer differs. The latter case is possible if a primitive type,
15451545
/// e.g. `()` or `u8`, was interned in a different context.
15461546
pub trait Lift<'tcx>: fmt::Debug {
@@ -2107,8 +2107,8 @@ impl<'tcx> Hash for Interned<'tcx, TyS<'tcx>> {
21072107
}
21082108
}
21092109

2110-
impl<'tcx: 'lcx, 'lcx> Borrow<TypeVariants<'lcx>> for Interned<'tcx, TyS<'tcx>> {
2111-
fn borrow<'a>(&'a self) -> &'a TypeVariants<'lcx> {
2110+
impl<'tcx: 'lcx, 'lcx> Borrow<TyKind<'lcx>> for Interned<'tcx, TyS<'tcx>> {
2111+
fn borrow<'a>(&'a self) -> &'a TyKind<'lcx> {
21122112
&self.0.sty
21132113
}
21142114
}
@@ -2340,7 +2340,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
23402340
self.mk_fn_ptr(converted_sig)
23412341
}
23422342

2343-
pub fn mk_ty(&self, st: TypeVariants<'tcx>) -> Ty<'tcx> {
2343+
pub fn mk_ty(&self, st: TyKind<'tcx>) -> Ty<'tcx> {
23442344
CtxtInterners::intern_ty(&self.interners, &self.global_interners, st)
23452345
}
23462346

src/librustc/ty/flags.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ impl FlagComputation {
2828
}
2929
}
3030

31-
pub fn for_sty(st: &ty::TypeVariants) -> FlagComputation {
31+
pub fn for_sty(st: &ty::TyKind) -> FlagComputation {
3232
let mut result = FlagComputation::new();
3333
result.add_sty(st);
3434
result
@@ -67,7 +67,7 @@ impl FlagComputation {
6767
}
6868
}
6969

70-
fn add_sty(&mut self, st: &ty::TypeVariants) {
70+
fn add_sty(&mut self, st: &ty::TyKind) {
7171
match st {
7272
&ty::TyBool |
7373
&ty::TyChar |

src/librustc/ty/inhabitedness/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use ty::context::TyCtxt;
1313
use ty::{AdtDef, VariantDef, FieldDef, Ty, TyS};
1414
use ty::{DefId, Substs};
1515
use ty::{AdtKind, Visibility};
16-
use ty::TypeVariants::*;
16+
use ty::TyKind::*;
1717

1818
pub use self::def_id_forest::DefIdForest;
1919

src/librustc/ty/mod.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub use self::sty::{Binder, CanonicalVar, DebruijnIndex, INNERMOST};
6565
pub use self::sty::{FnSig, GenSig, PolyFnSig, PolyGenSig};
6666
pub use self::sty::{InferTy, ParamTy, ProjectionTy, ExistentialPredicate};
6767
pub use self::sty::{ClosureSubsts, GeneratorSubsts, UpvarSubsts, TypeAndMut};
68-
pub use self::sty::{TraitRef, TypeVariants, PolyTraitRef};
68+
pub use self::sty::{TraitRef, TyKind, PolyTraitRef};
6969
pub use self::sty::{ExistentialTraitRef, PolyExistentialTraitRef};
7070
pub use self::sty::{ExistentialProjection, PolyExistentialProjection, Const};
7171
pub use self::sty::{BoundRegion, EarlyBoundRegion, FreeRegion, Region};
@@ -74,7 +74,7 @@ pub use self::sty::{TyVid, IntVid, FloatVid, RegionVid};
7474
pub use self::sty::BoundRegion::*;
7575
pub use self::sty::InferTy::*;
7676
pub use self::sty::RegionKind::*;
77-
pub use self::sty::TypeVariants::*;
77+
pub use self::sty::TyKind::*;
7878

7979
pub use self::binding::BindingMode;
8080
pub use self::binding::BindingMode::*;
@@ -490,7 +490,7 @@ bitflags! {
490490
}
491491

492492
pub struct TyS<'tcx> {
493-
pub sty: TypeVariants<'tcx>,
493+
pub sty: TyKind<'tcx>,
494494
pub flags: TypeFlags,
495495

496496
/// This is a kind of confusing thing: it stores the smallest
@@ -542,29 +542,29 @@ impl<'tcx> Hash for TyS<'tcx> {
542542
impl<'tcx> TyS<'tcx> {
543543
pub fn is_primitive_ty(&self) -> bool {
544544
match self.sty {
545-
TypeVariants::TyBool |
546-
TypeVariants::TyChar |
547-
TypeVariants::TyInt(_) |
548-
TypeVariants::TyUint(_) |
549-
TypeVariants::TyFloat(_) |
550-
TypeVariants::TyInfer(InferTy::IntVar(_)) |
551-
TypeVariants::TyInfer(InferTy::FloatVar(_)) |
552-
TypeVariants::TyInfer(InferTy::FreshIntTy(_)) |
553-
TypeVariants::TyInfer(InferTy::FreshFloatTy(_)) => true,
554-
TypeVariants::TyRef(_, x, _) => x.is_primitive_ty(),
545+
TyKind::TyBool |
546+
TyKind::TyChar |
547+
TyKind::TyInt(_) |
548+
TyKind::TyUint(_) |
549+
TyKind::TyFloat(_) |
550+
TyKind::TyInfer(InferTy::IntVar(_)) |
551+
TyKind::TyInfer(InferTy::FloatVar(_)) |
552+
TyKind::TyInfer(InferTy::FreshIntTy(_)) |
553+
TyKind::TyInfer(InferTy::FreshFloatTy(_)) => true,
554+
TyKind::TyRef(_, x, _) => x.is_primitive_ty(),
555555
_ => false,
556556
}
557557
}
558558

559559
pub fn is_suggestable(&self) -> bool {
560560
match self.sty {
561-
TypeVariants::TyAnon(..) |
562-
TypeVariants::TyFnDef(..) |
563-
TypeVariants::TyFnPtr(..) |
564-
TypeVariants::TyDynamic(..) |
565-
TypeVariants::TyClosure(..) |
566-
TypeVariants::TyInfer(..) |
567-
TypeVariants::TyProjection(..) => false,
561+
TyKind::TyAnon(..) |
562+
TyKind::TyFnDef(..) |
563+
TyKind::TyFnPtr(..) |
564+
TyKind::TyDynamic(..) |
565+
TyKind::TyClosure(..) |
566+
TyKind::TyInfer(..) |
567+
TyKind::TyProjection(..) => false,
568568
_ => true,
569569
}
570570
}

src/librustc/ty/sty.rs

Lines changed: 3 additions & 3 deletions
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-
//! This module contains TypeVariants and its major components
11+
//! This module contains TyKind and its major components
1212
1313
use hir::def_id::DefId;
1414

@@ -33,7 +33,7 @@ use serialize;
3333
use hir;
3434

3535
use self::InferTy::*;
36-
use self::TypeVariants::*;
36+
use self::TyKind::*;
3737

3838
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)]
3939
pub struct TypeAndMut<'tcx> {
@@ -82,7 +82,7 @@ impl BoundRegion {
8282
/// NB: If you change this, you'll probably want to change the corresponding
8383
/// AST structure in libsyntax/ast.rs as well.
8484
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, RustcEncodable, RustcDecodable)]
85-
pub enum TypeVariants<'tcx> {
85+
pub enum TyKind<'tcx> {
8686
/// The primitive boolean type. Written as `bool`.
8787
TyBool,
8888

src/librustc/ty/util.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use traits::{self, ObligationCause};
1919
use ty::{self, Ty, TyCtxt, GenericParamDefKind, TypeFoldable};
2020
use ty::subst::{Substs, UnpackedKind};
2121
use ty::query::TyCtxtAt;
22-
use ty::TypeVariants::*;
22+
use ty::TyKind::*;
2323
use ty::layout::{Integer, IntegerExt};
2424
use util::common::ErrorReported;
2525
use middle::lang_items;
@@ -503,7 +503,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
503503
!impl_generics.region_param(ebr, self).pure_wrt_drop
504504
}
505505
UnpackedKind::Type(&ty::TyS {
506-
sty: ty::TypeVariants::TyParam(ref pt), ..
506+
sty: ty::TyKind::TyParam(ref pt), ..
507507
}) => {
508508
!impl_generics.type_param(pt, self).pure_wrt_drop
509509
}

src/librustc/util/ppaux.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@ define_print! {
10291029
}
10301030

10311031
define_print! {
1032-
('tcx) ty::TypeVariants<'tcx>, (self, f, cx) {
1032+
('tcx) ty::TyKind<'tcx>, (self, f, cx) {
10331033
display {
10341034
match *self {
10351035
TyBool => write!(f, "bool"),

src/librustc_borrowck/borrowck/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ impl<'a, 'tcx> BorrowckCtxt<'a, 'tcx> {
697697
Some(nl.to_string()),
698698
Origin::Ast);
699699
let need_note = match lp.ty.sty {
700-
ty::TypeVariants::TyClosure(id, _) => {
700+
ty::TyKind::TyClosure(id, _) => {
701701
let node_id = self.tcx.hir.as_local_node_id(id).unwrap();
702702
let hir_id = self.tcx.hir.node_to_hir_id(node_id);
703703
if let Some((span, name)) = self.tables.closure_kind_origins().get(hir_id) {

src/librustc_codegen_llvm/intrinsic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1801,7 +1801,7 @@ fn int_type_width_signed(ty: Ty, cx: &CodegenCx) -> Option<(u64, bool)> {
18011801

18021802
// Returns the width of a float TypeVariant
18031803
// Returns None if the type is not a float
1804-
fn float_type_width<'tcx>(sty: &ty::TypeVariants<'tcx>) -> Option<u64> {
1804+
fn float_type_width<'tcx>(sty: &ty::TyKind<'tcx>) -> Option<u64> {
18051805
match *sty {
18061806
ty::TyFloat(t) => Some(t.bit_width() as u64),
18071807
_ => None,

src/librustc_lint/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1332,7 +1332,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MutableTransmutes {
13321332
fn get_transmute_from_to<'a, 'tcx>
13331333
(cx: &LateContext<'a, 'tcx>,
13341334
expr: &hir::Expr)
1335-
-> Option<(&'tcx ty::TypeVariants<'tcx>, &'tcx ty::TypeVariants<'tcx>)> {
1335+
-> Option<(&'tcx ty::TyKind<'tcx>, &'tcx ty::TyKind<'tcx>)> {
13361336
let def = if let hir::ExprKind::Path(ref qpath) = expr.node {
13371337
cx.tables.qpath_def(qpath, expr.hir_id)
13381338
} else {

src/librustc_lint/types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits {
321321
//
322322
// No suggestion for: `isize`, `usize`.
323323
fn get_type_suggestion<'a>(
324-
t: &ty::TypeVariants,
324+
t: &ty::TyKind,
325325
val: u128,
326326
negative: bool,
327327
) -> Option<String> {
@@ -367,7 +367,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeLimits {
367367
fn report_bin_hex_error(
368368
cx: &LateContext,
369369
expr: &hir::Expr,
370-
ty: ty::TypeVariants,
370+
ty: ty::TyKind,
371371
repr_str: String,
372372
val: u128,
373373
negative: bool,

src/librustc_mir/borrow_check/error_reporting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
134134

135135
if let Some(ty) = self.retrieve_type_for_place(place) {
136136
let needs_note = match ty.sty {
137-
ty::TypeVariants::TyClosure(id, _) => {
137+
ty::TyKind::TyClosure(id, _) => {
138138
let tables = self.tcx.typeck_tables_of(id);
139139
let node_id = self.tcx.hir.as_local_node_id(id).unwrap();
140140
let hir_id = self.tcx.hir.node_to_hir_id(node_id);

0 commit comments

Comments
 (0)