Fixing bad suggestion for _ in const type when a function #81885

This commit is contained in:
Kevin Per 2021-02-09 08:35:58 +00:00
parent 921ec4b3fc
commit 09d5d0766e
9 changed files with 54 additions and 150 deletions

View file

@ -2,10 +2,7 @@ error[E0121]: the type placeholder `_` is not allowed within types on item signa
--> $DIR/issue-74086.rs:2:20
|
LL | static BUG: fn(_) -> u8 = |_| 8;
| ^
| |
| not allowed in type signatures
| help: use type parameters instead: `T`
| ^ not allowed in type signatures
error: aborting due to previous error

View file

@ -0,0 +1,10 @@
const TEST4: fn() -> _ = 42;
//~^ ERROR the type placeholder `_` is not allowed within types on item
//signatures
fn main() {
const TEST5: fn() -> _ = 42;
//~^ ERROR the type placeholder `_` is not allowed within types on item
//signatures
}

View file

@ -0,0 +1,15 @@
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
--> $DIR/issue-81885.rs:1:22
|
LL | const TEST4: fn() -> _ = 42;
| ^ not allowed in type signatures
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
--> $DIR/issue-81885.rs:6:26
|
LL | const TEST5: fn() -> _ = 42;
| ^ not allowed in type signatures
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0121`.