summaryrefslogtreecommitdiffstats
path: root/src/test/ui/parser/struct-literal-variant-in-if.stderr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /src/test/ui/parser/struct-literal-variant-in-if.stderr
parentInitial commit. (diff)
downloadrustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz
rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/parser/struct-literal-variant-in-if.stderr')
-rw-r--r--src/test/ui/parser/struct-literal-variant-in-if.stderr76
1 files changed, 76 insertions, 0 deletions
diff --git a/src/test/ui/parser/struct-literal-variant-in-if.stderr b/src/test/ui/parser/struct-literal-variant-in-if.stderr
new file mode 100644
index 000000000..4cffbe433
--- /dev/null
+++ b/src/test/ui/parser/struct-literal-variant-in-if.stderr
@@ -0,0 +1,76 @@
+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:10:13
+ |
+LL | if x == E::V { field } {}
+ | ^^^^ not a value
+ |
+help: surround the struct literal with parentheses
+ |
+LL | if x == (E::V { field }) {}
+ | + +
+
+error[E0308]: mismatched types
+ --> $DIR/struct-literal-variant-in-if.rs:10:20
+ |
+LL | if x == E::V { field } {}
+ | ---------------^^^^^--
+ | | |
+ | | expected `()`, found `bool`
+ | expected this to be `()`
+
+error[E0308]: mismatched types
+ --> $DIR/struct-literal-variant-in-if.rs:21:20
+ |
+LL | let y: usize = ();
+ | ----- ^^ expected `usize`, found `()`
+ | |
+ | expected due to this
+
+error: aborting due to 7 previous errors
+
+Some errors have detailed explanations: E0308, E0423.
+For more information about an error, try `rustc --explain E0308`.