summaryrefslogtreecommitdiffstats
path: root/tests/ui/parser/fn-body-eq-expr-semi.stderr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /tests/ui/parser/fn-body-eq-expr-semi.stderr
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/parser/fn-body-eq-expr-semi.stderr')
-rw-r--r--tests/ui/parser/fn-body-eq-expr-semi.stderr117
1 files changed, 117 insertions, 0 deletions
diff --git a/tests/ui/parser/fn-body-eq-expr-semi.stderr b/tests/ui/parser/fn-body-eq-expr-semi.stderr
new file mode 100644
index 000000000..f1255d864
--- /dev/null
+++ b/tests/ui/parser/fn-body-eq-expr-semi.stderr
@@ -0,0 +1,117 @@
+error: function body cannot be `= expression;`
+ --> $DIR/fn-body-eq-expr-semi.rs:4:14
+ |
+LL | fn foo() = 42;
+ | ^^^^^
+ |
+help: surround the expression with `{` and `}` instead of `=` and `;`
+ |
+LL | fn foo() { 42 }
+ | ~ ~
+
+error: function body cannot be `= expression;`
+ --> $DIR/fn-body-eq-expr-semi.rs:5:20
+ |
+LL | fn bar() -> u8 = 42;
+ | ^^^^^
+ |
+help: surround the expression with `{` and `}` instead of `=` and `;`
+ |
+LL | fn bar() -> u8 { 42 }
+ | ~ ~
+
+error: function body cannot be `= expression;`
+ --> $DIR/fn-body-eq-expr-semi.rs:9:14
+ |
+LL | fn foo() = 42;
+ | ^^^^^
+ |
+help: surround the expression with `{` and `}` instead of `=` and `;`
+ |
+LL | fn foo() { 42 }
+ | ~ ~
+
+error: function body cannot be `= expression;`
+ --> $DIR/fn-body-eq-expr-semi.rs:11:20
+ |
+LL | fn bar() -> u8 = 42;
+ | ^^^^^
+ |
+help: surround the expression with `{` and `}` instead of `=` and `;`
+ |
+LL | fn bar() -> u8 { 42 }
+ | ~ ~
+
+error: function body cannot be `= expression;`
+ --> $DIR/fn-body-eq-expr-semi.rs:16:14
+ |
+LL | fn foo() = 42;
+ | ^^^^^
+ |
+help: surround the expression with `{` and `}` instead of `=` and `;`
+ |
+LL | fn foo() { 42 }
+ | ~ ~
+
+error: function body cannot be `= expression;`
+ --> $DIR/fn-body-eq-expr-semi.rs:17:20
+ |
+LL | fn bar() -> u8 = 42;
+ | ^^^^^
+ |
+help: surround the expression with `{` and `}` instead of `=` and `;`
+ |
+LL | fn bar() -> u8 { 42 }
+ | ~ ~
+
+error: function body cannot be `= expression;`
+ --> $DIR/fn-body-eq-expr-semi.rs:21:14
+ |
+LL | fn foo() = 42;
+ | ^^^^^
+ |
+help: surround the expression with `{` and `}` instead of `=` and `;`
+ |
+LL | fn foo() { 42 }
+ | ~ ~
+
+error: function body cannot be `= expression;`
+ --> $DIR/fn-body-eq-expr-semi.rs:22:20
+ |
+LL | fn bar() -> u8 = 42;
+ | ^^^^^
+ |
+help: surround the expression with `{` and `}` instead of `=` and `;`
+ |
+LL | fn bar() -> u8 { 42 }
+ | ~ ~
+
+error: incorrect function inside `extern` block
+ --> $DIR/fn-body-eq-expr-semi.rs:9:8
+ |
+LL | extern "C" {
+ | ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body
+LL | fn foo() = 42;
+ | ^^^ ----- help: remove the invalid body: `;`
+ | |
+ | cannot have a body
+ |
+ = help: you might have meant to write a function accessible through FFI, which can be done by writing `extern fn` outside of the `extern` block
+ = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html
+
+error: incorrect function inside `extern` block
+ --> $DIR/fn-body-eq-expr-semi.rs:11:8
+ |
+LL | extern "C" {
+ | ---------- `extern` blocks define existing foreign functions and functions inside of them cannot have a body
+...
+LL | fn bar() -> u8 = 42;
+ | ^^^ ----- help: remove the invalid body: `;`
+ | |
+ | cannot have a body
+ |
+ = help: you might have meant to write a function accessible through FFI, which can be done by writing `extern fn` outside of the `extern` block
+ = note: for more information, visit https://doc.rust-lang.org/std/keyword.extern.html
+
+error: aborting due to 10 previous errors
+