From bbad31df2f0661976814832786a6067e4bc255f1 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 13 Aug 2020 13:07:27 +0200 Subject: [PATCH 1/3] Clean up E0752 explanation --- src/librustc_error_codes/error_codes/E0752.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/librustc_error_codes/error_codes/E0752.md b/src/librustc_error_codes/error_codes/E0752.md index 86945f83b5524..77512fddcf63a 100644 --- a/src/librustc_error_codes/error_codes/E0752.md +++ b/src/librustc_error_codes/error_codes/E0752.md @@ -1,11 +1,19 @@ -`fn main()` or the specified start function is not allowed to be -async. You might be seeing this error because your async runtime -library is not set up correctly. +The entry point of the program was marked as `async`. Erroneous code example: ```compile_fail,E0752 -async fn main() -> Result { +async fn main() -> Result { // error! + Ok(1) +} +``` + +`fn main()` or the specified start function is not allowed to be `async`. You +might be seeing this error because your async runtime library is not set up +correctly. To fix it, don't declare the entry point as `async`: + +``` +fn main() -> Result { // ok! Ok(1) } ``` From 406719bf24dc33e333e70804faf7697e795bc422 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 13 Aug 2020 20:13:44 +0200 Subject: [PATCH 2/3] Improve wording --- src/librustc_error_codes/error_codes/E0752.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/librustc_error_codes/error_codes/E0752.md b/src/librustc_error_codes/error_codes/E0752.md index 77512fddcf63a..d79ad06bee095 100644 --- a/src/librustc_error_codes/error_codes/E0752.md +++ b/src/librustc_error_codes/error_codes/E0752.md @@ -8,9 +8,9 @@ async fn main() -> Result { // error! } ``` -`fn main()` or the specified start function is not allowed to be `async`. You -might be seeing this error because your async runtime library is not set up -correctly. To fix it, don't declare the entry point as `async`: +`fn main()` or the specified start function is not allowed to be `async`. Not +having a correct async runtime library setup may cause this error. To fix it, +declare the entry point without `async`: ``` fn main() -> Result { // ok! From 0ce97fc5112e3162b8396afe23848ac0b594a7ea Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 13 Aug 2020 21:07:56 +0200 Subject: [PATCH 3/3] Fix code examples --- src/librustc_error_codes/error_codes/E0752.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/librustc_error_codes/error_codes/E0752.md b/src/librustc_error_codes/error_codes/E0752.md index d79ad06bee095..9736da80c2b7b 100644 --- a/src/librustc_error_codes/error_codes/E0752.md +++ b/src/librustc_error_codes/error_codes/E0752.md @@ -3,8 +3,8 @@ The entry point of the program was marked as `async`. Erroneous code example: ```compile_fail,E0752 -async fn main() -> Result { // error! - Ok(1) +async fn main() -> Result<(), ()> { // error! + Ok(()) } ``` @@ -13,7 +13,7 @@ having a correct async runtime library setup may cause this error. To fix it, declare the entry point without `async`: ``` -fn main() -> Result { // ok! - Ok(1) +fn main() -> Result<(), ()> { // ok! + Ok(()) } ```