about summary refs log tree commit diff
path: root/src/test/ui/parser
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-11-14 08:03:01 +0000
committerbors <bors@rust-lang.org>2019-11-14 08:03:01 +0000
commita2491ee4e6c74451371aee8f4a2a5786d7a35406 (patch)
tree276dc5a1368ab04c84a6387bf15bffab129aa5ff /src/test/ui/parser
parent5e380b797b22e5361a43b2b82f6278df17d89f3e (diff)
parentd145d1e72c184177f40447c63b2813dcef729860 (diff)
Auto merge of #66403 - JohnTitor:rollup-7obuivl, r=JohnTitor
Rollup of 9 pull requests

Successful merges:

 - #66253 (Improve errors after re rebalance coherence)
 - #66264 (fix an ICE in macro's diagnostic message)
 - #66349 (expand source_util macros with def-site context)
 - #66351 (Tweak non-char/numeric in range pattern diagnostic)
 - #66360 (Fix link to Exten in Vec::set_len)
 - #66361 (parser: don't use `unreachable!()` in `fn unexpected`.)
 - #66363 (Improve error message in make_tests)
 - #66369 (compiletest: Obtain timestamps for common inputs only once)
 - #66372 (Fix broken links in Ipv4Addr::is_benchmarking docs)

Failed merges:

r? @ghost
Diffstat (limited to 'src/test/ui/parser')
-rw-r--r--src/test/ui/parser/issue-66357-unexpected-unreachable.rs14
-rw-r--r--src/test/ui/parser/issue-66357-unexpected-unreachable.stderr16
-rw-r--r--src/test/ui/parser/macros-no-semicolon-items.stderr6
-rw-r--r--src/test/ui/parser/mbe_missing_right_paren.rs3
-rw-r--r--src/test/ui/parser/mbe_missing_right_paren.stderr31
-rw-r--r--src/test/ui/parser/recover-range-pats.stderr72
6 files changed, 91 insertions, 51 deletions
diff --git a/src/test/ui/parser/issue-66357-unexpected-unreachable.rs b/src/test/ui/parser/issue-66357-unexpected-unreachable.rs
new file mode 100644
index 00000000000..1730adfa914
--- /dev/null
+++ b/src/test/ui/parser/issue-66357-unexpected-unreachable.rs
@@ -0,0 +1,14 @@
+// The problem in #66357 was that the call trace:
+//
+// - parse_fn_block_decl
+// - expect_or
+// - unexpected
+// - expect_one_of
+// - expected_one_of_not_found
+// - recover_closing_delimiter
+//
+// ended up bubbling up `Ok(true)` to `unexpected` which then used `unreachable!()`.
+
+fn f() { |[](* }
+//~^ ERROR expected one of `,` or `:`, found `(`
+//~| ERROR expected one of `)`, `-`, `_`, `box`, `mut`, `ref`, `|`, identifier, or path, found `*`
diff --git a/src/test/ui/parser/issue-66357-unexpected-unreachable.stderr b/src/test/ui/parser/issue-66357-unexpected-unreachable.stderr
new file mode 100644
index 00000000000..00d84e2afe3
--- /dev/null
+++ b/src/test/ui/parser/issue-66357-unexpected-unreachable.stderr
@@ -0,0 +1,16 @@
+error: expected one of `,` or `:`, found `(`
+  --> $DIR/issue-66357-unexpected-unreachable.rs:12:13
+   |
+LL | fn f() { |[](* }
+   |             ^ expected one of `,` or `:`
+
+error: expected one of `)`, `-`, `_`, `box`, `mut`, `ref`, `|`, identifier, or path, found `*`
+  --> $DIR/issue-66357-unexpected-unreachable.rs:12:14
+   |
+LL | fn f() { |[](* }
+   |             -^ help: `)` may belong here
+   |             |
+   |             unclosed delimiter
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/parser/macros-no-semicolon-items.stderr b/src/test/ui/parser/macros-no-semicolon-items.stderr
index 980ceeed8c6..f9019b78c8d 100644
--- a/src/test/ui/parser/macros-no-semicolon-items.stderr
+++ b/src/test/ui/parser/macros-no-semicolon-items.stderr
@@ -6,8 +6,8 @@ LL | macro_rules! foo()
    |
 help: change the delimiters to curly braces
    |
-LL | macro_rules! foo {}
-   |                  ^^
+LL | macro_rules! foo{}
+   |                 ^^
 help: add a semicolon
    |
 LL | macro_rules! foo();
@@ -26,7 +26,7 @@ LL | | )
    |
 help: change the delimiters to curly braces
    |
-LL | bar! {
+LL | bar!{
 LL |     blah
 LL |     blah
 LL |     blah
diff --git a/src/test/ui/parser/mbe_missing_right_paren.rs b/src/test/ui/parser/mbe_missing_right_paren.rs
new file mode 100644
index 00000000000..689176b3eb7
--- /dev/null
+++ b/src/test/ui/parser/mbe_missing_right_paren.rs
@@ -0,0 +1,3 @@
+// ignore-tidy-trailing-newlines
+// error-pattern: aborting due to 3 previous errors
+macro_rules! abc(ؼ
\ No newline at end of file
diff --git a/src/test/ui/parser/mbe_missing_right_paren.stderr b/src/test/ui/parser/mbe_missing_right_paren.stderr
new file mode 100644
index 00000000000..4504fc0eb00
--- /dev/null
+++ b/src/test/ui/parser/mbe_missing_right_paren.stderr
@@ -0,0 +1,31 @@
+error: this file contains an un-closed delimiter
+  --> $DIR/mbe_missing_right_paren.rs:3:19
+   |
+LL | macro_rules! abc(ؼ
+   |                 - ^
+   |                 |
+   |                 un-closed delimiter
+
+error: macros that expand to items must be delimited with braces or followed by a semicolon
+  --> $DIR/mbe_missing_right_paren.rs:3:17
+   |
+LL | macro_rules! abc(ؼ
+   |                 ^^
+   |
+help: change the delimiters to curly braces
+   |
+LL | macro_rules! abc{ؼ}
+   |                 ^ ^
+help: add a semicolon
+   |
+LL | macro_rules! abc(ؼ;
+   |                   ^
+
+error: unexpected end of macro invocation
+  --> $DIR/mbe_missing_right_paren.rs:3:1
+   |
+LL | macro_rules! abc(ؼ
+   | ^^^^^^^^^^^^^^^^^^ missing tokens in macro arguments
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/parser/recover-range-pats.stderr b/src/test/ui/parser/recover-range-pats.stderr
index 89ec059cb82..160ab18e34a 100644
--- a/src/test/ui/parser/recover-range-pats.stderr
+++ b/src/test/ui/parser/recover-range-pats.stderr
@@ -401,19 +401,17 @@ error[E0029]: only char and numeric types are allowed in range patterns
   --> $DIR/recover-range-pats.rs:19:12
    |
 LL |     if let true..Y = 0 {}
-   |            ^^^^ ranges require char or numeric types
-   |
-   = note: start type: bool
-   = note: end type: u8
+   |            ^^^^  - this is of type `u8`
+   |            |
+   |            this is of type `bool` but it should be `char` or numeric
 
 error[E0029]: only char and numeric types are allowed in range patterns
   --> $DIR/recover-range-pats.rs:20:15
    |
 LL |     if let X..true = 0 {}
-   |               ^^^^ ranges require char or numeric types
-   |
-   = note: start type: u8
-   = note: end type: bool
+   |            -  ^^^^ this is of type `bool` but it should be `char` or numeric
+   |            |
+   |            this is of type `u8`
 
 error[E0308]: mismatched types
   --> $DIR/recover-range-pats.rs:21:12
@@ -437,19 +435,17 @@ error[E0029]: only char and numeric types are allowed in range patterns
   --> $DIR/recover-range-pats.rs:32:12
    |
 LL |     if let true..=Y = 0 {}
-   |            ^^^^ ranges require char or numeric types
-   |
-   = note: start type: bool
-   = note: end type: u8
+   |            ^^^^   - this is of type `u8`
+   |            |
+   |            this is of type `bool` but it should be `char` or numeric
 
 error[E0029]: only char and numeric types are allowed in range patterns
   --> $DIR/recover-range-pats.rs:33:16
    |
 LL |     if let X..=true = 0 {}
-   |                ^^^^ ranges require char or numeric types
-   |
-   = note: start type: u8
-   = note: end type: bool
+   |            -   ^^^^ this is of type `bool` but it should be `char` or numeric
+   |            |
+   |            this is of type `u8`
 
 error[E0308]: mismatched types
   --> $DIR/recover-range-pats.rs:34:12
@@ -473,19 +469,17 @@ error[E0029]: only char and numeric types are allowed in range patterns
   --> $DIR/recover-range-pats.rs:45:12
    |
 LL |     if let true...Y = 0 {}
-   |            ^^^^ ranges require char or numeric types
-   |
-   = note: start type: bool
-   = note: end type: u8
+   |            ^^^^   - this is of type `u8`
+   |            |
+   |            this is of type `bool` but it should be `char` or numeric
 
 error[E0029]: only char and numeric types are allowed in range patterns
   --> $DIR/recover-range-pats.rs:47:16
    |
 LL |     if let X...true = 0 {}
-   |                ^^^^ ranges require char or numeric types
-   |
-   = note: start type: u8
-   = note: end type: bool
+   |            -   ^^^^ this is of type `bool` but it should be `char` or numeric
+   |            |
+   |            this is of type `u8`
 
 error[E0308]: mismatched types
   --> $DIR/recover-range-pats.rs:49:12
@@ -509,10 +503,7 @@ error[E0029]: only char and numeric types are allowed in range patterns
   --> $DIR/recover-range-pats.rs:60:12
    |
 LL |     if let true.. = 0 {}
-   |            ^^^^ ranges require char or numeric types
-   |
-   = note: start type: bool
-   = note: end type: [type error]
+   |            ^^^^ this is of type `bool` but it should be `char` or numeric
 
 error[E0308]: mismatched types
   --> $DIR/recover-range-pats.rs:62:12
@@ -527,10 +518,7 @@ error[E0029]: only char and numeric types are allowed in range patterns
   --> $DIR/recover-range-pats.rs:70:12
    |
 LL |     if let true..= = 0 {}
-   |            ^^^^ ranges require char or numeric types
-   |
-   = note: start type: bool
-   = note: end type: [type error]
+   |            ^^^^ this is of type `bool` but it should be `char` or numeric
 
 error[E0308]: mismatched types
   --> $DIR/recover-range-pats.rs:72:12
@@ -545,10 +533,7 @@ error[E0029]: only char and numeric types are allowed in range patterns
   --> $DIR/recover-range-pats.rs:82:12
    |
 LL |     if let true... = 0 {}
-   |            ^^^^ ranges require char or numeric types
-   |
-   = note: start type: bool
-   = note: end type: [type error]
+   |            ^^^^ this is of type `bool` but it should be `char` or numeric
 
 error[E0308]: mismatched types
   --> $DIR/recover-range-pats.rs:85:12
@@ -563,10 +548,7 @@ error[E0029]: only char and numeric types are allowed in range patterns
   --> $DIR/recover-range-pats.rs:94:14
    |
 LL |     if let ..true = 0 {}
-   |              ^^^^ ranges require char or numeric types
-   |
-   = note: start type: [type error]
-   = note: end type: bool
+   |              ^^^^ this is of type `bool` but it should be `char` or numeric
 
 error[E0308]: mismatched types
   --> $DIR/recover-range-pats.rs:96:12
@@ -581,10 +563,7 @@ error[E0029]: only char and numeric types are allowed in range patterns
   --> $DIR/recover-range-pats.rs:104:15
    |
 LL |     if let ..=true = 0 {}
-   |               ^^^^ ranges require char or numeric types
-   |
-   = note: start type: [type error]
-   = note: end type: bool
+   |               ^^^^ this is of type `bool` but it should be `char` or numeric
 
 error[E0308]: mismatched types
   --> $DIR/recover-range-pats.rs:106:12
@@ -599,10 +578,7 @@ error[E0029]: only char and numeric types are allowed in range patterns
   --> $DIR/recover-range-pats.rs:116:15
    |
 LL |     if let ...true = 0 {}
-   |               ^^^^ ranges require char or numeric types
-   |
-   = note: start type: [type error]
-   = note: end type: bool
+   |               ^^^^ this is of type `bool` but it should be `char` or numeric
 
 error[E0308]: mismatched types
   --> $DIR/recover-range-pats.rs:119:12