&str { "hi" } which doesn't compile.">

[bug] -> _ inference fails for &'static str · Issue #16676 · rust-lang/rust-analyzer (original) (raw)

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.