Skip to content

placeholder _ is referred when there is a trait const with no type whatsoever. #101755

New issue

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

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

Already on GitHub? # to your account

Closed
vi opened this issue Sep 13, 2022 · 0 comments · Fixed by #101790
Closed

placeholder _ is referred when there is a trait const with no type whatsoever. #101755

vi opened this issue Sep 13, 2022 · 0 comments · Fixed by #101790
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@vi
Copy link
Contributor

vi commented Sep 13, 2022

Given the following code:

trait Qqq {
    const A;
}

(https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=a84a11a114f0dcb9aa8f1ea1987db82f)

The current output is:

error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants
 --> src/lib.rs:2:12
  |
2 |     const A;
  |            ^ not allowed in type signatures

error: missing type for `const` item
 --> src/lib.rs:2:12
  |
2 |     const A;
  |            ^ help: provide a type for the item: `: <type>`

...

Ideally the output should look like:

error: missing type for `const` item
 --> src/lib.rs:2:12
  |
2 |     const A;
  |            ^ help: provide a type for the item: `: <type>`

...
@vi vi added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 13, 2022
@TaKO8Ki TaKO8Ki self-assigned this Sep 13, 2022
@bors bors closed this as completed in 4c64c14 Sep 17, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants