about summary refs log tree commit diff
path: root/src/test/ui/parser/fn-defined-using-func.rs
diff options
context:
space:
mode:
authorakabinds <staticxxd@gmail.com>2022-08-18 16:14:04 -0500
committerakabinds <staticxxd@gmail.com>2022-08-18 16:14:04 -0500
commit1b54ad0585ca25b779be93d1149930664f722dc3 (patch)
tree3f56da8171e0297af4739417f7f71c56e9e974dc /src/test/ui/parser/fn-defined-using-func.rs
parent801821d1560f84e4716fcbd9244ec959320a13d5 (diff)
downloadrust-1b54ad0585ca25b779be93d1149930664f722dc3.tar.gz
rust-1b54ad0585ca25b779be93d1149930664f722dc3.zip
added improved diagnostic for a function defined with an invalid qualifier
Diffstat (limited to 'src/test/ui/parser/fn-defined-using-func.rs')
-rw-r--r--src/test/ui/parser/fn-defined-using-func.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/test/ui/parser/fn-defined-using-func.rs b/src/test/ui/parser/fn-defined-using-func.rs
new file mode 100644
index 00000000000..2dce96fdce0
--- /dev/null
+++ b/src/test/ui/parser/fn-defined-using-func.rs
@@ -0,0 +1,10 @@
+// Check what happens when `func` is used to define a function, instead of `fn`
+// edition:2021
+
+#![allow(dead_code)]
+
+func foo() {}
+//~^ ERROR expected one of `!` or `::`, found `foo`
+//~^^ HELP write `fn` instead of `func` to declare a function
+
+fn main() {}