Skip to content

Suggest associated const for incorrect use of let in traits #101797

Closed
@Rageking8

Description

@Rageking8

Given the following code: link

trait Trait {
    let x: i32;
}

fn main() {

}

The current output is:

   Compiling playground v0.0.1 (/playground)
error: non-item in item list
 --> src/main.rs:2:5
  |
1 | trait Trait {
  |             - item list starts here
2 |     let x: i32;
  |     ^^^ non-item starts here
3 | }
  | - item list ends here

error: could not compile `playground` due to previous error

Ideally the output should suggest changing the let to a const for associated const. Thanks.

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