Skip to content

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

Closed
@vi

Description

@vi

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>`

...

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions