-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #69867 - ayushmishra2005:doc/61137-add-long-error-cod…
…e-e0628, r=Dylan-DPC Add long error explanation for E0628 Add long explanation for the E0628 error code Part of #61137 r? @GuillaumeGomez
- Loading branch information
Showing
3 changed files
with
32 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
More than one parameter was used for a generator. | ||
|
||
Erroneous code example: | ||
|
||
```compile_fail,E0628 | ||
#![feature(generators, generator_trait)] | ||
fn main() { | ||
let generator = |a: i32, b: i32| { | ||
// error: too many parameters for a generator | ||
// Allowed only 0 or 1 parameter | ||
yield a; | ||
}; | ||
} | ||
``` | ||
|
||
At present, it is not permitted to pass more than one explicit | ||
parameter for a generator.This can be fixed by using | ||
at most 1 parameter for the generator. For example, we might resolve | ||
the previous example by passing only one parameter. | ||
|
||
``` | ||
#![feature(generators, generator_trait)] | ||
fn main() { | ||
let generator = |a: i32| { | ||
yield a; | ||
}; | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters