Skip to content

Fails to identify type of vec![] macro #6837

Closed
@zeramorphic

Description

@zeramorphic

In an empty (latest rust-analyzer, nightly rust) VSCode project, I am getting the following (related) errors to do with the vec! macro.
image
It seems as if rust-analyzer is maybe unable to resolve the second type parameter related to the new allocator API, and that error stops it from filling in the first parameter. Weirdly, it semi-correctly identifies a char in the following image, but thinks that it is part of an array.
image
It also identifies vec!["]; to be a Vec<[&str; _]>.

This is probably not a direct repeat of #6668 - I'm using a nightly version of rust-analyzer released after that issue was patched. Also, using the normal Vec constructor, and adding elements in afterwards, works fine thanks to type inference - it's only a problem with the macro, it seems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-tytype system / type inference / traits / method resolutionE-has-instructionsIssue has some instructions and pointers to code to get startedS-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