Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add long error explanation for E0628 #69867

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"),
E0635: include_str!("./error_codes/E0635.md"),
Expand Down Expand Up @@ -580,7 +581,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 only
ayushmishra2005 marked this conversation as resolved.
Show resolved Hide resolved
0 or 1 parameter for generator. So, for example, we might resolve
ayushmishra2005 marked this conversation as resolved.
Show resolved Hide resolved
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`.