about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2015-02-18 14:13:38 -0500
committerNiko Matsakis <niko@alum.mit.edu>2015-02-18 15:08:40 -0500
commit811c48fe22ffbe4ca45c32807c846d9a7c02a8f3 (patch)
tree57ae57975750ae6674ed286857dd457f1ac99530 /src/libsyntax/parse
parent362d71302615b07c96189e998a554e90d3f3506c (diff)
downloadrust-811c48fe22ffbe4ca45c32807c846d9a7c02a8f3.tar.gz
rust-811c48fe22ffbe4ca45c32807c846d9a7c02a8f3.zip
For now, accept the `i`, `u`, `is`, and `us` suffixes, but warn when
they are used without a feature-gate. This is both kinder to existing
code and should make it easier to land this PR, since we don't
have to catch EVERY SINGLE SUFFIX.
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/mod.rs15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index e3bed496647..6ea23cf3f04 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -711,6 +711,8 @@ pub fn integer_lit(s: &str, suffix: Option<&str>, sd: &SpanHandler, sp: Span) ->
             "u16" => ast::UnsignedIntLit(ast::TyU16),
             "u32" => ast::UnsignedIntLit(ast::TyU32),
             "u64" => ast::UnsignedIntLit(ast::TyU64),
+            "i" | "is" => ast::SignedIntLit(ast::TyIs(true), ast::Plus),
+            "u" | "us" => ast::UnsignedIntLit(ast::TyUs(true)),
             _ => {
                 // i<digits> and u<digits> look like widths, so lets
                 // give an error message along those lines
@@ -720,17 +722,8 @@ pub fn integer_lit(s: &str, suffix: Option<&str>, sd: &SpanHandler, sp: Span) ->
                                               &suf[1..]));
                 } else {
                     sd.span_err(sp, &*format!("illegal suffix `{}` for numeric literal", suf));
-
-                    if suf == "i" || suf == "is" {
-                        sd.span_help(sp, "per RFC 544/573, the suffix \
-                                          for `isize` literals is now `isize`");
-                    } else if suf == "u" || suf == "us" {
-                        sd.span_help(sp, "per RFC 544/573, the suffix \
-                                          for `usize` literals is now `usize`");
-                    } else {
-                        sd.span_help(sp, "the suffix must be one of the integral types \
-                                          (`u32`, `isize`, etc)");
-                    }
+                    sd.span_help(sp, "the suffix must be one of the integral types \
+                                      (`u32`, `isize`, etc)");
                 }
 
                 ty