Fixing bad suggestion for _ in const type when a function #81885
This commit is contained in:
parent
921ec4b3fc
commit
09d5d0766e
9 changed files with 54 additions and 150 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
10
src/test/ui/issues/issue-81885.rs
Normal file
10
src/test/ui/issues/issue-81885.rs
Normal 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
|
||||
|
||||
}
|
||||
15
src/test/ui/issues/issue-81885.stderr
Normal file
15
src/test/ui/issues/issue-81885.stderr
Normal 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`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue