]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_typeck/diagnostics.rs
Add E0618
[rust.git] / src / librustc_typeck / diagnostics.rs
index 6ccfab0a324b67b70cc0870bf877ccdb07db0120..c1240be6d2b4ed2b3514bdf8a1c0b9abba47f8d2 100644 (file)
@@ -4152,6 +4152,55 @@ struct Foo {
 For more information see The Rust Book: https://doc.rust-lang.org/book/
 "##,
 
+E0617: r##"
+Attempted to pass an invalid type of variable into a variadic function.
+
+Erroneous code example:
+
+```compile_fail,E0617
+extern {
+    fn printf(c: *const i8, ...);
+}
+
+unsafe {
+    printf(::std::ptr::null(), 0f32);
+    // error: can't pass an `f32` to variadic function, cast to `c_double`
+}
+```
+
+To fix this error, you need to pass variables corresponding to C types as much
+as possible. For better explanations, see The Rust Book:
+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! {