Skip to content

"Insert explicit type" suggestion produces invalid code for array #2922

Closed
@jplatte

Description

@jplatte

For arrays, ra produces an invalid suggestion to insert [T;_], where T is a concrete type, but _ is literally an underscore, which is not valid in that position.

Example:

let x = [0.0; 3];

produces a suggestion that when applied results in

let x: [f64;_] = [0.0; 3];

which leads to the error message

error: expected expression, found reserved identifier `_`
   --> src/file.rs:line:col
    |
col |             let x: [f64;_] = [0.0; 3];
    |                 -       ^ expected expression
    |                 |
    |                 while parsing the type for `x`

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-assistsS-actionableSomeone could pick this issue up and work on it right now

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions