about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2021-11-20 22:33:49 +0100
committerGitHub <noreply@github.com>2021-11-20 22:33:49 +0100
commit410d64fe9eab1c2833b5c0371b8633587fcb6aa5 (patch)
tree429c657b0ef497097a961d65b017cb83ddaaeed0
parent09d9c098e0b38fb4b41a22a9bc8d19957be0503d (diff)
parent5f6059d9a2433042ffeeec1eb42c94c5f1e75135 (diff)
downloadrust-410d64fe9eab1c2833b5c0371b8633587fcb6aa5.tar.gz
rust-410d64fe9eab1c2833b5c0371b8633587fcb6aa5.zip
Rollup merge of #90927 - terrarier2111:fix-float-ice, r=jackh726
Fix float ICE

This fixes https://github.com/rust-lang/rust/issues/90728
-rw-r--r--compiler/rustc_parse/src/parser/expr.rs2
-rw-r--r--src/test/ui/parser/issue-90728.rs6
-rw-r--r--src/test/ui/parser/issue-90728.stderr20
-rw-r--r--src/tools/tidy/src/ui_tests.rs2
4 files changed, 29 insertions, 1 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs
index 3d29d305021..0c8c45410bd 100644
--- a/compiler/rustc_parse/src/parser/expr.rs
+++ b/compiler/rustc_parse/src/parser/expr.rs
@@ -1032,6 +1032,8 @@ impl<'a> Parser<'a> {
             [IdentLike(_), Punct('+' | '-')] |
             // 1e+2 | 1e-2
             [IdentLike(_), Punct('+' | '-'), IdentLike(_)] |
+            // 1.2e+ | 1.2e-
+            [IdentLike(_), Punct('.'), IdentLike(_), Punct('+' | '-')] |
             // 1.2e+3 | 1.2e-3
             [IdentLike(_), Punct('.'), IdentLike(_), Punct('+' | '-'), IdentLike(_)] => {
                 // See the FIXME about `TokenCursor` above.
diff --git a/src/test/ui/parser/issue-90728.rs b/src/test/ui/parser/issue-90728.rs
new file mode 100644
index 00000000000..d6a898361cc
--- /dev/null
+++ b/src/test/ui/parser/issue-90728.rs
@@ -0,0 +1,6 @@
+fn main() {
+    a.5.2E+
+    //~^ ERROR: unexpected token: `5.2E+`
+    //~| ERROR: expected one of `.`, `;`, `?`, `}`, or an operator, found `5.2E+`
+    //~| ERROR: expected at least one digit in exponent
+}
diff --git a/src/test/ui/parser/issue-90728.stderr b/src/test/ui/parser/issue-90728.stderr
new file mode 100644
index 00000000000..b55c4603066
--- /dev/null
+++ b/src/test/ui/parser/issue-90728.stderr
@@ -0,0 +1,20 @@
+error: expected at least one digit in exponent
+  --> $DIR/issue-90728.rs:2:7
+   |
+LL |     a.5.2E+
+   |       ^^^^^
+
+error: unexpected token: `5.2E+`
+  --> $DIR/issue-90728.rs:2:7
+   |
+LL |     a.5.2E+
+   |       ^^^^^
+
+error: expected one of `.`, `;`, `?`, `}`, or an operator, found `5.2E+`
+  --> $DIR/issue-90728.rs:2:7
+   |
+LL |     a.5.2E+
+   |       ^^^^^ expected one of `.`, `;`, `?`, `}`, or an operator
+
+error: aborting due to 3 previous errors
+
diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs
index 248d4f1583f..7fae9bf0f69 100644
--- a/src/tools/tidy/src/ui_tests.rs
+++ b/src/tools/tidy/src/ui_tests.rs
@@ -9,7 +9,7 @@ const ENTRY_LIMIT: usize = 1000;
 // FIXME: The following limits should be reduced eventually.
 const ROOT_ENTRY_LIMIT: usize = 983;
 const ISSUES_ENTRY_LIMIT: usize = 2310;
-const PARSER_LIMIT: usize = 1010;
+const PARSER_LIMIT: usize = 1012;
 
 fn check_entries(path: &Path, bad: &mut bool) {
     let dirs = walkdir::WalkDir::new(&path.join("test/ui"))