diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs index c64f0ddac50..56d57d39be6 100644 --- a/src/librustc/diagnostics.rs +++ b/src/librustc/diagnostics.rs @@ -392,9 +392,30 @@ function `main()`. If there are multiple such functions, please rename one. "##, E0137: r##" +More than one function was declared with the `#[main]` attribute. + +Erroneous code example: + +```compile_fail +#![feature(main)] + +#[main] +fn foo() {} + +#[main] +fn f() {} // error: multiple functions with a #[main] attribute +``` + This error indicates that the compiler found multiple functions with the `#[main]` attribute. This is an error because there must be a unique entry -point into a Rust program. +point into a Rust program. Example: + +``` +#![feature(main)] + +#[main] +fn f() {} // ok! +``` "##, E0138: r##"