Skip to content

Detect type ascription use that should be let assignment #78907

Closed
@estebank

Description

@estebank

The following code

    let mut foo: i32 = 1;
    foo: i32 = 4;

currently emits

error[E0658]: type ascription is experimental
 --> src/main.rs:3:5
  |
3 |     foo: i32 = 4;
  |     ^^^^^^^^
  |
  = note: see issue #23416 <https://github.com/rust-lang/rust/issues/23416> for more information
  = help: add `#![feature(type_ascription)]` to the crate attributes to enable

but it should also suggest let foo: i32 = 4;

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`D-papercutDiagnostics: An error or lint that needs small tweaks.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