]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_typeck/diagnostics.rs
Add E0618
[rust.git] / src / librustc_typeck / diagnostics.rs
index 76c664d7997a4fe69652ccf9d07798998f6351b7..c1240be6d2b4ed2b3514bdf8a1c0b9abba47f8d2 100644 (file)
@@ -4173,6 +4173,34 @@ struct Foo {
 https://doc.rust-lang.org/book/
 "##,
 
+E0618: r##"
+Attempted to call something which isn't a function nor a method.
+
+Erroneous code examples:
+
+```compile_fail,E0618
+enum X {
+    Entry,
+}
+
+X::Entry(); // error: expected function, found `X::Entry`
+
+// Or even simpler:
+let x = 0i32;
+x(); // error: expected function, found `i32`
+```
+
+Only functions and methods can be called using `()`. Example:
+
+```
+// We declare a function:
+fn i_am_a_function() {}
+
+// And we call it:
+i_am_a_function();
+```
+"##,
+
 }
 
 register_diagnostics! {