Skip to content

Commit 9813e9c

Browse files
huonwnikomatsakis
authored andcommitted
---
yaml --- r: 171119 b: refs/heads/try c: e957795 h: refs/heads/master i: 171117: 77920c3 171115: be41870 171111: 1724495 171103: d535243 v: v3
1 parent d9a3c06 commit 9813e9c

File tree

19 files changed

+113
-80
lines changed

19 files changed

+113
-80
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 73a25f55ad748b4d3516417c711b99ce446591af
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 5b3cd3900ceda838f5798c30ab96ceb41f962534
5-
refs/heads/try: 2f99a41fe1a27a48e96bc2616ec9faa6de924386
5+
refs/heads/try: e95779554e9d6fc111102df7af80b40f8e22cfae
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/librustc/lint/builtin.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ impl LintPass for TypeLimits {
216216
match lit.node {
217217
ast::LitInt(v, ast::SignedIntLit(_, ast::Plus)) |
218218
ast::LitInt(v, ast::UnsuffixedIntLit(ast::Plus)) => {
219-
let int_type = if t == ast::TyIs {
219+
let int_type = if let ast::TyIs(_) = t {
220220
cx.sess().target.int_type
221221
} else { t };
222222
let (min, max) = int_ty_range(int_type);
@@ -233,7 +233,7 @@ impl LintPass for TypeLimits {
233233
};
234234
},
235235
ty::ty_uint(t) => {
236-
let uint_type = if t == ast::TyUs {
236+
let uint_type = if let ast::TyUs(_) = t {
237237
cx.sess().target.uint_type
238238
} else { t };
239239
let (min, max) = uint_ty_range(uint_type);
@@ -296,7 +296,7 @@ impl LintPass for TypeLimits {
296296
// warnings are consistent between 32- and 64-bit platforms
297297
fn int_ty_range(int_ty: ast::IntTy) -> (i64, i64) {
298298
match int_ty {
299-
ast::TyIs=> (i64::MIN, i64::MAX),
299+
ast::TyIs(_) => (i64::MIN, i64::MAX),
300300
ast::TyI8 => (i8::MIN as i64, i8::MAX as i64),
301301
ast::TyI16 => (i16::MIN as i64, i16::MAX as i64),
302302
ast::TyI32 => (i32::MIN as i64, i32::MAX as i64),
@@ -306,7 +306,7 @@ impl LintPass for TypeLimits {
306306

307307
fn uint_ty_range(uint_ty: ast::UintTy) -> (u64, u64) {
308308
match uint_ty {
309-
ast::TyUs=> (u64::MIN, u64::MAX),
309+
ast::TyUs(_) => (u64::MIN, u64::MAX),
310310
ast::TyU8 => (u8::MIN as u64, u8::MAX as u64),
311311
ast::TyU16 => (u16::MIN as u64, u16::MAX as u64),
312312
ast::TyU32 => (u32::MIN as u64, u32::MAX as u64),
@@ -323,7 +323,7 @@ impl LintPass for TypeLimits {
323323

324324
fn int_ty_bits(int_ty: ast::IntTy, target_int_ty: ast::IntTy) -> u64 {
325325
match int_ty {
326-
ast::TyIs=> int_ty_bits(target_int_ty, target_int_ty),
326+
ast::TyIs(_) => int_ty_bits(target_int_ty, target_int_ty),
327327
ast::TyI8 => i8::BITS as u64,
328328
ast::TyI16 => i16::BITS as u64,
329329
ast::TyI32 => i32::BITS as u64,
@@ -333,7 +333,7 @@ impl LintPass for TypeLimits {
333333

334334
fn uint_ty_bits(uint_ty: ast::UintTy, target_uint_ty: ast::UintTy) -> u64 {
335335
match uint_ty {
336-
ast::TyUs=> uint_ty_bits(target_uint_ty, target_uint_ty),
336+
ast::TyUs(_) => uint_ty_bits(target_uint_ty, target_uint_ty),
337337
ast::TyU8 => u8::BITS as u64,
338338
ast::TyU16 => u16::BITS as u64,
339339
ast::TyU32 => u32::BITS as u64,
@@ -404,12 +404,12 @@ struct ImproperCTypesVisitor<'a, 'tcx: 'a> {
404404
impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
405405
fn check_def(&mut self, sp: Span, ty_id: ast::NodeId, path_id: ast::NodeId) {
406406
match self.cx.tcx.def_map.borrow()[path_id].clone() {
407-
def::DefPrimTy(ast::TyInt(ast::TyIs)) => {
407+
def::DefPrimTy(ast::TyInt(ast::TyIs(_))) => {
408408
self.cx.span_lint(IMPROPER_CTYPES, sp,
409409
"found rust type `isize` in foreign module, while \
410410
libc::c_int or libc::c_long should be used");
411411
}
412-
def::DefPrimTy(ast::TyUint(ast::TyUs)) => {
412+
def::DefPrimTy(ast::TyUint(ast::TyUs(_))) => {
413413
self.cx.span_lint(IMPROPER_CTYPES, sp,
414414
"found rust type `usize` in foreign module, while \
415415
libc::c_uint or libc::c_ulong should be used");

branches/try/src/librustc/metadata/tyencode.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub fn enc_ty<'a, 'tcx>(w: &mut SeekableMemWriter, cx: &ctxt<'a, 'tcx>, t: Ty<'t
6161
ty::ty_char => mywrite!(w, "c"),
6262
ty::ty_int(t) => {
6363
match t {
64-
ast::TyIs => mywrite!(w, "is"),
64+
ast::TyIs(_) => mywrite!(w, "is"),
6565
ast::TyI8 => mywrite!(w, "MB"),
6666
ast::TyI16 => mywrite!(w, "MW"),
6767
ast::TyI32 => mywrite!(w, "ML"),
@@ -70,7 +70,7 @@ pub fn enc_ty<'a, 'tcx>(w: &mut SeekableMemWriter, cx: &ctxt<'a, 'tcx>, t: Ty<'t
7070
}
7171
ty::ty_uint(t) => {
7272
match t {
73-
ast::TyUs => mywrite!(w, "us"),
73+
ast::TyUs(_) => mywrite!(w, "us"),
7474
ast::TyU8 => mywrite!(w, "Mb"),
7575
ast::TyU16 => mywrite!(w, "Mw"),
7676
ast::TyU32 => mywrite!(w, "Ml"),

branches/try/src/librustc/middle/const_eval.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,12 +528,12 @@ pub fn eval_const_expr_partial(tcx: &ty::ctxt, e: &Expr) -> Result<const_val, St
528528

529529
eval_const_expr_partial(tcx, &**base)
530530
.and_then(|val| define_casts!(val, {
531-
ty::ty_int(ast::TyIs) => (int, const_int, i64),
531+
ty::ty_int(ast::TyIs(_)) => (int, const_int, i64),
532532
ty::ty_int(ast::TyI8) => (i8, const_int, i64),
533533
ty::ty_int(ast::TyI16) => (i16, const_int, i64),
534534
ty::ty_int(ast::TyI32) => (i32, const_int, i64),
535535
ty::ty_int(ast::TyI64) => (i64, const_int, i64),
536-
ty::ty_uint(ast::TyUs) => (uint, const_uint, u64),
536+
ty::ty_uint(ast::TyUs(_)) => (uint, const_uint, u64),
537537
ty::ty_uint(ast::TyU8) => (u8, const_uint, u64),
538538
ty::ty_uint(ast::TyU16) => (u16, const_uint, u64),
539539
ty::ty_uint(ast::TyU32) => (u32, const_uint, u64),

branches/try/src/librustc/middle/ty.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2341,12 +2341,12 @@ impl<'tcx> CommonTypes<'tcx> {
23412341
bool: intern_ty(arena, interner, ty_bool),
23422342
char: intern_ty(arena, interner, ty_char),
23432343
err: intern_ty(arena, interner, ty_err),
2344-
int: intern_ty(arena, interner, ty_int(ast::TyIs)),
2344+
int: intern_ty(arena, interner, ty_int(ast::TyIs(_))),
23452345
i8: intern_ty(arena, interner, ty_int(ast::TyI8)),
23462346
i16: intern_ty(arena, interner, ty_int(ast::TyI16)),
23472347
i32: intern_ty(arena, interner, ty_int(ast::TyI32)),
23482348
i64: intern_ty(arena, interner, ty_int(ast::TyI64)),
2349-
uint: intern_ty(arena, interner, ty_uint(ast::TyUs)),
2349+
uint: intern_ty(arena, interner, ty_uint(ast::TyUs(_))),
23502350
u8: intern_ty(arena, interner, ty_uint(ast::TyU8)),
23512351
u16: intern_ty(arena, interner, ty_uint(ast::TyU16)),
23522352
u32: intern_ty(arena, interner, ty_uint(ast::TyU32)),
@@ -2692,7 +2692,7 @@ impl FlagComputation {
26922692

26932693
pub fn mk_mach_int<'tcx>(tcx: &ctxt<'tcx>, tm: ast::IntTy) -> Ty<'tcx> {
26942694
match tm {
2695-
ast::TyIs => tcx.types.int,
2695+
ast::TyIs(_) => tcx.types.int,
26962696
ast::TyI8 => tcx.types.i8,
26972697
ast::TyI16 => tcx.types.i16,
26982698
ast::TyI32 => tcx.types.i32,
@@ -2702,7 +2702,7 @@ pub fn mk_mach_int<'tcx>(tcx: &ctxt<'tcx>, tm: ast::IntTy) -> Ty<'tcx> {
27022702

27032703
pub fn mk_mach_uint<'tcx>(tcx: &ctxt<'tcx>, tm: ast::UintTy) -> Ty<'tcx> {
27042704
match tm {
2705-
ast::TyUs => tcx.types.uint,
2705+
ast::TyUs(_) => tcx.types.uint,
27062706
ast::TyU8 => tcx.types.u8,
27072707
ast::TyU16 => tcx.types.u16,
27082708
ast::TyU32 => tcx.types.u32,
@@ -3363,7 +3363,7 @@ pub fn type_contents<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> TypeContents {
33633363

33643364
let result = match ty.sty {
33653365
// uint and int are ffi-unsafe
3366-
ty_uint(ast::TyUs) | ty_int(ast::TyIs) => {
3366+
ty_uint(ast::TyUs(_)) | ty_int(ast::TyIs(_)) => {
33673367
TC::ReachesFfiUnsafe
33683368
}
33693369

@@ -3937,7 +3937,7 @@ pub fn type_is_fresh(ty: Ty) -> bool {
39373937

39383938
pub fn type_is_uint(ty: Ty) -> bool {
39393939
match ty.sty {
3940-
ty_infer(IntVar(_)) | ty_uint(ast::TyUs) => true,
3940+
ty_infer(IntVar(_)) | ty_uint(ast::TyUs(_)) => true,
39413941
_ => false
39423942
}
39433943
}
@@ -3983,7 +3983,7 @@ pub fn type_is_signed(ty: Ty) -> bool {
39833983

39843984
pub fn type_is_machine(ty: Ty) -> bool {
39853985
match ty.sty {
3986-
ty_int(ast::TyIs) | ty_uint(ast::TyUs) => false,
3986+
ty_int(ast::TyIs(_)) | ty_uint(ast::TyUs(_)) => false,
39873987
ty_int(..) | ty_uint(..) | ty_float(..) => true,
39883988
_ => false
39893989
}

branches/try/src/librustc_resolve/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -819,15 +819,15 @@ impl PrimitiveTypeTable {
819819
table.intern("char", TyChar);
820820
table.intern("f32", TyFloat(TyF32));
821821
table.intern("f64", TyFloat(TyF64));
822-
table.intern("int", TyInt(TyIs));
823-
table.intern("isize", TyInt(TyIs));
822+
table.intern("int", TyInt(TyIs(true)));
823+
table.intern("isize", TyInt(TyIs(false)));
824824
table.intern("i8", TyInt(TyI8));
825825
table.intern("i16", TyInt(TyI16));
826826
table.intern("i32", TyInt(TyI32));
827827
table.intern("i64", TyInt(TyI64));
828828
table.intern("str", TyStr);
829-
table.intern("uint", TyUint(TyUs));
830-
table.intern("usize", TyUint(TyUs));
829+
table.intern("uint", TyUint(TyUs(true)));
830+
table.intern("usize", TyUint(TyUs(false)));
831831
table.intern("u8", TyUint(TyU8));
832832
table.intern("u16", TyUint(TyU16));
833833
table.intern("u32", TyUint(TyU32));

branches/try/src/librustc_trans/trans/base.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -917,8 +917,8 @@ pub fn fail_if_zero_or_overflows<'blk, 'tcx>(
917917
ty::ty_int(t) => {
918918
let llty = Type::int_from_ty(cx.ccx(), t);
919919
let min = match t {
920-
ast::TyIs if llty == Type::i32(cx.ccx()) => i32::MIN as u64,
921-
ast::TyIs => i64::MIN as u64,
920+
ast::TyIs(_) if llty == Type::i32(cx.ccx()) => i32::MIN as u64,
921+
ast::TyIs(_) => i64::MIN as u64,
922922
ast::TyI8 => i8::MIN as u64,
923923
ast::TyI16 => i16::MIN as u64,
924924
ast::TyI32 => i32::MIN as u64,

branches/try/src/librustc_trans/trans/debuginfo.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,14 +1804,14 @@ fn basic_type_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
18041804
ty::ty_bool => ("bool".to_string(), DW_ATE_boolean),
18051805
ty::ty_char => ("char".to_string(), DW_ATE_unsigned_char),
18061806
ty::ty_int(int_ty) => match int_ty {
1807-
ast::TyIs => ("isize".to_string(), DW_ATE_signed),
1807+
ast::TyIs(_) => ("isize".to_string(), DW_ATE_signed),
18081808
ast::TyI8 => ("i8".to_string(), DW_ATE_signed),
18091809
ast::TyI16 => ("i16".to_string(), DW_ATE_signed),
18101810
ast::TyI32 => ("i32".to_string(), DW_ATE_signed),
18111811
ast::TyI64 => ("i64".to_string(), DW_ATE_signed)
18121812
},
18131813
ty::ty_uint(uint_ty) => match uint_ty {
1814-
ast::TyUs => ("usize".to_string(), DW_ATE_unsigned),
1814+
ast::TyUs(_) => ("usize".to_string(), DW_ATE_unsigned),
18151815
ast::TyU8 => ("u8".to_string(), DW_ATE_unsigned),
18161816
ast::TyU16 => ("u16".to_string(), DW_ATE_unsigned),
18171817
ast::TyU32 => ("u32".to_string(), DW_ATE_unsigned),
@@ -3739,12 +3739,12 @@ fn push_debuginfo_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
37393739
ty::ty_bool => output.push_str("bool"),
37403740
ty::ty_char => output.push_str("char"),
37413741
ty::ty_str => output.push_str("str"),
3742-
ty::ty_int(ast::TyIs) => output.push_str("isize"),
3742+
ty::ty_int(ast::TyIs(_)) => output.push_str("isize"),
37433743
ty::ty_int(ast::TyI8) => output.push_str("i8"),
37443744
ty::ty_int(ast::TyI16) => output.push_str("i16"),
37453745
ty::ty_int(ast::TyI32) => output.push_str("i32"),
37463746
ty::ty_int(ast::TyI64) => output.push_str("i64"),
3747-
ty::ty_uint(ast::TyUs) => output.push_str("usize"),
3747+
ty::ty_uint(ast::TyUs(_)) => output.push_str("usize"),
37483748
ty::ty_uint(ast::TyU8) => output.push_str("u8"),
37493749
ty::ty_uint(ast::TyU16) => output.push_str("u16"),
37503750
ty::ty_uint(ast::TyU32) => output.push_str("u32"),

branches/try/src/librustc_trans/trans/type_.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ impl Type {
112112

113113
pub fn int_from_ty(ccx: &CrateContext, t: ast::IntTy) -> Type {
114114
match t {
115-
ast::TyIs => ccx.int_type(),
115+
ast::TyIs(_) => ccx.int_type(),
116116
ast::TyI8 => Type::i8(ccx),
117117
ast::TyI16 => Type::i16(ccx),
118118
ast::TyI32 => Type::i32(ccx),
@@ -122,7 +122,7 @@ impl Type {
122122

123123
pub fn uint_from_ty(ccx: &CrateContext, t: ast::UintTy) -> Type {
124124
match t {
125-
ast::TyUs => ccx.int_type(),
125+
ast::TyUs(_) => ccx.int_type(),
126126
ast::TyU8 => Type::i8(ccx),
127127
ast::TyU16 => Type::i16(ccx),
128128
ast::TyU32 => Type::i32(ccx),

branches/try/src/librustc_trans/trans/type_of.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ pub fn type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>) -> Type {
263263
}
264264

265265
match unsized_part_of_type(cx.tcx(), t).sty {
266-
ty::ty_str | ty::ty_vec(..) => Type::uint_from_ty(cx, ast::TyUs),
266+
ty::ty_str | ty::ty_vec(..) => Type::uint_from_ty(cx, ast::TyUs(_)),
267267
ty::ty_trait(_) => Type::vtable_ptr(cx),
268268
_ => panic!("Unexpected type returned from unsized_part_of_type : {}",
269269
t.repr(cx.tcx()))

branches/try/src/librustc_typeck/check/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2442,7 +2442,7 @@ fn try_index_step<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
24422442

24432443
// First, try built-in indexing.
24442444
match (ty::index(adjusted_ty), &index_ty.sty) {
2445-
(Some(ty), &ty::ty_uint(ast::TyUs)) | (Some(ty), &ty::ty_infer(ty::IntVar(_))) => {
2445+
(Some(ty), &ty::ty_uint(ast::TyUs(_))) | (Some(ty), &ty::ty_infer(ty::IntVar(_))) => {
24462446
debug!("try_index_step: success, using built-in indexing");
24472447
fcx.write_adjustment(base_expr.id, base_expr.span, ty::AdjustDerefRef(adjustment));
24482448
return Some((tcx.types.uint, ty));
@@ -4770,7 +4770,7 @@ pub fn check_enum_variants(ccx: &CrateCtxt,
47704770
ast::TyU16 => disr as u16 as Disr == disr,
47714771
ast::TyU32 => disr as u32 as Disr == disr,
47724772
ast::TyU64 => disr as u64 as Disr == disr,
4773-
ast::TyUs => uint_in_range(ccx, ccx.tcx.sess.target.uint_type, disr)
4773+
ast::TyUs(_) => uint_in_range(ccx, ccx.tcx.sess.target.uint_type, disr)
47744774
}
47754775
}
47764776
fn int_in_range(ccx: &CrateCtxt, ty: ast::IntTy, disr: ty::Disr) -> bool {
@@ -4779,7 +4779,7 @@ pub fn check_enum_variants(ccx: &CrateCtxt,
47794779
ast::TyI16 => disr as i16 as Disr == disr,
47804780
ast::TyI32 => disr as i32 as Disr == disr,
47814781
ast::TyI64 => disr as i64 as Disr == disr,
4782-
ast::TyIs => int_in_range(ccx, ccx.tcx.sess.target.int_type, disr)
4782+
ast::TyIs(_) => int_in_range(ccx, ccx.tcx.sess.target.int_type, disr)
47834783
}
47844784
}
47854785
match ty {

branches/try/src/librustdoc/clean/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,12 +1389,12 @@ impl<'tcx> Clean<Type> for ty::Ty<'tcx> {
13891389
match self.sty {
13901390
ty::ty_bool => Primitive(Bool),
13911391
ty::ty_char => Primitive(Char),
1392-
ty::ty_int(ast::TyIs) => Primitive(Isize),
1392+
ty::ty_int(ast::TyIs(_)) => Primitive(Isize),
13931393
ty::ty_int(ast::TyI8) => Primitive(I8),
13941394
ty::ty_int(ast::TyI16) => Primitive(I16),
13951395
ty::ty_int(ast::TyI32) => Primitive(I32),
13961396
ty::ty_int(ast::TyI64) => Primitive(I64),
1397-
ty::ty_uint(ast::TyUs) => Primitive(Usize),
1397+
ty::ty_uint(ast::TyUs(_)) => Primitive(Usize),
13981398
ty::ty_uint(ast::TyU8) => Primitive(U8),
13991399
ty::ty_uint(ast::TyU16) => Primitive(U16),
14001400
ty::ty_uint(ast::TyU32) => Primitive(U32),
@@ -2269,12 +2269,12 @@ fn resolve_type(cx: &DocContext,
22692269
ast::TyStr => return Primitive(Str),
22702270
ast::TyBool => return Primitive(Bool),
22712271
ast::TyChar => return Primitive(Char),
2272-
ast::TyInt(ast::TyIs) => return Primitive(Isize),
2272+
ast::TyInt(ast::TyIs(_)) => return Primitive(Isize),
22732273
ast::TyInt(ast::TyI8) => return Primitive(I8),
22742274
ast::TyInt(ast::TyI16) => return Primitive(I16),
22752275
ast::TyInt(ast::TyI32) => return Primitive(I32),
22762276
ast::TyInt(ast::TyI64) => return Primitive(I64),
2277-
ast::TyUint(ast::TyUs) => return Primitive(Usize),
2277+
ast::TyUint(ast::TyUs(_)) => return Primitive(Usize),
22782278
ast::TyUint(ast::TyU8) => return Primitive(U8),
22792279
ast::TyUint(ast::TyU16) => return Primitive(U16),
22802280
ast::TyUint(ast::TyU32) => return Primitive(U32),

branches/try/src/libsyntax/ast.rs

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,15 +1075,29 @@ pub struct Typedef {
10751075
pub typ: P<Ty>,
10761076
}
10771077

1078-
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]
1078+
#[derive(Clone, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]
10791079
pub enum IntTy {
1080-
TyIs,
1080+
TyIs(bool /* is this deprecated `int`? */),
10811081
TyI8,
10821082
TyI16,
10831083
TyI32,
10841084
TyI64,
10851085
}
10861086

1087+
impl PartialEq for IntTy {
1088+
fn eq(&self, other: &IntTy) -> bool {
1089+
match (*self, *other) {
1090+
// true/false need to compare the same, so this can't be derived
1091+
(TyIs(_), TyIs(_)) |
1092+
(TyI8, TyI8) |
1093+
(TyI16, TyI16) |
1094+
(TyI32, TyI32) |
1095+
(TyI64, TyI64) => true,
1096+
_ => false
1097+
}
1098+
}
1099+
}
1100+
10871101
impl fmt::Show for IntTy {
10881102
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
10891103
fmt::String::fmt(self, f)
@@ -1099,27 +1113,41 @@ impl fmt::String for IntTy {
10991113
impl IntTy {
11001114
pub fn suffix_len(&self) -> uint {
11011115
match *self {
1102-
TyIs => 1,
1103-
TyI8 => 2,
1116+
TyIs(true) /* i */ => 1,
1117+
TyIs(false) /* is */ | TyI8 => 2,
11041118
TyI16 | TyI32 | TyI64 => 3,
11051119
}
11061120
}
11071121
}
11081122

1109-
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]
1123+
#[derive(Clone, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]
11101124
pub enum UintTy {
1111-
TyUs,
1125+
TyUs(bool /* is this deprecated uint? */),
11121126
TyU8,
11131127
TyU16,
11141128
TyU32,
11151129
TyU64,
11161130
}
11171131

1132+
impl PartialEq for UintTy {
1133+
fn eq(&self, other: &UintTy) -> bool {
1134+
match (*self, *other) {
1135+
// true/false need to compare the same, so this can't be derived
1136+
(TyUs(_), TyUs(_)) |
1137+
(TyU8, TyU8) |
1138+
(TyU16, TyU16) |
1139+
(TyU32, TyU32) |
1140+
(TyU64, TyU64) => true,
1141+
_ => false
1142+
}
1143+
}
1144+
}
1145+
11181146
impl UintTy {
11191147
pub fn suffix_len(&self) -> uint {
11201148
match *self {
1121-
TyUs => 1,
1122-
TyU8 => 2,
1149+
TyUs(true) /* u */ => 1,
1150+
TyUs(false) /* us */ | TyU8 => 2,
11231151
TyU16 | TyU32 | TyU64 => 3,
11241152
}
11251153
}

0 commit comments

Comments
 (0)