Skip to content

E0121 wrongly suggests replacements for _ #86021

Closed
@fee1-dead

Description

@fee1-dead

Given the following code: play

const A: [_; 3] = [1u8, 2, 3];

The current output is:

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
 --> src/lib.rs:1:10
  |
1 | const A: [_; 3] = [1u8, 2, 3];
  |          ^^^^^^
  |          |
  |          not allowed in type signatures
  |          help: replace `_` with the correct type: `[u8; 3]`

Ideally the output should look like:

error[E0121]: the type placeholder `_` is not allowed within types on item signatures
 --> src/lib.rs:1:10
  |
1 | const A: [_; 3] = [1u8, 2, 3];
  |          ^^^^^^
  |          |
  |          not allowed in type signatures
  |          help: replace `_` with the correct type: `u8`

@rustbot claim
@rustbot label D-incorrect D-invalid-suggestion

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsD-incorrectDiagnostics: A diagnostic that is giving misleading or incorrect information.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.T-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