about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2019-01-11 21:19:44 -0800
committerEsteban Küber <esteban@kuber.com.ar>2019-01-11 21:19:44 -0800
commit8bede50f23d1b53cd34356a4d3b57bb775304b57 (patch)
tree194e0f39a9dc1356b2b3471099c6f64d380e539c
parent65a8d7b1d8e5acb494c0313829f173657fd0d5b8 (diff)
downloadrust-8bede50f23d1b53cd34356a4d3b57bb775304b57.tar.gz
rust-8bede50f23d1b53cd34356a4d3b57bb775304b57.zip
Continue evaluating after incorrect float literal
-rw-r--r--src/libsyntax/parse/mod.rs6
-rw-r--r--src/test/ui/parser/lex-bad-numeric-literals.stderr6
-rw-r--r--src/test/ui/parser/no-binary-float-literal.rs5
-rw-r--r--src/test/ui/parser/no-binary-float-literal.stderr18
-rw-r--r--src/test/ui/parser/no-hex-float-literal.rs6
-rw-r--r--src/test/ui/parser/no-hex-float-literal.stderr25
6 files changed, 54 insertions, 12 deletions
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index ba5676a65d7..48184f6d918 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -673,7 +673,11 @@ fn integer_lit(s: &str, suffix: Option<Symbol>, diag: Option<(Span, &Handler)>)
                 _ => None,
             };
             if let Some(err) = err {
-                err!(diag, |span, diag| diag.span_err(span, err));
+                err!(diag, |span, diag| {
+                    diag.struct_span_err(span, err)
+                        .span_label(span, "not supported")
+                        .emit();
+                });
             }
             return filtered_float_lit(Symbol::intern(s), Some(suf), diag)
         }
diff --git a/src/test/ui/parser/lex-bad-numeric-literals.stderr b/src/test/ui/parser/lex-bad-numeric-literals.stderr
index b1a91705533..1fa23b8b73c 100644
--- a/src/test/ui/parser/lex-bad-numeric-literals.stderr
+++ b/src/test/ui/parser/lex-bad-numeric-literals.stderr
@@ -110,7 +110,7 @@ error: octal float literal is not supported
   --> $DIR/lex-bad-numeric-literals.rs:5:5
    |
 LL |     0o2f32; //~ ERROR: octal float literal is not supported
-   |     ^^^^^^
+   |     ^^^^^^ not supported
 
 error: int literal is too large
   --> $DIR/lex-bad-numeric-literals.rs:16:5
@@ -128,13 +128,13 @@ error: octal float literal is not supported
   --> $DIR/lex-bad-numeric-literals.rs:23:5
    |
 LL |     0o123f64; //~ ERROR: octal float literal is not supported
-   |     ^^^^^^^^
+   |     ^^^^^^^^ not supported
 
 error: binary float literal is not supported
   --> $DIR/lex-bad-numeric-literals.rs:25:5
    |
 LL |     0b101f64; //~ ERROR: binary float literal is not supported
-   |     ^^^^^^^^
+   |     ^^^^^^^^ not supported
 
 error: aborting due to 23 previous errors
 
diff --git a/src/test/ui/parser/no-binary-float-literal.rs b/src/test/ui/parser/no-binary-float-literal.rs
index c078bf5f63e..a42d2cbc442 100644
--- a/src/test/ui/parser/no-binary-float-literal.rs
+++ b/src/test/ui/parser/no-binary-float-literal.rs
@@ -1,7 +1,8 @@
-// error-pattern:binary float literal is not supported
-
 fn main() {
     0b101010f64;
+    //~^ ERROR binary float literal is not supported
     0b101.010;
+    //~^ ERROR binary float literal is not supported
     0b101p4f64;
+    //~^ ERROR invalid suffix `p4f64` for numeric literal
 }
diff --git a/src/test/ui/parser/no-binary-float-literal.stderr b/src/test/ui/parser/no-binary-float-literal.stderr
index 7ff3e28ccb6..90f4171f88d 100644
--- a/src/test/ui/parser/no-binary-float-literal.stderr
+++ b/src/test/ui/parser/no-binary-float-literal.stderr
@@ -1,8 +1,22 @@
 error: binary float literal is not supported
-  --> $DIR/no-binary-float-literal.rs:5:5
+  --> $DIR/no-binary-float-literal.rs:4:5
    |
 LL |     0b101.010;
    |     ^^^^^^^^^
 
-error: aborting due to previous error
+error: binary float literal is not supported
+  --> $DIR/no-binary-float-literal.rs:2:5
+   |
+LL |     0b101010f64;
+   |     ^^^^^^^^^^^ not supported
+
+error: invalid suffix `p4f64` for numeric literal
+  --> $DIR/no-binary-float-literal.rs:6:5
+   |
+LL |     0b101p4f64;
+   |     ^^^^^^^^^^
+   |
+   = help: the suffix must be one of the integral types (`u32`, `isize`, etc)
+
+error: aborting due to 3 previous errors
 
diff --git a/src/test/ui/parser/no-hex-float-literal.rs b/src/test/ui/parser/no-hex-float-literal.rs
index d830c96fc2f..bf11dee0833 100644
--- a/src/test/ui/parser/no-hex-float-literal.rs
+++ b/src/test/ui/parser/no-hex-float-literal.rs
@@ -1,7 +1,9 @@
-// error-pattern:hexadecimal float literal is not supported
-
 fn main() {
     0xABC.Df;
+    //~^ ERROR `{integer}` is a primitive type and therefore doesn't have fields
     0x567.89;
+    //~^ ERROR hexadecimal float literal is not supported
     0xDEAD.BEEFp-2f;
+    //~^ ERROR invalid suffix `f` for float literal
+    //~| ERROR `{integer}` is a primitive type and therefore doesn't have fields
 }
diff --git a/src/test/ui/parser/no-hex-float-literal.stderr b/src/test/ui/parser/no-hex-float-literal.stderr
index 1668cfe5a33..11e911f5ecb 100644
--- a/src/test/ui/parser/no-hex-float-literal.stderr
+++ b/src/test/ui/parser/no-hex-float-literal.stderr
@@ -1,8 +1,29 @@
 error: hexadecimal float literal is not supported
-  --> $DIR/no-hex-float-literal.rs:5:5
+  --> $DIR/no-hex-float-literal.rs:4:5
    |
 LL |     0x567.89;
    |     ^^^^^^^^
 
-error: aborting due to previous error
+error: invalid suffix `f` for float literal
+  --> $DIR/no-hex-float-literal.rs:6:18
+   |
+LL |     0xDEAD.BEEFp-2f;
+   |                  ^^
+   |
+   = help: valid suffixes are `f32` and `f64`
+
+error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
+  --> $DIR/no-hex-float-literal.rs:2:11
+   |
+LL |     0xABC.Df;
+   |           ^^
+
+error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
+  --> $DIR/no-hex-float-literal.rs:6:12
+   |
+LL |     0xDEAD.BEEFp-2f;
+   |            ^^^^^
+
+error: aborting due to 4 previous errors
 
+For more information about this error, try `rustc --explain E0610`.