diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-02-18 14:35:01 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-02-18 14:35:01 -0800 |
| commit | 5250a82f7917d6f9ec590e7e762bfd036e21ef74 (patch) | |
| tree | 38ce94117b42eb159b630d0a97748b5f3056fbe5 /src/libsyntax/parse | |
| parent | 5a32b4a34fc6fbd78e293b16f7ba7d06caca7a48 (diff) | |
| parent | 811c48fe22ffbe4ca45c32807c846d9a7c02a8f3 (diff) | |
| download | rust-5250a82f7917d6f9ec590e7e762bfd036e21ef74.tar.gz rust-5250a82f7917d6f9ec590e7e762bfd036e21ef74.zip | |
rollup merge of #22497: nikomatsakis/suffixes
Conflicts: src/librustc_trans/trans/tvec.rs
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 5f4cf9af5ee..6ea23cf3f04 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -701,18 +701,18 @@ 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::TyIs(true), ast::Plus), - "is" => ast::SignedIntLit(ast::TyIs(false), ast::Plus), + "isize" => ast::SignedIntLit(ast::TyIs(false), 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::TyUs(true)), - "us" => ast::UnsignedIntLit(ast::TyUs(false)), + "usize" => ast::UnsignedIntLit(ast::TyUs(false)), "u8" => ast::UnsignedIntLit(ast::TyU8), "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 @@ -722,6 +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)); + sd.span_help(sp, "the suffix must be one of the integral types \ + (`u32`, `isize`, etc)"); } ty |
