Skip to content

Commit 8f2482b

Browse files
authored
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
2 parents 0d7c82e + c33c88b commit 8f2482b

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

src/librustc_error_codes/error_codes.rs

+1-1
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
E0634: include_str!("./error_codes/E0634.md"),
@@ -583,7 +584,6 @@ E0748: include_str!("./error_codes/E0748.md"),
583584
// E0612, // merged into E0609
584585
// E0613, // Removed (merged with E0609)
585586
E0625, // thread-local statics cannot be accessed at compile-time
586-
E0628, // generators cannot have explicit parameters
587587
E0629, // missing 'feature' (rustc_const_unstable)
588588
// rustc_const_unstable attribute must be paired with stable/unstable
589589
// attribute
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
19+
at most 1 parameter for the generator. 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

+1
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)