diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-04-16 23:34:41 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-16 23:34:41 +0200 |
| commit | c68c71e24e098d617fd1bbb82b6120d03ff3e252 (patch) | |
| tree | 0aee7b983dfedfb164577122252ea5bf066fbc0b /src | |
| parent | 7f3df5772439eee1c512ed2eb540beef1124d236 (diff) | |
| parent | 26fdde994d0c2a80bfa2322f81a93baaa90e788c (diff) | |
Rollup merge of #70611 - pawanbisht62:doc/61137-add-long-error-code-e0708, r=GuillaumeGomez
Add long error explanation for E0708 #61137 Add long explanation for the E0708 error code Part of #61137 r? @GuillaumeGomez
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_error_codes/error_codes.rs | 3 | ||||
| -rw-r--r-- | src/librustc_error_codes/error_codes/E0708.md | 26 | ||||
| -rw-r--r-- | src/test/ui/async-await/no-params-non-move-async-closure.stderr | 1 |
3 files changed, 28 insertions, 2 deletions
diff --git a/src/librustc_error_codes/error_codes.rs b/src/librustc_error_codes/error_codes.rs index 8d9982131c3..57f13d0cb38 100644 --- a/src/librustc_error_codes/error_codes.rs +++ b/src/librustc_error_codes/error_codes.rs @@ -394,6 +394,7 @@ E0703: include_str!("./error_codes/E0703.md"), E0704: include_str!("./error_codes/E0704.md"), E0705: include_str!("./error_codes/E0705.md"), E0706: include_str!("./error_codes/E0706.md"), +E0708: include_str!("./error_codes/E0708.md"), E0710: include_str!("./error_codes/E0710.md"), E0712: include_str!("./error_codes/E0712.md"), E0713: include_str!("./error_codes/E0713.md"), @@ -604,8 +605,6 @@ E0751: include_str!("./error_codes/E0751.md"), E0696, // `continue` pointing to a labeled block // E0702, // replaced with a generic attribute input check // E0707, // multiple elided lifetimes used in arguments of `async fn` - E0708, // `async` non-`move` closures with parameters are not currently - // supported // E0709, // multiple different lifetimes used in arguments of `async fn` E0711, // a feature has been declared with conflicting stability attributes E0717, // rustc_promotable without stability attribute diff --git a/src/librustc_error_codes/error_codes/E0708.md b/src/librustc_error_codes/error_codes/E0708.md new file mode 100644 index 00000000000..a0f53e38b53 --- /dev/null +++ b/src/librustc_error_codes/error_codes/E0708.md @@ -0,0 +1,26 @@ +`async` non-`move` closures with parameters are currently not supported. + +Erroneous code example: + +```compile_fail,edition2018 +#![feature(async_closure)] + +fn main() { + let add_one = async |num: u8| { // error! + num + 1 + }; +} +``` + +`async` with non-move is currently not supported with the current +version, you can use successfully by using move: + +```edition2018 +#![feature(async_closure)] + +fn main() { + let add_one = async move |num: u8| { // ok! + num + 1 + }; +} +``` diff --git a/src/test/ui/async-await/no-params-non-move-async-closure.stderr b/src/test/ui/async-await/no-params-non-move-async-closure.stderr index 04c8c325fe7..1f589c516a9 100644 --- a/src/test/ui/async-await/no-params-non-move-async-closure.stderr +++ b/src/test/ui/async-await/no-params-non-move-async-closure.stderr @@ -8,3 +8,4 @@ LL | let _ = async |x: u8| {}; error: aborting due to previous error +For more information about this error, try `rustc --explain E0708`. |
