From a850d407b203d695a9d19979b4183578171f1226 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 27 May 2016 21:16:58 +0200 Subject: [PATCH] Improve E0132 error explanation --- src/librustc_typeck/diagnostics.rs | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 7598751c8fe18..eee53f30428a9 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -1864,12 +1864,35 @@ fn main() { // error: main function is not allowed to have type parameters "##, E0132: r##" +A function with the `start` attribute was declared with type parameters. + +Erroneous code example: + +```compile_fail +#![feature(start)] + +#[start] +fn f() {} +``` + It is not possible to declare type parameters on a function that has the `start` -attribute. Such a function must have the following type signature: +attribute. Such a function must have the following type signature (for more +information: http://doc.rust-lang.org/stable/book/no-stdlib.html): ```ignore fn(isize, *const *const u8) -> isize; ``` + +Example: + +``` +#![feature(start)] + +#[start] +fn my_start(argc: isize, argv: *const *const u8) -> isize { + 0 +} +``` "##, E0163: r##"