summaryrefslogtreecommitdiffstats
path: root/src/test/ui/parser/expr-as-stmt.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/expr-as-stmt.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/expr-as-stmt.stderr')
-rw-r--r--src/test/ui/parser/expr-as-stmt.stderr216
1 files changed, 216 insertions, 0 deletions
diff --git a/src/test/ui/parser/expr-as-stmt.stderr b/src/test/ui/parser/expr-as-stmt.stderr
new file mode 100644
index 000000000..858b4e8db
--- /dev/null
+++ b/src/test/ui/parser/expr-as-stmt.stderr
@@ -0,0 +1,216 @@
+error: expected expression, found `+`
+ --> $DIR/expr-as-stmt.rs:8:9
+ |
+LL | {2} + {2}
+ | ^ expected expression
+ |
+help: parentheses are required to parse this as an expression
+ |
+LL | ({2}) + {2}
+ | + +
+
+error: leading `+` is not supported
+ --> $DIR/expr-as-stmt.rs:13:9
+ |
+LL | {2} + 2
+ | ^ unexpected `+`
+ |
+help: parentheses are required to parse this as an expression
+ |
+LL | ({2}) + 2
+ | + +
+
+error: expected expression, found `+`
+ --> $DIR/expr-as-stmt.rs:19:12
+ |
+LL | { 42 } + foo;
+ | ^ expected expression
+ |
+help: parentheses are required to parse this as an expression
+ |
+LL | ({ 42 }) + foo;
+ | + +
+
+error: expected expression, found `>`
+ --> $DIR/expr-as-stmt.rs:32:7
+ |
+LL | } > 0
+ | ^ expected expression
+ |
+help: parentheses are required to parse this as an expression
+ |
+LL ~ (match x {
+LL | _ => 1,
+LL ~ }) > 0
+ |
+
+error: expected parameter name, found `{`
+ --> $DIR/expr-as-stmt.rs:41:16
+ |
+LL | { true } | { true }
+ | ^ expected parameter name
+ |
+help: parentheses are required to parse this as an expression
+ |
+LL | ({ true }) | { true }
+ | + +
+
+error[E0308]: mismatched types
+ --> $DIR/expr-as-stmt.rs:64:7
+ |
+LL | { foo() } || { true }
+ | ^^^^^- help: consider using a semicolon here: `;`
+ | |
+ | expected `()`, found `i32`
+
+error[E0308]: mismatched types
+ --> $DIR/expr-as-stmt.rs:8:6
+ |
+LL | {2} + {2}
+ | ^ expected `()`, found integer
+ |
+help: you might have meant to return this value
+ |
+LL | {return 2;} + {2}
+ | ++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/expr-as-stmt.rs:13:6
+ |
+LL | {2} + 2
+ | ^ expected `()`, found integer
+ |
+help: you might have meant to return this value
+ |
+LL | {return 2;} + 2
+ | ++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/expr-as-stmt.rs:19:7
+ |
+LL | { 42 } + foo;
+ | ^^ expected `()`, found integer
+ |
+help: you might have meant to return this value
+ |
+LL | { return 42; } + foo;
+ | ++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/expr-as-stmt.rs:25:7
+ |
+LL | { 3 } * 3
+ | ^ expected `()`, found integer
+ |
+help: you might have meant to return this value
+ |
+LL | { return 3; } * 3
+ | ++++++ +
+
+error[E0614]: type `{integer}` cannot be dereferenced
+ --> $DIR/expr-as-stmt.rs:25:11
+ |
+LL | { 3 } * 3
+ | ^^^
+ |
+help: parentheses are required to parse this as an expression
+ |
+LL | ({ 3 }) * 3
+ | + +
+
+error[E0308]: mismatched types
+ --> $DIR/expr-as-stmt.rs:36:6
+ |
+LL | {2} - 2
+ | ^ expected `()`, found integer
+ |
+help: you might have meant to return this value
+ |
+LL | {return 2;} - 2
+ | ++++++ +
+
+error[E0600]: cannot apply unary operator `-` to type `u32`
+ --> $DIR/expr-as-stmt.rs:36:9
+ |
+LL | {2} - 2
+ | ^^^ cannot apply unary operator `-`
+ |
+help: parentheses are required to parse this as an expression
+ |
+LL | ({2}) - 2
+ | + +
+
+error[E0308]: mismatched types
+ --> $DIR/expr-as-stmt.rs:41:7
+ |
+LL | { true } | { true }
+ | ^^^^ expected `()`, found `bool`
+ |
+help: you might have meant to return this value
+ |
+LL | { return true; } | { true }
+ | ++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/expr-as-stmt.rs:46:7
+ |
+LL | { true } && { true }
+ | ^^^^ expected `()`, found `bool`
+ |
+help: you might have meant to return this value
+ |
+LL | { return true; } && { true }
+ | ++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/expr-as-stmt.rs:46:14
+ |
+LL | fn revenge_from_mars() -> bool {
+ | ---- expected `bool` because of return type
+LL | { true } && { true }
+ | ^^^^^^^^^^^ expected `bool`, found `&&bool`
+ |
+help: consider removing the `&&`
+ |
+LL - { true } && { true }
+LL + { true } { true }
+ |
+help: parentheses are required to parse this as an expression
+ |
+LL | ({ true }) && { true }
+ | + +
+
+error[E0308]: mismatched types
+ --> $DIR/expr-as-stmt.rs:51:7
+ |
+LL | { true } || { true }
+ | ^^^^ expected `()`, found `bool`
+ |
+help: you might have meant to return this value
+ |
+LL | { return true; } || { true }
+ | ++++++ +
+
+error[E0308]: mismatched types
+ --> $DIR/expr-as-stmt.rs:51:14
+ |
+LL | fn attack_from_mars() -> bool {
+ | ---- expected `bool` because of return type
+LL | { true } || { true }
+ | ^^^^^^^^^^^ expected `bool`, found closure
+ |
+ = note: expected type `bool`
+ found closure `[closure@$DIR/expr-as-stmt.rs:51:14: 51:16]`
+help: use parentheses to call this closure
+ |
+LL | { true } (|| { true })()
+ | + +++
+help: parentheses are required to parse this as an expression
+ |
+LL | ({ true }) || { true }
+ | + +
+
+error: aborting due to 18 previous errors
+
+Some errors have detailed explanations: E0308, E0600, E0614.
+For more information about an error, try `rustc --explain E0308`.