Skip to content

Commit

Permalink
Rollup merge of rust-lang#65098 - GuillaumeGomez:long-err-explanation…
Browse files Browse the repository at this point in the history
…-E0561, r=Centril

Add long error explanation for E0561

Part of rust-lang#61137
  • Loading branch information
Centril authored Oct 8, 2019
2 parents a9777b3 + 8dd0008 commit 73685ec
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
29 changes: 28 additions & 1 deletion src/librustc_passes/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,34 @@ fn main() {
```
"##,

E0561: r##"
A non-ident or non-wildcard pattern has been used as a parameter of a function
pointer type.
Erroneous code example:
```compile_fail,E0561
type A1 = fn(mut param: u8); // error!
type A2 = fn(&param: u32); // error!
```
When using an alias over a function type, you cannot e.g. denote a parameter as
being mutable.
To fix the issue, remove patterns (`_` is allowed though). Example:
```
type A1 = fn(param: u8); // ok!
type A2 = fn(_: u32); // ok!
```
You can also omit the parameter name:
```
type A3 = fn(i16); // ok!
```
"##,

E0571: r##"
A `break` statement with an argument appeared in a non-`loop` loop.
Expand Down Expand Up @@ -503,7 +531,6 @@ Switch to the Rust 2018 edition to use `async fn`.
;
E0226, // only a single explicit lifetime bound is permitted
E0472, // asm! is unsupported on this target
E0561, // patterns aren't allowed in function pointer types
E0567, // auto traits can not have generic parameters
E0568, // auto traits can not have super traits
E0666, // nested `impl Trait` is illegal
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/no-patterns-in-args-macro.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ LL | m!((bad, pat));

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0130, E0642.
Some errors have detailed explanations: E0130, E0561, E0642.
For more information about an error, try `rustc --explain E0130`.
3 changes: 2 additions & 1 deletion src/test/ui/no-patterns-in-args.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ LL | type A2 = fn(&arg: u8);

error: aborting due to 5 previous errors

For more information about this error, try `rustc --explain E0130`.
Some errors have detailed explanations: E0130, E0561.
For more information about an error, try `rustc --explain E0130`.

0 comments on commit 73685ec

Please sign in to comment.