Skip to content

Commit 8a5dccd

Browse files
committed
Remove Ty prefix from Ty{Bool|Char|Int|Uint|Float|Str}
1 parent 04fa5d3 commit 8a5dccd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+549
-549
lines changed

src/librustc/hir/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1672,12 +1672,12 @@ impl fmt::Debug for Ty {
16721672
/// Not represented directly in the AST, referred to by name through a ty_path.
16731673
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
16741674
pub enum PrimTy {
1675-
TyInt(IntTy),
1676-
TyUint(UintTy),
1677-
TyFloat(FloatTy),
1678-
TyStr,
1679-
TyBool,
1680-
TyChar,
1675+
Int(IntTy),
1676+
Uint(UintTy),
1677+
Float(FloatTy),
1678+
Str,
1679+
Bool,
1680+
Char,
16811681
}
16821682

16831683
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]

src/librustc/ich/impls_hir.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -308,12 +308,12 @@ impl<'a> HashStable<StableHashingContext<'a>> for hir::Ty {
308308
}
309309

310310
impl_stable_hash_for!(enum hir::PrimTy {
311-
TyInt(int_ty),
312-
TyUint(uint_ty),
313-
TyFloat(float_ty),
314-
TyStr,
315-
TyBool,
316-
TyChar
311+
Int(int_ty),
312+
Uint(uint_ty),
313+
Float(float_ty),
314+
Str,
315+
Bool,
316+
Char
317317
});
318318

319319
impl_stable_hash_for!(struct hir::BareFnTy {

src/librustc/ich/impls_ty.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -806,20 +806,20 @@ for ty::TyKind<'gcx>
806806

807807
mem::discriminant(self).hash_stable(hcx, hasher);
808808
match *self {
809-
TyBool |
810-
TyChar |
811-
TyStr |
809+
Bool |
810+
Char |
811+
Str |
812812
Error |
813813
Never => {
814814
// Nothing more to hash.
815815
}
816-
TyInt(int_ty) => {
816+
Int(int_ty) => {
817817
int_ty.hash_stable(hcx, hasher);
818818
}
819-
TyUint(uint_ty) => {
819+
Uint(uint_ty) => {
820820
uint_ty.hash_stable(hcx, hasher);
821821
}
822-
TyFloat(float_ty) => {
822+
Float(float_ty) => {
823823
float_ty.hash_stable(hcx, hasher);
824824
}
825825
Adt(adt_def, substs) => {

src/librustc/infer/canonical/canonicalizer.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -265,13 +265,13 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Canonicalizer<'cx, 'gcx, 'tcx>
265265
ty::Closure(..)
266266
| ty::Generator(..)
267267
| ty::GeneratorWitness(..)
268-
| ty::TyBool
269-
| ty::TyChar
270-
| ty::TyInt(..)
271-
| ty::TyUint(..)
272-
| ty::TyFloat(..)
268+
| ty::Bool
269+
| ty::Char
270+
| ty::Int(..)
271+
| ty::Uint(..)
272+
| ty::Float(..)
273273
| ty::Adt(..)
274-
| ty::TyStr
274+
| ty::Str
275275
| ty::Error
276276
| ty::Array(..)
277277
| ty::Slice(..)

src/librustc/infer/combine.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,16 @@ impl<'infcx, 'gcx, 'tcx> InferCtxt<'infcx, 'gcx, 'tcx> {
8383
.map_err(|e| int_unification_error(a_is_expected, e))?;
8484
Ok(a)
8585
}
86-
(&ty::Infer(ty::IntVar(v_id)), &ty::TyInt(v)) => {
86+
(&ty::Infer(ty::IntVar(v_id)), &ty::Int(v)) => {
8787
self.unify_integral_variable(a_is_expected, v_id, IntType(v))
8888
}
89-
(&ty::TyInt(v), &ty::Infer(ty::IntVar(v_id))) => {
89+
(&ty::Int(v), &ty::Infer(ty::IntVar(v_id))) => {
9090
self.unify_integral_variable(!a_is_expected, v_id, IntType(v))
9191
}
92-
(&ty::Infer(ty::IntVar(v_id)), &ty::TyUint(v)) => {
92+
(&ty::Infer(ty::IntVar(v_id)), &ty::Uint(v)) => {
9393
self.unify_integral_variable(a_is_expected, v_id, UintType(v))
9494
}
95-
(&ty::TyUint(v), &ty::Infer(ty::IntVar(v_id))) => {
95+
(&ty::Uint(v), &ty::Infer(ty::IntVar(v_id))) => {
9696
self.unify_integral_variable(!a_is_expected, v_id, UintType(v))
9797
}
9898

@@ -104,10 +104,10 @@ impl<'infcx, 'gcx, 'tcx> InferCtxt<'infcx, 'gcx, 'tcx> {
104104
.map_err(|e| float_unification_error(relation.a_is_expected(), e))?;
105105
Ok(a)
106106
}
107-
(&ty::Infer(ty::FloatVar(v_id)), &ty::TyFloat(v)) => {
107+
(&ty::Infer(ty::FloatVar(v_id)), &ty::Float(v)) => {
108108
self.unify_float_variable(a_is_expected, v_id, v)
109109
}
110-
(&ty::TyFloat(v), &ty::Infer(ty::FloatVar(v_id))) => {
110+
(&ty::Float(v), &ty::Infer(ty::FloatVar(v_id))) => {
111111
self.unify_float_variable(!a_is_expected, v_id, v)
112112
}
113113

src/librustc/infer/error_reporting/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -704,11 +704,11 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
704704
fn equals<'tcx>(a: &Ty<'tcx>, b: &Ty<'tcx>) -> bool {
705705
match (&a.sty, &b.sty) {
706706
(a, b) if *a == *b => true,
707-
(&ty::TyInt(_), &ty::Infer(ty::InferTy::IntVar(_)))
708-
| (&ty::Infer(ty::InferTy::IntVar(_)), &ty::TyInt(_))
707+
(&ty::Int(_), &ty::Infer(ty::InferTy::IntVar(_)))
708+
| (&ty::Infer(ty::InferTy::IntVar(_)), &ty::Int(_))
709709
| (&ty::Infer(ty::InferTy::IntVar(_)), &ty::Infer(ty::InferTy::IntVar(_)))
710-
| (&ty::TyFloat(_), &ty::Infer(ty::InferTy::FloatVar(_)))
711-
| (&ty::Infer(ty::InferTy::FloatVar(_)), &ty::TyFloat(_))
710+
| (&ty::Float(_), &ty::Infer(ty::InferTy::FloatVar(_)))
711+
| (&ty::Infer(ty::InferTy::FloatVar(_)), &ty::Float(_))
712712
| (
713713
&ty::Infer(ty::InferTy::FloatVar(_)),
714714
&ty::Infer(ty::InferTy::FloatVar(_)),

src/librustc/infer/freshen.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,13 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for TypeFreshener<'a, 'gcx, 'tcx> {
175175
bug!("encountered canonical ty during freshening"),
176176

177177
ty::Generator(..) |
178-
ty::TyBool |
179-
ty::TyChar |
180-
ty::TyInt(..) |
181-
ty::TyUint(..) |
182-
ty::TyFloat(..) |
178+
ty::Bool |
179+
ty::Char |
180+
ty::Int(..) |
181+
ty::Uint(..) |
182+
ty::Float(..) |
183183
ty::Adt(..) |
184-
ty::TyStr |
184+
ty::Str |
185185
ty::Error |
186186
ty::Array(..) |
187187
ty::Slice(..) |

src/librustc/mir/mod.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -2227,12 +2227,12 @@ pub fn fmt_const_val(f: &mut impl Write, const_val: &ty::Const) -> fmt::Result {
22272227
// print some primitives
22282228
if let ConstValue::Scalar(Scalar::Bits { bits, .. }) = value {
22292229
match ty.sty {
2230-
TyBool if bits == 0 => return write!(f, "false"),
2231-
TyBool if bits == 1 => return write!(f, "true"),
2232-
TyFloat(ast::FloatTy::F32) => return write!(f, "{}f32", Single::from_bits(bits)),
2233-
TyFloat(ast::FloatTy::F64) => return write!(f, "{}f64", Double::from_bits(bits)),
2234-
TyUint(ui) => return write!(f, "{:?}{}", bits, ui),
2235-
TyInt(i) => {
2230+
Bool if bits == 0 => return write!(f, "false"),
2231+
Bool if bits == 1 => return write!(f, "true"),
2232+
Float(ast::FloatTy::F32) => return write!(f, "{}f32", Single::from_bits(bits)),
2233+
Float(ast::FloatTy::F64) => return write!(f, "{}f64", Double::from_bits(bits)),
2234+
Uint(ui) => return write!(f, "{:?}{}", bits, ui),
2235+
Int(i) => {
22362236
let bit_width = ty::tls::with(|tcx| {
22372237
let ty = tcx.lift_to_global(&ty).unwrap();
22382238
tcx.layout_of(ty::ParamEnv::empty().and(ty))
@@ -2243,7 +2243,7 @@ pub fn fmt_const_val(f: &mut impl Write, const_val: &ty::Const) -> fmt::Result {
22432243
let shift = 128 - bit_width;
22442244
return write!(f, "{:?}{}", ((bits as i128) << shift) >> shift, i);
22452245
}
2246-
TyChar => return write!(f, "{:?}", ::std::char::from_u32(bits as u32).unwrap()),
2246+
Char => return write!(f, "{:?}", ::std::char::from_u32(bits as u32).unwrap()),
22472247
_ => {},
22482248
}
22492249
}
@@ -2255,7 +2255,7 @@ pub fn fmt_const_val(f: &mut impl Write, const_val: &ty::Const) -> fmt::Result {
22552255
if let ConstValue::ScalarPair(ptr, len) = value {
22562256
if let Scalar::Ptr(ptr) = ptr {
22572257
if let ScalarMaybeUndef::Scalar(Scalar::Bits { bits: len, .. }) = len {
2258-
if let Ref(_, &ty::TyS { sty: TyStr, .. }, _) = ty.sty {
2258+
if let Ref(_, &ty::TyS { sty: Str, .. }, _) = ty.sty {
22592259
return ty::tls::with(|tcx| {
22602260
let alloc = tcx.alloc_map.lock().get(ptr.alloc_id);
22612261
if let Some(interpret::AllocType::Memory(alloc)) = alloc {

src/librustc/traits/coherence.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -441,12 +441,12 @@ fn ty_is_local_constructor(ty: Ty, in_crate: InCrate) -> bool {
441441
debug!("ty_is_local_constructor({:?})", ty);
442442

443443
match ty.sty {
444-
ty::TyBool |
445-
ty::TyChar |
446-
ty::TyInt(..) |
447-
ty::TyUint(..) |
448-
ty::TyFloat(..) |
449-
ty::TyStr |
444+
ty::Bool |
445+
ty::Char |
446+
ty::Int(..) |
447+
ty::Uint(..) |
448+
ty::Float(..) |
449+
ty::Str |
450450
ty::FnDef(..) |
451451
ty::FnPtr(_) |
452452
ty::Array(..) |

src/librustc/traits/error_reporting.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,11 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
244244
/// if the type can be equated to any type.
245245
fn type_category<'tcx>(t: Ty<'tcx>) -> Option<u32> {
246246
match t.sty {
247-
ty::TyBool => Some(0),
248-
ty::TyChar => Some(1),
249-
ty::TyStr => Some(2),
250-
ty::TyInt(..) | ty::TyUint(..) | ty::Infer(ty::IntVar(..)) => Some(3),
251-
ty::TyFloat(..) | ty::Infer(ty::FloatVar(..)) => Some(4),
247+
ty::Bool => Some(0),
248+
ty::Char => Some(1),
249+
ty::Str => Some(2),
250+
ty::Int(..) | ty::Uint(..) | ty::Infer(ty::IntVar(..)) => Some(3),
251+
ty::Float(..) | ty::Infer(ty::FloatVar(..)) => Some(4),
252252
ty::Ref(..) | ty::RawPtr(..) => Some(5),
253253
ty::Array(..) | ty::Slice(..) => Some(6),
254254
ty::FnDef(..) | ty::FnPtr(..) => Some(7),

src/librustc/traits/query/dropck_outlives.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -216,18 +216,18 @@ pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'_, '_, 'tcx>, ty: Ty<'tcx>) ->
216216
// execution.
217217
ty::Infer(ty::FreshIntTy(_))
218218
| ty::Infer(ty::FreshFloatTy(_))
219-
| ty::TyBool
220-
| ty::TyInt(_)
221-
| ty::TyUint(_)
222-
| ty::TyFloat(_)
219+
| ty::Bool
220+
| ty::Int(_)
221+
| ty::Uint(_)
222+
| ty::Float(_)
223223
| ty::Never
224224
| ty::FnDef(..)
225225
| ty::FnPtr(_)
226-
| ty::TyChar
226+
| ty::Char
227227
| ty::GeneratorWitness(..)
228228
| ty::RawPtr(_)
229229
| ty::Ref(..)
230-
| ty::TyStr
230+
| ty::Str
231231
| ty::Foreign(..)
232232
| ty::Error => true,
233233

src/librustc/traits/select.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -2180,16 +2180,16 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
21802180

21812181
match self_ty.sty {
21822182
ty::Infer(ty::IntVar(_)) | ty::Infer(ty::FloatVar(_)) |
2183-
ty::TyUint(_) | ty::TyInt(_) | ty::TyBool | ty::TyFloat(_) |
2183+
ty::Uint(_) | ty::Int(_) | ty::Bool | ty::Float(_) |
21842184
ty::FnDef(..) | ty::FnPtr(_) | ty::RawPtr(..) |
2185-
ty::TyChar | ty::Ref(..) | ty::Generator(..) |
2185+
ty::Char | ty::Ref(..) | ty::Generator(..) |
21862186
ty::GeneratorWitness(..) | ty::Array(..) | ty::Closure(..) |
21872187
ty::Never | ty::Error => {
21882188
// safe for everything
21892189
Where(ty::Binder::dummy(Vec::new()))
21902190
}
21912191

2192-
ty::TyStr | ty::Slice(_) | ty::Dynamic(..) | ty::Foreign(..) => None,
2192+
ty::Str | ty::Slice(_) | ty::Dynamic(..) | ty::Foreign(..) => None,
21932193

21942194
ty::Tuple(tys) => {
21952195
Where(ty::Binder::bind(tys.last().into_iter().cloned().collect()))
@@ -2231,14 +2231,14 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
22312231
Where(ty::Binder::dummy(Vec::new()))
22322232
}
22332233

2234-
ty::TyUint(_) | ty::TyInt(_) | ty::TyBool | ty::TyFloat(_) |
2235-
ty::TyChar | ty::RawPtr(..) | ty::Never |
2234+
ty::Uint(_) | ty::Int(_) | ty::Bool | ty::Float(_) |
2235+
ty::Char | ty::RawPtr(..) | ty::Never |
22362236
ty::Ref(_, _, hir::MutImmutable) => {
22372237
// Implementations provided in libcore
22382238
None
22392239
}
22402240

2241-
ty::Dynamic(..) | ty::TyStr | ty::Slice(..) |
2241+
ty::Dynamic(..) | ty::Str | ty::Slice(..) |
22422242
ty::Generator(..) | ty::GeneratorWitness(..) | ty::Foreign(..) |
22432243
ty::Ref(_, _, hir::MutMutable) => {
22442244
None
@@ -2300,18 +2300,18 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
23002300
/// ```
23012301
fn constituent_types_for_ty(&self, t: Ty<'tcx>) -> Vec<Ty<'tcx>> {
23022302
match t.sty {
2303-
ty::TyUint(_) |
2304-
ty::TyInt(_) |
2305-
ty::TyBool |
2306-
ty::TyFloat(_) |
2303+
ty::Uint(_) |
2304+
ty::Int(_) |
2305+
ty::Bool |
2306+
ty::Float(_) |
23072307
ty::FnDef(..) |
23082308
ty::FnPtr(_) |
2309-
ty::TyStr |
2309+
ty::Str |
23102310
ty::Error |
23112311
ty::Infer(ty::IntVar(_)) |
23122312
ty::Infer(ty::FloatVar(_)) |
23132313
ty::Never |
2314-
ty::TyChar => {
2314+
ty::Char => {
23152315
Vec::new()
23162316
}
23172317

src/librustc/ty/cast.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ pub enum CastKind {
6060
impl<'tcx> CastTy<'tcx> {
6161
pub fn from_ty(t: Ty<'tcx>) -> Option<CastTy<'tcx>> {
6262
match t.sty {
63-
ty::TyBool => Some(CastTy::Int(IntTy::Bool)),
64-
ty::TyChar => Some(CastTy::Int(IntTy::Char)),
65-
ty::TyInt(_) => Some(CastTy::Int(IntTy::I)),
63+
ty::Bool => Some(CastTy::Int(IntTy::Bool)),
64+
ty::Char => Some(CastTy::Int(IntTy::Char)),
65+
ty::Int(_) => Some(CastTy::Int(IntTy::I)),
6666
ty::Infer(ty::InferTy::IntVar(_)) => Some(CastTy::Int(IntTy::I)),
6767
ty::Infer(ty::InferTy::FloatVar(_)) => Some(CastTy::Float),
68-
ty::TyUint(u) => Some(CastTy::Int(IntTy::U(u))),
69-
ty::TyFloat(_) => Some(CastTy::Float),
68+
ty::Uint(u) => Some(CastTy::Int(IntTy::U(u))),
69+
ty::Float(_) => Some(CastTy::Float),
7070
ty::Adt(d,_) if d.is_enum() && d.is_payloadfree() =>
7171
Some(CastTy::Int(IntTy::CEnum)),
7272
ty::RawPtr(mt) => Some(CastTy::Ptr(mt)),

0 commit comments

Comments
 (0)