Skip to content

Commit 7b75c34

Browse files
author
Ayush Kumar Mishra
committed
Add long error explanation for E0628 #61137
1 parent 3dbade6 commit 7b75c34

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

src/librustc_error_codes/error_codes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ E0623: include_str!("./error_codes/E0623.md"),
349349
E0624: include_str!("./error_codes/E0624.md"),
350350
E0626: include_str!("./error_codes/E0626.md"),
351351
E0627: include_str!("./error_codes/E0627.md"),
352+
E0628: include_str!("./error_codes/E0628.md"),
352353
E0631: include_str!("./error_codes/E0631.md"),
353354
E0633: include_str!("./error_codes/E0633.md"),
354355
E0635: include_str!("./error_codes/E0635.md"),
@@ -580,7 +581,6 @@ E0748: include_str!("./error_codes/E0748.md"),
580581
// E0612, // merged into E0609
581582
// E0613, // Removed (merged with E0609)
582583
E0625, // thread-local statics cannot be accessed at compile-time
583-
E0628, // generators cannot have explicit parameters
584584
E0629, // missing 'feature' (rustc_const_unstable)
585585
// rustc_const_unstable attribute must be paired with stable/unstable
586586
// attribute
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
More than one parameter was used for a generator.
2+
3+
Erroneous code example:
4+
5+
```compile_fail,E0628
6+
#![feature(generators, generator_trait)]
7+
8+
fn main() {
9+
let generator = |a: i32, b: i32| {
10+
// error: too many parameters for a generator
11+
// Allowed only 0 or 1 parameter
12+
yield a;
13+
};
14+
}
15+
```
16+
17+
At present, it is not permitted to pass more than one explicit
18+
parameter for a generator.This can be fixed by using only
19+
0 or 1 parameter for generator. So, for example, we might resolve
20+
the previous example by passing only one parameter.
21+
22+
```
23+
#![feature(generators, generator_trait)]
24+
25+
fn main() {
26+
let generator = |a: i32| {
27+
yield a;
28+
};
29+
}
30+
```

src/test/ui/generator/too-many-parameters.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ LL | |(), ()| {
66

77
error: aborting due to previous error
88

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

0 commit comments

Comments
 (0)