1
Fork 0

Rollup merge of #69867 - ayushmishra2005:doc/61137-add-long-error-code-e0628, r=Dylan-DPC

Add long error explanation for E0628

Add long explanation for the E0628 error code
Part of #61137

r? @GuillaumeGomez
This commit is contained in:
Dylan DPC 2020-03-16 13:16:42 +01:00 committed by GitHub
commit 8f2482b801
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 1 deletions

View file

@ -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"),
@ -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

View file

@ -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;
};
}
```

View file

@ -6,3 +6,4 @@ LL | |(), ()| {
error: aborting due to previous error
For more information about this error, try `rustc --explain E0628`.