Skip to content

Commit

Permalink
Rollup merge of #69867 - ayushmishra2005:doc/61137-add-long-error-cod…
Browse files Browse the repository at this point in the history
…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
Dylan-DPC authored Mar 16, 2020
2 parents 0d7c82e + c33c88b commit 8f2482b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/librustc_error_codes/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ E0623: include_str!("./error_codes/E0623.md"),
E0624: include_str!("./error_codes/E0624.md"),
E0626: include_str!("./error_codes/E0626.md"),
E0627: include_str!("./error_codes/E0627.md"),
E0628: include_str!("./error_codes/E0628.md"),
E0631: include_str!("./error_codes/E0631.md"),
E0633: include_str!("./error_codes/E0633.md"),
E0634: include_str!("./error_codes/E0634.md"),
Expand Down Expand Up @@ -583,7 +584,6 @@ E0748: include_str!("./error_codes/E0748.md"),
// E0612, // merged into E0609
// E0613, // Removed (merged with E0609)
E0625, // thread-local statics cannot be accessed at compile-time
E0628, // generators cannot have explicit parameters
E0629, // missing 'feature' (rustc_const_unstable)
// rustc_const_unstable attribute must be paired with stable/unstable
// attribute
Expand Down
30 changes: 30 additions & 0 deletions src/librustc_error_codes/error_codes/E0628.md
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;
};
}
```
1 change: 1 addition & 0 deletions src/test/ui/generator/too-many-parameters.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ LL | |(), ()| {

error: aborting due to previous error

For more information about this error, try `rustc --explain E0628`.

0 comments on commit 8f2482b

Please sign in to comment.