Skip to content

Lifetime elision error not displayed #7053

Closed
@branpk

Description

@branpk
fn foo(a: &i32, b: &i32) -> &i32 {}

fn main() {}

rust-analyzer shows no inline errors for the above code. Manually running cargo check works correctly:

error[E0106]: missing lifetime specifier                                                 
 --> src\main.rs:1:29
  |
1 | fn foo(a: &i32, b: &i32) -> &i32 {}
  |           ----     ----     ^ expected named lifetime parameter
  |
  = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `a` or `b`
help: consider introducing a named lifetime parameter
  |
1 | fn foo<'a>(a: &'a i32, b: &'a i32) -> &'a i32 {}
  |       ^^^^    ^^^^^^^     ^^^^^^^     ^^^

but rust-analyzer shows no inline error message.

Other check-on-save errors are shown correctly, so I don't think it's an issue with my setup.

Windows 10, VS Code, Rust 1.50.0 nightly, rust-analyzer v0.2.424

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions