]> git.lizzy.rs Git - rust.git/blobdiff - src/test/ui/struct-literal-variant-in-if.stderr
Auto merge of #62748 - luca-barbieri:optimize-refcell-borrow, r=RalfJung
[rust.git] / src / test / ui / struct-literal-variant-in-if.stderr
index e38eb0d61e060faa7fe5ade143e458ebdcf7d012..f91b9d7dce60fda07a9042bbf9b8ab9e0b4e61e8 100644 (file)
@@ -1,5 +1,45 @@
+error: struct literals are not allowed here
+  --> $DIR/struct-literal-variant-in-if.rs:13:13
+   |
+LL |     if x == E::I { field1: true, field2: 42 } {}
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+help: surround the struct literal with parentheses
+   |
+LL |     if x == (E::I { field1: true, field2: 42 }) {}
+   |             ^                                 ^
+
+error: struct literals are not allowed here
+  --> $DIR/struct-literal-variant-in-if.rs:15:13
+   |
+LL |     if x == E::V { field: false } {}
+   |             ^^^^^^^^^^^^^^^^^^^^^
+help: surround the struct literal with parentheses
+   |
+LL |     if x == (E::V { field: false }) {}
+   |             ^                     ^
+
+error: struct literals are not allowed here
+  --> $DIR/struct-literal-variant-in-if.rs:17:13
+   |
+LL |     if x == E::J { field: -42 } {}
+   |             ^^^^^^^^^^^^^^^^^^^
+help: surround the struct literal with parentheses
+   |
+LL |     if x == (E::J { field: -42 }) {}
+   |             ^                   ^
+
+error: struct literals are not allowed here
+  --> $DIR/struct-literal-variant-in-if.rs:19:13
+   |
+LL |     if x == E::K { field: "" } {}
+   |             ^^^^^^^^^^^^^^^^^^
+help: surround the struct literal with parentheses
+   |
+LL |     if x == (E::K { field: "" }) {}
+   |             ^                  ^
+
 error[E0423]: expected value, found struct variant `E::V`
-  --> $DIR/struct-literal-variant-in-if.rs:7:13
+  --> $DIR/struct-literal-variant-in-if.rs:10:13
    |
 LL |     if x == E::V { field } {}
    |             ^^^^----------
@@ -7,7 +47,7 @@ LL |     if x == E::V { field } {}
    |             help: surround the struct literal with parenthesis: `(E::V { field })`
 
 error[E0308]: mismatched types
-  --> $DIR/struct-literal-variant-in-if.rs:7:20
+  --> $DIR/struct-literal-variant-in-if.rs:10:20
    |
 LL | fn test_E(x: E) {
    |                 - help: try adding a return type: `-> bool`
@@ -19,7 +59,7 @@ LL |     if x == E::V { field } {}
               found type `bool`
 
 error[E0308]: mismatched types
-  --> $DIR/struct-literal-variant-in-if.rs:10:20
+  --> $DIR/struct-literal-variant-in-if.rs:21:20
    |
 LL |     let y: usize = ();
    |                    ^^ expected usize, found ()
@@ -27,7 +67,7 @@ LL |     let y: usize = ();
    = note: expected type `usize`
               found type `()`
 
-error: aborting due to 3 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`.