rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.12k stars 1.58k forks source link

Lifetimes for structs and traits in inlay hints don't work in VSCode #17098

Open coolCucumber-cat opened 5 months ago

coolCucumber-cat commented 5 months ago

rust-analyzer version: 0.3.1924-standalone (5dbe3fe75 2024-04-14)

It also only occurs on this version (0.3.1924) and not previous ones like 0.3.1916

rustc version: rustc 1.77.2 (25ef9e3d8 2024-04-09)

editor or extension: VSCode

code snippet to reproduce:

struct Test<'a> {
    t: &'a i32,
}

fn main() {
    let test = Test { t: &0 };
}

The inlay hint for test is Test<'{error}>. You can also not turn them off. I don't want any lifetimes in inlay hints at all, they take up too much space, so an option to turn them off would be a win-win.

Veykril commented 5 months ago

Right, we should not show error lifetimes for now as we have too many of them due to missing implementations

coolCucumber-cat commented 5 months ago

@Veykril I'm not sure what you mean? Do you mean lifetime errors instead of error lifetimes?

Veykril commented 5 months ago

I'm saying we shouldn't render '{error} in inlay hints currently (or generally), as most lifetimes will end up as errors currently

Leedehai commented 5 months ago

Adding a Settings option to disable showing lifetime specifiers in the inlay hints ('{error} or otherwise) would be great.