Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong lifetime in type inlay hints #16993

Closed
NichtsHsu opened this issue Apr 2, 2024 · 2 comments
Closed

Wrong lifetime in type inlay hints #16993

NichtsHsu opened this issue Apr 2, 2024 · 2 comments
Labels
A-ty type system / type inference / traits / method resolution C-bug Category: bug

Comments

@NichtsHsu
Copy link

rust-analyzer version: 0.4.1907-standalone

rustc version: rustc 1.79.0-nightly (805813650 2024-03-31)

editor or extension: VSCode with extension v0.4.1907 (pre-release)

relevant settings:

repository link (if public, optional):

code snippet to reproduce:

struct Ref<'a, T>(&'a T);

fn new<T>(r: &T) -> Ref<'_, T> {
    Ref(r)
}

fn main() {
    let i = 0;
    let r = new(&i);
}

image

RA hints that the type of r is Ref<'static, i32>, but the lifetime of &i should not be 'static.

@NichtsHsu NichtsHsu added the C-bug Category: bug label Apr 2, 2024
@Veykril Veykril added the A-ty type system / type inference / traits / method resolution label Apr 2, 2024
@Veykril
Copy link
Member

Veykril commented Apr 2, 2024

We haven't implemented lifetime elision yet

@Veykril
Copy link
Member

Veykril commented Apr 2, 2024

Will be fixed by rust-lang/chalk#809 (in the sense that we won't show 'static but '{unkown}

@Veykril Veykril closed this as completed Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ty type system / type inference / traits / method resolution C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants