about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-01-06 15:07:48 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-01-06 15:07:48 -0800
commit5f27b500800fc2720c5caa4a0cd5dcc46c0b911f (patch)
treedd42329ccb6a18d64ba7ce983605e3e67f507d81 /src/libsyntax
parent1afe8a4fb86fe54be8008b033de166d9c1f8f650 (diff)
parent5a4ca319185a3f399986bc5e5a2d0a96fac583ae (diff)
downloadrust-5f27b500800fc2720c5caa4a0cd5dcc46c0b911f.tar.gz
rust-5f27b500800fc2720c5caa4a0cd5dcc46c0b911f.zip
rollup merge of #20609: cmr/mem
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast.rs8
-rw-r--r--src/libsyntax/ast_util.rs12
-rw-r--r--src/libsyntax/attr.rs8
-rw-r--r--src/libsyntax/ext/build.rs4
-rw-r--r--src/libsyntax/ext/deriving/generic/mod.rs2
-rw-r--r--src/libsyntax/ext/quote.rs4
-rw-r--r--src/libsyntax/parse/mod.rs6
7 files changed, 24 insertions, 20 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index da3744d83f5..753e60738f6 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -1087,7 +1087,7 @@ pub struct Typedef {
 
 #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]
 pub enum IntTy {
-    TyI,
+    TyIs,
     TyI8,
     TyI16,
     TyI32,
@@ -1103,7 +1103,7 @@ impl fmt::Show for IntTy {
 impl IntTy {
     pub fn suffix_len(&self) -> uint {
         match *self {
-            TyI => 1,
+            TyIs => 1,
             TyI8 => 2,
             TyI16 | TyI32 | TyI64  => 3,
         }
@@ -1112,7 +1112,7 @@ impl IntTy {
 
 #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]
 pub enum UintTy {
-    TyU,
+    TyUs,
     TyU8,
     TyU16,
     TyU32,
@@ -1122,7 +1122,7 @@ pub enum UintTy {
 impl UintTy {
     pub fn suffix_len(&self) -> uint {
         match *self {
-            TyU => 1,
+            TyUs => 1,
             TyU8 => 2,
             TyU16 | TyU32 | TyU64  => 3,
         }
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs
index aad6f115206..871f1237aee 100644
--- a/src/libsyntax/ast_util.rs
+++ b/src/libsyntax/ast_util.rs
@@ -120,8 +120,8 @@ pub fn is_path(e: P<Expr>) -> bool {
 /// We want to avoid "45int" and "-3int" in favor of "45" and "-3"
 pub fn int_ty_to_string(t: IntTy, val: Option<i64>) -> String {
     let s = match t {
-        TyI if val.is_some() => "i",
-        TyI => "int",
+        TyIs if val.is_some() => "is",
+        TyIs => "isize",
         TyI8 => "i8",
         TyI16 => "i16",
         TyI32 => "i32",
@@ -141,7 +141,7 @@ pub fn int_ty_max(t: IntTy) -> u64 {
     match t {
         TyI8 => 0x80u64,
         TyI16 => 0x8000u64,
-        TyI | TyI32 => 0x80000000u64, // actually ni about TyI
+        TyIs | TyI32 => 0x80000000u64, // actually ni about TyIs
         TyI64 => 0x8000000000000000u64
     }
 }
@@ -150,8 +150,8 @@ pub fn int_ty_max(t: IntTy) -> u64 {
 /// We want to avoid "42uint" in favor of "42u"
 pub fn uint_ty_to_string(t: UintTy, val: Option<u64>) -> String {
     let s = match t {
-        TyU if val.is_some() => "u",
-        TyU => "uint",
+        TyUs if val.is_some() => "us",
+        TyUs => "usize",
         TyU8 => "u8",
         TyU16 => "u16",
         TyU32 => "u32",
@@ -168,7 +168,7 @@ pub fn uint_ty_max(t: UintTy) -> u64 {
     match t {
         TyU8 => 0xffu64,
         TyU16 => 0xffffu64,
-        TyU | TyU32 => 0xffffffffu64, // actually ni about TyU
+        TyUs | TyU32 => 0xffffffffu64, // actually ni about TyUs
         TyU64 => 0xffffffffffffffffu64
     }
 }
diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs
index 68bbde35ae6..c5cffc401a1 100644
--- a/src/libsyntax/attr.rs
+++ b/src/libsyntax/attr.rs
@@ -457,8 +457,10 @@ fn int_type_of_word(s: &str) -> Option<IntType> {
         "u32" => Some(UnsignedInt(ast::TyU32)),
         "i64" => Some(SignedInt(ast::TyI64)),
         "u64" => Some(UnsignedInt(ast::TyU64)),
-        "int" => Some(SignedInt(ast::TyI)),
-        "uint" => Some(UnsignedInt(ast::TyU)),
+        "int" => Some(SignedInt(ast::TyIs)),
+        "uint" => Some(UnsignedInt(ast::TyUs)),
+        "isize" => Some(SignedInt(ast::TyIs)),
+        "usize" => Some(UnsignedInt(ast::TyUs)),
         _ => None
     }
 }
@@ -502,7 +504,7 @@ impl IntType {
             SignedInt(ast::TyI16) | UnsignedInt(ast::TyU16) |
             SignedInt(ast::TyI32) | UnsignedInt(ast::TyU32) |
             SignedInt(ast::TyI64) | UnsignedInt(ast::TyU64) => true,
-            SignedInt(ast::TyI) | UnsignedInt(ast::TyU) => false
+            SignedInt(ast::TyIs) | UnsignedInt(ast::TyUs) => false
         }
     }
 }
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index e3561e86070..bd4f295401c 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -642,10 +642,10 @@ impl<'a> AstBuilder for ExtCtxt<'a> {
         self.expr(sp, ast::ExprLit(P(respan(sp, lit))))
     }
     fn expr_uint(&self, span: Span, i: uint) -> P<ast::Expr> {
-        self.expr_lit(span, ast::LitInt(i as u64, ast::UnsignedIntLit(ast::TyU)))
+        self.expr_lit(span, ast::LitInt(i as u64, ast::UnsignedIntLit(ast::TyUs)))
     }
     fn expr_int(&self, sp: Span, i: int) -> P<ast::Expr> {
-        self.expr_lit(sp, ast::LitInt(i as u64, ast::SignedIntLit(ast::TyI, ast::Sign::new(i))))
+        self.expr_lit(sp, ast::LitInt(i as u64, ast::SignedIntLit(ast::TyIs, ast::Sign::new(i))))
     }
     fn expr_u8(&self, sp: Span, u: u8) -> P<ast::Expr> {
         self.expr_lit(sp, ast::LitInt(u as u64, ast::UnsignedIntLit(ast::TyU8)))
diff --git a/src/libsyntax/ext/deriving/generic/mod.rs b/src/libsyntax/ext/deriving/generic/mod.rs
index 8ef9a7dc012..8f13a4475b7 100644
--- a/src/libsyntax/ext/deriving/generic/mod.rs
+++ b/src/libsyntax/ext/deriving/generic/mod.rs
@@ -1031,7 +1031,7 @@ impl<'a> MethodDef<'a> {
             let arms: Vec<ast::Arm> = variants.iter().enumerate()
                 .map(|(index, variant)| {
                     let pat = variant_to_pat(cx, sp, type_ident, &**variant);
-                    let lit = ast::LitInt(index as u64, ast::UnsignedIntLit(ast::TyU));
+                    let lit = ast::LitInt(index as u64, ast::UnsignedIntLit(ast::TyUs));
                     cx.arm(sp, vec![pat], cx.expr_lit(sp, lit))
                 }).collect();
 
diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs
index 66c7381e433..77aea0c370a 100644
--- a/src/libsyntax/ext/quote.rs
+++ b/src/libsyntax/ext/quote.rs
@@ -273,13 +273,13 @@ pub mod rt {
         );
     }
 
-    impl_to_source_int! { signed, int, TyI }
+    impl_to_source_int! { signed, int, TyIs }
     impl_to_source_int! { signed, i8,  TyI8 }
     impl_to_source_int! { signed, i16, TyI16 }
     impl_to_source_int! { signed, i32, TyI32 }
     impl_to_source_int! { signed, i64, TyI64 }
 
-    impl_to_source_int! { unsigned, uint, TyU }
+    impl_to_source_int! { unsigned, uint, TyUs }
     impl_to_source_int! { unsigned, u8,   TyU8 }
     impl_to_source_int! { unsigned, u16,  TyU16 }
     impl_to_source_int! { unsigned, u32,  TyU32 }
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index d4650a4bb03..b79f59cc0c1 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -701,12 +701,14 @@ pub fn integer_lit(s: &str, suffix: Option<&str>, sd: &SpanHandler, sp: Span) ->
     if let Some(suf) = suffix {
         if suf.is_empty() { sd.span_bug(sp, "found empty literal suffix in Some")}
         ty = match suf {
-            "i"   => ast::SignedIntLit(ast::TyI, ast::Plus),
+            "i"   => ast::SignedIntLit(ast::TyIs, ast::Plus),
+            "is"   => ast::SignedIntLit(ast::TyIs, ast::Plus),
             "i8"  => ast::SignedIntLit(ast::TyI8, ast::Plus),
             "i16" => ast::SignedIntLit(ast::TyI16, ast::Plus),
             "i32" => ast::SignedIntLit(ast::TyI32, ast::Plus),
             "i64" => ast::SignedIntLit(ast::TyI64, ast::Plus),
-            "u"   => ast::UnsignedIntLit(ast::TyU),
+            "u"   => ast::UnsignedIntLit(ast::TyUs),
+            "us"   => ast::UnsignedIntLit(ast::TyUs),
             "u8"  => ast::UnsignedIntLit(ast::TyU8),
             "u16" => ast::UnsignedIntLit(ast::TyU16),
             "u32" => ast::UnsignedIntLit(ast::TyU32),