Skip to content

[bug] -> _ inference fails for &'static str #16676

Open
@oriongonza

Description

@oriongonza

rust-analyzer version: 2023-12-18

rustc version: 1.76

fn infer() -> _ {
    "hi"
}

image
Has the correct code action (3) but if we choose 2 we get

fn infer() -> &str {
    "hi"
}

which doesn't compile.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-assistsA-tytype system / type inference / traits / method resolutionC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions