about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-04-18 23:58:57 +0300
committerEsteban Küber <esteban@kuber.com.ar>2019-04-19 10:32:44 -0700
commitaa393b0cde881c612379d90ca300396cd7ce2e96 (patch)
tree23ae8880b9af2e436f38e54cf6393c9bf773bac8 /src/test
parent4c4ca60edd9775873e555dbb5928b000bd734403 (diff)
downloadrust-aa393b0cde881c612379d90ca300396cd7ce2e96.tar.gz
rust-aa393b0cde881c612379d90ca300396cd7ce2e96.zip
Some cleanup to `maybe_parse_struct_expr`
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/parser/struct-literal-in-match-discriminant.stderr1
-rw-r--r--src/test/ui/struct-literal-variant-in-if.rs4
-rw-r--r--src/test/ui/struct-literal-variant-in-if.stderr44
3 files changed, 13 insertions, 36 deletions
diff --git a/src/test/ui/parser/struct-literal-in-match-discriminant.stderr b/src/test/ui/parser/struct-literal-in-match-discriminant.stderr
index b8818ccba39..0058e8981cd 100644
--- a/src/test/ui/parser/struct-literal-in-match-discriminant.stderr
+++ b/src/test/ui/parser/struct-literal-in-match-discriminant.stderr
@@ -14,3 +14,4 @@ LL |     }) {
    |
 
 error: aborting due to previous error
+
diff --git a/src/test/ui/struct-literal-variant-in-if.rs b/src/test/ui/struct-literal-variant-in-if.rs
index 8f2d50586c0..4ef8effaf1f 100644
--- a/src/test/ui/struct-literal-variant-in-if.rs
+++ b/src/test/ui/struct-literal-variant-in-if.rs
@@ -13,9 +13,7 @@ fn test_E(x: E) {
     if x == E::I { field1: true, field2: 42 } {}
     //~^ ERROR struct literals are not allowed here
     if x == E::V { field: false } {}
-    //~^ ERROR expected identifier, found keyword `false`
-    //~| ERROR expected type, found keyword `false`
-    //~| ERROR expected value, found struct variant `E::V`
+    //~^ ERROR struct literals are not allowed here
     if x == E::J { field: -42 } {}
     //~^ ERROR struct literals are not allowed here
     if x == E::K { field: "" } {}
diff --git a/src/test/ui/struct-literal-variant-in-if.stderr b/src/test/ui/struct-literal-variant-in-if.stderr
index 0af0c6aefaf..55f23baea7a 100644
--- a/src/test/ui/struct-literal-variant-in-if.stderr
+++ b/src/test/ui/struct-literal-variant-in-if.stderr
@@ -8,32 +8,18 @@ help: surround the struct literal with parenthesis
 LL |     if x == (E::I { field1: true, field2: 42 }) {}
    |             ^                                 ^
 
-error: expected identifier, found keyword `false`
-  --> $DIR/struct-literal-variant-in-if.rs:15:27
-   |
-LL |     if x == E::V { field: false } {}
-   |                           ^^^^^ expected identifier, found keyword
-help: you can escape reserved keywords to use them as identifiers
-   |
-LL |     if x == E::V { field: r#false } {}
-   |                           ^^^^^^^
-
-error: expected type, found keyword `false`
-  --> $DIR/struct-literal-variant-in-if.rs:15:27
+error: struct literals are not allowed here
+  --> $DIR/struct-literal-variant-in-if.rs:15:13
    |
 LL |     if x == E::V { field: false } {}
-   |                           ^^^^^ expecting a type here because of type ascription
-   |
-   = note: type ascription is a nightly-only feature that lets you annotate an expression with a type: `<expr>: <type>`
-note: this expression expects an ascribed type after the colon
-  --> $DIR/struct-literal-variant-in-if.rs:15:20
+   |             ^^^^^^^^^^^^^^^^^^^^^
+help: surround the struct literal with parenthesis
    |
-LL |     if x == E::V { field: false } {}
-   |                    ^^^^^
-   = help: this might be indicative of a syntax error elsewhere
+LL |     if x == (E::V { field: false }) {}
+   |             ^                     ^
 
 error: struct literals are not allowed here
-  --> $DIR/struct-literal-variant-in-if.rs:19:13
+  --> $DIR/struct-literal-variant-in-if.rs:17:13
    |
 LL |     if x == E::J { field: -42 } {}
    |             ^^^^^^^^^^^^^^^^^^^
@@ -43,7 +29,7 @@ LL |     if x == (E::J { field: -42 }) {}
    |             ^                   ^
 
 error: struct literals are not allowed here
-  --> $DIR/struct-literal-variant-in-if.rs:21:13
+  --> $DIR/struct-literal-variant-in-if.rs:19:13
    |
 LL |     if x == E::K { field: "" } {}
    |             ^^^^^^^^^^^^^^^^^^
@@ -60,14 +46,6 @@ LL |     if x == E::V { field } {}
    |             |
    |             help: surround the struct literal with parenthesis: `(E::V { field })`
 
-error[E0423]: expected value, found struct variant `E::V`
-  --> $DIR/struct-literal-variant-in-if.rs:15:13
-   |
-LL |     if x == E::V { field: false } {}
-   |             ^^^^-----------------
-   |             |
-   |             help: surround the struct literal with parenthesis: `(E::V { field: false })`
-
 error[E0308]: mismatched types
   --> $DIR/struct-literal-variant-in-if.rs:10:20
    |
@@ -81,7 +59,7 @@ LL |     if x == E::V { field } {}
               found type `bool`
 
 error[E0308]: mismatched types
-  --> $DIR/struct-literal-variant-in-if.rs:23:20
+  --> $DIR/struct-literal-variant-in-if.rs:21:20
    |
 LL |     let y: usize = ();
    |                    ^^ expected usize, found ()
@@ -89,7 +67,7 @@ LL |     let y: usize = ();
    = note: expected type `usize`
               found type `()`
 
-error: aborting due to 9 previous errors
+error: aborting due to 7 previous errors
 
-Some errors occurred: E0308, E0423.
+Some errors have detailed explanations: E0308, E0423.
 For more information about an error, try `rustc --explain E0308`.